PI Informatik The Maximum Flow Problem Kurt Mehlhorn nput: a directed graph G =(V,E), source node s ∈ V , sink node t ∈ V edge capacities cap : E → IR0 1/0 1/1 s 1/1 t 2/2 2/1 Goal: compute a ow of maximal value, i.e., a function f : E → IR0 satisfying the capacity constraints and the ow conservation constraints (1) 0 f(e) cap(e) for every edge e ∈ E P P (2) f(e)= f(e) for every node v ∈ V \{s, t} e;target(e)=v e;source(e)=v and maximizing the net ow1 into t. PI Informatik Further Reading Kurt Mehlhorn he main sources for the lectures are the books [8, 1, 9]. The original ublications on the preow-push algorithm are [6, 2]. [5] describes the currently est ow algorithm for integral capacities. Papers by the instructors are [3, 7, 4]. R.K. Ahuja, T.L. Magnanti, and J.B. Orlin. Network Flows. Prentice Hall, 1993. R.K. Ahuja and J.B. Orlin. A fast and simple algorithm for the maximum ow problem. Operation Research, 37:748–759, 1989. J. Cheriyan, T. Hagerup, and K. Mehlhorn. An o(n3)-time maximum ow algorithm. SIAM Journal of Computing, 25(6):1144–1170, 1996. J. Cheriyan and K. Mehlhorn. An analysis of the highest-level selection rule in the preow-push max-ow algorithm. IPL, 69:239–242, 1999. www.mpi-sb.mpg.de/~mehlhorn/ftp/maxflow.ps. A.V. Goldberg and S. Rao. Beyond the ow decomposition barrier. JACM, 45(5), 1998. A.V. Goldberg and R.E. Tarjan. A new approach to the maximum-ow problem. Journal of the ACM, 35:921–940, 1988. T. Hagerup, P. Sanders, and J. Tra. An implementation of the binary blocking ow algorithm. In Proceedings of the 2nd Workshop on Algorithm Engineering (WAE’98), pages 143–154. Max-Planck-Institut fur Informatik, 1998. K. Mehlhorn. Data Structures and Algorithms. Springer, 1984. K. Mehlhorn and S. Naher. The LEDA Platform for Combinatorial and Geometric Computing. Cambridge University Press,2 1999. 1018 pages. PI Informatik Some Notation and First Properties Kurt Mehlhorn P P the excess of a node v: excess(v)= f(e) f(e) e;target(e)=v e;source(e)=v in a ow: all nodes except s and t have excess zero. the value of a ow = val(f)=excess(t) learly: the net ow into t is equal to the next ow out of s. emma 1 excess(t)=excess(s) he proof is short and illustrates an important technique X excess(s)+excess(t)= excess(v)=0 v∈V the rst equality holds since excess(v)=0forv =6 s, t. the second equality holds since the ow across any edge e =(v, w) appears twice in this sum – positively in excess(w) and negatively in excess(v) 3 PI Informatik Cuts Kurt Mehlhorn a subset S of the nodes is called a cut. Let T = V \ S S is called an (s, t)-cut if s ∈ S and t ∈ T . the capacity of a cut is the total capacity of the edges leaving the cut, X cap(S)= cap(e). e∈E∩(ST ) a cut S is called saturated if f(e)=cap(e) for all e ∈ E ∩ (S T ) and f(e) = 0 for all e ∈ E ∩ (T S). 1/1 1/1 1/0 1/1 s t s 1/1 t 1/0 2/2 2/1 2/2 2/2 4 PI Informatik Cuts and Flows Kurt Mehlhorn emma 2 For any ow f and any (s, t)-cut val(f) cap(S). if S is saturated, val(f)=cap(S). roof: We have X val(f)=excess(s)= excess(u) ∈ X u SX X = f(e) f(e) cap(e) e∈E∩(ST ) e∈E∩(T S) e∈E∩(ST ) = cap(S). or a saturated cut, the inequality is an equality. Remarks: A saturated cut proves the optimality of a ow. For every maximal ow there is a5 saturated cut proving its optimality (=⇒) PI Informatik The Residual Network Kurt Mehlhorn let f be a ow in G =(V,E) the residual network Gf captures possible changes to f – same node set as G 0 00 – for every edge e =(v, w) up to two edges e and e in Gf 0 if cap(e) <f(e), we have an edge e =(v, w) ∈ Gf residual capacity r(e0)=cap(e) f(e). 00 if f(e) > 0, we have an edge e =(w, v) ∈ Gf residual capacity r(e00)=f(e). two ows and the corresponding residual networks 1/1 1/1 1/0 1/1 s t s 1/1 t 1/0 2/2 2/1 2/2 2/2 6 PI Informatik Maximum Flows and the Residual Graph Kurt Mehlhorn heorem 1 (Maximum Flows and the Residual Graph) Let f be an s,t)-ow, let Gf be the residual network with respect to f, and let S be the set of odes that are reachable from s in Gf . ) If t ∈ S then f is not maximum. ) If t/∈ S then S is a saturated cut and f is maximum. 1 2/1 2/2 2 2/2 2/2 1 s 1/1 tts 1 s 1/0 t 1 2/2 2/1 2 1 2/2 2/2 G Gf G An illustration of part a) 7 PI InformatikMaximum Flows and the Residual Graph: PartKurt a Mehlhorn t is reachable from s in Gf , f is not maximal Let p be any simple path from s to t in Gf Let be the minimum residual capacity of any edge of p. Then >0. We construct a ow f 0 of value val(f)+. Let (see Figure on preceding slide) 0 f(e)+ if e is in p 0 00 f (e)= f(e) if e is in p f(e) if neither e0 nor e00 belongs to p. f 0 is a ow and val(f 0)=val(f)+. a path in Gf : s → v1 → v2 → v3 → v4 → v5 → t the corresponding path in G: 8 PI InformatikMaximum Flows and the Residual Graph: PartKurt b Mehlhorn t cannot be reached from s in Gf , f is maximal. Let S be the set of nodes reachable from s and let T = V \ S. There is no edge (v, w)inGf with v ∈ S and w ∈ T . Hence – f(e)=cap(e) for any e with e ∈ E ∩ (S T ) and – f(e) = 0 for any e with e ∈ E ∩ (T S) Thus S is saturated and f is maximal. Gf G 9 PI Informatik Max-Flow-Min-Cut Theorem Kurt Mehlhorn heorem 2 (Max-Flow-Min-Cut Theorem) max {val(f) ; f is a ow} = min {cap(S) ; S is an (s, t)-cut} roof: is the content of Lemma 2, part (a). let f be a maximum ow – then there is no path from s to t in Gf and – the set S of nodes reachable from s form a saturated cut – hence val(f)=cap(S) by Lemma 2, part (b). theorem of the form above is called a duality theorem. 10 PI Informatik The Ford-Fulkerson Algorithm Kurt Mehlhorn start with the zero ow, i.e., f(e) = 0 for all e. construct the residual network Gf check whether t is reachable from s. – if not, stop – if yes, increase ow along an augmenting path, and iterate each iteration takes time O(n + m) if capacities are arbitrary reals, the algorithm may run forever it does well in the case of integer capacities 11 PI Informatik Integrality Theorem Kurt Mehlhorn assume integral capacities, say in [0 .. C] let v = value of the maximum ow deg(s) C nC Claim: all ows constructed are integral (and hence nal ow is integral) Proof: We use induction on the number of iterations. – the initial ow (= all-zero-ow) is integral. – if current ow is integral, residual capacities are integral and hence next ow is integral every augmentation increases ow value by at least one running time is O((n + m)v); this is good if v is small heorem 3 If edge capacities are integral, there exists an integral maximal ow. Moreover, the algorithm of Ford and Fulkerson nds it in time O((n + m)v), here v is the value of the maximum ow. 12 PI Informatik Bipartite Matching Kurt Mehlhorn given a bipartite graph G =(A ∪ B,E), nd a maximal matching matching M, a subset of the edges, no two of which share an endpoint reduces easily to network ow – add a source s, edges (s, a) for a ∈ A, capacity one – add a sink t, edges (b, t) for b ∈ B, capacity one – direct edges in G from A to B, capacity +∞ – integral ows correspond to matchings √ – Ford-Fulkerson takes time O(nm) since v n, can be improved to O( nm) 0 4 0 4 1 5 1 5 2 6 2 6 3 7 3 7 13 PI Informatik The Theorem of Hall Kurt Mehlhorn heorem 4 A bipartite graph G =(A ∪ B,E) has an A-perfect matching (= a matching of size |A|) i for every subset A0 A, |(A0)||A0|, where (A0) is he set of neighbors of the nodes in A0. ondition is clearly necessary; we need to show suciency assume that there is no A-perfect matching then ow in the graph dened on preceding slide is less than |A| and hence minimum cut has capacity less than |A|. consider a minimum (s, t)-cut (S, T ).
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages44 Page
-
File Size-