TExcelTAD
Home › Spectral Graph Theory & Modern Graph Algorithms › The Normalized Laplacian and the Random-Walk Matrix

The Normalized Laplacian and the Random-Walk Matrix

The Laplacian L=D−AL = D - A 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 [0,2][0, 2] 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 DD is invertible. Define

N=D−1/2LD−1/2=I−D−1/2AD−1/2,P=D−1A.N = D^{-1/2} L D^{-1/2} = I - D^{-1/2} A D^{-1/2}, \qquad P = D^{-1} A .

NN is the normalized Laplacian (Chung writes L\mathcal{L}). Its entries are Nvv=1N_{vv} = 1 and Nuv=−wuv/dudvN_{uv} = -w_{uv}/\sqrt{d_u d_v}. PP is the transition matrix of the random walk: from uu, step to a neighbour vv with probability Puv=wuv/duP_{uv} = w_{uv}/d_u. It is row-stochastic, and a distribution pp written as a row vector evolves as pt+1=ptPp_{t+1} = p_t P. Some books use the column-stochastic AD−1AD^{-1} instead; it is the transpose.

PP is not symmetric, but it is similar to a symmetric matrix:

D1/2PD−1/2=D−1/2AD−1/2=I−N.D^{1/2} P D^{-1/2} = D^{-1/2} A D^{-1/2} = I - N .

So PP has real eigenvalues 1−νi1 - \nu_i, where 0=ν1≤ν2≤⋯≤νn0 = \nu_1 \le \nu_2 \le \cdots \le \nu_n are the eigenvalues of NN, and its eigenvectors are D−1/2D^{-1/2} times those of NN (right eigenvectors) or D1/2D^{1/2} times them (left eigenvectors). A third matrix, the random-walk Laplacian Lrw=D−1L=I−PL_{\text{rw}} = D^{-1}L = I - P, has the same eigenvalues νi\nu_i. Its eigenvector equation Lx=νDxLx = \nu Dx is the generalized eigenproblem used by Shi and Malik for normalized cuts.

The Rayleigh quotient with degree weights

Substitute y=D1/2xy = D^{1/2}x in the Rayleigh quotient of NN:

yTNyyTy=xTLxxTDx=∑{u,v}∈Ewuv(xu−xv)2∑vdvxv2.\frac{y^{\mathsf{T}} N y}{y^{\mathsf{T}} y} = \frac{x^{\mathsf{T}} L x}{x^{\mathsf{T}} D x} = \frac{\sum_{\{u,v\} \in E} w_{uv}(x_u - x_v)^2}{\sum_v d_v x_v^2} .

The numerator is the same edge sum as before; the denominator now weighs each vertex by its degree. The eigenvector of ν1=0\nu_1 = 0 is y=D1/21y = D^{1/2}\mathbf{1} (that is, x=1x = \mathbf{1}), and "orthogonal to it" becomes ∑vdvxv=0\sum_v d_v x_v = 0: xx is balanced with respect to degree. This is the form used in every proof about NN.

The spectrum lies in [0,2][0, 2]

Claim. 0≤νi≤20 \le \nu_i \le 2, and νn=2\nu_n = 2 if and only if some connected component of GG is bipartite.

Proof. Nonnegativity holds because LL is positive semidefinite. For the upper bound, (xu−xv)2≤2xu2+2xv2(x_u - x_v)^2 \le 2x_u^2 + 2x_v^2, and summing over edges gives xTLx≤2∑vdvxv2=2xTDxx^{\mathsf{T}} L x \le 2\sum_v d_v x_v^2 = 2x^{\mathsf{T}} D x. Equality needs xu=−xvx_u = -x_v on every edge (and x≠0x \ne 0). On a component where xx is nonzero, the sign of xx then alternates along edges, which 2-colours that component, so it is bipartite. Conversely, on a bipartite component with sides X,YX, Y, the vector that is +1+1 on XX, −1-1 on YY and 0 elsewhere attains the ratio 2. □\square

Also tr⁡(N)=n\operatorname{tr}(N) = n, so the eigenvalues average to exactly 1. Compare with LL, whose largest eigenvalue can be as large as 2dmax⁡2d_{\max}.

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 Lx=νDxLx = \nu Dx with SciPy.

python · try it yourself
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 n=7n = 7, and the largest is below 2 because the triangle makes the graph non-bipartite.

Bipartite components and νn=2\nu_n = 2

For a bipartite graph the spectrum of NN is symmetric about 1: if yy is an eigenvector for ν\nu, flipping its sign on one side gives an eigenvector for 2−ν2 - \nu. For the random walk this means the eigenvalue −1-1 of PP, the reason a walk on a bipartite graph oscillates between the sides and never converges. The lazy walk P~=12(I+P)\tilde P = \frac{1}{2}(I + P) (stay put with probability 12\frac12) has eigenvalues 1−νi/2∈[0,1]1 - \nu_i/2 \in [0, 1] and fixes this, as in Stationary Distributions and Mixing Time.

python · try it yourself
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 KnK_n has ν=nn−1\nu = \frac{n}{n-1} with multiplicity n−1n - 1. The star shows a feature of the normalization: although its hub has degree 5, its normalized spectrum is just {0,1,1,1,1,2}\{0, 1, 1, 1, 1, 2\}.

The stationary distribution

The row vector π\pi with πv=dv/2m\pi_v = d_v / 2m (with weights, dv/∑udud_v / \sum_u d_u) satisfies πP=π\pi P = \pi: (πP)v=∑udu2m⋅wuvdu=dv2m(\pi P)_v = \sum_u \frac{d_u}{2m} \cdot \frac{w_{uv}}{d_u} = \frac{d_v}{2m}. It corresponds to the eigenvector D1/21D^{1/2}\mathbf{1} of NN with ν1=0\nu_1 = 0. The walk is reversible: πuPuv=wuv2m=πvPvu\pi_u P_{uv} = \frac{w_{uv}}{2m} = \pi_v P_{vu}, which is the probabilistic reason PP is similar to a symmetric matrix. How fast a walk approaches π\pi is governed by ν2\nu_2 (and νn\nu_n), the topic of Mixing of Random Walks via the Spectral Gap.

python · try it yourself
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 N=I−D−1/2AD−1/2N = I - D^{-1/2} A D^{-1/2}?

  1. [0,1][0, 1]
  2. [0,2][0, 2]
  3. [0,dmax⁡][0, d_{\max}]
  4. [−1,1][-1, 1]

If NN has eigenvalues νi\nu_i, what are the eigenvalues of the random-walk matrix P=D−1AP = D^{-1} A?

  1. νi\nu_i
  2. 1−νi1 - \nu_i
  3. 1/νi1/\nu_i
  4. νi/2\nu_i / 2

What is the stationary distribution of the random walk on a connected non-bipartite graph?

  1. Uniform
  2. πv=dv/2m\pi_v = d_v / 2m
  3. πv=1/dv\pi_v = 1/d_v
  4. Concentrated on the highest-degree vertex

Which constraint replaces x⊥1x \perp \mathbf{1} when you minimize xTLxxTDx\frac{x^{\mathsf{T}} L x}{x^{\mathsf{T}} D x} to get ν2\nu_2?

  1. ∑vxv=0\sum_v x_v = 0
  2. ∑vdvxv=0\sum_v d_v x_v = 0
  3. ∥x∥=1\lVert x \rVert = 1
  4. x≥0x \ge 0