TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Facebook Graph Theory

13 点作者 rajeshvaya超过 13 年前

2 条评论

espeed超过 13 年前
You can write these type of algorithms easily with a graph-programming language like Gremlin (<a href="https://github.com/tinkerpop/gremlin/wiki" rel="nofollow">https://github.com/tinkerpop/gremlin/wiki</a>):<p><pre><code> g = new Neo4jGraph('/tmp/neo4j') // calculate basic collaborative filtering for vertex 1 m = [:] g.v(1).out('likes').in('likes').out('likes').groupCount(m) m.sort{a,b -&#62; a.value &#60;=&#62; b.value} // calculate the primary eigenvector (eigenvector centrality) of a graph m = [:]; c = 0; g.V.out.groupCount(m).loop(2){c++ &#60; 1000} m.sort{a,b -&#62; a.value &#60;=&#62; b.value} </code></pre> When a user signs in with Facebook or Twitter, you can load their friends and followers into a graph database such as Neo4j and then use Gremlin to run these type of social-graph algorithms.<p>Graph DBs are fast in general because there is no external index lookup during traversals (the index containing adjacent nodes are located within the node). Pair that with local-rank (<a href="http://markorodriguez.com/2011/03/30/global-vs-local-graph-ranking/" rel="nofollow">http://markorodriguez.com/2011/03/30/global-vs-local-graph-r...</a>), and you can do real-time ranking and analysis.
brent超过 13 年前
This blog post seems to be copied from <a href="http://20bits.com/articles/graph-theory-part-iii-facebook/" rel="nofollow">http://20bits.com/articles/graph-theory-part-iii-facebook/</a> without any attribution.<p>It was also posted on yc only two weeks ago (see <a href="http://news.ycombinator.com/item?id=2912073" rel="nofollow">http://news.ycombinator.com/item?id=2912073</a> for commentary).