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 and a multiset of edges with and weights . Let be the sum of the weights of the edges between and (so ), let , and let . The invariant is:
(I) For each vertex ,
deg[u], andadj[u]holds exactly one pair for each edge of with ends and and weight .
Initialization. With empty, deg is all zeros and every list is empty, so (I) holds.
ADD-EDGE. Let the new edge be with weight . Line L1 adds to deg[u] and to deg[v], which is the change of and ; no other degree changes, because the edge has no other end. Lines L2 and L3 add the pair to adj[u] and to adj[v], one pair at each end and nothing else. So (I) holds for .
Reading the matrix. By (I), for the sum of over the pairs of adj[u] is , so is this sum negated, and $L_{uu} = D_{uu} - W_{uu} = $ deg[u]. This is what ENTRY returns.
MULTIPLY. Fix . Line L5 sets . Lines L6 and L7 then subtract once for each pair of adj[u], which by (I) subtracts . So after the inner loop . The outer loop of line L4 does this for each , and line L8 returns .
QUADRATIC-FORM. By (I), each edge gives one pair in adj[u] and one in adj[v], and the test of line L11 keeps exactly one of them. So line L13 returns . Expanding the square,
because each edge adds to the squares of its two ends, and the double sum over ordered pairs counts each edge twice.
Consequences. Since , is positive semidefinite. If then , so for every edge, as all weights are positive, and is constant on each connected component. Conversely, if is constant on each component then each term of is zero. So the kernel of is spanned by the indicator vectors of the components, which are linearly independent, and . This is what components computes by exact elimination.
Cost. ADD-EDGE does amortized work. MULTIPLY and QUADRATIC-FORM read each of the degrees once and each of the pairs once, so they take time.