Link Graph Encyclopedia

Foundations

Random walks and Markov chains

A walker who follows random links visits some nodes more often than others. The long-run visit frequencies, the stationary distribution, are the mathematical core of PageRank and its relatives.

A random walk on a graph starts at some node and, at every step, moves along an out-link chosen uniformly at random. Run it for a long time and count how often it visits each node. On a well-behaved graph those frequencies settle down to a fixed distribution, the stationary distribution, which no longer depends on where the walk started. Nodes that many frequently visited nodes link to get visited often. That is the idea behind PageRank, and the theory of Markov chains says when it works.

Transition matrix

Write PP for the matrix with Puv=1/d+(u)P_{uv} = 1/d^+(u) when uu links to vv and 0 otherwise, the row-normalised adjacency matrix. Row uu is the probability distribution of the walker’s next position when it stands on uu. If xtx_t is a row vector giving the probability of being at each node after tt steps, then

xt+1=xtP,xt=x0Pt.x_{t+1} = x_t P, \qquad x_t = x_0 P^t .

A stationary distribution π\pi is a probability vector that one step leaves unchanged:

π=πP,∑vπ(v)=1.\pi = \pi P, \qquad \sum_v \pi(v) = 1 .

Each node’s stationary probability equals the probability flowing into it: π(v)=∑u→vπ(u)/d+(u)\pi(v) = \sum_{u \to v} \pi(u)/d^+(u). That is the PageRank equation without the teleport term.

A small example

Take only the core of the running example: A links to B and C, B links to C, and C links to A. The transition probabilities are PAB=PAC=1/2P_{AB} = P_{AC} = 1/2 and PBC=PCA=1P_{BC} = P_{CA} = 1. Solving π=πP\pi = \pi P:

πA=πC,πB=12πA,πC=12πA+πB.\pi_A = \pi_C, \qquad \pi_B = \tfrac12 \pi_A, \qquad \pi_C = \tfrac12 \pi_A + \pi_B .

With the probabilities summing to 1, π=(πA,πB,πC)=(2/5, 1/5, 2/5)\pi = (\pi_A, \pi_B, \pi_C) = (2/5,\, 1/5,\, 2/5). The walker spends 40% of its time on A, 40% on C and 20% on B. B loses because it receives only half of A’s traffic, while C receives the other half plus everything from B.

When a unique answer exists

Markov chain theory gives two conditions:

The core above has a cycle of length 2 (A → C → A) and one of length 3 (A → B → C → A), so it is aperiodic, and xtx_t converges to (2/5,1/5,2/5)(2/5, 1/5, 2/5). A chain that is both irreducible and aperiodic is called ergodic. The Perron–Frobenius theorem is the linear-algebra version of this result.

Why the raw web fails

On the raw web graph the walk is not even defined everywhere, and it is far from irreducible:

PageRank repairs both with teleportation: with probability 1−α1 - \alpha the walker jumps to a random node, and from a dangling node it always jumps. The repaired chain is irreducible and aperiodic by construction, so it has a unique stationary distribution, which is the PageRank vector (see random surfer and damping factor).

Undirected graphs are easy

On an undirected graph the stationary distribution has a closed form: π(v)=d(v)/2m\pi(v) = d(v) / 2m, proportional to degree. A random walk on an undirected graph is therefore just a slow way to compute degree centrality. Direction is what makes random walks interesting on the web: a link from uu to vv sends traffic one way only, and the stationary distribution depends on the whole structure of who links to whom.

How fast the walk forgets its start

The mixing time is how many steps it takes for xtx_t to get close to π\pi. It is governed by the second-largest eigenvalue modulus ∣λ2∣|\lambda_2| of the transition matrix: the distance to π\pi shrinks roughly like ∣λ2∣t|\lambda_2|^t. For PageRank’s repaired matrix, Haveliwala and Kamvar showed that ∣λ2∣≤α|\lambda_2| \le \alpha, which is why power iteration converges in a predictable number of steps however large the graph is.

References

Edit this entry on GitHub