2pt 0em
play

2pt 0em CSCE423/823 Computer Science & Engineering 423/823 - PowerPoint PPT Presentation

2pt 0em CSCE423/823 Computer Science & Engineering 423/823 Introduction Flow Networks Design and Analysis of Algorithms Ford-Fulkerson Method Lecture 07 Maximum Flow (Chapter 26) Edmonds-Karp Algorithm Maximum Bipartite Matching


  1. 2pt 0em CSCE423/823 Computer Science & Engineering 423/823 Introduction Flow Networks Design and Analysis of Algorithms Ford-Fulkerson Method Lecture 07 — Maximum Flow (Chapter 26) Edmonds-Karp Algorithm Maximum Bipartite Matching Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 35

  2. Introduction CSCE423/823 Can use a directed graph as a flow network to model: Data through communication networks, water/oil/gas through pipes, assembly lines, etc. Introduction A flow network is a directed graph with two special vertices: source s Flow Networks Ford-Fulkerson that produces flow and sink t that takes in flow Method Each directed edge is a conduit with a certain capacity (e.g. 200 Edmonds-Karp Algorithm gallons/hour) Maximum Vertices are conduit junctions Bipartite Matching Except for s and t , flow must be conserved: The flow into a vertex must match the flow out Maximum flow problem: Given a flow network, determine the maximum amount of flow that can get from s to t Other application: Bipartite matching 2 / 35

  3. Flow Networks CSCE423/823 A flow network G = ( V, E ) is a directed graph in which each edge ( u, v ) 2 E has a nonnegative capacity c ( u, v ) � 0 If ( u, v ) 62 E , c ( u, v ) = 0 Introduction Assume that every vertex in V lies on some path from the source Flow Networks Example vertex s 2 V to the sink vertex t 2 V More Notation Multiple Sources and Sinks Ford-Fulkerson Method Edmonds-Karp Algorithm Maximum Bipartite Matching 3 / 35

  4. Flows CSCE423/823 A flow in graph G is a function f : V ⇥ V ! R that satisfies: Capacity constraint: For all u, v 2 V , 0  f ( u, v )  c ( u, v ) (flow 1 should be nonnegative and not exceed capacity) Introduction Flow conservation: For all u 2 V \ { s, t } , 2 Flow Networks Example More Notation X X f ( v, u ) = f ( u, v ) Multiple Sources and Sinks v 2 V v 2 V Ford-Fulkerson Method (flow entering a vertex = flow leaving) Edmonds-Karp Algorithm The value of a flow is the net flow out of s (= net flow into t ): Maximum Bipartite X X | f | = f ( s, v ) � f ( v, s ) Matching v 2 V v 2 V Maximum flow problem: given graph and capacities, find a flow of maximum value 4 / 35

  5. Flow Example CSCE423/823 Introduction Flow Networks Example More Notation Multiple Sources and Sinks Ford-Fulkerson Method Edmonds-Karp Algorithm Maximum Bipartite Matching What is the value of this flow? 5 / 35

  6. Multiple Sources and Sinks CSCE423/823 Introduction Might have cases where there are multiple sources and/or sinks; e.g. Flow Networks if there are multiple factories producing products and/or multiple Example More Notation warehouses to ship to Multiple Sources and Sinks Can easily accommodate graphs with multiple sources s 1 , . . . , s k and Ford-Fulkerson Method multiple sinks t 1 , . . . , t ` Edmonds-Karp Add to G a supersource s with an edge ( s, s i ) for i 2 { 1 , . . . , k } and Algorithm a supersink t with an edge ( t j , t ) for j 2 { 1 , . . . , ` } Maximum Bipartite Matching Each new edge has a capacity of 1 6 / 35

  7. Multiple Sources and Sinks (2) CSCE423/823 Introduction Flow Networks Example More Notation Multiple Sources and Sinks Ford-Fulkerson Method Edmonds-Karp Algorithm Maximum Bipartite Matching 7 / 35

  8. Ford-Fulkerson Method CSCE423/823 A method (rather than specific algorithm) for solving max flow Introduction Multiple ways of implementing, with varying running times Flow Networks Core concepts: Ford-Fulkerson Method Residual network: A network G f , which is G with capacities reduced 1 Residual based on the amount of flow f already going through it Networks Flow Augmenting path: A simple path from s to t in residual network G f Augmentation 2 Augmenting Path ) If such a path exists, then can push more flow through network Max-Flow Min-Cut Cut: A partition of V into S and T where s 2 S and t 2 T ; can 3 Theorem Basic measure net flow and capacity crossing a cut Ford-Fulkerson Algorithm Ford-Fulkerson Method repeatedly finds an augmenting path in residual network, Example Analysis of adds in flow along the path, then updates residual network Ford-Fulkerson Edmonds-Karp Algorithm Maximum 8 / 35 Bipartite

  9. Ford-Fulkerson-Method( G, s, t ) CSCE423/823 Introduction Flow Networks Initialize flow f to 0 ; Ford-Fulkerson 1 while there exists augmenting path p in residual Method Residual network G f do Networks Flow augment flow f along p ; 2 Augmentation Augmenting 3 end Path Max-Flow 4 return f ; Min-Cut Theorem Basic Ford-Fulkerson Algorithm Ford-Fulkerson Example Analysis of Ford-Fulkerson Edmonds-Karp Algorithm Maximum 9 / 35 Bipartite

  10. Residual Networks CSCE423/823 Given flow network G with capacities c and flow f , residual network G f consists of edges with capacities showing how one can change flow in G Introduction Define residual capacity of an edge as Flow Networks Ford-Fulkerson 8 c ( u, v ) � f ( u, v ) if ( u, v ) 2 E Method < Residual c f ( u, v ) = f ( v, u ) if ( v, u ) 2 E Networks Flow Augmentation 0 otherwise : Augmenting Path Max-Flow E.g. if c ( u, v ) = 16 and f ( u, v ) = 11 , then c f ( u, v ) = 5 and Min-Cut Theorem c f ( v, u ) = 11 Basic Ford-Fulkerson Algorithm Then can define G f = ( V, E f ) as Ford-Fulkerson Example Analysis of Ford-Fulkerson E f = { ( u, v ) 2 V ⇥ V : c f ( u, v ) > 0 } Edmonds-Karp Algorithm So G f will have some edges not in G , and vice-versa Maximum 10 / 35 Bipartite

  11. Residual Networks (2) CSCE423/823 Introduction Flow Networks Ford-Fulkerson Method Residual Networks Flow Augmentation Augmenting Path Max-Flow Min-Cut Theorem Basic Ford-Fulkerson Algorithm Ford-Fulkerson Example Analysis of Ford-Fulkerson Edmonds-Karp Algorithm Maximum 11 / 35 Bipartite

  12. Flow Augmentation CSCE423/823 G f is like a flow network (except that it can have an edge and its reversal); so we can find a flow within it Introduction If f is a flow in G and f 0 is a flow in G f , can define the Flow Networks augmentation of f by f 0 as Ford-Fulkerson Method ⇢ f ( u, v ) + f 0 ( u, v ) � f 0 ( v, u ) Residual if ( u, v ) 2 E Networks ( f " f 0 )( u, v ) = Flow 0 otherwise Augmentation Augmenting Path Max-Flow Lemma: f " f 0 is a flow in G with value | f " f 0 | = | f | + | f 0 | Min-Cut Theorem Basic Proof: Not di ffi cult to show that f " f 0 satisfies capacity constraint Ford-Fulkerson Algorithm Ford-Fulkerson and and flow conservation; then show that | f " f 0 | = | f | + | f 0 | Example Analysis of (pp. 718–719) Ford-Fulkerson Edmonds-Karp Result: If we can find a flow f 0 in G f , we can increase flow in G Algorithm Maximum 12 / 35 Bipartite

  13. Augmenting Path CSCE423/823 By definition of residual network, an edge ( u, v ) 2 E f with Introduction c f ( u, v ) > 0 can handle additional flow Flow Networks Ford-Fulkerson Since edges in E f all have positive residual capacity, it follows that if Method there is a simple path p from s to t in G f , then we can increase flow Residual Networks Flow along each edge in p , thus increasing total flow Augmentation Augmenting Path We call p an augmenting path Max-Flow Min-Cut Theorem The amount of flow we can put on p is p ’s residual capacity: Basic Ford-Fulkerson Algorithm Ford-Fulkerson c f ( p ) = min { c f ( u, v ) : ( u, v ) is on p } Example Analysis of Ford-Fulkerson Edmonds-Karp Algorithm Maximum 13 / 35 Bipartite

  14. Augmenting Path (2) CSCE423/823 Introduction Flow Networks Ford-Fulkerson Method Residual Networks Flow Augmentation Augmenting Path Max-Flow Min-Cut Theorem Basic Ford-Fulkerson Algorithm p is shaded; what is c f ( p ) ? Ford-Fulkerson Example Analysis of Ford-Fulkerson Edmonds-Karp Algorithm Maximum 14 / 35 Bipartite

  15. Augmenting Path (3) CSCE423/823 Lemma: Let G = ( V, E ) be a flow network, f be a flow in G , and p be an augmenting path in G f . Define f p : V ⇥ V ! R as Introduction ⇢ c f ( p ) Flow Networks if ( u, v ) 2 p Ford-Fulkerson f p ( u, v ) = Method 0 otherwise Residual Networks Flow Then f p is a flow in G f with value | f p | = c f ( p ) > 0 Augmentation Augmenting Path Corollary: Let G , f , p , and f p be as above. Then f " f p is a flow in Max-Flow Min-Cut Theorem G with value | f " f p | = | f | + | f p | > | f | Basic Ford-Fulkerson Algorithm Thus, every augmenting path increases flow in G Ford-Fulkerson Example When do we stop? Will we have a maximum flow if there is no Analysis of Ford-Fulkerson augmenting path? Edmonds-Karp Algorithm Maximum 15 / 35 Bipartite

  16. Max-Flow Min-Cut Theorem CSCE423/823 Used to prove that once we run out of augmenting paths, we have a maximum flow Introduction A cut ( S, T ) of a flow network G = ( V, E ) is a partition of V into Flow Networks S ✓ V and T = V \ S such that s 2 S and t 2 T Ford-Fulkerson Net flow across the cut ( S, T ) is Method Residual Networks Flow X X X X f ( S, T ) = f ( u, v ) � f ( v, u ) Augmentation Augmenting Path u 2 S v 2 T u 2 S v 2 T Max-Flow Min-Cut Theorem Capacity of cut ( S, T ) is Basic Ford-Fulkerson Algorithm Ford-Fulkerson X X Example c ( S, T ) = c ( u, v ) Analysis of Ford-Fulkerson u 2 S v 2 T Edmonds-Karp Algorithm A minimum cut is one whose capacity is smallest over all cuts Maximum 16 / 35 Bipartite

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend