Maximum flow (concept + Ford-Fulkerson)
◈ 5 cardsFlow networks, residual graphs, augmenting paths, the max-flow min-cut theorem, and Edmonds-Karp (BFS augmenting paths, O(VE²)).
Flow networks
A flow network is a directed graph where each edge has a nonnegative capacity , with a designated source and sink . A flow assigns a value to each edge subject to two rules:
- Capacity constraint: — you cannot send more than an edge can carry.
- Flow conservation: at every vertex except and , flow in equals flow out — nothing accumulates or appears.
The value is the net flow leaving the source. The maximum-flow problem asks for the flow of greatest value.
Residual networks and augmenting paths
The key device is the residual network , which records how the flow can still change. For each edge it provides two residual capacities:
- Forward residual — unused capacity you can still push.
- Backward residual — the ability to cancel existing flow and reroute it.
An edge appears in exactly when its residual capacity is positive. An augmenting path is any simple path in ; its residual capacity is the bottleneck . Augmenting along pushes units — raising forward edges and lowering the cancelled ones — increasing by . The backward edges are what let a greedy method undo a bad earlier routing choice.
The max-flow min-cut theorem (Theorem 24.6)
A cut partitions the vertices with , ; its capacity is the total capacity of edges crossing . The theorem states three equivalent conditions:
- is a maximum flow.
- contains no augmenting path.
- for some cut .
So max flow = min cut. The proof is constructive: when no augmenting path exists, take vertices reachable from in . Then every edge is saturated () and every edge carries zero flow, so the net flow across the cut equals its capacity, — proving maximality and exhibiting a minimum cut at once.
Ford-Fulkerson and Edmonds-Karp
Ford-Fulkerson is the method: start with , and while an augmenting path exists in , augment along it. With integer capacities each augmentation adds at least , so it terminates — but choosing the path carelessly costs , which is not polynomial in the input size (a -capacity graph can need augmentations).
Edmonds-Karp fixes this by always taking the shortest (fewest-edge) augmenting path via BFS. Then BFS distances from in increase monotonically, so each edge becomes a critical (bottleneck) edge at most times — yielding augmentations and a total of , polynomial regardless of capacity values. By the integrality theorem, integer capacities yield an integer maximum flow — which is why bipartite matching reduces to max flow: give every edge capacity and each vertex is matched at most once.
Worked example
On the CLRS Fig 24.1 network (6 vertices ) Edmonds-Karp finds a maximum flow of value 23.