ConceptComplete

Cayley Formula and Matrix-Tree Theorem

Counting spanning trees reveals deep connections between combinatorics, linear algebra, and graph structure. Two fundamental resultsβ€”Cayley's formula and the matrix-tree theoremβ€”provide powerful tools for enumeration.

TheoremCayley's Formula

The complete graph KnK_n has exactly nnβˆ’2n^{n-2} labeled spanning trees.

For example: K3K_3 has 31=33^1 = 3 trees, K4K_4 has 42=164^2 = 16 trees, and K5K_5 has 53=1255^3 = 125 trees.

Multiple proofs of Cayley's formula exist, each offering different insights. The PrΓΌfer code provides a bijection between labeled trees on nn vertices and sequences of length nβˆ’2n-2 from {1,2,…,n}\{1, 2, \ldots, n\}, directly establishing the count.

DefinitionPrΓΌfer Code

The PrΓΌfer code of a labeled tree TT on vertices {1,2,…,n}\{1, 2, \ldots, n\} is constructed by:

  1. Find the leaf with smallest label, say vv
  2. Record the label of vv's unique neighbor
  3. Remove vv and repeat until 2 vertices remain

This produces a sequence (a1,a2,…,anβˆ’2)(a_1, a_2, \ldots, a_{n-2}) with each ai∈{1,…,n}a_i \in \{1, \ldots, n\}. The map is bijective, proving Cayley's formula.

ExamplePrΓΌfer Code Construction

For a tree with edges {(1,3),(2,3),(3,4),(4,5)}\{(1,3), (2,3), (3,4), (4,5)\} on 5 vertices:

  • Leaf 1 connects to 3: record a1=3a_1 = 3, remove vertex 1
  • Leaf 2 connects to 3: record a2=3a_2 = 3, remove vertex 2
  • Leaf 3 connects to 4: record a3=4a_3 = 4, remove vertex 3
  • Two vertices remain, stop

PrΓΌfer code: (3,3,4)(3, 3, 4). Since there are 53=1255^3 = 125 such codes, K5K_5 has 125 spanning trees.

TheoremMatrix-Tree Theorem (Kirchhoff)

For any graph GG with Laplacian matrix LL, let LijL_{ij} denote the matrix obtained by deleting row ii and column jj from LL. Then the number of spanning trees of GG is: Ο„(G)=det⁑(Lii)\tau(G) = \det(L_{ii})

for any ii. Remarkably, this determinant is independent of which row and column are deleted.

The matrix-tree theorem provides an algebraic method to count spanning trees without enumeration, connecting graph structure to linear algebra through the Laplacian matrix.

ExampleMatrix-Tree for $K_4$

For K4K_4, the Laplacian is: L=(3βˆ’1βˆ’1βˆ’1βˆ’13βˆ’1βˆ’1βˆ’1βˆ’13βˆ’1βˆ’1βˆ’1βˆ’13)L = \begin{pmatrix} 3 & -1 & -1 & -1 \\ -1 & 3 & -1 & -1 \\ -1 & -1 & 3 & -1 \\ -1 & -1 & -1 & 3 \end{pmatrix}

Deleting the first row and column: L11=(3βˆ’1βˆ’1βˆ’13βˆ’1βˆ’1βˆ’13)L_{11} = \begin{pmatrix} 3 & -1 & -1 \\ -1 & 3 & -1 \\ -1 & -1 & 3 \end{pmatrix}

Computing: det⁑(L11)=16\det(L_{11}) = 16, confirming Cayley's formula: 44βˆ’2=164^{4-2} = 16.

Remark

The matrix-tree theorem extends to weighted graphs by replacing βˆ’1-1 entries with βˆ’wij-w_{ij} (negative edge weights) in the Laplacian. The determinant then sums over all spanning trees weighted by the product of their edge weights, providing a generating function for weighted tree counting.

These counting results have applications in network reliability, random graph generation, and statistical physics (counting configurations in the Ising model), demonstrating the interplay between combinatorics and analysis in graph theory.