Guest
Sign in to keep your graphs and progress.
Select an algorithm and generate steps to begin visualization
Every walk counts, the short ones most
Counts every walk that ends at a vertex, a walk of k steps weighted α^k, on top of a base score for each vertex, so it also ranks graphs without cycles
Select an algorithm and generate steps to begin visualization
Katz centrality, proposed by Leo Katz in 1953 as a status index, ranks a vertex by the walks that end at it. A walk of one step counts α, a walk of two steps α², and so on, so near influence weighs most and far influence fades. Every vertex also gets a base score β, which is the difference from eigenvector centrality: on a directed graph without cycles, such as a citation network, the eigenvector is all zeros, while Katz still separates the vertices. The sum converges when α is below 1 / λ, where λ is the largest eigenvalue of the adjacency matrix.
The scores solve x = β + αAᵀx, and the visualizer finds them by iteration: every vertex starts at β = 1, then in each round takes 1 plus α times the sum of the scores of the vertices that point to it. After k rounds the scores count every walk of up to k steps, and each round adds less, by a factor of about αλ. Here α = 0.2, lowered to 0.9 / λ when that would come too close to 1 / λ, and on a graph without cycles λ = 0, so the scores are exact after as many rounds as the longest path. Vertices grow with their score, the edges into the vertex being updated light up, and the panel lists the scores with each in-degree. In the example citation network E has fewer citations than D but ends higher, because the papers that cite it are cited themselves.
Katz centrality ranks papers and patents in citation networks, people in social and communication networks, and packages in software dependency graphs, all directed and often acyclic. The same series of walks gives the Katz index for link prediction, one of the strongest classic scores in the study by Liben-Nowell and Kleinberg. PageRank can be seen as a normalised relative, in which a vertex shares its score among its out-links instead of passing all of it on. NetworkX and igraph provide it, and α sets how far influence travels: near 0 it approaches in-degree, near 1 / λ eigenvector centrality.
A fixed-point iteration: each round passes a share α of every score along the edges.
Katz(G, alpha, beta):
x(v) = beta for every vertex v
repeat until the scores stop changing:
for each vertex v:
x2(v) = beta + alpha * sum of w(u, v) * x(u) over edges u -> v
x = x2
return x // needs alpha < 1 / lambdaIn matrix form the scores are x = β(I − αAᵀ)⁻¹1, the sum β(1 + αAᵀ1 + α²(Aᵀ)²1 + ...). The k-th term counts the walks of length k that end at each vertex, weighted by αᵏ. The series converges exactly when α < 1 / λ, λ being the largest eigenvalue of the adjacency matrix.
The citation network loaded on this page, with α = 0.2 and β = 1.
Example graph: Arcs A → D, B → D, C → D, F → E, G → E, H → F, A → F, B → F, H → G, C → G, A → G. A, B, C and H cite, nobody cites them.
E 1.64, D 1.6, F 1.6, G 1.6, and 1 for A, B, C and H. E has 2 citations and D has 3, yet E ranks first, because the papers that cite E are cited themselves.
Time: O(m) per iteration · Space: O(n)
Each iteration reads every edge once. The error shrinks by a factor of about αλ per round, so reaching an accuracy ε takes about log ε / log(αλ) rounds, few when α is well below 1 / λ. On a graph without cycles it ends after as many rounds as the longest path, as here. Solving the linear system (I − αAᵀ)x = β1 directly costs O(n³), only sensible for small graphs.
Katz and its relatives among the centrality measures.
| Alternative | Prefer it when | Cost |
|---|---|---|
| In-degree | Only direct links matter. It is Katz with α close to 0. | O(n + m) |
| Eigenvector centrality | The graph is strongly connected and undirected or nearly so. Without β it collapses to 0 on acyclic and weakly connected parts. | O(m) per iteration |
| PageRank | A vertex with many out-links should pass less to each one, as on the web. Each vertex divides its score among its out-links. | O(m) per iteration |
Read the full article: Graph Centrality Measures and PageRank
Read the full article: Spectral Graph Theory in Machine Learning
Related algorithms: Eigenvector Centrality, PageRank, HITS (Hubs and Authorities), Harmonic Centrality, Link Prediction
Built by Mohammed Islam Hadjoudj · Work with me