Proofs: Gomory-Hu tree algorithm
These are the human proofs of Gomory-Hu tree algorithm, at full length.
The Gomory-Hu algorithm returns a cut tree full
This proof shows: correctness, termination.
Let be undirected with weights . For write for the total weight of edges with exactly one end in , and for the least over sets with , . A minimum - cut is such a set with , or its complement.
Fact 1 (submodularity). For all , . Proof. Check each edge by where its ends lie. An edge counted on the right is counted at least as often on the left; for example an edge from to counts twice on the left and zero times on the right, and an edge from to counts twice on each side. Also .
Fact 2 (triangle inequality). . Proof. A minimum - cut with , separates from if , and from if .
Fact 3 (contraction keeps cuts). Each vertex set of corresponds to the vertex set of obtained by expanding the contracted vertices, with the same cut value. So every cut of is a cut of , and .
For a tree edge let be the union of the nodes on the side of .
Invariant. Before each test of line L2, the nodes of partition , is a tree, and every tree edge of weight has a witness pair , with .
It holds at the start, when has one node and no edge. Assume it holds before a round on node with .
Claim A. Some minimum - cut of does not split , the vertex set of any component of . Proof. Let be a minimum - cut with . Take a component , joined to by the tree edge with , witness , , and . Then , , and is a minimum - cut. If : contains but not , so , and Fact 1 gives ; the set contains , not , so it is a minimum - cut containing . If : apply Fact 1 to and , which contains , , . The union contains and not , so its value is at least , and so ; the set contains , not , and is disjoint from . Either way is replaced by a minimum - cut that does not split . The sets of different components are disjoint, so adding or removing one of them does not split another that was whole. Repeat for each component.
By Claim A and Fact 3, , and the set of line L5, expanded, is a minimum - cut of that splits no .
The new edge. After line L8, the side of the edge that contains is together with every with , which is . So its value , and is a witness pair with , .
The old edges. Let be an old edge with witness and . After line L8 the side of the edge is still , since only was split, so still holds. If the half that is attached to contains , the witness stays. Otherwise say is attached to while ; then and . We show that is a witness. The set contains and not , so . Let be a minimum - cut with , . If , then separates from and . If , the set contains and not , so , and Fact 1 gives ; the set contains and not , so . Hence . The case where is attached to while is the same with and swapped and replaced by , which is a minimum - cut.
The nodes still partition , and is still a tree: a node was split in two joined by one edge, and every old edge has one end moved to one of the halves. So the invariant holds after the round.
Termination. Each round increases the number of nodes by one, since and are both nonempty. A partition of has at most parts, so after rounds every node is a single vertex and line L2 fails.
The result. At the end each tree edge joins single vertices, so its witness is itself: . Take and the tree path . Every edge of the path has a side that contains exactly one of and , so for each . By Fact 2 applied times, . So is the least weight on the path, and the side of a lightest path edge is a cut of that value separating from , a minimum - cut.