Spanning Tree Count Calculator

Kirchhoff's theorem: τ(G)

CalculatorsFreeNo Signup
4.2(55 reviews)
All Tools

Loading tool...

About Spanning Tree Count Calculator

A spanning tree count calculator using Kirchhoff's matrix tree theorem: τ(G) = any cofactor of the Laplacian matrix L(G). For K_n: τ = n^{n-2} (Cayley's formula). For C_n: τ = n. For K_{m,n}: τ = m^{n-1}·n^{m-1}. Client-side.

Spanning Tree Count Calculator Features

  • τ(G) count
  • Cayley's formula
  • Common graphs
  • Laplacian det
  • Sequence
Spanning tree count τ(G): number of spanning trees. Kirchhoff's matrix tree theorem (1847): τ = any cofactor of L(G) = product of non-zero Laplacian eigenvalues / n. Cayley's formula: τ(K_n) = n^{n-2}.

How to Use

Select graph:

  • τ(G): Tree count
  • Formula: Closed form
  • Cayley: K_n = n^{n-2}

Matrix Tree Theorem

Form Laplacian L = D - A (degree matrix minus adjacency). Delete any row i and column i. τ(G) = det of resulting (n-1)×(n-1) matrix. Equivalently: τ = (λ₁·λ₂·...·λ_{n-1})/n where λᵢ are non-zero eigenvalues of L.

Cayley's Formula

τ(K_n) = n^{n-2}. For n=4: 4²=16 spanning trees. Proved by Cayley (1889). Also proved via Prüfer sequences: bijection between labeled trees on n vertices and sequences of length n-2 from {1,...,n}.

Step-by-Step Instructions

  1. 1Select graph.
  2. 2Compute τ(G).
  3. 3See formula.
  4. 4Check Cayley.
  5. 5Compare graphs.

Spanning Tree Count Calculator — Frequently Asked Questions

What is Cayley's formula?+

τ(K_n) = n^{n-2}: the complete graph on n labeled vertices has exactly n^{n-2} spanning trees. n=3: 3 trees. n=4: 16 trees. n=5: 125 trees. Proved elegantly via Prüfer sequences.

How does the matrix tree theorem work?+

The Laplacian L has L[i][i]=deg(i), L[i][j]=-1 if edge ij, 0 otherwise. Delete any row and column (same index). The determinant of the remaining matrix equals τ(G). This works for any choice of deleted row/column!

What about multigraphs?+

The theorem generalizes: L[i][j] = -(number of edges between i and j), L[i][i] = sum of degrees. The cofactor counts spanning trees with multiplicity from parallel edges. Weighted version counts by product of edge weights.

Share this tool: