Proofs: Stoer-Wagner algorithm
These are the human proofs of Stoer-Wagner algorithm, at full length.
The Stoer-Wagner algorithm returns a global minimum cut full
This proof shows: correctness.
Setting. is an undirected graph with vertices and weights ; parallel edges are summed into one weight and self-loops are ignored. For disjoint sets , , is the total weight of the edges with one end in and the other in , and . A cut is a set with , with weight . It separates and if exactly one of them is in .
Lemma 1 (keys). In MINIMUM-CUT-PHASE, let be the order of line L9, with , and let . When is chosen, , and maximizes over all .
Proof. By induction: line L7 sets , and line L10 adds to every outside after is chosen. Line L9 takes the largest key.
Lemma 2 (cut of the phase). Let and . Then is the weight of a minimum cut of among the cuts that separate and .
Proof. The set is a cut that separates and , and its weight is . Let be any cut that separates and . We show .
Call with active if and are on different sides of . Since and are on different sides, is active. For each let be the set of edges of , that is, edges between and , that have both ends in , and their weight. We claim that for every active .
First active vertex. Let be the first active vertex. Then are all on one side of , and is on the other, so every edge between and is in : .
Induction step. Let be active, and let , , be the active vertex before it. By the hypothesis, . Then
The first inequality holds by Lemma 1: when was chosen, was also outside , so . The vertices , which form , are all on the side of , because none of is active, and is on the other side because it is active. So every edge between and is in . These edges are not in , because . The edges of are also in . Since weights are nonnegative, , which proves the claim.
Apply the claim to , which is active: , since .
Lemma 3 (merging). Let be the graph obtained by merging into . The cuts of correspond exactly, with the same weights, to the cuts of that do not separate and .
Proof. A cut of corresponds to the cut of in which the merged vertex is replaced by both and . An edge of from the merged vertex to has weight , so it crosses exactly when the two edges , cross ; the edge disappears, and it does not cross . Every cut of with and on one side arises in this way.
Theorem. STOER-WAGNER returns the weight of a global minimum cut of , and a set , the group of the last vertex of the best phase, with .
Proof. By induction on . Each value recorded at line L4 is the weight of a real cut of the original graph: the group of against the rest, by Lemma 3 applied to all earlier merges. So the result is at least , and it is the weight of the returned . For there is one phase, and the only cut is , which the phase records. For , let be a minimum cut of , and let , be the last two vertices of the first phase. If separates and , the phase records at most by Lemma 2. If not, corresponds to a cut of the merged graph of the same weight by Lemma 3, so the minimum cut of is , and by the induction hypothesis the remaining phases, which form the algorithm run on , record a cut of weight . In both cases the smallest recorded value is .