$f$ max $\iff$ no augmenting path in $G_f$ $\iff$ $\lvert f\rvert=c(S,T)$ for some cut.
Min-cut construction
At a max flow, $S=$ residual-reachable set of $s$; all $S\to T$ edges are saturated, all $T\to S$ edges carry 0.
Integrality
Integer capacities $\Rightarrow$ Ford–Fulkerson (from zero flow) returns an integer max flow.
Matching = flow
Max bipartite matching size $=$ max-flow value on the unit-capacity reduction.
Hall's theorem
$X$-saturating matching exists $\iff \lvert N(W)\rvert\ge\lvert W\rvert$ for all $W\subseteq X$.
Ford–Fulkerson / Edmonds–Karp (the algorithm)
f <- 0 # start from the zero flow
while G_f has an s->t path p: # an augmenting path
Δ <- min residual capacity on p # bottleneck
for each step u->v on p:
if forward edge: f(u,v) += Δ # push
if back edge: f(v,u) -= Δ # CANCEL existing flow
return f # max flow when no path remains
Why it's correct: halting means "no augmenting path" = condition (ii) ⇒ flow is max (theorem).
Bipartite matching → max flow (reduction recipe)
Step
Add
1
source $s$, sink $t$
2
$s\to x$, capacity 1, for each $x\in X$
3
$x\to y$, capacity 1, for each original edge $x{-}y$
4
$y\to t$, capacity 1, for each $y\in Y$
Run max_flow(s,t). Matching = middle edges $x\to y$ carrying 1 unit; size = flow value. Unit caps force ≤1 per vertex on each side.
Decision aid — "what do I compute?"
Goal
Compute
Read off
Max throughput $s\to t$
max flow
value $\lvert f\rvert$
Prove flow optimal
residual-reachable set of $s$
matching cut of equal capacity
Cheapest disconnect of $s,t$
min cut ($=$ max flow)
the saturated cut edges
Largest set of compatible pairs
matching → max flow reduction
flow-carrying middle edges
"Can everyone be assigned?"
max flow vs. $\lvert X\rvert$ (or Hall)
deficient $W$ if not
Foreground/background split (vision)
min cut
$S$ = foreground side
Common pitfalls
⚠️ A back edge $v\to u$ subtracts from $f(u,v)$ — it is not a new edge in the original graph. The original edge set never changes.
⚠️ A flow below some cut proves nothing. Optimality needs a cut of equal capacity (the min cut), not any cut.
⚠️ Cut capacity counts only $S\to T$ edges. $T\to S$ and within-side edges contribute 0.
⚠️ Bipartite matching needs the integer max flow; fractional flows don't correspond to matchings (integrality saves you with integer capacities).
⚠️ Naive "push on any spare forward path" greed is wrong — it can't undo a bad commitment. You need residual back edges.
Toolkit additions (dmtoolkit/graphs.py)
Function
Signature
Returns
max_flow
max_flow(g, s, t)
maximum flow value (Edmonds–Karp; BFS augmenting paths)
Composes with Graph (Ch. 27), bfs/dfs (Ch. 28), dijkstra (Ch. 29), mst_kruskal (Ch. 32). Feed it the unit-capacity reduction ⇒ bipartite matching size. Used in the Chapter 39 Track B social-network analyzer.
One-line mental model
Max flow = min cut. The most you can push equals the cheapest way to sever the network — a maximization and a minimization that are secretly the same number (strong duality). Find a flow and a cut of equal value, and you have proved both optimal.
We use cookies to improve your experience and show relevant ads. Privacy Policy