你本可以发明 PageRank。
You could have invented PageRank

原始链接: https://praveshkoirala.com/2026/08/26/you-could-have-invented-pagerank/

1996 年,像 AltaVista 这样的搜索引擎仅依靠简单的关键词匹配,难以保证搜索结果的相关性。斯坦福大学的研究生谢尔盖·布林(Sergey Brin)和拉里·佩奇(Larry Page)开发了 **PageRank** 算法,彻底改变了这一局面,并推动谷歌走向全球领先地位。 PageRank 的核心逻辑是将超链接视为一种“投票”或认可。一个网页的重要性取决于链接到该页面的网页质量与数量。该算法通过简单的迭代过程运作:每个页面将其“声望”(排名)平均分配给它所链接的页面,同时通过基准的“随机跳转”因子获取一部分排名。 通过反复计算直到数值趋于稳定,该算法建立了一套明确的网页重要性等级体系。尽管谷歌后来获得了复杂的声誉,但其底层机制在数学上却优雅而直观。正如简练的 Python 实现所证明的那样,PageRank 本质上构建了一个自我强化的权威网络,这印证了最具变革性的技术创新往往植根于简单且合乎逻辑的基础之上。

这篇 Hacker News 的讨论探讨了一个发人深省的观点,即人们常在事后认为自己“本可以发明 PageRank”,这种心态在面对革命性技术时尤为常见。 评论者们对此展开了辩论。一些人强调,尽管基于链接的排名概念在今天看来显而易见,但在 1996 年,这却是一个深刻且新颖的洞见,它需要将视角转向图论,并克服当时巨大的技术限制。另一些人则指出,发明算法只是挑战的一部分;执行、部署和可扩展性才是真正的困难所在。 最终,讨论转向了对“实干家”的哲学辩护。参与者引用达米安·赫斯特(Damien Hirst)以及西奥多·罗斯福(Theodore Roosevelt)的“竞技场上的人”演讲,论证批评者往往忽视了将想法转化为现实所需的努力。虽然事后声称自己本可以发明某样东西很容易,但功劳与成就只属于那些真正付诸实践的人。
相关文章

原文

Picture this, the year is 1996. You find yourself frustrated with the incumbent search engines like AltaVista, which primarily does a content-based search (it’ll give you an article on “Hotels for Chickens” if you search “Hotels” because the word matches). There’s gotta be a better way, right? Well, in hindsight, of course. Sergey Brin and Larry Page came up with this precise algorithm, i.e., PageRank, which was one of the key algorithms that helped catapult Google into a household name and made them tons of money. Both Sergey and Larry were grad students at Stanford, so their coming up with such an amazing algorithm doesn’t seem surprising. However, the question is, could you have stumbled upon the same? I think yes.

PageRank, at its core, symbolizes these basic properties.

  • Every page has a “rank” or reputation.
  • A page shares its “rank” with another page by linking to it, sort of giving it a mark of approval.
  • A page’s total rank/reputation is some minimum summed with all the reputation it gets from its neighbors (whoever links it).

And that’s it. To solidify this with a concrete example. Imagine a page (say BBC News) has a reputation of 50 and it links to 5 different pages. Assume that it distributes 80% (40) of its reputation to its linkees (the remaining being distributed uniformly to all pages). Then each of its linkees gets, from BBC, a total of 40/5 = 8 points.

You could potentially cook up a very small (and surprisingly readable) python program that does this as follows:

# incoming[n] has all incoming nodes upon n 
# outgoing[n] has all outgoing nodes from n 
# A page distributes damping% of its reputation to its neighbors. 
# (1-damping)% is distributed to all pages equally. 

def pagerank(incoming, outgoing, damping=.85, tolerance=1e-10): 
    n = len(incoming)                # total pages 
    rank = [1 / n] * n               # starting ranks. all equal. 
    minimum_rank = (1 - damping) / n # a page gets at least this 
                                     # from every other page 
                                     # due to random jumps. 
    while True: 
        old = rank.copy() 
        for page, neighbors in enumerate(incoming): 
            # you get this from your linker (who's distributing 
            # its rank equally to all of its linkees) 
            acquired = sum( old[neighbor] / len(outgoing[neighbor])
                            for neighbor in neighbors ) 
            
            rank[page] = minimum_rank + damping * acquired 
        # until the algorithm converges 
        if max(abs(a - b) for a, b in zip(rank, old)) < tolerance:
            return rank

And that’s about it. If you run these updates a bunch of times, you eventually end up with a rank for each of the pages that basically tells you how important they are. Of course, certain assumptions have been made here (like no dangling nodes, etc.), but those are simply bookkeeping, and you now know the crux of the algorithm. Congratulations, if you ever find yourself in 1996, you know what to do to become a billionaire!

联系我们 contact @ memedata.com