common features of flow networks single source single
play

Common Features of Flow Networks Single Source Single Sink Flows - PowerPoint PPT Presentation

Common Features of Flow Networks Single Source Single Sink Flows Simple setting: single source s and single sink t Network represented by a (directed) graph G = ( V , E ) every other node v is an internal node Each edge e has a


  1. Common Features of Flow Networks Single Source Single Sink Flows Simple setting: ◮ single source s and single sink t ◮ Network represented by a (directed) graph G = ( V , E ) ◮ every other node v is an internal node ◮ Each edge e has a capacity c ( e ) ≥ 0 that limits amount of ◮ flow originates at s and terminates at t traffic on e ◮ Source(s) of traffic/data 9 ◮ Sink(s) of traffic/data 3 6 ◮ Each edge e has a capacity c ( e ) ≥ 0 ◮ Traffic flows from sources to sinks 10 15 10 4 15 ◮ Traffic is switched/interchanged at nodes ◮ Source s ∈ V with no incoming edges 5 8 10 s 2 5 t ◮ Sink t ∈ V with no outgoing edges 15 10 4 15 6 Flow: abstract term to indicate stuff (traffic/data/etc) that flows 30 1 4 from sources to sinks. Assumptions: All capacities are integer, and every vertex has at least one edge incident to it. Definition of Flow Edge Based Definition of Flow Definition A flow in a network G = ( V , E ), is a function f : E → R ≥ 0 such that Two ways to define flows: ◮ edge based 9/9 ◮ Capacity Constraint: For each edge 3 6 ◮ path based e , f ( e ) ≤ c ( e ) 10/10 1/15 9/10 0/4 0/15 They are essentially equivalent but have different uses. ◮ Conservation Constraint: For each 4/5 8/8 9/10 s 2 5 t vertex v � = s , t Edge based definition is more compact. 14/15 10/10 0/4 0/15 4/6 � � f ( e ) = f ( e ) 14/30 1 4 e into v e out of v Figure : Flow with value

  2. More Definitions and Notation A Path Based Definition of Flow Intuition: flow goes from source s to sink t along a path. Notation P : set of all paths from s to t . |P| can be exponential in n ! ◮ The inflow into a vertex v is f in ( v ) = � e into v f ( e ) and the Definition A flow in a network G = ( V , E ), is a function f : P → R ≥ 0 such outflow is f out ( v ) = � e out of v f ( e ) that ◮ For a set of vertices A , f in ( A ) = � e into A f ( e ). Outflow f out ( A ) is defined analogously ◮ Capacity Constraint: For each edge e , total flow on e is ≤ c ( e ). � Definition f ( p ) ≤ c ( e ) For a network G = ( V , E ) with source s , the value of flow f is p ∈P e defined as v ( f ) = f out ( s ) ◮ Conservation Constraint: No need! Automatic. Value of flow: � p ∈P f ( p ) Path based flow implies Edge based flow Edge based flow to Path based Flow Flow Decomposition: Lemma Lemma Given a path based flow f : P → R ≥ 0 there is an edge based flow Given an edge based flow f ′ : E → R ≥ 0 , there is a path based flow f ′ : E → R ≥ 0 of the same value. f : P → R ≥ 0 of same value. Moreover, f assigns non-negative flow to at most m + n paths where | E | = m and | V | = n. Given f ′ , the Proof. path based flow can be computed in O ( mn ) time. For each edge e define f ′ ( e ) = � p : e ∈ p f ( p ). Verify capacity and conservation constraints for f ′ . Proof Idea. ◮ remove all edges with f ′ ( e ) = 0 ◮ find a path p from s to t ◮ assign f ( p ) to be min e ∈ p f ′ ( e ) ◮ reduce f ′ ( e ) for all e ∈ p by f ′ ( e ) ◮ repeat until no path from s to t

  3. Edge vs Path based Definitions of Flow The Maximum-Flow Problem Edge based flows: ◮ compact representation, only m values to be specified Problem ◮ need to check flow conservation explicitly at each internal node Input A network G with capacity c and source s and sink t Path flows: Goal Find flow of maximum value ◮ in some applications, paths more natural Question: Given a flow network, what is an upper bound on the ◮ not compact maximum flow between source and sink? ◮ no need to check flow conservation constraints Equivalence shows that we can go back and forth easily. Cuts Minimum Cut Definition Definition Given a flow network an s − t cut is a set of edges E ′ ⊂ E such Given a flow network an s − t minimum cut is a cut E ′ of smallest that removing E ′ disconnects s from t : in other words there is no capacity amongst all s − t cuts. directed s → t path in E − E ′ . The capacity of cut E ′ is � 9 e ∈ E ′ c ( e ). 3 6 10 15 10 9 4 15 3 6 5 8 10 10 15 10 s 2 5 t 4 15 15 10 5 8 10 4 15 6 s 2 5 t 30 15 10 1 4 4 15 6 30 1 4 Observation: exponential number of s − t cuts and no “easy” algorithm to find a minimum cut. Caution: cut may leave t → s paths!

  4. The Minimum-Cut Problem Flows and Cuts Lemma For any s − t cut E ′ , maximum s − t flow ≤ capacity of E ′ . Proof. Formal proof easier with path based definition of flow. Suppose f : P → R ≥ 0 is a max-flow. Problem Input A network G with capacity c and source s and sink t Every path p ∈ P contains an edge e ∈ E ′ . Why? Goal Find the capacity of a minimum s − t cut Assign each path p ∈ P to exactly on edge e ∈ E ′ . Let P e be paths assigned to e ∈ E ′ . Then � � � v ( f ) = f ( p ) = f ( p ) p ∈P p ∈P e e ∈ E ′ � ≤ c ( e ) e ∈ E ′ Flows and Cuts Max-Flow Min-Cut Theorem Theorem In any flow network the maximum s − t flow is equal to the minimum s − t cut. Lemma Can compute minimum-cut from maximum flow and vice-versa! For any s − t cut E ′ , maximum s − t flow ≤ capacity of E ′ . Proof coming shortly. Corollary Maximum s − t flow ≤ minimum s − t cut. Many applications: ◮ optimization ◮ graph theory ◮ combinatorics

  5. The Maximum-Flow Problem Greedy Approach 1. Begin with f ( e ) = 0 for each edge u Problem 2. Find a s - t path P with f ( e ) < c ( e ) for 10/20 10/10 Input A network G with capacity c and source s and sink t every edge e ∈ P 10/30 s t Goal Find flow of maximum value 3. Augment flow along this path 10/10 10/20 4. Repeat augmentation for as long as possible. v Greedy Approach: Issues Residual Graph Definition 1. Begin with f ( e ) = 0 for each edge For a network G = ( V , E ) and flow f , the residual graph u G f = ( V ′ , E ′ ) of G with respect to f is 2. Find a s - t path P with f ( e ) < c ( e ) for 20/20 10 ◮ V ′ = V every edge e ∈ P 20/30 s t 3. Augment flow along this path ◮ Forward Edges: For each edge e ∈ E with f ( e ) < c ( e ), we 10 20/20 e ∈ E ′ with capacity c ( e ) − f ( e ) 4. Repeat augmentation for as long as possible. ◮ Backward Edges: For each edge e = ( u , v ) ∈ E with v f ( e ) > 0, we ( v , u ) ∈ E ′ with capacity f ( e ) Need to “push-back” flow along edge ( u , v )

  6. Residual Graph Example Ford-Fulkerson Algorithm for every edge e, f(e) = 0 G f is residual graph of G with respect to f u u while G f has a simple s-t path 20/20 0/10 10 let P be simple s-t path in G f 20 f = augment(f,P) Construct new residual graph G f 20/30 s s t 20 10 t 0/10 20/20 10 augment(f,P) 20 let b be bottleneck capacity, i.e., min capacity of edges in P v v for each edge e in P if e is a forward edge f(e) = f(e) + b else (* e is a backward edge *) Figure : Flow in red edges Figure : Residual Graph f(e) = f(e) - b return f Properties about Augmentation Progress in Ford-Fulkerson Proposition Lemma Let f be a flow and f ′ be flow after one augmentation. Then If f is a flow and P is a simple s-t path in G f , then f ′ = augment ( f , P ) is also a flow. v ( f ) < v ( f ′ ) Proof. Lemma Let P be an augmenting path, i.e., P is a simple s - t path in At every stage of the Ford-Fulkerson algorithm, the flow values residual graph f ( e ) and the residual capacities in G f are integers ◮ First edge e in P must leave s Proof. ◮ Original network G has no incoming edges to s ; hence e is a Initial flow and residual capacities are integers. Suppose lemma forward edge holds for j iterations. Then in j + 1st iteration, minimum capacity ◮ P is simple and so never returns to s edge b is an integer, and so flow after augmentation is an integer. ◮ Thus, value of flow increases by the flow on edge e

  7. Termination Proof Efficiency of Ford-Fulkerson Theorem Running time = O ( mC ) is not polynomial. Can the upper bound Let C = � e out of s c ( e ) . Ford-Fulkerson algorithm terminates be achieved? after finding at most C augmenting paths Proof. u u The value of the flow increases by at least 1 after each C − 1 C C C augmentation. Maximum value of flow is at most C . 1 1 1 s s Running time t t C − 1 C C C ◮ Number of iterations = O ( C ) 1 ◮ Number of edges in G f ≤ 2 m v v ◮ Time to find augmenting path is O ( n + m ) ◮ Running time is O ( C ( n + m )) = O ( mC ) Correctness of Ford-Fulkerson Augmenting Path Algorithm Cuts as Vertex Partitions Let A ⊂ V such that ◮ s ∈ A , t �∈ A Question: When the algorithm terminates, is the flow computed ◮ B = V − A and hence t ∈ B the maximum s − t flow? Define ( A , B ) = { ( u , v ) ∈ E | u ∈ A , v ∈ B } Claim Proof idea: show a cut of value equal to the flow. Also shows that ( A , B ) is an s − t cut. maximum flow is equal to minimum cut! 9 Definition 3 6 Given a flow network an s − t cut is a set of edges E ′ ⊂ E such 10 15 10 4 15 that removing E ′ disconnects s from t : in other words there is no 5 8 10 s 2 5 t directed s → t path in E − E ′ . The capacity of cut E ′ is � 15 10 e ∈ E ′ c ( e ). 4 15 6 30 1 4

Recommend


More recommend