Algorithm Search⌘K

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. G=(V,E)G = (V, E) is an undirected graph with n≥2n \ge 2 vertices and weights w≥0w \ge 0; parallel edges are summed into one weight w(u,v)w(u, v) and self-loops are ignored. For disjoint sets XX, YY, w(X,Y)w(X, Y) is the total weight of the edges with one end in XX and the other in YY, and w(X,v)=w(X,{v})w(X, v) = w(X, \{v\}). A cut is a set CC with ∅≠C⊊V\emptyset \ne C \subsetneq V, with weight w(C)=w(C,V∖C)w(C) = w(C, V \setminus C). It separates xx and yy if exactly one of them is in CC.

Lemma 1 (keys). In MINIMUM-CUT-PHASE, let v1,…,vkv_1, \ldots, v_k be the order of line L9, with v1=av_1 = a, and let Ai={v1,…,vi−1}A_i = \{v_1, \ldots, v_{i-1}\}. When viv_i is chosen, key(vi)=w(Ai,vi)\mathrm{key}(v_i) = w(A_i, v_i), and viv_i maximizes w(Ai,x)w(A_i, x) over all x∉Aix \notin A_i.

Proof. By induction: line L7 sets key(x)=w({v1},x)\mathrm{key}(x) = w(\{v_1\}, x), and line L10 adds w(vi,x)w(v_i, x) to every xx outside Ai+1A_{i+1} after viv_i is chosen. Line L9 takes the largest key. □\square

Lemma 2 (cut of the phase). Let s=vk−1s = v_{k-1} and t=vkt = v_k. Then w(Ak,t)=w(V∖{t},t)w(A_k, t) = w(V \setminus \{t\}, t) is the weight of a minimum cut of GG among the cuts that separate ss and tt.

Proof. The set {t}\{t\} is a cut that separates ss and tt, and its weight is w(Ak,t)w(A_k, t). Let CC be any cut that separates ss and tt. We show w(Ak,t)≤w(C)w(A_k, t) \le w(C).

Call viv_i with i≥2i \ge 2 active if viv_i and vi−1v_{i-1} are on different sides of CC. Since ss and tt are on different sides, tt is active. For each ii let CiC_i be the set of edges of CC, that is, edges between CC and V∖CV \setminus C, that have both ends in Ai∪{vi}A_i \cup \{v_i\}, and w(Ci)w(C_i) their weight. We claim that w(Ai,vi)≤w(Ci)w(A_i, v_i) \le w(C_i) for every active viv_i.

First active vertex. Let viv_i be the first active vertex. Then v1,…,vi−1v_1, \ldots, v_{i-1} are all on one side of CC, and viv_i is on the other, so every edge between AiA_i and viv_i is in CiC_i: w(Ai,vi)≤w(Ci)w(A_i, v_i) \le w(C_i).

Induction step. Let viv_i be active, and let vjv_j, j<ij < i, be the active vertex before it. By the hypothesis, w(Aj,vj)≤w(Cj)w(A_j, v_j) \le w(C_j). Then

w(Ai,vi)=w(Aj,vi)+w(Ai∖Aj,vi)≤w(Aj,vj)+w(Ai∖Aj,vi)≤w(Cj)+w(Ai∖Aj,vi).w(A_i, v_i) = w(A_j, v_i) + w(A_i \setminus A_j, v_i) \le w(A_j, v_j) + w(A_i \setminus A_j, v_i) \le w(C_j) + w(A_i \setminus A_j, v_i).

The first inequality holds by Lemma 1: when vjv_j was chosen, viv_i was also outside AjA_j, so w(Aj,vj)≥w(Aj,vi)w(A_j, v_j) \ge w(A_j, v_i). The vertices vj,…,vi−1v_j, \ldots, v_{i-1}, which form Ai∖AjA_i \setminus A_j, are all on the side of vjv_j, because none of vj+1,…,vi−1v_{j+1}, \ldots, v_{i-1} is active, and viv_i is on the other side because it is active. So every edge between Ai∖AjA_i \setminus A_j and viv_i is in CiC_i. These edges are not in CjC_j, because vi∉Aj∪{vj}v_i \notin A_j \cup \{v_j\}. The edges of CjC_j are also in CiC_i. Since weights are nonnegative, w(Cj)+w(Ai∖Aj,vi)≤w(Ci)w(C_j) + w(A_i \setminus A_j, v_i) \le w(C_i), which proves the claim.

Apply the claim to t=vkt = v_k, which is active: w(Ak,t)≤w(Ck)=w(C)w(A_k, t) \le w(C_k) = w(C), since Ak∪{t}=VA_k \cup \{t\} = V. □\square

Lemma 3 (merging). Let G′G' be the graph obtained by merging tt into ss. The cuts of G′G' correspond exactly, with the same weights, to the cuts of GG that do not separate ss and tt.

Proof. A cut C′C' of G′G' corresponds to the cut CC of GG in which the merged vertex is replaced by both ss and tt. An edge of G′G' from the merged vertex to xx has weight w(s,x)+w(t,x)w(s, x) + w(t, x), so it crosses C′C' exactly when the two edges sxsx, txtx cross CC; the edge stst disappears, and it does not cross CC. Every cut of GG with ss and tt on one side arises in this way. □\square

Theorem. STOER-WAGNER returns the weight λ\lambda of a global minimum cut of GG, and a set SS, the group of the last vertex of the best phase, with w(S)=λw(S) = \lambda.

Proof. By induction on nn. Each value recorded at line L4 is the weight of a real cut of the original graph: the group of tt against the rest, by Lemma 3 applied to all earlier merges. So the result is at least λ\lambda, and it is the weight of the returned SS. For n=2n = 2 there is one phase, and the only cut is {t}\{t\}, which the phase records. For n>2n > 2, let CC be a minimum cut of GG, and let ss, tt be the last two vertices of the first phase. If CC separates ss and tt, the phase records at most w(C)=λw(C) = \lambda by Lemma 2. If not, CC corresponds to a cut of the merged graph G′G' of the same weight by Lemma 3, so the minimum cut of G′G' is λ\lambda, and by the induction hypothesis the remaining phases, which form the algorithm run on G′G', record a cut of weight λ\lambda. In both cases the smallest recorded value is λ\lambda. ■\blacksquare

Back to Stoer-Wagner algorithm