Documentation

CslibFrontier.Foundations.Combinatorics.SimpleGraph.MatrixTree

Kirchhoff's matrix-tree theorem #

For a finite simple graph G and a vertex r, the determinant of the reduced Laplacian, the submatrix of G.lapMatrix ℤ on the rows and columns of the vertices other than r, is the number of spanning trees of G (SimpleGraph.det_lapMatrix_submatrix_eq_natCard_isTree); this is Kirchhoff's theorem [Kir47] in its modern determinant form. A spanning tree is a subgraph T ≤ G on all of V with T.IsTree. The same holds over any commutative ring (SimpleGraph.det_lapMatrix_submatrix_eq_natCard_isTree').

Both are the case of all weights 1 of the weighted matrix-tree theorem (SimpleGraph.det_laplacian_weightedAdjMatrix_submatrix_eq_finsum_isTree). For edge weights w : Sym2 V → R in a commutative ring, the reduced Laplacian of the weighted adjacency matrix SimpleGraph.weightedAdjMatrix G w has determinant ∑ T, ∏ e ∈ T.edgeSet, w e, the sum over the spanning trees T ≤ G.

The proof is the standard one by the Cauchy–Binet formula. Write N' for the oriented incidence matrix SimpleGraph.orientedIncMatrix G with the row of r deleted. Then the reduced weighted Laplacian is N' * diagonal w * N'ᵀ (SimpleGraph.orientedIncMatrix_map_mul_diagonal_mul_transpose), and its determinant is the sum over the sets S of |V| - 1 edges of det (N'_S) ^ 2 * ∏ e ∈ S, w e, by Matrix.det_mul_eq_sum_powersetCard_of_equiv. For any family g of edges indexed by the vertices other than r (an edge g v need not be incident to v):

A connected spanning subgraph with |V| - 1 edges is a spanning tree, and conversely.

As a corollary, the complete graph on n ≥ 1 vertices has n ^ (n - 2) spanning trees (Cayley's formula [Cay89], SimpleGraph.natCard_isTree_eq_card_pow): its reduced Laplacian is n • 1 minus the all-ones matrix of size n - 1, whose determinant is n ^ (n - 1) * (1 - (n - 1) / n) by the matrix determinant lemma.

The directed analogue, Tutte's matrix-tree theorem for arborescences, is in CslibFrontier.Foundations.Combinatorics.Digraph.MatrixTree.

Main results #

References #

theorem SimpleGraph.fromEdgeSet_range_adj {V : Type u_1} {G : SimpleGraph V} {ι : Type u_2} (g : ι → ↑G.edgeSet) {a b : V} :
(fromEdgeSet (Set.range fun (k : ι) => ↑(g k))).Adj a b ↔ ∃ (k : ι), ↑(g k) = s(a, b)

Adjacency in the spanning subgraph whose edges are the values of a family g of edges.

theorem SimpleGraph.det_orientedIncMatrix_submatrix_eq_zero {V : Type u_1} {G : SimpleGraph V} [Fintype V] [DecidableEq V] {r w : V} (g : { v : V // v ≠ r } → ↑G.edgeSet) (hw : ¬(fromEdgeSet (Set.range fun (k : { v : V // v ≠ r }) => ↑(g k))).Reachable r w) :

If the edges of a family g indexed by the vertices other than r do not connect w to r, then the minor of the oriented incidence matrix on the rows v ≠ r and the columns g vanishes.

theorem SimpleGraph.det_orientedIncMatrix_submatrix_sq_eq_one {V : Type u_1} {G : SimpleGraph V} [Fintype V] [DecidableEq V] {r : V} (g : { v : V // v ≠ r } → ↑G.edgeSet) (hc : (fromEdgeSet (Set.range fun (k : { v : V // v ≠ r }) => ↑(g k))).Connected) :

If the edges of a family g indexed by the vertices other than r form a connected spanning subgraph, then the square of the minor of the oriented incidence matrix on the rows v ≠ r and the columns g is 1.

theorem SimpleGraph.det_orientedIncMatrix_submatrix_sq {V : Type u_1} {G : SimpleGraph V} [Fintype V] [DecidableEq V] {r : V} (g : { v : V // v ≠ r } → ↑G.edgeSet) :
(G.orientedIncMatrix.submatrix Subtype.val g).det ^ 2 = if (fromEdgeSet (Set.range fun (k : { v : V // v ≠ r }) => ↑(g k))).Connected then 1 else 0

The square of the minor of the oriented incidence matrix on the rows v ≠ r and the columns g is 1 if the edges chosen by g form a connected spanning subgraph, and 0 otherwise.

The reduced Laplacian on the vertices other than r is N' * N'ᵀ, where N' is the oriented incidence matrix with the row of r deleted.

The weighted matrix-tree theorem [Kir47]. For edge weights w : Sym2 V → R in a commutative ring and every vertex r of a finite simple graph G, the determinant of the reduced weighted Laplacian, the submatrix of (G.weightedAdjMatrix w).laplacian on the vertices other than r, is the sum over the spanning trees T ≤ G of the product of the weights of the edges of T.

Kirchhoff's matrix-tree theorem over a commutative ring: the determinant of the reduced Laplacian G.lapMatrix R on the vertices other than r is the number of spanning trees of G, cast to R. This is the case of all weights 1 of SimpleGraph.det_laplacian_weightedAdjMatrix_submatrix_eq_finsum_isTree.

Kirchhoff's matrix-tree theorem [Kir47], in its modern determinant form ([GR01b], §13.2, Theorem 13.2.1; locator from secondary sources, unverified). For every vertex r of a finite simple graph G, the determinant of the reduced Laplacian, the submatrix of G.lapMatrix ℤ on the vertices other than r, is the number of spanning trees T ≤ G of G.

The Laplacian over a commutative ring is the image of the integer Laplacian.

Cayley's formula: there are n ^ (n - 2) trees on a type with n ≥ 1 elements, that is, the complete graph on n labelled vertices has n ^ (n - 2) spanning trees [Cay89]. The proof applies the matrix-tree theorem SimpleGraph.det_lapMatrix_submatrix_eq_natCard_isTree' to ⊤ over ℚ.