Upload
hangoc
View
213
Download
0
Embed Size (px)
Citation preview
Ford-Fulkerson with shortest paths (Edmonds-Karp)
Recall that in class we stated the following theorem of Edmonds and Karp (where G = (V,E)is the graph (network), n = |V (G)| and m = |E(G)|.
Theorem 1 If the Ford-Fulkerson algorithm for finding a maximum-flow is run by selecting ineach iteration a shortest path from s to t in the residual graph Gf , then the number of iterations ofthe algorithm is at most n ·m.
Since finding a shortest path can be done in time O(n + m) (by performing a Breadth First Search(BFS)), and m = Ω(n) (since we assumed that every vertex is on some path from s to t or else itcan be removed), we get a total running time of O(nm2).The theorem will follow from the next claim (recall that for an augmenting path P in Gf , an arc(u, v) on the path is a bottleneck arc, if (u, v) has a minimum residual capacity cf (u, v) among allarcs on the path P ).
Claim 2 For each pair (u, v) such that either (u, v) ∈ E(G) or (v, u) ∈ E(G), the number of timesthat (u, v) is a bottleneck arc in the path found by the algorithm (i.e, cf (u, v) equals the minimalresidual capacity of an arc on the path in Gf ), is at most n/2.
We first establish the theorem based on the claim, and then prove the claim.Proof of Theorem 1: In each iteration of the algorithm, at least one pair (u, v) is a bottleneckarc on the path found by the algorithm in Gf . Since by Claim 2 a pair (u, v) can become abottleneck arc at most n/2 times, and there are at most 2m such pairs, there are at most nmiterations.Claim 2 is proved using the next claim.
Claim 3 If we denote the distance from s to v in Gf at the start of the jth iteration of the algorithmby dj(v), then dj+1(v) ≥ dj(v) for every vertex v and iteration j.
The proof of the claim is left as a homework exercise. The intuition is the following. Consider theresidual graph Gf at the start of the jth iteration. Suppose we partition the vertices into levelsaccording to their distance from s. Namely, Li consists of those vertices at distance i from s (whereL0 = s). The first observation is that if P = (u0 = s, u1, . . . , u` = t) is the path selected by thealgorithm, then ui ∈ Li for each 0 ≤ i ≤ `. Let f ′ be the flow after augmenting the flow f usingthe path P so that Gf ′ is the residual graph at the start of iteration j + 1. What is the differencebetween Gf and Gf ′? For each arc (ui, ui+1) on the path P , if (ui, ui+1) was not a bottleneck arc,then it also appears in Gf ′ . On the other hand, if (ui, ui+1) was a bottleneck arc, then (ui, ui+1)
1
does not appear in Gf ′ . In both cases possibly (ui+1, ui) is added to Gf ′ (in case f(ui, ui+1) = 0and c(ui+1, ui) = 0, since f ′(ui, ui+1) > 0 so that cf ′(ui+1, ui) > 0). Thus, intuitively, a vertexcannot get closer to s in this process, and this can be formalized by an inductive argument or byassuming the claim does not hold and reaching a contradiction.It is now left to prove Claim 2.
Proof of Claim 2: Recall that if (u, v) is a bottleneck arc in Gf in iteration j, then it is removedfrom the residual graph, since its residual capacity goes down to 0. In order for it to become abottleneck arc again it is necessary that its residual capacity increase above 0, so that it is addedback to the residual graph. This is possible only if (v, u) is part of the augmenting path selectedin some iteration j′ > j. Since the algorithm selects shortest paths, we have that
dj(v) = dj(u) + 1 and dj′(u) = dj′(v) + 1
By Claim 3,dj′(v) ≥ dj(v) ,
and therefore,dj′(u) = dj(u) + 2 .
That is, each time (u, v) reappears in the residual graph (which is a pre-requisite for it to becomea bottleneck arc), the distance from s to v is increased by at least 2. The claim follows since thisdistance can increase to at most n−1, or at some point u becomes unreachable from s (the distancefrom s to v is ∞), and it cannot become reachable again (since the distance cannot decrease).
2