Algorithm Search⌘K

Proofs: Laplacian matrix

These are the human proofs of Laplacian matrix, at full length.

The Laplacian operations keep the degree invariant and compute Lx and the quadratic form full

This proof shows: correctness.

We use the pseudocode of the page. The graph has the vertices 0,…,n−10, \ldots, n - 1 and a multiset EE of edges {u,v}\{u, v\} with u≠vu \ne v and weights w>0w > 0. Let WuvW_{uv} be the sum of the weights of the edges between uu and vv (so Wuu=0W_{uu} = 0), let Duu=∑vWuvD_{uu} = \sum_v W_{uv}, and let L=D−WL = D - W. The invariant is:

(I) For each vertex uu, deg[u] =Duu= D_{uu}, and adj[u] holds exactly one pair (v,w)(v, w) for each edge of EE with ends uu and vv and weight ww.

Initialization. With EE empty, deg is all zeros and every list is empty, so (I) holds.

ADD-EDGE. Let the new edge be {u,v}\{u, v\} with weight ww. Line L1 adds ww to deg[u] and to deg[v], which is the change of DuuD_{uu} and DvvD_{vv}; no other degree changes, because the edge has no other end. Lines L2 and L3 add the pair (v,w)(v, w) to adj[u] and (u,w)(u, w) to adj[v], one pair at each end and nothing else. So (I) holds for E∪{{u,v}}E \cup \{\{u, v\}\}.

Reading the matrix. By (I), for u≠vu \ne v the sum of ww over the pairs (v,w)(v, w) of adj[u] is WuvW_{uv}, so Luv=−WuvL_{uv} = -W_{uv} is this sum negated, and $L_{uu} = D_{uu} - W_{uu} = $ deg[u]. This is what ENTRY returns.

MULTIPLY. Fix uu. Line L5 sets yu=Duuxuy_u = D_{uu} x_u. Lines L6 and L7 then subtract wxvw x_v once for each pair of adj[u], which by (I) subtracts ∑vWuvxv\sum_v W_{uv} x_v. So after the inner loop yu=Duuxu−∑vWuvxv=∑vLuvxv=(Lx)uy_u = D_{uu} x_u - \sum_v W_{uv} x_v = \sum_v L_{uv} x_v = (Lx)_u. The outer loop of line L4 does this for each uu, and line L8 returns y=Lxy = Lx.

QUADRATIC-FORM. By (I), each edge e={u,v}e = \{u, v\} gives one pair in adj[u] and one in adj[v], and the test u<vu < v of line L11 keeps exactly one of them. So line L13 returns s=∑e∈Ew(e)(xu−xv)2s = \sum_{e \in E} w(e) (x_u - x_v)^2. Expanding the square,

s=∑ew(e)(xu2+xv2)−2∑ew(e)xuxv=∑uDuuxu2−∑u,vWuvxuxv=xTLx,s = \sum_{e} w(e) (x_u^2 + x_v^2) - 2 \sum_{e} w(e) x_u x_v = \sum_u D_{uu} x_u^2 - \sum_{u, v} W_{uv} x_u x_v = x^T L x,

because each edge adds w(e)w(e) to the squares of its two ends, and the double sum over ordered pairs counts each edge twice.

Consequences. Since s≥0s \ge 0, LL is positive semidefinite. If Lx=0Lx = 0 then xTLx=0x^T L x = 0, so xu=xvx_u = x_v for every edge, as all weights are positive, and xx is constant on each connected component. Conversely, if xx is constant on each component then each term of (Lx)u=∑vWuv(xu−xv)(Lx)_u = \sum_v W_{uv}(x_u - x_v) is zero. So the kernel of LL is spanned by the indicator vectors of the cc components, which are linearly independent, and rank⁡L=n−c\operatorname{rank} L = n - c. This is what components computes by exact elimination.

Cost. ADD-EDGE does O(1)O(1) amortized work. MULTIPLY and QUADRATIC-FORM read each of the nn degrees once and each of the 2∣E∣2|E| pairs once, so they take Θ(n+m)\Theta(n + m) time. ■\blacksquare

Back to Laplacian matrix