150 likes | 316 Views
Network Flows. Source vertex s no incoming edges Sink vertex t no out-going edges Each edge e has integer capacity c ( e ) A flow f assigns a value to every edge such that f ( e ) c ( e ) for every edge e f in ( v ) = f out ( v ) for every vertex v s , t.
E N D
Network Flows • Source vertex s • no incoming edges • Sink vertex t • no out-going edges • Each edge e has integer capacity c(e) • A flowf assigns a value to every edge such that • f(e) c(e) for every edge e • fin(v) = fout(v) for every vertex v s, t
Maximum flow algorithm: attempt 1 Begin with f(e) = 0 for every edge e Find some s-t path P in G with f(e) c(e) for every e P Augment flow along this path Repeat augmentation for as long as possible • Residual graph Gf • same vertex set • two kinds of edges: • forward • backward
Attempt 2: Ford-Fulkerson • Question: why does this terminate? • need some notion of “progress” in each iteration • The flow is constantly increasing! • and it can’t get bigger than C = out-edges e from sc(e) Begin with f(e) = 0 for every edge e Find some s-t path P in Gf with f(e) c(e) for every e P Augment flow along this path and construct new Gf Repeat augmentation for as long as possible
Ford-Fulkerson: running time analysis • Lemma 1: Integer capacities integer flow-values • Lemma 2: Augmentation always increases flow • Hence each augmentation increases flow-value by 1 • Flow-value C, so there are at most C iterations • Within each iteration: • find an s-t path in Gf • augment flow along that path • update Gf
Proof of Lemma 1 • Lemma 1: At every stage in the Ford-Fulkerson algorithm, the flow values f(e) and the residual capacities in Gf are integers • Induction on number of iterations • Base case: • Inductive step: After the jthiteration, all residual capacities are integers Hence, the bottleneck edge in the augmentation has integer value Hence, after the j+1thiteration, the new flow and residual capacities are integers
Proof of Lemma 2 • Lemma 2: Let f be a flow and let f’ be the flow after one augmentation. Then v(f) v(f’) • Proof: Let P be an augmenting path So P is a simple s-t path Its first edge e leaves s Note that e must be a forward edge P is simple, so it never returns to s Thus, the flow-value increases by the additional flow on edge e
Proving optimality: cuts and flows • We noted that for any flow f, v(f) C = out-edges e from sc(e) • More generally: v(f) total capacity of any s-tcut • An s-t cut is a partition (A,B) of the vertex set such that s A, t B • Capacity of cut (A,B) is c(A,B) = out-edges e from Ac(e)
Optimality of Ford-Fulkerson • Lemma 3: If f is a flow and (A,B) is any s-t cut, then v(f) = fout(A) fin(A) c(A,B) • Claim: When F-F terminates, v(f) = c(A*,B*) for some s-t cut (A*,B*) • Proof: F-F terminates when there is no s-t path in Gf Let A* = vertices reachable from s in Gf and B* = everything else (A*,B*) is an s-t cut, so v(f) = fout(A*) fin(A*)
Proof of Lemma 3 • Lemma 3: If f is a flow and (A,B) is any s-t cut, then v(f) = fout(A) fin(A) c(A,B) • Proof: v(f) = fout(s) = fout(s) fin(s) = v Afout(v) fin(v) = fout(A) fin(A) c(A,B)
Max-Flow Min-Cut Theorem • Theorem: For any network G, the value of the maximum flow is equal to the capacity of the minimum s-t cut • Ford-Fulkerson can be used to find the minimum s-t cut in O(mC) time • pseudo-polynomial • Can actually be achieved:
Suggestions? • Suggestion 1: pick an s-t path with maximum bottleneck capacity • how can we find such a path? • Suggestion 2: pick a shortest s-t path • Edmonds-Karp, Dinitz: O(m2n) • improved to O(mn log n) or O(n3) • Modified suggestion 1: pick an s-t path with large bottleneck capacity, i.e. capacity • Idea: Gf() = sub-graph of Gf such that every edge has capacity • s-t path in Gf() increases flow by at least • if no s-t path exists, = / 2
Capacity Scaling Algorithm • When = 1, Gf() = Gf ; so algorithm terminates with max-flow f • Outer while-loop runs at most log C + 1 times • Each augmentation increases flow by at least Begin with f(e) = 0 for every edge e = largest power of 2 smaller than maximum capacity edge in G while 1 while some s-t path P in Gf() exists augment flow along this path and construct new Gf() = / 2
Cuts and flows in Gf() • Lemma 4: Let f be such that Gf() does not have an s-t path. Then the maximum flow is at most v(f) + m • Proof: We will show that there is an s-t cut (A,B) of capacity v(f) + m Let A = vertices reachable from s in Gf() and B = everything else So (A,B) is an s-t cut v(f) = fout(A) fin(A) e out of A [ c(e) ] e into of A = c(A,B) e out of and into A c(A,B) m
Analysis of Capacity Scaling Algorithm • Lemma 5: The inner while-loop executes at most 2m times • Proof: Let f be the flow after the previous iteration, i.e. with scaling = 2 If f* is a max-flow, then v(f*) v(f) + m.(2) Each augmentation in the current phase increases flow by Hence, there are at most 2m augmentations • Running time: Outer loop: log C + 1 times, inner loop: O(m) times Loop body: O(m) • Total running time: O(m2 log C)
Upcoming Talk Chandra Chekuri Algorithms for Multi-commodity Flow Problems in Routing and Network Design March 12 (Monday), 2007 at 4:00 p.m. 1404 Siebel