The Normalized Laplacian and the Random-Walk Matrix
The Laplacian treats every vertex alike. In a graph whose degrees vary a lot (a social network with a few hubs, a mesh with a dense region) that is the wrong scale: a cut through low-degree vertices looks as cheap as one through hubs, and the eigenvalues grow with the maximum degree. Rescaling by the degrees gives the normalized Laplacian, whose eigenvalues always lie in and which is tied exactly to the random walk on the graph. Cheeger's inequality, mixing times and normalized-cut clustering are all statements about this matrix.
Definitions
Assume no vertex is isolated, so is invertible. Define
is the normalized Laplacian (Chung writes ). Its entries are and . is the transition matrix of the random walk: from , step to a neighbour with probability . It is row-stochastic, and a distribution written as a row vector evolves as . Some books use the column-stochastic instead; it is the transpose.
is not symmetric, but it is similar to a symmetric matrix:
So has real eigenvalues , where are the eigenvalues of , and its eigenvectors are times those of (right eigenvectors) or times them (left eigenvectors). A third matrix, the random-walk Laplacian , has the same eigenvalues . Its eigenvector equation is the generalized eigenproblem used by Shi and Malik for normalized cuts.
The Rayleigh quotient with degree weights
Substitute in the Rayleigh quotient of :
The numerator is the same edge sum as before; the denominator now weighs each vertex by its degree. The eigenvector of is (that is, ), and "orthogonal to it" becomes : is balanced with respect to degree. This is the form used in every proof about .
The spectrum lies in
Claim. , and if and only if some connected component of is bipartite.
Proof. Nonnegativity holds because is positive semidefinite. For the upper bound, , and summing over edges gives . Equality needs on every edge (and ). On a component where is nonzero, the sign of then alternates along edges, which 2-colours that component, so it is bipartite. Conversely, on a bipartite component with sides , the vector that is on , on and 0 elsewhere attains the ratio 2.
Also , so the eigenvalues average to exactly 1. Compare with , whose largest eigenvalue can be as large as .
The program builds both matrices for a small irregular graph (a hub joined to a triangle and to a path), checks the similarity, and solves the generalized problem with SciPy.
import numpy as np
from scipy.linalg import eigh
n = 7
edges = [(0, 1), (0, 2), (1, 2), (0, 3), (0, 4), (4, 5), (5, 6)]
A = np.zeros((n, n))
for u, v in edges:
A[u, v] = A[v, u] = 1
d = A.sum(axis=1)
L = np.diag(d) - A
Dm = np.diag(1 / np.sqrt(d))
N = Dm @ L @ Dm
P = A / d[:, None] # row-stochastic walk matrix
nu = np.linalg.eigvalsh(N)
p_eigs = np.sort(np.linalg.eigvals(P).real)[::-1]
gen = eigh(L, np.diag(d), eigvals_only=True) # generalized problem L x = nu D x
print("degrees:", d.astype(int))
print("eigenvalues of N :", np.round(nu, 4) + 0.0)
print("1 - eigenvalues of P :", np.round(1 - p_eigs, 4) + 0.0)
print("generalized L x = nu D x :", np.round(gen, 4) + 0.0)
print("trace(N) =", round(float(np.trace(N)), 6), " sum of eigenvalues =", round(float(nu.sum()), 6))
print("rows of P sum to 1:", bool(np.allclose(P.sum(axis=1), 1)))degrees: [4 2 2 1 2 2 1]
eigenvalues of N : [0. 0.1857 0.7434 1. 1.5 1.649 1.9219]
1 - eigenvalues of P : [0. 0.1857 0.7434 1. 1.5 1.649 1.9219]
generalized L x = nu D x : [0. 0.1857 0.7434 1. 1.5 1.649 1.9219]
trace(N) = 7.0 sum of eigenvalues = 7.0
rows of P sum to 1: True
The three lists agree, the eigenvalues add up to , and the largest is below 2 because the triangle makes the graph non-bipartite.
Bipartite components and
For a bipartite graph the spectrum of is symmetric about 1: if is an eigenvector for , flipping its sign on one side gives an eigenvector for . For the random walk this means the eigenvalue of , the reason a walk on a bipartite graph oscillates between the sides and never converges. The lazy walk (stay put with probability ) has eigenvalues and fixes this, as in Stationary Distributions and Mixing Time.
import numpy as np
def normalized_spectrum(n, edges):
A = np.zeros((n, n))
for u, v in edges:
A[u, v] = A[v, u] = 1
s = 1 / np.sqrt(A.sum(axis=1))
N = np.eye(n) - s[:, None] * A * s[None, :]
return np.linalg.eigvalsh(N)
graphs = {
"path P_6 (bipartite)": (6, [(i, i + 1) for i in range(5)]),
"cycle C_6 (bipartite)": (6, [(i, (i + 1) % 6) for i in range(6)]),
"cycle C_5 (odd)": (5, [(i, (i + 1) % 5) for i in range(5)]),
"star K_{1,5}": (6, [(0, i) for i in range(1, 6)]),
"complete K_5": (5, [(i, j) for i in range(5) for j in range(i + 1, 5)]),
}
for name, (n, edges) in graphs.items():
nu = normalized_spectrum(n, edges)
print(f"{name:22} {np.round(nu, 4) + 0.0}")path P_6 (bipartite) [0. 0.191 0.691 1.309 1.809 2. ]
cycle C_6 (bipartite) [0. 0.5 0.5 1.5 1.5 2. ]
cycle C_5 (odd) [0. 0.691 0.691 1.809 1.809]
star K_{1,5} [0. 1. 1. 1. 1. 2.]
complete K_5 [0. 1.25 1.25 1.25 1.25]
Each bipartite spectrum is symmetric about 1 and ends at 2. The odd cycle stops short of 2, and the complete graph has with multiplicity . The star shows a feature of the normalization: although its hub has degree 5, its normalized spectrum is just .
The stationary distribution
The row vector with (with weights, ) satisfies : . It corresponds to the eigenvector of with . The walk is reversible: , which is the probabilistic reason is similar to a symmetric matrix. How fast a walk approaches is governed by (and ), the topic of Mixing of Random Walks via the Spectral Gap.
import numpy as np
n = 7
edges = [(0, 1), (0, 2), (1, 2), (0, 3), (0, 4), (4, 5), (5, 6)]
A = np.zeros((n, n))
for u, v in edges:
A[u, v] = A[v, u] = 1
d = A.sum(axis=1)
P = A / d[:, None]
lazy = (np.eye(n) + P) / 2
pi = d / d.sum()
p = np.zeros(n); p[6] = 1.0 # start at the end of the path
for t in range(1, 61):
p = p @ lazy
if t in (1, 5, 20, 60):
print(f"t = {t:2}: {np.round(p, 4) + 0.0} TV distance {0.5 * float(np.abs(p - pi).sum()):.4f}")
print("pi = d / 2m:", np.round(pi, 4) + 0.0)t = 1: [0. 0. 0. 0. 0. 0.5 0.5] TV distance 0.7857
t = 5: [0.0889 0.0107 0.0107 0.0098 0.2246 0.4092 0.2461] TV distance 0.5227
t = 20: [0.2432 0.109 0.109 0.0584 0.1674 0.204 0.109 ] TV distance 0.1233
t = 60: [0.2849 0.1422 0.1422 0.0712 0.1434 0.1441 0.0722] TV distance 0.0025
pi = d / 2m: [0.2857 0.1429 0.1429 0.0714 0.1429 0.1429 0.0714]
Test yourself
Which interval always contains the eigenvalues of the normalized Laplacian ?
If has eigenvalues , what are the eigenvalues of the random-walk matrix ?
What is the stationary distribution of the random walk on a connected non-bipartite graph?
- Uniform
- Concentrated on the highest-degree vertex
Which constraint replaces when you minimize to get ?