The adjacency matrix, the Laplacian $L = D - A$, the matrix tree theorem, eigenvalues and connectivity, and a proof that the $(i,j)$-entry of $A^k$ counts the number of walks of length $k$.
For a simple graph G=(V,E) on n vertices V={v1,…,vn}, the adjacency matrixA=A(G) is the n×n matrix defined by
Aij={10{vi,vj}∈E,otherwise.
When G is undirected, A is a real symmetric matrix.
Example 2.
The path graph P3 on vertices v1−v2−v3 has adjacency matrix
A=010101010.
2. Powers of the Adjacency Matrix and Walk Counting
The triangle K3 on three vertices:
Theorem 3 (Combinatorial interpretation ofAk).
Let A be the adjacency matrix of a graph G. The (i,j)-entry of Ak equals the number of walks of length k from vi to vj.
Proof.
We proceed by induction on k.Base case (k=1).(A)ij=1 if and only if vi and vj are adjacent, which corresponds to a single walk of length 1. If (A)ij=0, there is no such walk.Inductive step. Assume (Ak−1)iℓ counts the walks of length k−1 from vi to vℓ for every ℓ. Then
(Ak)ij=ℓ=1∑n(Ak−1)iℓ⋅Aℓj.
The term (Ak−1)iℓ⋅Aℓj is nonzero only when vℓ and vj are adjacent (Aℓj=1), in which case it counts the walks of length k−1 from vi to vℓ, each of which extends to a walk of length k from vi to vj by appending the edge {vℓ,vj}. Summing over all possible intermediate vertices vℓ gives the total number of walks of length k from vi to vj.□
Example 4.
The triangle K3 has adjacency matrix A=011101110 and A2=211121112. The entry (A2)11=2 reflects the two walks of length 2 from v1 to itself: v1v2v1 and v1v3v1.
3. The Laplacian Matrix
Definition 5 (Degree matrix and Laplacian).
The degree matrixD of G is the diagonal matrix with Dii=deg(vi). The Laplacian of G is
L=L(G)=D−A.
Each row of L sums to zero (∑jLij=Dii−∑jAij=deg(vi)−deg(vi)=0), so L1=0: the all-ones vector 1 is an eigenvector of L with eigenvalue 0.
Theorem 6 (Positive semidefiniteness of the Laplacian).
L(G) is positive semidefinite: xTLx≥0 for every x∈Rn.
The last equality is obtained by expanding the contributions of each edge {vi,vj} to both the diagonal (D) and off-diagonal (A) terms.□
4. Eigenvalues and Connectivity
Since L is real symmetric and positive semidefinite, its eigenvalues can be arranged as 0=λ1≤λ2≤⋯≤λn.
Theorem 7 (Connected components and the multiplicity of eigenvalue0).
The number of connected components of G equals the multiplicity of 0 as an eigenvalue of L(G).
Proof.
If G has c connected components G1,…,Gc, reordering the vertices by component makes L block-diagonal: L=L(G1)⊕⋯⊕L(Gc). Each L(Gk) is positive semidefinite with L(Gk)1k=0, so each has eigenvalue 0 with multiplicity at least 1.To see that the multiplicity is exactly 1 for each block: if L(Gk)x=0, then xTL(Gk)x=∑{vi,vj}∈E(Gk)(xi−xj)2=0, forcing xi=xj for all adjacent pairs. Since Gk is connected, all components of x are equal, so kerL(Gk) is one-dimensional.Therefore the total multiplicity of eigenvalue 0 is c.□
Definition 8 (Algebraic connectivity).
For a connected graph G, the second-smallest eigenvalue λ2(L(G)) is called the algebraic connectivity (or Fiedler value) of G.
Remark 9.
λ2>0 is equivalent to G being connected. A larger λ2 indicates stronger connectivity, making algebraic connectivity an important measure in spectral graph partitioning and clustering.
5. The Matrix Tree Theorem
Theorem 10 (Matrix tree theorem (Kirchhoff, 1847)).
Let G be a connected graph on n vertices with Laplacian L=L(G). Let Lii denote any cofactor of L obtained by deleting row i and column i. Then the number τ(G) of spanning trees of G is
τ(G)=Lii=n1λ2λ3⋯λn,
where λ1=0<λ2≤⋯≤λn are the eigenvalues of L.
Proof.
We outline the argument. Let L^ be the (n−1)×(n−1) matrix obtained by deleting row i and column i from L. By the Cauchy–Binet formula,
detL^=∣S∣=n−1∑(detBS)2,
where B is the oriented incidence matrix of G with row i deleted, and S ranges over all (n−1)-element subsets of the edge set. One shows that detBS=0 if and only if S forms a spanning tree, in which case detBS=±1. Thus the sum counts spanning trees.The eigenvalue formula detL^=n1∏k=2nλk follows from analysis of the characteristic polynomial of L.□
Example 11.
The Laplacian of K4 has eigenvalues 0,4,4,4, giving τ(K4)=41⋅43=16. More generally, τ(Kn)=nn−2, recovering Cayley's formula.
The following graph has τ(G)=8 spanning trees, which can be verified via any cofactor of its Laplacian: