Key idea of this section
Euler circuit ⟺ connected and every degree even Matching saturating X ⟺ |N(S)| ≥ |S| for all S ⊆ X (Hall) Labelled trees on [n]: nⁿ⁻² (Cayley)
Degrees and Euler's theorem
A graph G = (V, E) has ∑ᵥ deg(v) = 2|E| (the handshake lemma), since each edge contributes to two degrees; hence the number of odd-degree vertices is even. An Euler circuit is a closed walk using every edge exactly once.
Theorem 12.1 (Euler 1736, Hierholzer 1873). A connected multigraph has an Euler circuit if and only if every vertex has even degree. It has an Euler trail (not closed) if and only if exactly two vertices have odd degree.
Proof. Necessity: each passage of a circuit through v uses two edges at v. Sufficiency, by induction on |E|: since every degree is even and positive (when E ≠ ∅), G has no vertex of degree 1, so walking without repeating edges from any vertex must eventually return to it, giving a closed trail T. Deleting the edges of T leaves a graph whose degrees are still even; each of its components meets T (by connectivity) and has, by induction, an Euler circuit, which can be spliced into T at a common vertex. For the trail version, add an edge between the two odd vertices. ∎
In 1736 Euler applied this to the seven bridges of Königsberg. The four land masses have degrees 5, 3, 3, 3, so there is no walk crossing each bridge once. More generally, a connected graph with 2k odd vertices (k ≥ 1) can be covered by k edge-disjoint trails, and not fewer.
Hall's marriage theorem
Theorem 12.2 (Hall, 1935). Let G be a bipartite graph with parts X and Y. There is a matching covering every vertex of X if and only if |N(S)| ≥ |S| for every S ⊆ X, where N(S) is the set of neighbours of S.
Proof (Halmos–Vaughan). Necessity is clear. For sufficiency, induct on |X|; the case |X| = 1 is trivial. Case 1: |N(S)| ≥ |S| + 1 for every nonempty proper S ⊂ X. Match any x ∈ X to any neighbour y, and delete both; every nonempty S ⊆ X − x loses at most one neighbour, so Hall's condition still holds, and induction completes the matching. Case 2: some nonempty proper S₀ has |N(S₀)| = |S₀|. By induction S₀ can be matched into N(S₀). In the graph on (X − S₀) ∪ (Y − N(S₀)), any T ⊆ X − S₀ satisfies |N(T) − N(S₀)| = |N(T ∪ S₀)| − |N(S₀)| ≥ |T| + |S₀| − |S₀| = |T|, so by induction X − S₀ can be matched into Y − N(S₀). The two matchings together cover X. ∎
Corollary 12.3. Every k-regular bipartite graph with k ≥ 1 has a perfect matching, and its edge set is a disjoint union of k perfect matchings.
Proof. Counting edges, k|S| ≤ k|N(S)| for every S ⊆ X, since the k|S| edges leaving S all end in N(S), where at most k|N(S)| edges arrive. Also |X| = |Y|. Remove a perfect matching to obtain a (k − 1)-regular bipartite graph and repeat. ∎
Equivalently, by Birkhoff and von Neumann, every doubly stochastic matrix is a convex combination of permutation matrices. Hall's theorem is also equivalent to König's theorem (1931): in a bipartite graph the maximum size of a matching equals the minimum size of a vertex cover. Both are special cases of the max-flow min-cut theorem and of linear programming duality for totally unimodular systems, and in turn imply Dilworth's theorem that a finite poset can be partitioned into as many chains as the maximum size of an antichain.
Trees and Cayley's formula
A tree is a connected acyclic graph; a tree on n vertices has n − 1 edges and a unique path between any two vertices.
Theorem 12.4 (Cayley). There are nⁿ⁻² trees on the vertex set [n]. More precisely, the number with deg(i) = dᵢ for all i, where ∑ dᵢ = 2n − 2 and every dᵢ ≥ 1, is the multinomial coefficient (n − 2)!/∏ᵢ (dᵢ − 1)!.
Proof (Prüfer, 1918). Given a tree on [n] with n ≥ 2, repeatedly delete the leaf with the smallest label and record its unique neighbour, until two vertices remain. The resulting Prüfer code is a word of length n − 2 over [n], in which vertex i appears exactly deg(i) − 1 times (it is recorded once each time a neighbour is deleted, except for the last edge, which either deletes i itself or survives at the end). The tree is recovered from the code: at step j, the deleted leaf is the smallest label that does not occur in the remaining code and has not yet been deleted, and it is joined to the j-th code letter; finally the two unused labels are joined. Hence the map is a bijection between labelled trees and [n]ⁿ⁻², and words with prescribed letter counts dᵢ − 1 are counted by the multinomial coefficient. ∎
For example, the tree on [6] with edges 12, 13, 34, 35, 56 has leaves 2, 4, 6. Deleting 2 records 1; then 1 is a leaf and deleting it records 3; deleting 4 records 3; deleting 3 records 5. The code is (1, 3, 3, 5), and indeed deg 1 = 2, deg 3 = 3 and deg 5 = 2.
The matrix-tree theorem
Theorem 12.5 (Kirchhoff, 1847). The number of spanning trees of a connected graph G equals any cofactor of its Laplacian L = D − A, where D is the diagonal matrix of degrees and A the adjacency matrix; equivalently, (1/n) times the product of the nonzero eigenvalues of L.
For Kₙ the Laplacian nI − J has eigenvalue n with multiplicity n − 1, giving nⁿ⁻¹/n = nⁿ⁻², another proof of Cayley's formula. For the complete bipartite graph Km,n the theorem gives mn−1 nm−1.
Exercise
- (a)How many trees on [6] have vertex 1 of degree exactly 3?
- (b)Reconstruct the tree on [5] with Prüfer code (4, 4, 2).
- (c)How many spanning trees does K₄ have, and how many does K₂,₃ have?
Show solution
Answers: (a) Vertex 1 must appear exactly twice in a code of length 4, with the other two letters from the remaining 5 labels: C(4, 2) · 5² = 150. (b) The leaf 1 is joined to 4, then 3 to 4, then 4 to 2; the remaining labels 2 and 5 are joined. Edges: 14, 34, 24, 25. (c) 4² = 16, and 2² · 3¹ = 12.