Ford-Fulkerson Algorithm
A digraph G = (V,E), with an integer-valued function c (capacity function) define on its edges is called a capacitated network. Two distinguished vertices exist. The first, vertex s has in-degree 0 is called the source and the second, vertex t has out-degree 0 is called the sink. The capacity of edge (i,j) is c(i,j) 0.
4
27
12 12
15
s= 1
24
t=6
6
2
6
3
12
A flow in the network is an integer-valued function f defined on the edges of G satisfying 0 f(i,j) c(i,j) for every edge (i,j) in E. Conservation Condition For every vertex j in V, where j is not the source s or the sink t, the sum of the flow into j equals the sum of the flow out of j. A flow that satisfies the conservation condition is called a feasible flow. Let f be a feasible flow in a network G. The flow of the network, denoted by f(G) is the sum of flows coming out of the source s. The Ford-Fulkerson algorithm determines the maximum flow of the network. Let f be a feasible flow in G. Edge (i,j) is said to be a) saturated if f(i,j) = c(i,j) b) free if f(i,j) = 0 c) positive if 0 < f(i,j) < c(i,j). An augmenting path is an alternating sequence of vertices and edges of the form s, e1, v1, e2, v2, , ek, t in which no vertex is repeated and no forward edge is saturated and no backward edge is free.
The residual capacity (rc) of an edge (i,j) equals c(i,j) f(i,j) when (i,j) is a forward edge, and equals f(i,j) when (i,j) is a backward edge.
flow/cap
Forward edge j
i i
rc flow
j Backward edge j
flow/cap
i i
flow rc
Example: Augmenting Path
s
5
3/8
6/7
2/6
4/9
t
4
The excess flow capacity of an augmenting path equals the minimum of the residual capacities of each edge in the path. We can increase the flow in the path from s to t in the above diagram by determining the excess flow capacity of this path. From left to right the residual capacities (the amount flow can be increased on the edge) are the first number on each edge. minimum(5, 1, 2, 5) = 1
Saturated edge
Theorem: A flow in a capacitated network is a maximum flow if and only if there is no augmenting path in the network.
X 4 s 6 Z 4
3 5
W 5 t Y 4
0 4
3 5
5 0 0 0
s
6 0
Augmenting path: s->X->W->t Excess capacity of s->X->W->t
= min(4, 3, 5) = 3
3 1
0 5
2 3 0 0
s
6 0
Augmenting path: s->X->t Excess capacity of s->X->t
= min(1, 5) = 1
4 0
0 4
2 3 1 0
s
6 0
Augmenting path: s->Z->Y->t Excess capacity of s->Z->Y->t = min(6, 4, 4) = 4
4 0
0 4
2 3 1 4
s
2 4
At this point, there are no remaining augmenting paths! Therefore the flow is a maximum = 8.
X
4/4
3/3
W
3/5 1/5
s
4/6
t Z
4/4 4/4