Presentation is loading. Please wait.

Presentation is loading. Please wait.

3.4 Push-Relabel(Preflow-Push) Maximum Flow Alg.

Similar presentations


Presentation on theme: "3.4 Push-Relabel(Preflow-Push) Maximum Flow Alg."β€” Presentation transcript:

1 3.4 Push-Relabel(Preflow-Push) Maximum Flow Alg.
Algorithm that allows 𝑓π‘₯(𝑣)>0 (conservation of flow not maintained) before completion. For ease of exposition, take (i) 𝑒𝑀𝑣=π‘₯𝑀𝑣=0 if π‘£π‘€βˆˆπΈ and π‘€π‘£βˆ‰πΈ (conceptual device, don’t make actual arc) (ii) Define auxiliary digraph 𝐺(π‘₯) as before, but do not bother with parallel arcs, i. e., we put π‘£π‘€βˆˆπΈ(𝐺(π‘₯)) iff π‘₯𝑀𝑣>0 or π‘₯𝑣𝑀<𝑒𝑣𝑀. If π‘£π‘€βˆˆπΈ(𝐺(π‘₯)), up to 𝑒 𝑣𝑀 =π‘’π‘£π‘€βˆ’π‘₯𝑣𝑀+π‘₯𝑀𝑣 can be β€œpushed” from 𝑣 to 𝑀 (residual capacity of 𝑣𝑀) (increase π‘₯𝑣𝑀 to 𝑒𝑣𝑀 and decrease π‘₯𝑀𝑣 to 0 ) Combinatorial Optimization 2016

2 We call π‘₯ a preflow if it satisfies 𝑓π‘₯(𝑣)β‰₯0 for all π‘₯βˆˆπ‘‰βˆ–{π‘Ÿ, 𝑠}
Definitions: We call π‘₯ a preflow if it satisfies 𝑓π‘₯(𝑣)β‰₯0 for all π‘₯βˆˆπ‘‰βˆ–{π‘Ÿ, 𝑠} feasible preflow if it also satisfies 0≀π‘₯≀𝑒 push on 𝑣𝑀 : For pair (𝑣, 𝑀) with 𝑒 𝑣𝑀 >0 and 𝑓π‘₯(𝑣)>0, pushing up to ο₯ = min ( 𝑒 𝑣𝑀 , 𝑓π‘₯(𝑣)) from 𝑣 to 𝑀. (it produces new feasible preflow ) (If both 𝑣𝑀 and 𝑀𝑣 are arcs of 𝐺 and ο₯< 𝑒 𝑣𝑀 , we decrease π‘₯𝑀𝑣 first as much as possible, then increase π‘₯𝑣𝑀 ) (pushing 2 units on ab) π‘Ž π‘Ž 3,3 4,0 3,3 4,0 π‘Ÿ 4,1 1,0 𝑠 π‘Ÿ 4,0 1,1 𝑠 4,4 2,1 4,4 2,1 𝑏 𝑏 Combinatorial Optimization 2016

3 We call π‘£βˆˆπ‘‰βˆ–{π‘Ÿ, 𝑠} active if 𝑓π‘₯(𝑣)>0 (has positive net flow) Idea:
Definitions: We call π‘£βˆˆπ‘‰βˆ–{π‘Ÿ, 𝑠} active if 𝑓π‘₯(𝑣)>0 (has positive net flow) Idea: choose an active node and push flow toward sink. difficulties order of selection pushing on 𝑣𝑀, then 𝑀𝑣, ... causes infinite loop. Possible to have situation that we cannot push toward sink, but there are still active nodes. retreat to restore conservation of flow to identify the direction of push, use estimate of distances to 𝑠 in 𝐺(π‘₯). Combinatorial Optimization 2016

4 for every arc 𝑣𝑀 of 𝐺(π‘₯), 𝑑(𝑣)≀𝑑(𝑀)+1
We say vector π‘‘βˆˆ( 𝑍 + βˆͺ{∞})𝑉 is a valid labelling with respect to a preflow π‘₯ if 𝑑(π‘Ÿ)=𝑛, 𝑑(𝑠)=0 (3.14) for every arc 𝑣𝑀 of 𝐺(π‘₯), 𝑑(𝑣)≀𝑑(𝑀)+1 (Recall that 𝑑π‘₯(𝑣, 𝑀) denotes the number of arcs in a shortest (𝑣, 𝑀) dipath in 𝐺(π‘₯). 𝑑(𝑣)= 𝑑 π‘₯ (𝑣, 𝑠) satisfies all conditions except 𝑑(π‘Ÿ)=𝑛.) (Note that βˆƒ π‘˜, 0<π‘˜<𝑛 such that 𝑑(𝑣)β‰ π‘˜ for all π‘£βˆˆπ‘‰.) Valid labelling gives an estimate of the shortest distance of the node 𝑣 to 𝑠 in 𝐺(π‘₯). Given an active node 𝑣, we try to push excess flow to the node closer to 𝑠 using the valid label as estimate. However, valid labelling may not exist for some feasible preflow. So, start with some feasible preflow and valid labelling which we can easily identify and maintain the validity of labelling. Combinatorial Optimization 2016

5 Put π‘₯𝑒=𝑒𝑒 for all arcs 𝑒 having tail π‘Ÿ π‘₯𝑒=0 for all other arcs π‘’βˆˆπΈ
Constructing initial feas. preflow and valid labelling (initialize π‘₯, 𝑑) Put π‘₯𝑒=𝑒𝑒 for all arcs 𝑒 having tail π‘Ÿ π‘₯𝑒=0 for all other arcs π‘’βˆˆπΈ Put 𝑑(π‘Ÿ)=𝑛, 𝑑(𝑣)=0 for all other nodes π‘£βˆˆπ‘‰ (Assume each π‘’π‘Ÿπ‘£ β‰ βˆž (HW)) (1,0) 𝑝 π‘Ž (Initialize π‘₯, 𝑑) (1,0) (1,1) (1,0) (3,0) (3,0) π‘Ÿ 𝑠 6 (4,4) (4,0) (1,0) π‘ž 𝑏 (1,0) Combinatorial Optimization 2016

6 (feasible preflow and valid labelling saturates a cut)
Prop 3.22: If π‘₯ is a feasible preflow and 𝑑 is a valid labelling for π‘₯, then there exists an (π‘Ÿ, 𝑠)-cut (𝑅) such that π‘₯𝑣𝑀=𝑒𝑣𝑀 for all π‘£π‘€βˆˆο€(𝑅) and π‘₯𝑣𝑀=0 for all π‘£π‘€βˆˆο€( 𝑅 ). (feasible preflow and valid labelling saturates a cut) (pf) There exists π‘˜, 0<π‘˜<𝑛, such that 𝑑(𝑣)β‰ π‘˜ for all π‘£βˆˆπ‘‰. Take 𝑅={π‘£βˆˆπ‘‰: 𝑑(𝑣)>π‘˜}. Then π‘Ÿβˆˆπ‘… and π‘ βˆ‰π‘…. (3.14) implies that no arc of 𝐺(π‘₯) leaves 𝑅.  Cor 3.23: If a feasible flow π‘₯ has a valid labelling, then π‘₯ is a maximum flow. Consider the duality relation with augmenting path algorithm. (Augmenting path alg. Maintains feasible flows and stops when a saturated cut is found, while push-relabel alg. maintains saturated cuts and stops when the flow becomes feasible.) In what sense a valid labelling gives an approximation to distances in 𝐺(π‘₯)? Lemma 3.24: For any feasible preflow π‘₯, and any valid labelling 𝑑 for π‘₯, we have 𝑑π‘₯(𝑣,𝑀)β‰₯𝑑 𝑣 βˆ’π‘‘(𝑀), for all 𝑣, π‘€βˆˆπ‘‰. (pf) If 𝑑π‘₯(𝑣, 𝑀)=∞, true. So suppose 𝑑π‘₯(𝑣, 𝑀) finite. Consider any shortest (𝑣, 𝑀) dipath in 𝐺(π‘₯). Add inequality 𝑑(𝑝)βˆ’π‘‘(π‘ž)≀1 on the arcs π‘π‘ž on the dipath.  Combinatorial Optimization 2016

7 𝑑(𝑣) is a lower bound on 𝑑π‘₯(𝑣, 𝑠) 𝑑 𝑣 βˆ’π‘› is a lower bound on 𝑑π‘₯(𝑣, π‘Ÿ)
Observations: 𝑑(𝑣) is a lower bound on 𝑑π‘₯(𝑣, 𝑠) 𝑑 𝑣 βˆ’π‘› is a lower bound on 𝑑π‘₯(𝑣, π‘Ÿ) If 𝑑(𝑣)β‰₯𝑛, it means 𝑑π‘₯(𝑣, 𝑠)=∞, and excess flow at 𝑣 should be moved toward the source π‘Ÿ. Think 𝑑(𝑣) as height of node 𝑣 in a liquid flowing network using gravity. At a node with excess flow, we try to move flow toward nodes 𝑀 having 𝑑(𝑀)<𝑑(𝑣). 𝑑(𝑀)<𝑑(𝑣) and 𝑣𝑀 is an arc of 𝐺(π‘₯) β‡’ 𝑑 𝑀 =𝑑 𝑣 βˆ’1 (We have 𝑑(𝑣)≀𝑑(𝑀)+1 for a valid labelling) β‡’ push the preflow only on the arc 𝑣𝑀 in 𝐺(π‘₯) with 𝑑(𝑣)=𝑑(𝑀)+1. (admissible arc) Note that push does not affect the validity of the labelling (a possible new arc 𝑀𝑣 in 𝐺(π‘₯) satisfies 𝑑(𝑀)≀𝑑(𝑣)+1.) If 𝑣 active, but no 𝑣𝑀 in 𝐺(π‘₯) with 𝑑(𝑣)=𝑑(𝑀)+1 β‡’ increase 𝑑(𝑣) to min (𝑑(𝑀)+1: π‘£π‘€βˆˆπΈ(𝐺(π‘₯)) (labelling still valid) ; relabel Combinatorial Optimization 2016

8 Push-Relabel Algorithm
Process 𝒗 While there exists an admissible arc 𝑣𝑀 Push on 𝑣𝑀; If 𝑣 is active Relabel 𝑣. Push-Relabel Algorithm Initialize π‘₯, 𝑑; While π‘₯ is not a flow Choose an active node 𝑣; Process 𝑣. Combinatorial Optimization 2016

9 Modification on basic form:
Maximum distance push-relabel algorithm - Choose active node 𝑣 whose distance label 𝑑(𝑣) is maximum. Bounds on the number of operations Thm 3.25: Push-relabel algorithm performs 𝑂( 𝑛 2 ) relabels and 𝑂(π‘š 𝑛 2 ) pushes. Thm 3.26: The maximum distance push-relabel algorithm performs 𝑂( 𝑛 2 ) relabels and 𝑂( 𝑛 3 ) pushes. Lemma 3.27: If π‘₯ is a preflow and 𝑀 is an active node, then there is a 𝑀,π‘Ÿ -dipath in 𝐺(π‘₯). (pf) Let 𝑅 denote the set of nodes 𝑣 for which there is a (𝑣,π‘Ÿ)-dipath in 𝐺(π‘₯). Then no arc leaves 𝑅 in 𝐺(π‘₯), so π‘₯ 𝛿 𝑅 =0. But suppose that we add the inequalities 𝑓 π‘₯ (𝑣)β‰₯0 for all π‘£βˆˆ 𝑅 . Then, we get π‘₯ 𝛿 𝑅 βˆ’π‘₯(𝛿 𝑅 )β‰₯0. With π‘₯ 𝛿 𝑅 =0, this implies π‘₯ 𝛿 𝑅 =0, hence have 𝑓 π‘₯ 𝑣 =0 for all π‘£βˆˆ 𝑅 . That is there is no active node in 𝑅 , so active π‘€βˆˆπ‘…, as required.  Combinatorial Optimization 2016

10 (2) nonsaturating push: 𝑣 is no longer active: 𝑂(π‘šπ‘›2)
Lemma 3.28: At every stage of the push-relabel algorithm, for every π‘£βˆˆπ‘‰, we have 𝑑 𝑣 ≀2π‘›βˆ’1. Each node is relabelled at most 2π‘›βˆ’1 times, and there are 𝑂( 𝑛 2 ) relabels in all. (pf) Since each relabel of 𝑣 increases 𝑑(𝑣) by at least 1, the second statement follows from the first. Since only active nodes are relabelled, enough to prove the first statement for 𝑣 active. By Lemma 3.27, 𝑑 π‘₯ 𝑣,π‘Ÿ β‰€π‘›βˆ’1. By Lemma 3.24, 𝑑 π‘₯ 𝑣,π‘Ÿ β‰₯𝑑 𝑣 βˆ’π‘›. Combining these two inequalities gives 𝑑 𝑣 ≀2π‘›βˆ’1.  Pushes: (1) saturating push : 𝑒 𝑣𝑀 ≀𝑓π‘₯(𝑣), value pushed is 𝑒 𝑣𝑀 , 𝑣𝑀 leaves 𝐺(π‘₯): ≀2π‘šπ‘› (2) nonsaturating push: 𝑣 is no longer active: 𝑂(π‘šπ‘›2) β‡’ total 𝑂(π‘šπ‘›2) pushes (Pf): reading assignment Combinatorial Optimization 2016

11 Lemma 3.31: The maximum distance push-relabel algorithm performs 𝑂(𝑛3) nonsaturating pushes. (β‡’ total 𝑂(𝑛3) pushes) (pf) Any nonsaturating push from a node 𝑣 makes 𝑣 inactive, and 𝑣 cannot become active again before there is a relabel, since all active nodes 𝑀 has 𝑑(𝑀)≀𝑑(𝑣). Hence, if there are 𝑛 nonsaturating pushes with no relabel, there is no active node and the algorithm terminates. Therefore, the number of nonsaturating pushes is less than 𝑛 times the number of relabels, so by Lemma 3.28, it is 𝑂( 𝑛 3 ).  Tuncel(1994): max distance push-relabel algorithm requires only 𝑂 𝑛 2 π‘š pushes. Combinatorial Optimization 2016

12 (Implementation of Push-Relabel Algorithms)
For each 𝑣, we keep list 𝐿𝑣 of pairs 𝑣𝑀 such that 𝑣𝑀 or 𝑀𝑣 (or both) is an arc of 𝐺 (possible arcs in 𝐺(π‘₯)) For each 𝑣𝑀 in 𝐿𝑣, keep 𝑒 𝑣𝑀 . Keep links between π‘£π‘€βˆˆπΏπ‘£ and π‘€π‘£βˆˆπΏπ‘€ (update residual capacity on 𝑣𝑀 and 𝑀𝑣 in constant time) For each 𝑣, keep 𝑑(𝑣) and 𝑓π‘₯(𝑣) Each relabel of node 𝑣 takes 𝑂 𝐿𝑣 : Each push on 𝑣𝑀 takes constant time once the arc is selected for push. Total time looking for admissible arcs and determining whether it is time to relabel? Combinatorial Optimization 2016

13 Lemma 3.32: Suppose π‘£βˆˆπ‘‰ is active and arc 𝑣𝑀 is not admissible.
Then before 𝑣𝑀 becomes admissible, there will be a relabel of 𝑣. (pf) If 𝑣𝑀 not admissible, then (1) 𝑑(𝑣)≀𝑑(𝑀) or (2) 𝑒 𝑣𝑀 =0. In the case of (2), need push on 𝑀𝑣 before 𝑣𝑀 becomes admissible, which needs 𝑑(𝑀)=𝑑(𝑣)+1, i.e. 𝑑(𝑣)≀𝑑(𝑀). Hence need relabel of 𝑣 before 𝑣𝑀 becomes admissible.  Processing of 𝑣 results in (1) relabelling of 𝑣 or (2) push that makes 𝑣 inactive. If case (2), when we process node 𝑣 again, we do not need to push on the arcs that became inadmissible earlier by Lemma 3.32. Hence, remember the current element of 𝐿𝑣 where we stopped scanning, and start from that point when we process node 𝑣 again. β‡’ relabel node 𝑣 when and only when a traversal of 𝐿𝑣 is completed. Combinatorial Optimization 2016

14 => Total time spent looking for admissible arcs is
𝑣 can be relabeled at most 2π‘›βˆ’1 times (Lemma 3.28), hence only need 𝑂(𝑛) traversal of 𝐿𝑣. => Total time spent looking for admissible arcs is 𝑂(Ξ£(𝑛| 𝐿 𝑣 |: π‘£βˆˆπ‘‰))=𝑂(π‘›π‘š) Total time spent on relabel is the same, since each relabel of 𝑣 takes 𝑂(|𝐿𝑣|). Let 𝑁 be the number of pushes. Total time spent on choosing the next active node is 𝑂(𝑁+𝑛2) since each one leads to a push or a relabel. (For general algorithm, maintain list of active nodes) Total time for general algorithm is 𝑂(𝑛2π‘š) Combinatorial Optimization 2016

15 For maximum distance push-relabel algorithm, not sure if choosing the next active node can be done in constant time. (may need 𝑂(𝑛) if we use list) Maintain doubly linked list π·π‘˜ for the (active) nodes 𝑣 s.t. 𝑑(𝑣)=π‘˜. Also maintain pointer for node 𝑣 to its position in π·π‘˜. If a node is relabelled, we remove it from its list and insert it into its new list. If we use max distance rule, after 𝑣 is relabeled, it still has max distance. If 𝑣 becomes inactive and π·π‘˜ empty, there almost always exists 𝑀 with 𝑑(𝑀)=π‘˜βˆ’1 and active (unless 𝑀=π‘Ÿ), so can look at 𝐷 π‘˜βˆ’1 . Some abnomalities can be handled with bounds. Thm 3.34: Maximum distance push-relabel max flow algorithm can be implemented to run in time 𝑂(𝑛3). Practical enhancement: Periodically (say, after a sequence of 𝑛/2 node processing steps) compute a largest valid labeling for the current preflow. Combinatorial Optimization 2016


Download ppt "3.4 Push-Relabel(Preflow-Push) Maximum Flow Alg."

Similar presentations


Ads by Google