1 / 37

Maximum Flow ( Push-relabel algorithms )

Maximum Flow ( Push-relabel algorithms ). Push-relabel algorithms: O(V 2 E) algorithm Preflow:a function f: satisfies 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 :. Lemma12:

mabyn
Download Presentation

Maximum Flow ( Push-relabel algorithms )

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 (Push-relabel algorithms)

  2. Push-relabel algorithms: O(V2E) algorithm • Preflow:a function f: satisfies • 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:

  3. Lemma12: 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.

  4. The basic operation PUSH(u,v) can be applied if u is an overflowing vertex, cf(u,v)>0, and u.h=v.h+1. • u.e:the execess flow stored at u. • u.h:the height of u. • f(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 u.h=v.h+1. * Action : Push f(u,v)=min(u.e, cf(u,v)) units of flow from u to v. }

  5. lemma13: After a non-saturating push from u to v, the vertex u is no longer overflowing. Pf: Since the push was non-saturating, the amount of flow f (u, v) actually pushed is u.e.

  6. Relabel(u) • The basic operation Relabel(u) applies if u is overflowing and if cf(u,v)>0 implies for all v. • When u is relabeled, must contain at least one edge that leaves u. • there must be at least one vertex v s.t. (v,u).f>0. { * Applies when : u is overflowing and for all implies * Action : Increase the height of u. }

  7. Initialize-Preflow(G,s) { for each vertex for each edge if u=s, otherwise for each vertex and if u=s, otherwise } Generic-Push-Relabel(G) { Initialize-Preflow(G,s) ; While there exists an applicable push or relabel operation. do select an applicable push or relabel operation and perform it; }

  8. Lemma14:(An overflowing vertex can be either pushed or relabeled) 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 relabel op applies to it. • Lemma15: (Vertex height never decrease) During the execution of Generic-Push-Relabel on a flow network G=(V,E), for each the height u.h never decreases. Moreover, whenever a relabel operation is applied to a vertex u, its height u.h increases 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 relabel operation can be applied to u. Proof : Vertex heights change only during relabel ops. If u is about to be relabeled, then  v with this implies so the op must increase u.h.

  9. Lemma16: G=(V,E): a flow network s: source, t:sink During the execution of Generic-Push-Relabel 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 an operation Relabel(u) leaves h a height function. (1) u v The operation Relabel(u) ensures that (2) w u By lemma16, before the op. Relabel(u) implies w.h< u.h+1 afterward. Thus, the operation Relabel(u) leaves h a height function. Consider an operation PUSH(u,v):two possibilities: (1) add the edge (v,u) to Ef:v.h = u.h-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.

  10. 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!

  11. Theorem 18: (Correctness of the generic push-relabel algorithm) If the algorithm Generic-Push-Relabel 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 from s to t in the residual network Gf. By the max-flow-min-cut thm, f is a max flow.

  12. Analysis of the push-relabel method: G,s,t,f:as above. • Lemma 19: For any overflowing vertex x, there is a simple path from x to s in the residual network Gf. Proof : Let U={ v: there exists a simple path from x to v in Gf } By contradiction, assume

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

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

  15. Lemma 22: (Bound on saturating pushes) During the execution of Generic-Push-Relabel on any flow network G=(V,E), the number of saturating pushes is less than 2|V||E| Pf: For any pair u,vV, consider the saturating pushes from u to v and from v to u. If there are any such pushes, at least one of (u, v) and (v, u) is in E. Suppose a saturating push from u to v has occurred. At that time, v.h = u.h-1. In order for another push from u to v later, the algorithm must first push flow from v to u, which cannot happen until v.h =u.h + 1, i.e. v.h must be increased by at least 2. Likewise, u.h must increase by at least 2 between saturating pushes from v to u.

  16. Heights start at 0 and never exceed 2|V|-1. Since at least one of u.h and v.h must increase by 2 between any two saturating pushes between u and v, there are fewer than 2|V| saturating saturating pushes between u and v. Thus there are less than 2|V||E| on the total number of saturating pushes. 

  17. Lemma 23: (Bound on non-saturating pushes) During the execution of Generic-Push-Relabel on any flow network G=(V,E), the number of non-saturating pushes is less than 4|V|2(|V|+|E|) Pf: Define a potential function: = Initially, =0 Relabeling a vertex u increases by at most 2|V|, since the set over which the sum is taken is the same and u cannot be relabeled by more than its maximum possible height. (by lemma 20, it is  2|V|-1) A saturating push from u to v increases by at most 2|V|, because no heights ever change and only vertex v, whose height  2|V| can possibly become overflowing.

  18. A non-saturating push from u to v decreases by at least 1, since u is no longer overflowing after the push, v is overflowing afterward even if it was not beforehand, and v.h = u.h - 1 By corollary 21 and lemma 22, the total amount of increase in   (2|V|)(2|V|2)+(2|V|)(2|V||E|) = 4|V|2(|V|+|E|) since 0, the total amount of decrease  4|V|2(|V|+|E|) Thus, the total number of non-saturating pushes  4|V|2(|V|+|E|) • Thm24: During the execution of Generic-Push-Relabel on any flow network G=(V,E), the number of basic operation is O(V2E) Pf: By Cor. 21, Lemmas 22 and 23. 

  19. The relabel-to-front algorithm: • Admissible network: G=(V,E): a flow network with source s and sink t; f is a preflow in G; h is a height function. (u,v) is an admissible edge if cf(u,v)>0 and h(u)=h(v)+1; otherwise, (u,v) is inadmissible. The admissible network is Gf,h=(V, Ef,h), where Ef,h is the set of admissible edges.

  20. Lemma 26: (The admissible network is acyclic) If G=(V,E) is a flow network, f is a preflow in G, and h is a height function on G, then the admissible network Gf,h=(V, Ef,h) is acyclic. Pf: By contradiction. Suppose Gf,h contains a cycle P=<v0, v1, …, vk>, where v0=vk and k>0. Since each edge in P is admissible, we have h(vi-1) = h(vi)+1 for i=1, …, k  0 = k 

  21. Lemma 27: G=(V,E): flow network ; f: preflow ; h: height function If u is overflowing and (u,v) is an admissible edge, then PUSH(u,v) applies. The operation does not create any new admissible edges, but it may cause (u,v) to become inadmissible. Pf: Since u is overflowing and (u,v) is admissible, the operation PUSH(u,v) applies. The only new residual edge that can be created by pushing flow from u to v is the edge (v,u). Since h(v)=h(u)-1, edge (v,u) cannot become admissible. If the operation is a saturating push, then cf(u,v)=0 afterward and (u,v) becomes inadmissible. 

  22. u … … v • Lemma 28: If u is overflowing and there are no admissible edges leaving u, then RELABEL(u) applies. After the relabel operation, there is at least one admissible edge leaving u, but there are no admissible edges entering u. Pf: If u is overflowing, then by lemma 14, either a push or a relabel operation applies to it. If no admissible edges leaving u, no flow can be pushed from u and RELABEL(u) applies. After the relabel operation u.h = 1+min{v.h: (u,v)Ef}. If v is the one that achieves the minimum, (u,v) becomes admissible. Hence, after the relabel, there is at least one admissible edge leaving u.

  23. u.N v … u.N.head u.current: points to the vertex being considered  (After the relabel) Suppose that there is a vertex v such that (v,u) is admissible. Then v.h = u.h+1 after the relabel, and therefore v.h > u.h+1 just before the relabel. By lemma 12, no residual edges exist between vertices whose heights differ by more than 1. Moreover, relabeling a vertex does not change the residual network. Thus (v,u) is not in the residual network, and hence it cannot be in the admissible network.  • Neighbor lists: v is in u.N if (u, v) or (v, u) is in E. uV:

  24. Discharge an overflowing vertex: DISCHARGE(u) 1. while u.e>0 2. do v = u.current 3. if v == NIL 4. RELABEL(u) 5. u.current = u.N.head 6. elseif cf(u,v)>0 and u.h == v.h+1 7. PUSH(u,v) 8. else u.current = v.next-neighbor

  25. (a) (b)

  26. (c) (d)

  27. (e) (f)

  28. (g)

  29. Lemma 29 If DISCHARGE calls PUSH(u,v) in line 7, then a push operation applies to (u,v). If DISCHARGE calls Relabel(u) in line 4, then a relabel operation applies to u. Pf:  The tests in line 1 and 6 ensure that a push operation occurs only if the operation applies  According to line 1 and Lemma 28, need only to show that all edges leaving u are inadmissible. Each pass in the while loop begins at the head of u.N and finishes with u.current=NIL, at which point u is relabeled and a new pass begins. By Lemma 27 pushes cannot create any admissible edge. Thus, any admissible edge must be created by a relabel operation. But the vertex u is not relabeled during the pass, and by Lemma 28, any other v relabeled during the pass has no entering admissible edges. Thus, at the end of the pass, all edges leaving u remain inadmissible. 

  30. L: a linked list consisting of all vertices in V-{s,t} • Vertices in L are topologically sorted according to the admissible network RELABEL-TO-FRONT(G, s, t) 1. INITIALIZE-PREFLOW(G, s) 2. L = G.V-{s,t}, in any order 3. for each vertex u  G.V-{s,t} 4. u.current = u.N.head 5. u = L.head 6. while uNIL 7. old_height = u.h 8. DISCHARGE(u) 9. if u.h > old_height 10. move u to the front of list L 11. u = u.next

  31. (a) (b)

  32. (c) (d)

  33. (e)

  34. Lemma : If we run RELABEL-TO-FRONT on a flow network G=(V,E) then each iteration of the while loop in lines 6-11 maintains the invariant that list L is a topological sort of the vertices in the admissible network Gf,h=(V, Ef,h) Pf: Right after INITIALIZE-PREFLOW, s.h=|V| and v.h=0 for all vV-{s}. Since |V|2, no edge can be admissible. Thus, Ef,h= and any ordering of V-{s,t} is a topological sort of Ef,h. In each iteration of the while loop, the admissible network is changed only by push and relabel operations. “Push” can only make edges inadmissible “Relabel” can create admissible edges

  35. By Lemma 28, after a vertex u is relabed, there are no admissible edges entering u but there may be admissible edges leaving u. Thus, moving u to the front of L, the algorithm ensures that any admissible edge leaving u satisfy the topological sort ordering. 

  36. L … • Thm30: The running time of RELABEL-TO-FRONT on any flow network G=(V,E) is O(V3). Pf: Consider a phase between 2 consecutive relabel operations. Since there are O(V2) relabel operations, there are O(V2) phases. Each phase consists of at most |V| calls to DISCHARGE • If DISCHARGE does not perform a relabel operation, the next call to DISCHARGE is further down the list L • If DISCHARGE does perform a relabel, the next call to DISCHARGE belongs to a different phase. |V|

  37. Since each phase contains at most |V| calls to DISCHARGE and there are O(V2) phases, DISCHARGE is called O(V3) times in line 8 of RELABEL-TO-FRONT. Total work : O(V3) -- exclude the work done in DISCHARGE • Work done within DISCHARGE:  relabel operation: (line 4-5) Ex. 26.4-3: Performing O(V2) relabels need O(VE) times update u.current pointer: (line 8) This action occurs O(deg(u)) times when a vertex u is relabeled. Overall, O(V deg(u)) times  O(VE) work done push operation: (line 7) Total number of saturating push: O(VE) If a non-saturating push is executed, DISCHARGE returns. u.e = 0 at most one non-saturating push per DISCHARGE call O(V3) DISCHARGE calls  O(V3) non-saturating calls. O(V3+VE) 

More Related