The Maximum Flow Problem and the Ford-Fulkerson Method
The maximum flow problem is a classic network flow problem. Imagine you have an oil pipeline network with a source (like a refinery) and a sink (like a port). The pipes have fixed capacities (the maximum flow rate per unit time). The problem is how to schedule the flow on each pipe so that the total flow from the source to the sink is maximized. The Ford-Fulkerson method is a fundamental and important framework for solving this problem.
I. Problem Description and Modeling
We abstract this pipeline network into a directed graph G=(V, E).
Vis the set of vertices (e.g., pipe junctions, stations).Eis the set of edges (i.e., pipes).- Each edge
(u, v) ∈ Ehas a non-negative capacityc(u, v) ≥ 0. If the edge(u, v)does not exist, we setc(u, v) = 0. - We designate two special vertices: the source
sand the sinkt.
A flow f is a function from V × V to real numbers that satisfies the following two key constraints:
- Capacity Constraint: For all
u, v ∈ V,0 ≤ f(u, v) ≤ c(u, v). The flow on an edge cannot exceed its capacity. - Flow Conservation: For all
u ∈ V - {s, t},∑_{v∈V} f(v, u) = ∑_{w∈V} f(u, w). That is, for any vertex other than the source and sink, the total flow entering the vertex must equal the total flow leaving the vertex (no storage or spontaneous generation).
The value |f| of a flow is defined as the net flow out of the source: |f| = ∑_{v∈V} f(s, v) - ∑_{v∈V} f(v, s). It is usually assumed that no edge enters the source, so |f| = ∑_{v∈V} f(s, v). Our goal is to find a flow f that maximizes its value |f|.
II. Core Ideas: Residual Network and Augmenting Paths
The essence of the Ford-Fulkerson method is iterative improvement. It starts from a zero flow (all edge flows are 0) and continuously finds paths where more flow can be "pushed."
-
Residual Capacity and Residual Network:
Given graphGand the current flowf, for an edge(u, v), we define its residual capacityc_f(u, v)as how much more flow can be added on top of this current flow.- If the original edge
(u, v)still has remaining capacity, i.e.,f(u, v) < c(u, v), thenc_f(u, v) = c(u, v) - f(u, v). This means we can push up toc_f(u, v)more flow along the direction of this edge. - Additionally, we need to consider the possibility of reversal. The current flow
f(v, u)represents flow fromvtou. This part of the flow can actually be canceled (or "reversed"). Therefore, we define a residual capacity for the reverse edge asc_f(v, u) = f(u, v).
The graph
G_fconsisting of all verticesVand all edges where the residual capacityc_f(u, v) > 0(including forward edges with remaining capacity and reverse edges for flow cancellation) is called the residual network. It precisely describes which paths can be used to increase flow given the current flow state. - If the original edge
-
Augmenting Paths:
In the residual networkG_f, any simple pathpfrom the sourcesto the sinktis called an augmenting path.
The bottleneck capacityc_f(p)of this path is defined as the minimum residual capacity among all edges on the path, i.e.,c_f(p) = min{ c_f(u, v) | (u, v) is on path p }.
Key Operation: We can "push" an additional flow of sizec_f(p)along this augmenting pathp. How does this operation affect the original flowf?- For each forward edge
(u, v)on pathp(i.e., an original edge inG), we increase its flowf(u, v)byc_f(p). - For each reverse edge
(v, u)on pathp(which corresponds to the original edge(u, v)), we effectively cancel some of the original flow fromutov, so we decreasef(u, v)byc_f(p).
This operation always satisfies the capacity constraint and flow conservation. Intuitively, we find a path that can still carry flow and push through the maximum amount determined by the narrowest section (bottleneck). The existence of reverse edges is crucial; it allows the algorithm to undo previous suboptimal flow assignments ("pushing back" flow from an edge), enabling it to find the global optimal solution.
- For each forward edge
III. Steps of the Ford-Fulkerson Algorithm
The algorithm procedure is very clear:
- Initialize: For all edges
(u, v) ∈ E, setf(u, v) = 0. - Loop:
a. In the residual networkG_fcorresponding to the current flowf, use a graph search algorithm (like BFS or DFS) to find an augmenting pathpfromstot.
b. If no such path is found, the algorithm terminates; the currentfis the maximum flow.
c. If found, calculate the bottleneck capacityc_f(p)of this path.
d. Update the flowfalong pathp: For each edge(u, v)on the path:
* If(u, v)is a forward edge inE, thenf(u, v) = f(u, v) + c_f(p).
* If(u, v)is a reverse edge in the residual network (corresponding to the original edge(v, u)), thenf(v, u) = f(v, u) - c_f(p).
IV. Example Demonstration
Consider a simple network, s is the source, t is the sink, edges and capacities are as follows:
s -> A (10), s -> B (5), A -> B (3), A -> t (7), B -> t (8)
- Iteration 1:
- Initial flow
fis all 0. - Residual network
G_fis the same as the original graph (because all edges have residual capacity equal to original capacity, reverse edge capacities are 0 and not shown). - Find an augmenting path
s -> A -> t, bottleneck capacitymin(10, 7) = 7. - Update flow:
f(s, A)=7,f(A, t)=7.
- Initial flow
- Iteration 2:
- Current flow:
f(s,A)=7, f(A,t)=7, others are 0. Build the residual network:- Edge
(s,A): remaining10-7=3, forward edges->Acapacity 3; reverse edgeA->scapacityf(s,A)=7. - Edge
(A,t): remaining7-7=0, forward edge disappears; reverse edget->Acapacity 7. - Edge
(s,B): remaining 5, forward edge capacity 5. - Edge
(A,B): remaining 3, forward edge capacity 3. - Edge
(B,t): remaining 8, forward edge capacity 8.
- Edge
- Find augmenting path
s -> B -> t, bottleneck capacitymin(5, 8)=5. - Update flow:
f(s,B)=5,f(B,t)=5.
- Current flow:
- Iteration 3:
- Current flow:
f(s,A)=7, f(A,t)=7, f(s,B)=5, f(B,t)=5. - Build residual network (omitted). Can find augmenting path
s -> A -> B -> t.s->Aresidual capacity 3.A->Bresidual capacity 3.B->tresidual capacity8-5=3.
- Bottleneck capacity
min(3, 3, 3)=3. - Update flow:
f(s,A) = 7+3 = 10f(A,B) = 0+3 = 3(NoteA->Bis a forward edge)f(B,t) = 5+3 = 8- Meanwhile,
f(A,t)remains 7. Note flow conservation atB: inflow toBisf(A,B)=3plusf(s,B)=5, total 8; outflow fromBisf(B,t)=8. Conservation holds.
- Current flow:
- Termination:
- Flow value now
|f| = f(s,A) + f(s,B) = 10 + 5 = 15. - In the final residual network,
tis no longer reachable froms(e.g.,s->Ais saturated,s->Bis saturated, and no other path leads tot). Algorithm terminates. - Final maximum flow is 15.
- Flow value now
V. Key Theorems and Algorithm Analysis
- Max-Flow Min-Cut Theorem: This is the cornerstone theorem of network flow theory. It states that in a flow network, the value of the maximum flow from source
sto sinktequals the minimum sum of the capacities of all edges going from a setScontainingsto a setTcontainingt(this sum is called the capacity of an(S, T)cut). This theorem guarantees the correctness of the Ford-Fulkerson method—when nos-tpath exists in the residual network, a cut can be constructed from the current flow whose capacity equals the current flow value, thereby proving the current flow is maximal. - Time Complexity: The Ford-Fulkerson method itself is a framework; its time complexity depends on how augmenting paths are found.
- If DFS is used to find paths and edge capacities are integers, each augmentation increases the flow value by at least 1. Let the maximum flow value be
|f*|, then the algorithm takesO(|f*| * |E|)time. With large or non-integer capacities, it may not terminate in polynomial time. - Therefore, in practice, its improved version—the Edmonds-Karp algorithm—is often used, which specifies that BFS must be used to find augmenting paths (i.e., always finding the shortest
s-tpath). This guarantees the algorithm finishes inO(|V| * |E|^2)time, a deterministic polynomial-time algorithm. Each BFS path search isO(|E|), and the number of BFS searches can be proven not to exceedO(|V| * |E|).
- If DFS is used to find paths and edge capacities are integers, each augmentation increases the flow value by at least 1. Let the maximum flow value be
VI. Summary
The Ford-Fulkerson method approaches the maximum flow by iteratively finding augmenting paths in the residual network and pushing flow along them. The introduction of reverse edges is key to the algorithm's ability to find the global optimum. When no path from s to t exists in the residual network, the algorithm terminates, and the current flow is the maximum flow. Its improved version, the Edmonds-Karp algorithm (using BFS to find augmenting paths), provides a stable polynomial time complexity guarantee.