7.1 Max-flow min-cut theorem

Given a simple graph G=(V,E), we set E← to be the set of ordered edges of E whereby we give both the orientations to an edge e∈E. In other words, e∈E← implies that e=(x,y)≠(y,x) and we rather denote −e=(y,x) in such a case. Further, we set e−=x,e+=y.

Definition 7.1.

(Flow ) Let s,t∈V (source, target). A flow f from s (source) to t (target/sink) is a function f:E←→ℝ such that

  1. 1.

    (anti-symmetry) f⁢(e)=−f⁢(−e)

  2. 2.

    (Kirchoff’s node law ) (d∗⁢f)⁢(x):=∑e:e−=xf⁢(e)=0 for all x≠{s,t}.

  3. 3.

    (Positive output at source :) (d∗⁢f)⁢(s)≥0.

Definition 7.2.

Let c:E→[0,∞] be the capacity function. A flow from s to t is said to satisfy the capacity constraints if f⁢(e)≤c⁢(e) and we call such a flow feasible.

One can suitably define in-flow and out-flow at a vertex and show that Kirchoff’s node law implies that the in-flow and out-flow are equal at all vertices except the sink. We can further define value of a flow v⁢(f):=d∗⁢f⁢(s). Using double-counting and anti-symmetry, we derive that

∑x∈Vd∗⁢f⁢(x)=∑e∈E←f⁢(e)=12⁢∑e∈E←(f⁢(e)+f⁢(−e))=0.

So, from Kirchoff’s node law and definition of v⁢(f), we obtain −d∗⁢f⁢(t)=d∗⁢f⁢(s)=v⁢(f).

Let S⊂V. We call a pair (S,Sc) a (s,t)-cut if s∈S,t∉S. Defining C⁢(X,Y)=∑x∈X,y∈Yc⁢(x,y), f⁢(X,Y)=∑x∈X,y∈Yf⁢(x,y), we can show that v⁢(f)=f⁢(S,Sc) for any (s,t)-cut (S,Sc) and any feasible s−t flow. Note that if S={s}, v⁢(f)=f⁢(S,Sc) by definition. Re-iterating the above argument,

v⁢(f) =d∗⁢f⁢(s)=∑x∈Sd∗⁢f⁢(x)=∑e∈E←,e−∈Sf⁢(e)
=∑e,e−,e+∈Sf⁢(e)+∑e,e−,e+∈Sf⁢(e)
=12⁢∑e,e−,e+∈S(f⁢(e)+f⁢(−e))+f⁢(S,Sc)=f⁢(S,Sc).

Thus, we have that v⁢(f)=f⁢(S,Sc)≤C⁢(S,Sc) for a feasible s−t flow and so

sup{v⁢(f):f⁢is a (s,t)-flow}≤infS:s∈S,t∉SC⁢(S,Sc).

That the converse holds is the non-trivial max-flow min-cut theorem that we will state and prove now. Since the infimum for cuts is taken over a finite set, it is trivally a minimum. Though the LHS may not always be a maximum (see Lemma 7.4 and Exercise 7.8), we refer to it as max-flow and the RHS as min-cut.

Theorem 7.3 (Max-flow min-cut theorem ; Elias-Feinstein-Shannon and Ford-Fulkerson (1956) ).
sup{v⁢(f):f⁢is a feasible (s,t)-flow}=minS⊂V:s∈S,t∉S⁡C⁢(S,Sc).

It will soon become clear that Max-flow min-cut theorem is not a single theorem but a class of theorems that can be proven under different frameworks using variants of the ideas we will use to prove the above theorem - Theorem 7.3. We say P=e1⁢…⁢ek is a s−t path if e1−=s,ek+=t and ei+=ei+1− for all 1≤i<k.

Lemma 7.4.

If there exists an infinite capacity s−t path (i.e. capacity of every edge on the path is infinite), then the max-flow is infinite and so is the min-cut. Else, the min-cut is finite and so is the max-flow.

Proof.

The proof of first part follows by constructing a sequence of flows with increasing strengths. We will prove the second part alone. Let there be no infinite capcity s−t path. We construct a finite min-cut as follows : Choose an s−t path P1 and since it is not infinite, there exists e1 such that c⁢(e1)<∞. Now repeat this procedure on G−e1 and choose an edge e2 in a s−t path P2 such that c⁢(e2)<∞. Repeatedly, we can choose edges e1,…,ek until G−{e1,…,ek} has no s−t path. Let S be the set of vertices in the component of s in G−{e1,…,ek} and clearly t∈Sc. Since s−t path exists in G, we have that E∩(S×Sc)⊂{e1,…,ek} and hence C⁢(S,Sc)≤∑i=1kc⁢(ei)<∞. ∎

Lemma 7.5.

If the capacity function is bounded, then

sup{v⁢(f):f⁢is a feasible (s,t)-flow}=max⁡{v⁢(f):f⁢is a feasible (s,t)-flow}.
Proof.

Let fn be a sequence of feasible s−t flows such that

v⁢(fn)↑sup{v⁢(f):f⁢is a feasible (s,t)-flow}.

Enumerate the set of edges in E as e1,…,em. Fix an orientation for each ei. Since fn⁢(e1)≤c⁢(e1)<∞, by Bolzano-Weierstrass theorem, there exists a convergent subsequence fn1⁢(e1) such that fn1⁢(e1)→x1. Set f0⁢(e1)=x1. Now apply the argument to the sequence of flows fn1 on e2. This way we get a limit x2 and set f0⁢(e2)=x2. Continuing, we get f⁢(ei)=xi for all 1≤i≤m. This is nothing but a diagonalization argument and so we have constructed a subsequence fnm such that fnm⁢(ei)→f0⁢(ei) for all 1≤i≤m. Thus, we have that

v(f0)=d∗f0(s)=limnm→∞d∗fnm(s)=limnm→∞v(fnm)=sup{v(f):fis a feasible (s,t)-flow,

i.e., f0 is the maximal element. ∎

Lemma 7.6.

Let f be a s−t flow in a graph and let P=e1⁢…⁢ek be a s−t path. Then for every ϵ>0, f′ defined as follows is also a flow : f′⁢(e):=f⁢(e) for e,−e≠e1,…,ek, f′⁢(e)=f⁢(e)+ϵ,e=e1,…,ek, f⁢(e)=f⁢(e)−ϵ,e=−e1,…,−ek. Further v⁢(f′)=v⁢(f)+ϵ.

Proof.

Clearly anti-symmetry holds and (d∗⁢f′)⁢(s)=∑e:e−=sf′⁢(e)=∑e:e−=sf⁢(e)+ϵ≥0. It remains only to show that (d∗⁢f′)⁢(v)=0 for all v≠s,t. This holds trivially for all v≠ei−,i=2,…,k. Suppose v=ei− for some 1<i≤k. Then

(d∗⁢f′)⁢(v) =∑e:e−=vf′⁢(e)=∑e:e−=v,e≠ei−1,eif⁢(e)+f′⁢(ei)+f′⁢(−ei−1)
=∑e:e−=v,e≠ei−1,eif⁢(e)+f⁢(ei)+f⁢(−ei−1)=(d∗⁢f)⁢(v)=0.

∎

We first present the Ford-Fulkerson algorithm which gives the idea of the proof.

Remark 7.7 (Ford-Fulkerson Algorithm ).

Given a flow f, define the residual capacity cf⁢(u,v)=c⁢(u,v)−f⁢(u,v).

  • Step 1: Set f≡0.

  • Step 2 : If there is a path P (called f-augmenting path from s to t in G such that cf⁢(u,v)>0 for all edges (u,v)∈P, then go to Step 3 else go to Step 6.

  • Step 3 : Find cf⁢(P)=min⁡{cf⁢(u,v):(u,v)∈P} (residual capacity).

  • Step 4 : For each edge (u,v)∈P, set f⁢(u,v)=f⁢(u,v)+cf⁢(P) and f⁢(v,u)=f⁢(v,u)−cf⁢(P).

  • Step 5 : Go back to Step 2.

  • Step 6 : Output flow f as the maximal flow.

Defining Sf be the set of vertices that can be reached from s with a path P such that cf⁢(u,v)>0 for all edges (u,v)∈P, note that Step 2 can also be rephrased as follows : If t∈Sf go to Step 3 else go to Step 6.

Proof.

(Theorem 7.3) Suppose that the capacity function is bounded. We will prove the theorem under this assumption and then argue the other case.

Let f be the max-flow whose existence is guaranteed by Lemma 7.5. Define

S=Sf={v:there exists a positive residual s−v path}∪{s}.

If t∉S, then [S,Sc] is as s−t cut. Also, if e∈S×Sc, then cf⁢(e)=0 as otherwise e+∈S which is a contradiction. As we argued before and by the zero residular property of edges in S⁢t⁢i⁢m⁢e⁢s⁢Sc, we have that

v⁢(f)=f⁢(S,Sc)=C⁢(S,Sc)

and so the theorem is proved as we already have the inequality.

If t∈S, then there is a positive residual path P. If we increase the capacity along the path by cf⁢(P) as in Lemma 7.6 and define a new flow f′ then v⁢(f′)=v⁢(f)+cf⁢(P). This will contradict the maximality of f if we show that it satisfies the capacity constraints. Trivially, the capacity constraint is satisfied for all e,−e∉P as the f′⁢(e)=f⁢(e) for all e,−e∉P. If −e∈P, then f′⁢(e)≤f⁢(e)≤c⁢(e). If e∈P, then f′⁢(e)=f⁢(e)+cf⁢(p)≤f⁢(e)+cf⁢(e)=c⁢(e) and so the capacity constraint is satisfied everywhere and the proof is complete.

Now let us assume that the capacity function is unbounded. But since the min-cut is finite, choose a cut [A,Ac] such that c⁢(A,Ac)<∞. Define c′ such that c′⁢(e)=c⁢(e)⁢𝟏⁢[c⁢(e)<∞]+c⁢(A,Ac)⁢𝟏⁢[c⁢(e)=∞]. Observe that the min-cut under c′ is same as that in c. Further, if a flow is feasible w.r.t c′ then it is feasible w.r.t. c as well. Since c′ is a bounded capacity function, we have a max-flow f such that v⁢(f)= min-cut under c′. But then, it also holds that v⁢(f)= min-cut under c and f is feasible under c as well. ∎

Exercise(A) 7.8.

The last part of the proof shows that Lemma 7.5 holds under the assumption of finite min-cut alone i.e., the assumption of bounded capacity can be relaxed considerably. Give a direct proof of this without using Max-flow Min-cut theorem.

Theorem 7.9.

Assume that the min-cut is finite. F-F Algorithm terminates if the capacities are integral and also gives that if capacities are integral, there is an integral maximal flow.

Proof.

If capacities are integral, the min-cut is integral and so is the max-flow. At evey step the F-F algorithm increases the flow strength by at least one as the residual capacity along any augmenting path is a positive integer . Since the max-flow is finite, in finitely many steps the algorithm outputs the max flow.

The algorithm starts with f≡0 and at every step, the flow on any edge is increased/decreased by the residual capcity if the edge is in a f-augmenting path. Since the residual capacity is integral, the flow is always integral and so is the max-flow. ∎

Example 7.10.

The F-F algorithm need not terminate when capacities are non-integral and here is an example. See https://en.wikipedia.org/wiki/Ford_Fulkerson_algorithm#Non-terminating_example

The definition of a flow can be extended to multiple sources and targets. Let S⊂V,T⊂V be the sources and sinks respectively. The definition of flow can be modified by requiring the Kirchoff’s node law to hold for all x∉S∪T and positive output at S i.e., ∑s∈S(d∗⁢f)⁢(s)≥0. An S−T cut is A⊂V such that S⊂A,T⊂Ac. We again have a max-flow min-cut theorem as follows.

Theorem 7.11 (Max-flow min-cut theorem for multiple sources and sinks.).
max⁡{v⁢(f):f⁢is a feasible S−T-flow}=infA⊂V:S⊂A,T⊂AcC⁢(A,Ac).
Proof.

Let us again assume that the min-cut is finite i.e., there is no infinite capacity S−T path. The trivial inequality follows as in the original theorem and also the fact that the supremum is maximum. To argue the equality, instead of repeating the proof, we shall use a reduction. Define G′ as follows : V′=V∪{a,b},E′=E∪(a×S)∪(T×b). Set the capacity of the new edges to be infinite. Note that any S−T cut in G is a a−b cut in G′. Further, any a−b cut involving edges in E′∖E has infinite capacity. Hence the min a−b cut in G′ and G are equal.

If f′ is a a−b flow in G′, let f be the restriction of f′ to G. Clearly f is skew-symmetric and satisfies Kirchoff’s node law. We verify the last condition as follows : By Kirchoff’s node law in G′, we have that

0=∑s∈S(d∗⁢f′)⁢(s)=∑e:e−∈S,e+∈Vf⁢(e)+∑e:e−∈S,e+=af⁢(e)=∑s∈S(d∗⁢f)⁢(s)−(d∗⁢f′)⁢(a).

Thus, v⁢(f)=∑s∈S(d∗⁢f)⁢(s)=(d∗⁢f′)⁢(a)=v⁢(f′)≥0 and so the max-flow in G′ is equal to the max-flow in G. Hence the theorem follows from the single-source single-sink max-flow min-cut theorem. ∎

A more general version of max-flow min-cut theorem is as follows : Let G=(V,E) be a directed graph i.e., e=(x,y)∈E does not imply that −e=(y,x)∈E. Let s,t∈V and c:E→[0,∞] be a capacity constraint function. Here even if e,−e∈E, c⁢(e)≠c⁢(−e). Then f:E→[0,∞) is a s−t flow if

  1. 1.

    ∑e:e−=xf⁢(e)=∑e:e+=xf⁢(e) for all x≠s,t. (conservation of flow / Kirchoff’s node law).

  2. 2.

    |f|:=∑e:e−=sf⁢(e)−∑e:e+=sf⁢(e)≥0. (flow strength is non-negative.)

As before, we say that f is a feasible flow (i.e., satisfies capacity constraint c) if for all e∈E, f⁢(e)≤c⁢(e). As before, a subset S⊂V is a directed s−t cut if s∈S,t∉S. Further capcity of a cut is defined as c⁢(S):=∑e∈E∩(S×Sc)c⁢(e).

1/15/53/41/24/51/13/33/3
Figure 7.1: The arrows are labelled with a/b where a is the flow passing and b is its capacity. The dotted line shows a min cut. This shows the equality of max flow and min cut in a directed graph
Exercise(A) 7.12.

(Max-flow min-cut theorem for directed graphs.) Under the notation as above, we have that

sup{|f|:f is a s−t flow satisfying capacity constraint c }=min{C(S):S⊂E is an s−t cut}.

Proof Sketch : The case of infinite min-cut and infinite capacities can be handled as in the undirected version. So let us assume that capacity is bounded i.e., c:E→[0,∞).

An f-augmenting x−y path is a path P:x=x0,…,xk=y such that for each 1≤i≤k either (i) c⁢(xi−1,xi)−f⁢(xi−1,xi)>0 or (ii) f⁢(xi,xi−1)>0. In simple words, either the ‘forward’ edges are not of full capacity or the ‘backward’ edges have positive flow. Define cf⁢(xi−1,xi)=c⁢(xi−1,xi)−f⁢(xi−1,xi) in Case (i) and cf⁢(xi−1,xi)=f⁢(xi,xi−1) in Case (ii). If both cases hold, pick one arbitarily as cf⁢(xi−1,xi). As before set cf⁢(P)=min⁡cf⁢(xi−1,xi). Show that the flow can be increased by adding cf⁢(P) to the ‘forward’ edges and subtracting cf⁢(P) from the ‘backward’ edges. Now use the proof idea of Theorem 7.3 to complete the proof.

A general version of max-flow min-cut theorem is stated in the exercises.

Exercise(A) 7.13.

Use max-flow min-cut theorem for directed graphs to show the undirected version.

Exercise(A) 7.14.

What is the equivalent of Ford-Fulkerson algorithm for flows on directed graphs.

Exercise(A) 7.15.

Does the F-F algorithm terminate is the capacities are rational ?