Algorithm Search⌘K

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 G=(V,E)G = (V, E) be undirected with weights w≥0w \ge 0. For A⊆VA \subseteq V write c(A)c(A) for the total weight of edges with exactly one end in AA, and λ(a,b)\lambda(a, b) for the least c(A)c(A) over sets AA with a∈Aa \in A, b∉Ab \notin A. A minimum aa-bb cut is such a set AA with c(A)=λ(a,b)c(A) = \lambda(a, b), or its complement.

Fact 1 (submodularity). For all A,B⊆VA, B \subseteq V, c(A)+c(B)≥c(A∩B)+c(A∪B)c(A) + c(B) \ge c(A \cap B) + c(A \cup B). Proof. Check each edge (p,q)(p, q) 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 A∖BA \setminus B to B∖AB \setminus A counts twice on the left and zero times on the right, and an edge from A∩BA \cap B to V∖(A∪B)V \setminus (A \cup B) counts twice on each side. Also c(A)=c(V∖A)c(A) = c(V \setminus A).

Fact 2 (triangle inequality). λ(a,c)≥min⁡(λ(a,b),λ(b,c))\lambda(a, c) \ge \min(\lambda(a, b), \lambda(b, c)). Proof. A minimum aa-cc cut AA with a∈Aa \in A, c∉Ac \notin A separates aa from bb if b∉Ab \notin A, and bb from cc if b∈Ab \in A.

Fact 3 (contraction keeps cuts). Each vertex set of GXG_X corresponds to the vertex set of GG obtained by expanding the contracted vertices, with the same cut value. So every cut of GXG_X is a cut of GG, and λGX(s,t)≥λG(s,t)\lambda_{G_X}(s, t) \ge \lambda_G(s, t).

For a tree edge e=(X,Y)e = (X, Y) let DeYD_e^Y be the union of the nodes on the YY side of T−eT - e.

Invariant. Before each test of line L2, the nodes of TT partition VV, TT is a tree, and every tree edge e=(X,Y)e = (X, Y) of weight λe\lambda_e has a witness pair x∈Xx \in X, y∈Yy \in Y with λ(x,y)=λe=c(DeY)\lambda(x, y) = \lambda_e = c(D_e^Y).

It holds at the start, when TT has one node and no edge. Assume it holds before a round on node XX with s,t∈Xs, t \in X.

Claim A. Some minimum ss-tt cut of GG does not split DCD_C, the vertex set of any component CC of T−XT - X. Proof. Let ZZ be a minimum ss-tt cut with s∈Zs \in Z. Take a component CC, joined to XX by the tree edge e=(X,Y)e = (X, Y) with Y∈CY \in C, witness x∈Xx \in X, y∈Yy \in Y, and D=DeY=DCD = D_e^Y = D_C. Then s,t,x∉Ds, t, x \notin D, y∈Dy \in D, and DD is a minimum xx-yy cut. If y∈Zy \in Z: Z∩DZ \cap D contains yy but not xx, so c(Z∩D)≥c(D)c(Z \cap D) \ge c(D), and Fact 1 gives c(Z∪D)≤c(Z)c(Z \cup D) \le c(Z); the set Z∪DZ \cup D contains ss, not tt, so it is a minimum ss-tt cut containing DD. If y∉Zy \notin Z: apply Fact 1 to ZZ and V∖DV \setminus D, which contains xx, ss, tt. The union Z∪(V∖D)Z \cup (V \setminus D) contains xx and not yy, so its value is at least c(D)=c(V∖D)c(D) = c(V \setminus D), and so c(Z∖D)≤c(Z)c(Z \setminus D) \le c(Z); the set Z∖DZ \setminus D contains ss, not tt, and is disjoint from DD. Either way ZZ is replaced by a minimum ss-tt cut that does not split DCD_C. The sets DCD_C of different components are disjoint, so adding or removing one of them does not split another that was whole. Repeat for each component. □\square

By Claim A and Fact 3, λGX(s,t)=λG(s,t)\lambda_{G_X}(s, t) = \lambda_G(s, t), and the set SS of line L5, expanded, is a minimum ss-tt cut S^\hat S of GG that splits no DCD_C.

The new edge. After line L8, the side of the edge (Xs,Xt)(X_s, X_t) that contains XsX_s is XsX_s together with every DCD_C with vC∈Sv_C \in S, which is S^\hat S. So its value c(S^)=λ=λ(s,t)c(\hat S) = \lambda = \lambda(s, t), and (s,t)(s, t) is a witness pair with s∈Xss \in X_s, t∈Xtt \in X_t.

The old edges. Let e=(X,Y)e = (X, Y) be an old edge with witness x,yx, y and D=DeYD = D_e^Y. After line L8 the YY side of the edge is still DD, since only XX was split, so c(D)=λ(x,y)c(D) = \lambda(x, y) still holds. If the half that YY is attached to contains xx, the witness stays. Otherwise say YY is attached to XtX_t while x∈Xsx \in X_s; then D∩S^=∅D \cap \hat S = \emptyset and x∈S^x \in \hat S. We show that (t,y)(t, y) is a witness. The set DD contains yy and not tt, so λ(t,y)≤c(D)\lambda(t, y) \le c(D). Let ZZ be a minimum tt-yy cut with y∈Zy \in Z, t∉Zt \notin Z. If x∉Zx \notin Z, then ZZ separates xx from yy and c(Z)≥λ(x,y)c(Z) \ge \lambda(x, y). If x∈Zx \in Z, the set Z∪S^Z \cup \hat S contains ss and not tt, so c(Z∪S^)≥c(S^)c(Z \cup \hat S) \ge c(\hat S), and Fact 1 gives c(Z∩S^)≤c(Z)c(Z \cap \hat S) \le c(Z); the set Z∩S^Z \cap \hat S contains xx and not yy, so c(Z)≥λ(x,y)c(Z) \ge \lambda(x, y). Hence λ(t,y)=λ(x,y)=c(D)\lambda(t, y) = \lambda(x, y) = c(D). The case where YY is attached to XsX_s while x∈Xtx \in X_t is the same with ss and tt swapped and S^\hat S replaced by V∖S^V \setminus \hat S, which is a minimum tt-ss cut.

The nodes still partition VV, and TT 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 Xs∋sX_s \ni s and Xt∋tX_t \ni t are both nonempty. A partition of VV has at most nn parts, so after n−1n - 1 rounds every node is a single vertex and line L2 fails.

The result. At the end each tree edge (a,b)(a, b) joins single vertices, so its witness is (a,b)(a, b) itself: λ(a,b)=λe=c(Deb)\lambda(a, b) = \lambda_e = c(D_e^b). Take u≠vu \ne v and the tree path u=x0,x1,…,xk=vu = x_0, x_1, \dots, x_k = v. Every edge ei=(xi−1,xi)e_i = (x_{i-1}, x_i) of the path has a side that contains exactly one of uu and vv, so λ(u,v)≤λei\lambda(u, v) \le \lambda_{e_i} for each ii. By Fact 2 applied k−1k - 1 times, λ(u,v)≥min⁡iλ(xi−1,xi)=min⁡iλei\lambda(u, v) \ge \min_i \lambda(x_{i-1}, x_i) = \min_i \lambda_{e_i}. So λ(u,v)\lambda(u, v) is the least weight on the path, and the side of a lightest path edge is a cut of that value separating uu from vv, a minimum uu-vv cut. ■\blacksquare

Back to Gomory-Hu tree algorithm