Short answer: PageRank assigns every page a score that is the stationary distribution of a random surfer. With probability d the surfer follows a link chosen uniformly among the page’s out-links. With probability 1−d the surfer jumps to a uniformly random page. The usual damping factor is 0.85. The scores are the dominant eigenvector of the resulting stochastic matrix, computed by power iteration. Dangling pages, which have no out-links, are treated as linking to every page so the matrix stays stochastic.
What the problem actually asks
A raw link count promotes a page that many pages cite, and it also promotes a page cited by a page that itself has a high score. That circular definition is an eigenvector equation. Without damping, the chain can get stuck in a component and the stationary distribution need not be unique. The teleport term makes the chain irreducible and aperiodic on a finite web, so the stationary distribution exists and is unique, and power iteration converges.
The damping factor is a modeling choice. 0.85 is the historical default, not a law. A different d changes the scores and the convergence rate. The gap that power iteration needs is created by this term.
What the algorithm guarantees
The damped Google matrix has a unique positive stationary distribution, the PageRank vector, which sums to 1. Power iteration multiplies by that matrix, which in practice is a sparse multiply by the link structure plus a rank-one teleport correction, not a dense matrix. Each iteration is linear in the number of edges. The iteration converges geometrically at a rate bounded by d. Extra memory is the score vector.
Pages with no out-links must be handled. Leaving their rows as zero breaks the stochastic matrix. The standard fix spreads that mass uniformly, or folds it into the teleport. Self-links and duplicate links should be defined by the graph builder before the iteration starts.
The working steps
- Build the directed graph. For a dangling node, treat it as having an edge to every node, or account for its rank in the teleport term.
- Initialize a positive score vector that sums to 1.
- Each iteration sets the new score of v to (1−d)/n plus d times the sum, over in-neighbors u that have out-degree k_u, of score(u)/k_u, with dangling mass included.
- Normalize if a dangling-node implementation requires it. Stop when the L1 change is below a tolerance.
- The dominant eigenvalue of the damped matrix is 1. Do not run an undamped iteration and expect the same uniqueness.
The unique stationary distribution belongs to the damped chain. HITS is a different hub-and-authority iteration. Power iteration is the numerical method. PageRank is the surfer model. A personalized PageRank changes the teleport distribution so it is not uniform, and the same iteration applies.
Approaches that look simpler and fail
| Approach | Why it fails when a dangling page keeps a zero row |
|---|---|
| Leave a page with no out-links as a row of zeros | Probability mass disappears. The vector no longer sums to 1 and the matrix is not stochastic. |
| Iterate the undamped link matrix and call the limit PageRank | The limit can depend on the start when the web has more than one terminal component. The teleport term removes that dependence. |
| Divide by out-degree zero | The damped formula’s link term is only over pages that have out-links, with dangling mass handled separately. A raw division by zero is the bug the special case exists to avoid. |
| Treat 0.85 as a required constant | Any d in (0, 1) yields a unique distribution. The number changes the scores and the convergence rate. |
The eigenvector computation is power iteration. A hub and authority pair is HITS. PageRank is the damped random-surfer stationary distribution.
A working example
This Python fragment iterates a damped link matrix. The single edge is 0→1, and vertex 1 is dangling, so its rank is spread by the teleport. With d = 0.5 the dangling page shares its rank and the link still favors vertex 1. It prints the scores rounded to two decimals, 0.40 0.60.
n, d = 2, 0.5
out = [1, 0] # vertex 1 is dangling
score = [1 / n, 1 / n]
for _ in range(40):
nxt = [(1 - d) / n, (1 - d) / n]
dangling = sum(score[u] for u in range(n) if out[u] == 0)
nxt[0] += d * dangling / n
nxt[1] += d * dangling / n
nxt[1] += d * score[0] / out[0]
score = nxt
assert abs(sum(score) - 1) < 1e-9
print(f"{score[0]:.2f}", f"{score[1]:.2f}")
Where it is used
PageRank was the ranking walk of early Google and is still the name of the damped score on a web or citation graph. Power iteration is how that vector is computed. HITS is the hub-and-authority alternative on the same kind of link graph.
When you can drop this algorithm
Drop the undamped matrix when the goal is the classical PageRank vector. Include the teleport term and a dangling-page rule, and iterate until the score vector stabilizes.
Why this stays published
We publish this so a search for PageRank returns the damped surfer, the dangling-page fix, and the power iteration that computes the scores. PageRank is the unique stationary distribution of a web surfer who follows a link with probability d and otherwise jumps uniformly, computed by power iteration.
本文由 HoHo 與 AI 協作整理,最後更新於 2026 年 11 月 13 日。
