Sub topic 7
The Max-Flow Min-Cut Theorem
This chapter assumes you already know the material from earlier chapters: flow networks, feasible flows, residual graphs, augmenting paths, the Ford-Fulkerson method, and s-t cuts with their capacities. It also assumes you are comfortable with proofs by contradiction. The goal here is to prove that the flow Ford-Fulkerson returns is optimal. The proof also gives you a cut that serves as a certificate: anyone can check it to confirm that no larger flow exists.
The Inequality You Already Have
The previous chapter showed that every cut bounds every flow. For any feasible flow f and any s-t cut (S, T):
- The net flow across the cut,
f(S, T), is the total flow on edges fromStoTminus the total flow on edges fromTtoS. It always equals the flow value|f|. - Flow on an
S-to-Tedge is at most that edge's capacity, and flow on aT-to-Sedge is at least 0. So|f| = f(S, T) ≤ c(S, T).
This is called weak duality. Any flow you find is a lower bound on the maximum flow, and any cut you find is an upper bound on it. When a flow and a cut have the same value, both are optimal, because neither bound can be improved. The max-flow min-cut theorem states that such a pair always exists.
Statement of the Theorem
Let f be a feasible flow in a network G with source s and sink t. The following three statements are equivalent:
fis a maximum flow inG.- The residual graph
G_fcontains no augmenting path fromstot. |f| = c(S, T)for some s-t cut(S, T).
A direct corollary is that the value of a maximum flow equals the capacity of a minimum cut.
The proof is a cycle of implications. Proving each arrow in the cycle proves all three statements equivalent.
The Proof
(1) implies (2)
Suppose f is maximum but G_f still has an augmenting path p. Every edge on p has positive residual capacity, so the bottleneck c_f(p) is positive. Augmenting along p gives a feasible flow with value |f| + c_f(p) > |f|. That contradicts the assumption that f is maximum.
(2) implies (3)
This step does the real work. Define
S = { v : v is reachable from s in G_f } and T = V \ S.
s is in S trivially. Since there is no augmenting path, t is not in S. So (S, T) is a valid s-t cut. Now take any u in S and any v in T:
- If
(u, v)is an edge ofG: supposef(u, v) < c(u, v). Then the residual graph has the edgeu → vwith positive capacity, andvwould be reachable fromsthroughu. That contradictsvbeing inT. Sof(u, v) = c(u, v), which means every forward edge across the cut is saturated. - If
(v, u)is an edge ofG: supposef(v, u) > 0. Then the residual graph has the reverse edgeu → vwith capacityf(v, u) > 0, andvwould again be reachable. Sof(v, u) = 0, which means every backward edge across the cut is empty.
Substitute both facts into the net flow:
|f| = f(S, T) = Σ c(u, v) over forward edges − Σ 0 over backward edges = c(S, T).
The second case is the reason reverse edges must be in the residual graph. Without them, a backward edge carrying flow would go undetected, and the inequality from weak duality could be strict.
(3) implies (1)
By weak duality, every feasible flow f' satisfies |f'| ≤ c(S, T) = |f|. So no flow has a larger value than f, which makes f maximum.
What the Theorem Buys You
Correctness of Ford-Fulkerson. Ford-Fulkerson stops exactly when statement (2) holds. So whenever it terminates, its flow is maximum. The algorithm only ever checks a local condition (is there a path in G_f?), and the theorem turns that check into a guarantee about the whole network.
A checkable certificate. A solver can return the pair (f, S). A verifier does not need to trust the solver or rerun it. It checks that f is feasible, computes |f|, computes c(S, T), and compares them. All of this takes O(V + E) time.
A second problem solved for free. Minimum cut is often the question you actually care about: the cheapest set of links to cut to disconnect two hosts, or the segmentation boundary in image processing. The theorem says you can solve it by computing a maximum flow.
Worked Example: Checking a Certificate
This example uses the six-node network from the Edmonds-Karp chapter: node 0 is s and node 5 is t. The claimed maximum flow below has value 23. The claimed cut puts S = {0, 1, 2, 4}. The code checks feasibility, then compares the flow value with the cut capacity.
def check_certificate(capacity, flow, s, t, S):
n = len(capacity)
in_S = [v in S for v in range(n)]
assert in_S[s] and not in_S[t], "not an s-t cut"
# Capacity constraint
for u in range(n):
for v in range(n):
assert 0 <= flow[u][v] <= capacity[u][v], f"capacity violated on {u}->{v}"
# Flow conservation at every vertex except s and t
for v in range(n):
if v in (s, t):
continue
inflow = sum(flow[u][v] for u in range(n))
outflow = sum(flow[v][w] for w in range(n))
assert inflow == outflow, f"conservation violated at {v}"
value = sum(flow[s][v] for v in range(n)) - sum(flow[u][s] for u in range(n))
cut_capacity = sum(capacity[u][v] for u in range(n) for v in range(n)
if in_S[u] and not in_S[v])
return value, cut_capacity, value == cut_capacity
capacity = [
[0, 16, 13, 0, 0, 0],
[0, 0, 0, 12, 0, 0],
[0, 4, 0, 0, 14, 0],
[0, 0, 9, 0, 0, 20],
[0, 0, 0, 7, 0, 4],
[0, 0, 0, 0, 0, 0],
]
flow = [
[0, 12, 11, 0, 0, 0],
[0, 0, 0, 12, 0, 0],
[0, 0, 0, 0, 11, 0],
[0, 0, 0, 0, 0, 19],
[0, 0, 0, 7, 0, 4],
[0, 0, 0, 0, 0, 0],
]
print(check_certificate(capacity, flow, 0, 5, {0, 1, 2, 4})) # (23, 23, True)The edges crossing from S to T are 1→3 (12), 4→3 (7), and 4→5 (4). is saturated, and their capacities add up to 23. The single backward edge 3→2 carries 0, as the proof requires.
Edge Cases and Subtleties
Minimum cuts need not be unique. Several cuts can share the minimum capacity. The reachable set from s in G_f gives the minimum cut whose source side is smallest. The set of vertices that can reach t in G_f gives the minimum cut whose sink side is smallest. If these two cuts are the same, the minimum cut is unique.
The cut does not depend on which maximum flow you found. Different maximum flows can route flow differently, but they all have the same value. Every minimum cut is saturated by every maximum flow.
Irrational capacities. The theorem still holds: a maximum flow exists, and its value equals the minimum cut capacity. What can fail is Ford-Fulkerson's termination, which the next chapter covers. The theorem says when to stop. It does not promise that you will ever get there.
Zero-capacity cuts. If t cannot be reached from s in G, then the empty flow is maximum. S is the set of vertices reachable from s in G itself, and c(S, T) = 0.
Linear programming view. If you have studied linear programming (LP), this theorem is a special case of LP strong duality. The dual of the max-flow LP is a relaxation of min cut, and that relaxation has an integral optimal solution.
Common Errors
| Mistake | Why it is wrong | Correct approach | Column | Column |
|---|---|---|---|---|
| Adding capacities of `T`-to-`S` edges into `c(S, T)` | Cut capacity counts only edges from `S` to `T` | Sum `c(u, v)` only for `u` in `S` and `v` in `T` | ||
| Taking `S` as the vertices reachable in the original graph `G` | In `G`, `t` is usually reachable, so this does not give a cut | Search in the residual graph `G_f` | ||
| Assuming every saturated edge is in the minimum cut | Saturated edges can lie entirely inside `S` or inside `T` | Only edges that cross from `S` to `T` count | ||
| Leaving reverse edges out of the residual search | You may find a "cut" whose backward edges carry flow, so `c(S, T) > | f | ` | Include residual capacity `f(v, u)` on every edge `u → v` |
| Treating a flow and cut of equal value as proof without checking feasibility | An infeasible "flow" can have any value | Check the capacity and conservation constraints first |
Exercises
Exercise
In the example network, consider the cut S = {s, 1, 2}, T = {3, 4, t}. Compute its capacity and explain what it tells you about the maximum flow.
Show answer
The edges from S to T are 1→3 (12) and 2→4 (14), so the capacity is 26. The edge 3→2 runs from T to S and is not counted. By weak duality, the maximum flow is at most 26. That bound is valid but not tight: the maximum flow is 23, so this is not a minimum cut.
Exercise
A colleague says: "My flow has value 40, and I found a cut of capacity 40, so my flow is maximum." When can you accept this argument without further checks?
Show answer
Accept it only after confirming that the flow is feasible (capacity and conservation constraints hold) and that the cut is a real s-t cut (s in S, t in T). Once both hold, weak duality gives |f'| ≤ 40 = |f| for every flow f', so the flow is maximum and the cut is minimum.
Exercise
In the proof of (2) implies (3), which case would break if the residual graph contained only forward residual edges c(u,v) − f(u,v) and no reverse edges?
Show answer
The case for backward edges. An edge (v, u) from T to S could carry positive flow without making v reachable, because the reverse residual edge u → v would be missing. Then f(S, T) = c(S, T) − (flow on backward edges) < c(S, T), and the search could stop at a flow that is not maximum.