The Ford–Fulkerson algorithm (named for L. R. Ford, Jr. and D. R. Fulkerson) computes the maximum flow in a flow network. It was published in 1956. The name "Ford–Fulkerson" is often also used for the Edmonds–Karp algorithm, which is a specialization of Ford–Fulkerson.
The idea behind the algorithm is very simple: As long as there is a path from the source (start node) to the sink (end node), with available capacity on all edges in the path, we send flow along one of these paths. Then we find another path, and so on. A path with available capacity is called an augmenting path.
Contents
Algorithm
Let G(V,E) be a graph, and for each edge from u to v, let c(u,v) be the capacity and f(u,v) be the flow. We want to find the maximum flow from the source s to the sink t. After every step in the algorithm the following is maintained:
This means that the flow through the network is a legal flow after each round in the algorithm. We define the residual network G_{f}(V,E_{f}) to be the network with capacity c_{f}(u,v) = c(u,v) − f(u,v) and no flow. Notice that it can happen that a flow from v to u is allowed in the residual network, though disallowed in the original network: if f(u,v) > 0 and c(v,u) = 0 then c_{f}(v,u) = c(v,u) − f(v,u) = f(u,v) > 0.
Algorithm Ford–Fulkerson
The path in step 2 can be found with for example a breadthfirst search or a depthfirst search in G_{f}(V,E_{f}). If you use the former, the algorithm is called Edmonds–Karp.
When no more paths in step 2 can be found, s will not be able to reach t in the residual network. If S is the set of nodes reachable by s in the residual network, then the total capacity in the original network of edges from S to the remainder of V is on the one hand equal to the total flow we found from s to t, and on the other hand serves as an upper bound for all such flows. This proves that the flow we found is maximal. See also Maxflow Mincut theorem.
Full article ▸
