1 / 124

Maximum flow: The preflow/push method of Goldberg and Tarjan (87)

Maximum flow: The preflow/push method of Goldberg and Tarjan (87). Definitions. G=(V,E) is a directed graph capacity u( v,w ) for every v,w V: If ( v,w )  E then u( v,w ) = 0 Two distinguished vertices s and t. s. 3. 4. 1. a. b. 3. 3. 2. c. d. 4. 3. t. Definitions (cont).

felice
Download Presentation

Maximum flow: The preflow/push method of Goldberg and Tarjan (87)

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: The preflow/push method of Goldberg and Tarjan (87)

  2. Definitions • G=(V,E) is a directed graph • capacity u(v,w) for every v,wV: If (v,w)  E then u(v,w) = 0 • Two distinguished vertices s and t. s 3 4 1 a b 3 3 2 c d 4 3 t

  3. Definitions (cont) • A flow is a function on the edges which satisfies the following requirements • f(v,w) = -f(w,v) skew symmetry • f(v,w)  u(v,w) • For every v except s and t wf(v,w) = 0 The value of the flow |f| = wf(s,w) The maxflow problem is to find f with maximum value

  4. Flows and s-t cuts Let (X,X’) be a cut such that s X, t X’. s t Flow is the same across any cut: f(X,X’) = f(v,w) = f(v,w) - f(v,w) = |f| - 0 = |f| v X, w  X v X, w  X’ v X, w  V so |f|  cap(X,X’) = u(v,w) The value of the maximum flow is smaller than the minimum capacity of a cut.

  5. More definitions The residual capacity of a flow is a function r on the edges such that r(v,w) = u(v,w) - f(v,w) a 2, 1 d Interpretation: We can push r(v,w) more flow from v to w by increasing f(v,w) and decreasing f(w,v)

  6. More definitions (cont) We define the residual graph R on V such that there is an arc from v to w with capacity r(v,w) for every v and w such that r(v,w) > 0 An augmenting path p  R is a path from s to t in R r(p) = min r(v,w) (v,w)  p We can increase the flow by r(p)

  7. Example 1 4 1 3 3 3 3 1 1 1 3 1 3 1 2 2 1 2 2 2 1 3 3 3 3 4 1 The residual network A flow

  8. Basic theorem (1) f is max flow <==> (2) There is no augmenting path in R <==> (3) |f| = cap(X,X’) for some X Proof. (3) ==> (1), (1) ==> (2) obvious To prove (2) ==>(3) let X be all vertices reachable from s in R. By assumption t  X. So (X,X’) is an s-t cut. Since there is no edge from X to X’ in R |f| = f(X,X’) = f(v,w) = u(v,w) = cap(X,X’)

  9. Augmenting path methods Repeat the following step: Find an augmenting path in R, increase the flow, update R Stop when s and t are disconnected in R. Need to be careful about how you choose those augmenting paths ! The best algorithm in this family is Dinic’s algorithm, that can be implemented in O(nmlog(n)) time

  10. But we’ll go for the preflow/push method

  11. Distance labels • Defined with respect to residual capacities • d(t) = 0, d(s) = n • d(v) ≤ d(w) + 1 if r(v,w) > 0

  12. Example (distance labels) 1 3 3 3 4 1 3 1 1 1 3 1 3 1 2 2 1 2 2 2 1 3 3 3 3 4 1 The residual network A flow

  13. Example (distance labels) 1 6 3 3 3 4 1 3 1 1 2 2 1 3 1 3 1 2 2 1 2 2 2 1 1 1 3 3 3 3 4 1 0 The residual network A flow Is this a valid distance labeling ?

  14. Distance labels – basic lemma Lemma: d(v) is a lower bound on the length of the shortest path from v to the sink Proof: Let the s.p. to the sink be: v v2 v1 t d(v) ≤ d(v1) + 1 ≤ d(v2) + 2 ..... ≤ d(t) + k = k

  15. Preflow (definition) • A preflow is a function on the edges which satisfies the following requirements • f(v,w) = -f(w,v) skew symmetry • f(v,w)  u(v,w) • For every w, except s and t, vf(v,w) ≥ 0 Let e(w) = vf(v,w) be the excess at the node v (we’ll also have e(t) ≥ 0, and e(s) ≤ 0)

  16. Example (preflow) 2 0 2 2 3 1 3 2 s t 0 3 2 1 Nodes with positive excess are called active. The preflow push algorithm will try to push flow from active nodes towards the sink, relying on d( ).

  17. 3 4 4 3 1 3 3 2 3 4 Initialization (preflow) 3 3 4 4 0 1 3 0 3 0 2 0 3 0 4 0

  18. 4 3 Initialization (distance labels) 6 3 3 4 4 3 4 0 1 1 0 0 3 0 3 0 3 3 2 2 0 0 0 3 0 3 4 0 4 0 Recall: s must be disconnected from t when d(s) = n, and the labeling is valid…

  19. Admissible arc in the residual graph v w d(v) = d(w) + 1

  20. The preflow push algorithm While there is an active node { pick an active node v and push/relabel(v) } Push/relabel(v) { If there is an admissible arc (v,w) then { push = min {e(v) , r(v,w)} flow from v to w } else { d(v) := min{d(w) + 1 | r(v,w) > 0} (relabel) }

  21. s v S Correctness Lemma 1: The source is reachable from every active vertex in the residual network Proof: Assume that’s not the case: Which means that no flow enters S -- A contradiction

  22. Correctness (cont) Corollary: There is an outgoing residual arc incident with every active vertex Corollary: So we can push-relabel as long as there is an active vertex

  23. Correctness (cont) Lemma 2:Distance labels only increase and remain valid at all times Proof: By induction on the number of push and relabel operations. For relabel this is clear by the definition of relabel For push: w v d(v) = d(w) + 1 so even if we add (w,v) to the residual network then it is still a valid labeling

  24. Correctness (cont) Lemma 3:When (and if) the algorithm stops the preflow is a maximum flow Proof: It is a flow since there is no active vertex. It is maximum since the sink is not reachable from the source in the residual network. (d(s) = n, and the labeling is valid)

  25. Complexity analysis

  26. Another example

More Related