Abstract
Given a directed graph where edges have capacities, and two special vertices — a source and a sink — how much “flow” can be pushed from to without exceeding any edge’s capacity?
- Category: Network Flow / Combinatorial Optimization (also formulable as Linear Programming)
- Input: Directed graph with non-negative edge capacities ; source , sink
- Output: An assignment of flow values to every edge, maximizing total flow
- Paradigm: Augmenting-path method (Ford-Fulkerson), improving a flow via a residual graph
- Typical use cases: bipartite matching, project/task selection, image segmentation, traffic and logistics routing — anything shaped like “maximize throughput subject to capacity limits”
Problem Specification
- Instance: Directed graph with non-negative edge weights called capacities. Two vertices (source), (sink).
- Solution Format: An assignment of non-negative values (flow) to each edge.
- Constraints:
- Capacity: for each edge , .
- Conservation: for each vertex , (flow in equals flow out).
- Objective: total flow out of (equivalently, total flow into ).
- Goal: Maximize.
Candidate Strategies / Approaches
Linear Programming (Simplex) ✔ — works, but not the specialized choice
Since every constraint above (capacity, conservation) and the objective (total flow) are linear, Max Flow is technically solvable directly as an instance of Linear Programming. But the problem’s graph structure supports a more specialized, more efficient combinatorial algorithm instead.
Ford-Fulkerson Method ✔ (chosen)
Start with a trivial solution, and keep trying to make it better.
- Trivial flow: zero flow along every edge.
- Better than zero: any path of positive-capacity edges from to .
- How much better? Send the minimum capacity of any edge along that path (the bottleneck) — that’s how much extra flow the whole path can carry.
The Ford-Fulkerson Method
The Residual Graph
Ford-Fulkerson’s insight: represent the problem of improving a flow as another flow problem, on a residual graph. If is the current flow on edge and its capacity, the residual graph changes that edge’s capacity to , and adds to the capacity of the reverse edge (representing the option to “undo” flow already sent).
Key Observation
Let be any flow in the original graph, and be any flow in the residual network with respect to . Then is a valid flow in the original network, and:
So we can keep finding flow in the residual network, update the residual graph, and repeat — until we can’t increase the flow any further.
Termination and the Min Cut
We stop when there’s no path from to left in the residual graph. Let be the set of all vertices reachable from in the residual graph at that point, and the unreachable vertices (, since we just said there’s no path to it).
Every edge with and can’t be in the residual graph (or would be reachable too) — meaning every such edge is being used at full capacity. Let be the total capacity of all such crossing edges. Then, at termination:
Pseudocode (Chosen Approach)
Algorithm 44 Network Flow
procedure FF()
while there is a path in the residual graph do
Find a path in the residual graph (DFS) from to
Augment the flow along every edge in this path
Create new residual graph
Variables & Data Structures
| Name | Type | Purpose |
|---|---|---|
f(e) | Number, per edge | Current flow assigned to edge |
| Residual graph | Graph | Same vertices, with each edge’s remaining capacity , plus a reverse edge of capacity to allow “undoing” flow |
Helper Functions / Operations Used
- Find an - path in the residual graph — Depth First Search (DFS) (as specified), per call.
- Augment along the path — push flow equal to the path’s bottleneck (minimum residual capacity along it); .
Proof of Correctness / Optimality
Weak duality (needed first): for any flow and any - cut , . Every unit of flow from to must cross from to somewhere, and no edge can carry more than its capacity — so total flow can never exceed any cut’s total capacity.
What Ford-Fulkerson shows at termination: the algorithm stops precisely when no augmenting path remains. At that point, taking = vertices reachable from in the residual graph and , every crossing edge is fully saturated, giving exactly (shown above).
Putting them together — the Max-Flow Min-Cut Theorem: since holds for every cut, and Ford-Fulkerson exhibits a flow and a specific cut with equality, two things follow simultaneously:
- is a maximum flow — no flow can exceed , and already equals it.
- is a minimum cut — no cut can be smaller than , and already equals it.
So Ford-Fulkerson doesn’t just find a flow it can’t improve — it provably finds the maximum flow, with a matching minimum cut as a certificate.
Time & Space Complexity Analysis
General Case
At most iterations of the outer loop, each costing time (one DFS), giving:
Where does come from?
(not explicitly defined in the source) is the maximum edge capacity. Each augmenting path increases total flow by at least 1 if capacities are integers, and the maximum possible flow value is bounded by (the number of edges leaving ) (max capacity) in the worst case — giving at most iterations before the flow can’t increase any further, each costing for the DFS.
| Complexity | Notes | |
|---|---|---|
| Time | Pseudo-polynomial — see Drawbacks below | |
| Space | The residual graph, same size as the original plus reverse edges |
Drawbacks / Constraints
- Pseudo-polynomial runtime. depends on the numeric value of capacities, not just the graph’s size — with large capacities, this can be slow, matching the same caveat seen in Knapsack Problem’s .
- Can fail to terminate with irrational capacities. If edge capacities aren’t required to be rational, Ford-Fulkerson’s augmenting-path process can (in pathological cases) run forever without converging to the max flow at all.
- Path choice matters. Using DFS to find any augmenting path (as specified) can be much slower in practice than always choosing the shortest augmenting path — the Edmonds-Karp variant (BFS instead of DFS) guarantees a strongly polynomial bound, independent of capacity values, fixing both the pseudo-polynomial and non-termination issues above.
