A Bit of History
Larry Page and Sergey Brin described PageRank while developing an early large-scale web search system at Stanford in the late 1990s. The central idea borrowed the spirit of academic citation: a link is a vote, but a vote from an important page should count more than one from an obscure page.
The clever step is recursive. Importance flows through a directed graph until the scores become self-consistent. That connects PageRank to Markov chains, stationary distributions, eigenvectors, and iterative numerical methods—not merely to counting incoming links.
The Random-Surfer Mental Model
Imagine a visitor who browses forever. From the current page, the visitor:
- with probability $d$, follows one outgoing link chosen uniformly;
- with probability $1-d$, teleports to a page selected from a fixed probability distribution.
PageRank is the long-run probability of finding this visitor on each page. Uniform teleportation chooses every page with probability $1/N$. Personalized PageRank replaces that uniform choice with a preference vector, biasing the walk toward a topic, user, or seed set.
Votes carry their source's rank
Ten links from negligible pages need not outweigh one link from a highly ranked page.
A page divides its vote
A page with ten destinations sends one tenth of its link-following probability to each.
Teleportation prevents lock-in
A small restart probability lets the visitor escape cycles and reach every page.
The PageRank Equation
With uniform teleportation and no dangling pages, the score of page $v$ satisfies
$$r(v)=\frac{1-d}{N}+d\sum_{u\to v}\frac{r(u)}{L(u)},$$
where $L(u)$ is the number of outgoing links from $u$. The formula has two clearly different sources of probability:
- Teleportation: every page receives a base amount $(1-d)/N$.
- Link flow: every non-dangling page distributes $d\,r(u)$ equally among its outgoing neighbors.
- Dangling redistribution: rank held by pages with no outgoing links is distributed according to the teleportation vector.
- Repeat synchronously: compute an entirely new vector from the old one until the total change is below a tolerance.
Mass-conservation check: a correct iteration keeps every score non-negative and the total rank equal to $1$ (up to floating-point rounding).
Dangling Pages, Rank Sinks, and Teleportation
A dangling page has no outgoing links. If its rank is simply discarded, total probability shrinks every iteration—the flaw in many short PageRank examples. Treat a dangling page as linking according to the teleportation distribution. With uniform teleportation, its rank is spread evenly across all pages.
A rank sink is a closed region with no links leading out. Pure link-following can trap all probability there. Separate directed cycles can also make a walk periodic. Teleportation fixes both problems by making the transition matrix positive when the preference vector is positive.
For a general preference vector $p$ with $\sum_v p(v)=1$, the complete update is
$$r_{k+1}(v)=(1-d)p(v)+d\left[D_k p(v)+\sum_{u\to v}\frac{r_k(u)}{L(u)}\right],$$
where $D_k=\sum_{u:L(u)=0}r_k(u)$ is the dangling mass at iteration $k$.
Visual Walkthrough
Let $A$ link to $B$ and $C$, $B$ link only to $C$, and $C$ link only to $A$. Start with $r_0=(1/3,1/3,1/3)$, use $d=0.85$, and teleport uniformly. The base contribution is $(1-d)/3=0.05$ per page.
| Iteration | $r(A)$ | $r(B)$ | $r(C)$ | $L_1$ change |
|---|---|---|---|---|
| 0 | 0.333333 | 0.333333 | 0.333333 | — |
| 1 | 0.333333 | 0.191667 | 0.475000 | 0.283333 |
| 2 | 0.453750 | 0.191667 | 0.354583 | 0.240833 |
| 5 | 0.394896 | 0.217831 | 0.387273 | 0.036975 |
| Limit | 0.387790 | 0.214811 | 0.397400 | 0 |
The Same Idea as a Matrix Equation
Construct a column-stochastic link matrix $S$: column $u$ divides one unit equally among $u$'s outgoing neighbors; a dangling column is replaced by the preference vector $p$. The Google matrix is
$$G=dS+(1-d)p\mathbf{1}^{\mathsf T},$$
and PageRank is the stationary vector satisfying $r=Gr$. Because columns sum to one, multiplying by $G$ preserves total probability. Power iteration simply computes $r_{k+1}=Gr_k$ until the vector stops changing.
Watch the Orientation
This article stores rank as a column vector, so source pages are columns and destinations are rows. Libraries that use row vectors transpose the convention. Both are correct; mixing them silently reverses the flow.
Why Power Iteration Converges
With $0\le d<1$ and a strictly positive preference vector, every entry of $G$ is positive. The resulting Markov chain is irreducible and aperiodic, so it has one positive stationary distribution.
There is also a direct numerical intuition. The stochastic link step cannot increase $L_1$ distance, and teleportation contributes the same fixed vector to every update. Therefore the PageRank update $F$ satisfies
$$\lVert F(x)-F(y)\rVert_1\le d\,\lVert x-y\rVert_1.$$
Since $d<1$, each iteration contracts differences by at least a factor of $d$. Banach's fixed-point theorem gives a unique fixed point and convergence from any starting probability vector. Smaller $d$ contracts faster; larger $d$ lets link structure dominate more strongly.
Complexity Analysis
With adjacency lists, one synchronous iteration initializes $V$ new scores and traverses every edge once:
$$\text{Time per iteration: }O(V+E) \qquad \text{Space: }O(V+E).$$
After $k$ iterations, total time is $O(k(V+E))$. The contraction bound implies roughly $k=O(\log(1/\varepsilon)/(1-d))$ iterations to reduce error to scale $\varepsilon$, though actual convergence depends on the graph, norm, starting vector, and stopping rule. Sparse linear algebra and vertex-centric message passing make the update naturally distributable.
Implementation
These versions use synchronous updates, redistribute dangling mass, stop on $L_1$ change rather than a fixed iteration count, validate link targets, and leave the input graph unchanged. The Python version also supports a personalized teleportation vector.
Choosing the Damping Factor
| Choice | Interpretation | Practical effect |
|---|---|---|
| $d=0$ | Always teleport | Scores equal the preference vector; links have no effect. |
| Moderate $d$ | Mix link structure with restarts | Stable ranking and reasonably fast convergence. |
| $d\approx1$ | Almost always follow links | Structure dominates, but convergence slows and traps exert more influence. |
| $d=1$ | Never teleport | Uniqueness and convergence from arbitrary starts are no longer guaranteed. |
The familiar value $0.85$ is a convention, not a mathematical constant. Choose $d$ according to the meaning of a “restart,” the desired locality of a personalized ranking, and the convergence budget. Report it with results because changing $d$ changes the question being answered.
Where PageRank-Style Scores Help
Link analysis
Estimate structural authority in directed hyperlink or reference networks.
Citation networks
Weight a citation by the influence of the paper or patent providing it.
Personalization
Restart near a user's interests or a trusted seed set to obtain topic-sensitive scores.
Software graphs
Rank packages, symbols, or services from directed dependency and call relationships.
Risk propagation
Adapt probability flow to prioritize structurally central entities in dependency networks.
Knowledge graphs
Provide a graph-structural prior that can complement semantic relevance.
Limitations and Common Pitfalls
| Mistake | Symptom | Correction |
|---|---|---|
| Discarding dangling rank | Total score falls below $1$. | Redistribute dangling mass through the preference vector. |
| Updating scores in place | Results depend on vertex traversal order. | Use separate old and new vectors for standard synchronous power iteration. |
| Forgetting outdegree division | Pages with many links create extra probability. | Divide each source's link contribution equally among its destinations. |
| Mixing matrix orientations | Rank appears to flow backward. | Document whether distributions are row or column vectors. |
| Using only a fixed iteration count | Work is wasted or convergence is premature. | Monitor a norm such as $L_1$ change and keep a safety cap. |
| Treating duplicate links inconsistently | One source may accidentally vote several times for the same destination. | Deduplicate for a simple web graph or deliberately model a multigraph. |
| Reading rank as relevance or truth | Structurally central but irrelevant nodes dominate. | Combine PageRank with content, context, freshness, and domain signals. |
| Ignoring manipulation and bias | Link farms or biased seed vectors distort results. | Audit the graph, preference vector, and downstream use. |
PageRank Is a Structural Prior
A high score means the random walk spends substantial probability on a node under the chosen graph, damping factor, dangling policy, and preference vector. It does not by itself establish quality, factual accuracy, relevance, fairness, or user value.
Exercises
Follow the Probability
- Trace. Reproduce iterations $1$ and $2$ of the three-page example and verify that every vector sums to $1$.
- Dangling node. Add page $D$ with no outlinks. Compute its contribution to the next update and confirm that no mass disappears.
- Personalize. Use preference vector $(0.8,0.1,0.1)$ on the example and explain how the stationary ranking changes.
- Orientation. Write the $3\times3$ column-stochastic matrix $S$ for the example and verify one matrix-vector update by hand.
- Experiment. Compare $d=0.5$, $0.85$, and $0.99$: record both the final scores and iterations needed for the same tolerance.
- Challenge. Implement a sparse “push” approximation for personalized PageRank that concentrates work near the seed set.
Hint for 4: column A contains $0,1/2,1/2$ because A splits its probability between B and C.