PageRank
Try it: PageRank
How PageRank repeatedly passes each page's score along its outgoing links until the scores stop changing, so that pages linked from important pages become important.
How it works
- Every page starts with rank 1.0.
- In each iteration a page splits its current rank equally over its outgoing links; each page adds up the shares it receives.
- Rank held by pages with no outgoing links is shared equally by all pages, so the total stays equal to the number of pages.
- With damping d: new rank = (1 - d) + d × (incoming shares + dangling share). d = 1 is exactly py4e's sprank.py.
- Repeat until the average change per page drops below ε (or the iteration limit is reached).
Default run (22 steps): 5 pages, 7 links. Every page starts with rank 1.0 (ranks always sum to 5). d = 0.85; stop when the average change per page is below 0.0001 or after 30 iterations. Page E has no outgoing links (dangling). … Converged after 15 iterations (average change 0.00009 < 0.0001). Ranks are relative to this graph and sum to 5.
Simplified: A toy web of up to 8 pages. Unlike sprank.py, which only ranks pages that have outgoing links in its database, pages without links stay in the graph and their rank is shared out like sprank's 'evaporated' rank.
Loading the simulation…