1 / 40

Maximum Flow

Maximum Flow. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity. u. Maximum-flow problem

dannyallen
Download Presentation

Maximum Flow

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Maximum Flow

  2. Maximum Flow A flow network G=(V, E) is a DIRECTED graph where each has a nonnegative capacity u

  3. Maximum-flow problem Given a flow network G with source s and sink t, we wish to find a flow of maximum value from s to t 12 12 v1 v3 11 20 16 15 1 s 10 4 7 t 9 7 4 13 4 v2 v4 8 4 14 11

  4. positive net flow entering a vertex v: Networks with multiple source and sinks: s1 s1 s2 t1 s2 t1  s3 t2 s’ s3 t2 t’ s4 t3 s4 t3 s5 s5

  5. X Y 1 3 • Lemma 1 4 2 X Z Y

  6. Ford-Fulkerson method • Residual networks

  7. Lemma 2 Pf:

  8. Augmenting paths: Given a flow network G=(V,E) and a flow f an augmenting path p is a simple path from s to t in the residual network Gf

  9. Lemma3: • Cor4:

  10. Flow network 12/12 v1 v3 (a) 11/16 15/20 s 10 4 7/7 t 4/9 8/13 4/4 v2 v4 11/14 Residual network 12 v1 v3 (b) 5 5 11 4 15 s 7 t 11 3 5 5 8 4 3 v2 v4 11

  11. Flow network 12/12 v1 v3 (c) 19/20 11/16 s 10 1/4 7/7 t 9 12/13 4/4 v2 v4 11/14 Residual network 12 v1 v3 (d) 5 1 11 19 s 7 t 11 9 3 1 12 4 3 v2 v4 11

  12. 12 v1 v3 (a) 16 20 s 10 4 7 t 9 13 4 v2 v4 14 4/12 v1 v3 4/16 20 s 10 4 7 t 4/9 13 4/4 v2 v4 4/14

  13. 8 (b) v1 v3 12 4 20 4 4 s 10 7 t 4 5 13 4 10 v2 v4 4 4/12 v1 v3 11/16 7/20 s 4 7/10 7/7 t 4/9 13 4/4 v2 v4 11/14

  14. 8 (c) v1 v3 5 4 13 11 4 7 s 3 7 t 11 5 13 4 3 v2 v4 11 12/12 v1 v3 11/16 15/20 s 10 1/4 7/7 t 4/9 8/13 4/4 v2 v4 11/14

  15. 12 (d) v1 v3 5 5 11 4 15 s 3 7 t 3 5 5 13 4 3 v2 v4 11 12/12 v1 v3 11/16 19/20 s 10 1/4 7/7 t 9 12/13 4/4 v2 v4 11/14

  16. 12 v1 v3 (e) 5 1 11 19 s 7 t 11 9 3 1 12 4 3 v2 v4

  17. The basic Ford-Fulkerson algorithm M M s t 1 M M

  18. Edmonds-karp algorithm Implement the computation of the augmenting path p with a breadth-first search. That is the augmenting path is a shortest path from s to t in the residual network, where each edge has unit distance.

  19. Cuts of flow networks • A cut(S,T) of flow network G=(V,E) is a partition of V into S and T=V-S such that • The net flow across the cut(S,T) is defined to be f(S,T). The capacity of the cut(S,T) is c(S,T) • Eg: S T 12 v1 v3 20 16 s 10 4 7 t 9 13 4 v2 v4 14

  20. Lemma 5 Pf:

  21. Cor6 Pf:

  22. Thm7: Pf:

  23. Lemma 8 Pf:

  24. Thm 9 Pf:

  25. There are at most O(E) pairs of vertices that can have an edge between them in a residual graph, the total number of critical edges during the entire execution of the Edmonds-karp algorithm is O(VE). Each awgmenting path has at least on critical edge, and hence the theorem follows. Each interation of Ford-Fulkerson can be impemented in O(E) time, when the owgmenting Path is found by BFS. Total running time of the Edmonds-karp algorithm is O(CE2). Best to date:

  26. Preflow-push algorithms: • Preflow:a function f: satisfies • (1) skew symmetry • (2) capacity constraints • (3) for all vertices • Excess flow into u: • G=(V,E): a flow network with source s and sink t, and let f be a preflow in G. • Height function:

  27. lemma13: Let G=(V,E) be a flow network, f be a preflow in G, and let h be a Height function on V. for any two vertices , if h(u)>h(v)+1, Then (u,v) is not an edge in the residual graph.

  28. The basic operation PUSH(u,v) can be applied if u is an overflowing vertex, cf(u,v)>0, and h(u)=h(v)+1. • e[u]:the execess flow stored at u. • h[u]:the height of u. • df(u,v):the amount of flow can be pushed from u to v. • Saturating push: if (u,v) becomes saturated(cf(u,v)=0 afterward); otherwise, it is a nonsaturating push. PUSH(u,v) { * Applies when : u is overflowing cf[u,v]>0 and h[u]=h[v]+1. * Action : Push df(u,v)=min(e[u],cf(u,v)) units of flow from u to v. }

  29. LIFT(u) • The basic operation LIFT(w) applies if u is overflowing and if cf(u,v)>0 implies for all v. • When u is lifted, Ef must contain at least one edge that leaves u. • E[u]=f[V,u]>0 there must be at least one vertex v s.t. f[v,u]>0. { * Applies when : u is overflowing and for all implies * Action : Increase the height of u. }

  30. Initialize-Preflow(G,s) { for each vertex do for each vertex do if u=s, if v=s, otherwise for each vertex and do if u=s, otherwise } Generic-Preflow-Push(G) { Initialize-Preflow(G,s) ; While there exists an applicable push or lift op. do select an applicable push or lift op and perform it; }

  31. Lemma14:(An overflowing vertex can be either pushed or lifted) Let G=(V,E) be a flow network with source s and sink t, let f be a preflow, and let h be any height function for f. if u is any overflowing vertex, then either a push or lift op applies to it. • Lemma15: (vertex height never decrease) During the execution of Generic-Perflow-Push on a flow network G=(V,E), for each the height h[u] never decreases. Moreover, whenever a lift operation is applied to a vertex u, its height h[u] increase by at least 1. Proof : For any residual edge (u,v) we have because h is a height function. If a push operation does not apply to u, then for all residual edges (u,v), we must have h(u)<h(v)+1, which implies Thus, a lift operation can be applied to u. Proof : Note that vertex heights change only during lift operations. If u is lifted, then for all v with this implies so the op must increase h[u].

  32. Lemma16: G=(V,E): a flow network S:source t:sink During the execution of Generic-Preflow-Push on G, the attribute h is maintained as a height function. Proof : By induction on the number of basic operations performed. Initially, h is a height function. Claim:if h is a height function, then a operation LIFT(u) leaves h a height function. (1) u v The operation LIFT(u) ensures that (2) w u By lemma15, before the op. LIFT(u) implies h[w]<h[v]+1 afterward. Thus, the operation LIFT(u) leaves h a height function. Consider an operation PUSH(u,v):two possibilities: (1) add the edge (v,u) to Ef:h[v]=h[u]-1, so h remains a height function. (2) Remove (u,v) from Ef: The removal of (u,v) from the residual network removes the corresponding constraint, and h remains a height function.

  33. Lemma17: G=(V,E): flow network ; S:source ; t:sink ; f:preflow in G ; h: height function on V. Thus, there is no path from the source s to the sink t in the residual network Gf. Proof : By contradiction, assume there is a path p=<v0=s,v1,…,vk=t> from s to t in Gf. Assume p is a simple path, then For i=0,1,…,k-1, edge Because h is a height function, for i=0,1,…,k-1. + ) =0 But in a height function. Thus, there is no such path!

  34. Lemma18: (correctness of the generic preflow-push algorithm) If the algorithm Generic-Preflow-Push terminates when run on a flow network G=(V,E) with source s and sink t, then the preflow f it computes is a maximum flow for G. Proof : If the generic algorithm terminates, then each vertex in V-{s,t} must have an excess of 0, by lemma14 and lemma16 and the invariant that f is always a preflow, there are no overflowing vertices. Therefore, f is a flow. Because h is a height function, by lemma17, there is no path form s to t in the residual network Gf. By the max-flow-min-Cut thm, f is a max flow.

  35. Analysis of the preflow-push method: G,s,t,f:as above. • Lemma19: For any overflowing vertex u, there is a simple path from u to s in the residual network Gf. Proof : Let U={ v: there exists a simple path from u to u in Gf } By contradiction, assume Claim: For each pair If f(w,v)>0, then f(v,w)<0, which implies that cf(v,w)=c(v,w)-f(v,w)>0.

  36. Lemma20: G=(V,E), s,t. At any time during the execution of Generic-Preflow-Push on G, we have Proof : Height of s and t never change, s,t never overflow by def. Thus, A vertex is lifted only when if is overflowing. Consider any overflowing vertex By lemma19, there is a simple path from u to s in Gf. Let p=<v0=s,v1,…,vk=t>, and p is simple. For i=0,1,…,k-1, we have

  37. Corollary21: (Bound on lift operations) During the execution of Generic-Preflow-Push on G, the number of lift operations is at most per vertex and at most Proof : Only V-{s,t,} can be lifted. Let . The op. LIFT(u) increases h[u]. The value of h[u] is initially 0. By lemma20, each is lifted at most times. Thus, the total number of lift operations performed is at most

More Related