Flow
Flow
1 Flows
(Notice that the expression for NetFlow(v) equals the total flow on edges out of v minus the total
flow on edges into v).
We have the following simple lemma.
Value(f ) = NetFlow(s).
1
2 Flows under capacity constraints
Let G = (V, E) be a directed graph. Let c : E → R be a function with c(e) ≥ 0 for each e ∈ E. We
will call c(e) the capacity of the edge E.
Let s, t ∈ V . A flow from s to t satisfying the capacities c is a flow f : E → R such that f (e) ≤ c(e)
for each edge e ∈ E.
3 Cuts
A cut in a graph G is simply a partition of the vertex set into two nonempty sets. If s, t are two
vertices of G, an (s, t)-cut is a partition of the vertex set into two nonempty sets such that s is in
one set and t is in the other.
Every cut in the graph G gives a simple upper bound on the maximum possible value of a flow
satisfying given capacity constraints.
Lemma 3. For every flow f satisfying the capacities c, and for every S ⊆ V , such that s ∈ S and
t ∈ S,
Value(f ) ≤ Capacity(S, S).
= Capacity(S, S).
Here we used the fact that 0 ≤ f (e) ≤ c(e) to derive the “≤” step.
4 Max-Flow / Min-Cut
where f varies over flows satisfying c, and S varies over (s, t)-cuts.
The max-flow-min-cut theorem says that these quantities are in fact equal.
Theorem 4 (Max-Flow/Min-Cut). Let G be a directed graph, and let c be a capacity function on
the edges of G. Then:
max Value(f ) = min Capacity(S, S),
f S
where f varies over flows satisfying c, and S varies over (s, t)-cuts.
2
The proof of this theorem will also lead to a simple, quick algorithm to find the maximum flow, as
well as a cut with capacity = value (thus showing that the flow is indeed max).
Proof. Let f be a flow satisfying c that maximizes Value(f ). We will show how to use f to find
a cut (S, S) whose capacity is Value(f ). Note that we crucially need to use the fact that f is a
maximum flow, this argument cannot work with any old flow.
The cut we are looking for is a “bottleneck” for f , across which no extra flow can be sent. Thus it
makes sense to look for the set S of vertices that can “receive” more flow. This is what we achieve
in the following procedure:
• Initialize S = {s}.
– If there exists u ∈ S and v ∈ V \ S are such that (u, v) ∈ E and either f(u,v) < c(u,v) or
f(v,u) > 0, then include v in S.
We first claim that (S, S) is an (s, t)-cut. If not, then t ∈ S. Consider the vertices v0 =
s, v1 , . . . , vk = t which led to t being included in S (i.e., for each i, either f(vi ,vi+1 ) < c(vi ,vi+1 )
or f(vi+1 ,vi ) > 0). Then we can modify f to get a flow with even higher value as follows: for a
suitably small , either increase f(vi ,vi+1 ) by or decrease f(vi+1 ,vi ) by (by choice of the vi , at least
one of these modifications will be possible without violating the capacity or nonnegativity of the
flow). This increases Value(f ) by , contradicting the maximality of f . Thus (S, S) is an (s, t)-cut.
Now we verify that Capacity(S, S) equals Value(f ).
We have:
X
Capacity(S, S) = c(e)
e∈E(S,S)
X
= f (e) by definition of S
e∈E(S,S)
X X
= f (e) − f (e) by definition of S again, f (e) = 0 for each e ∈ E(S, S)
e∈E(S,S) e∈E(S,S)
= Value(f ).
• Start with f = 0.
3
– If (S, S) is an (s, t)-cut, then we are done; f is the desired max flow, and (S, S) is a cut
which proves that f is maximum.
– Otherwise, as in the proof of Theorem 4, we can modify f and increase Value(f ).
By inspecting the proof of Theorem 4 (and in particular paying attention to the amount by which
Value(f ) can be increased), it is easy to check that ifPall the capacities c(e) are integers, then this
algorithm will find the maximum flow with at most e c(e) modifications of f .
Another important corollary of this algorithm is the integrality of the max flow:
Corollary 5. If c(e) is an integer for each edge e ∈ E, then there is a maximum flow f where f (e)
is an integer for each edge e ∈ E.