Six web pages, ten links, and one question: which page matters most? Counting incoming links says page C, with four. PageRank also says C, but it puts page A almost level with it, despite A having only half as many links in, and it rates three pages at under 4 percent each even though every one of them links out generously. A short Python script computes those numbers the way Google’s founders described in their original Stanford paper, checks them against two million steps of a simulated “random surfer,” and then shows what happens when someone builds five fake pages to promote their own.
The idea in Brin and Page’s words
A vote that depends on the voter
Sergey Brin and Lawrence Page laid out PageRank in their Stanford paper “The Anatomy of a Large-Scale Hypertextual Web Search Engine”. The core idea is that a link is a vote, but votes aren’t equal: a link from an important page counts more than one from an obscure page, and a page that links to many others splits its vote among them.
The formula
The paper writes it as PR(A) = (1 − d) + d (PR(T1)/C(T1) + … + PR(Tn)/C(Tn)), where T1 through Tn are the pages linking to A, C(T) is the number of links going out of page T, and d is a damping factor between 0 and 1. The authors wrote, “We usually set d to 0.85.”
The random surfer
The paper also gives an intuitive reading. It describes a “random surfer” who starts on a random page and keeps clicking links, “never hitting ‘back’ but eventually gets bored and starts on another random page.” A page’s PageRank is the fraction of time that surfer spends there. The damping factor is the chance of clicking a link rather than jumping somewhere new: with d = 0.85, the surfer follows a link 85 percent of the time.

The six-page web
The links
| Page | Links out to |
|---|---|
| A | B, C |
| B | C |
| C | A |
| D | C |
| E | D, F, A |
| F | E, C |
Incoming link counts
C has four links in (from A, B, D and F). A has two (from C and E). B, D, E and F have one each. A popularity contest by raw link count would put C first, A second, and the other four tied.
The math as a matrix
Each column of a 6×6 matrix holds one page’s outgoing vote, split evenly among the pages it links to: E’s column has 1/3 in rows A, D and F. Multiplying a vector of ranks by that matrix passes each page’s rank along its links. This version divides the (1 − d) term by the number of pages so the ranks sum to 1 and read as probabilities; the paper’s form sums to the number of pages instead, which changes the scale but not the order.
Power iteration
The method
Start every page at 1/6. Repeatedly apply the update: new rank equals 0.15/6 plus 0.85 times the matrix times the old rank. Each pass spreads rank along the links once. Keep going until the numbers stop changing.
Converging
| Iteration | Total error remaining |
|---|---|
| 1 | 0.42 |
| 6 | 0.026 |
| 11 | 0.0019 |
| 16 | 0.00010 |
| 21 | 0.0000088 |
| 26 | 0.00000098 |
| 36 | 0.0000000039 |
The error shrinks by a factor of roughly 0.57 per pass on this web, and 45 passes bring the total change below one ten-billionth. Brin and Page reported that a PageRank for 26 million web pages “can be computed in a few hours on a medium size workstation,” which is this same loop on a much bigger matrix.
The result
| Page | Links in | PageRank (d = 0.85) | Random surfer, 2 million steps |
|---|---|---|---|
| C | 4 | 0.3661 | 0.3662 |
| A | 2 | 0.3477 | 0.3478 |
| B | 1 | 0.1728 | 0.1724 |
| E | 1 | 0.0405 | 0.0407 |
| D | 1 | 0.0365 | 0.0365 |
| F | 1 | 0.0365 | 0.0364 |
The simulated surfer, who follows a random link 85 percent of the time and jumps to a random page otherwise, spent almost exactly the predicted fraction of time on each page. Two very different calculations, one linear algebra and one dice, agree to the third decimal place.

Why A beats its link count
Quality over quantity
A has only two incoming links, yet it sits just behind C. One of its two links comes from C, the most important page, and C links to nothing else, so A receives C’s entire vote. B also gets a link from a strong page, A, but only half of A’s vote, since A links to both B and C.
The trap of the A, B, C loop
Pages A, B and C link only among themselves. Once the surfer wanders into that loop, links never lead back out; only a random jump does. That’s why the three of them hold about 89 percent of all the rank between them.
Why D, E and F stay small
D, E and F send links into the A-B-C loop, but nothing in the loop links back to them. They only receive rank from each other and from the 15 percent random jumps. E has the highest rank of the three because F links to it, and D and F tie because each gets a third of E’s small vote. Linking out generously doesn’t raise a page’s own rank; it raises the rank of the pages it links to.
Changing the damping factor
From 0.5 to 0.99
| d | C | A | B | E | D | F | Passes to converge |
|---|---|---|---|---|---|---|---|
| 0.50 | 0.294 | 0.249 | 0.146 | 0.109 | 0.101 | 0.101 | 23 |
| 0.70 | 0.335 | 0.302 | 0.156 | 0.074 | 0.067 | 0.067 | 33 |
| 0.85 | 0.366 | 0.348 | 0.173 | 0.041 | 0.037 | 0.037 | 45 |
| 0.95 | 0.388 | 0.382 | 0.190 | 0.015 | 0.013 | 0.013 | 58 |
| 0.99 | 0.398 | 0.396 | 0.198 | 0.003 | 0.003 | 0.003 | 65 |
What changes and what doesn’t
The order of pages never changed in this web: C, A, B, then E, D and F. The spread changed a lot. At d = 0.5, the random jump flattens everything and D, E and F each keep about 10 percent. At d = 0.99 the surfer almost never jumps, gets stuck in the A-B-C loop, and D, E and F fall to 0.3 percent. Higher d also means slower convergence, from 23 passes to 65, because the random jump is what pulls the numbers toward their final values.
Why 0.85
The paper doesn’t give a derivation for 0.85. The table suggests why a value in that range is reasonable: high enough that the link structure dominates, low enough that pages outside a closed loop keep some rank and the calculation converges quickly.

Gaming it with a link farm
Five fake pages
The owner of page F builds five new pages, G1 through G5, each with a single link to F and nothing linking to them. The web now has 11 pages.
The effect
| Page | Before (6 pages) | After (11 pages) |
|---|---|---|
| F | 0.0365 | 0.0858 |
| E | 0.0405 | 0.0501 |
| C | 0.3661 | 0.3233 |
| A | 0.3477 | 0.3026 |
| Each G page | 0.0136 |
Reading it
F’s rank more than doubled, from 0.037 to 0.086, and some of the gain flowed on to E, which F links to. Each fake page has only the minimum rank that comes from random jumps, but five of them together push F past every page outside the A-B-C loop. Rescaled to compare only the original six pages, F’s share rose from 3.7 percent to 9.2 percent. This is the basic weakness search engines have spent years defending against: a page’s rank depends on who links to it, and links can be manufactured.
What the small web shows
The calculation
PageRank is an eigenvector problem dressed up as a web search. Power iteration finds it by repeated multiplication, and a random walk finds the same thing by brute simulation. On six pages both take a fraction of a second, and they agree.
The lesson
Raw link counts and PageRank agree on the winner here, but they disagree on almost everything else. A page that a strong page links to exclusively can rival one with twice the links, and pages that only link outward stay small no matter how many links they give away. The structure of who links to whom matters more than the count.
Sources
- Sergey Brin and Lawrence Page, “The Anatomy of a Large-Scale Hypertextual Web Search Engine,” Stanford University: http://infolab.stanford.edu/~backrub/google.html
