maximum flow the maximum flow problem
play

Maximum Flow The Maximum Flow Problem Given Directed graph G = ( V - PowerPoint PPT Presentation

Maximum Flow The Maximum Flow Problem Given Directed graph G = ( V , E ) A capacity function c : E R + Two vertices s and t . s , t -Flow Function f : E R + such that f ( e ) c ( e ) , for all v V


  1. Maximum Flow

  2. The Maximum Flow Problem Given ◮ Directed graph G = ( V , E ) ◮ A capacity function c : E → R + ◮ Two vertices s and t . s , t -Flow ◮ Function f : E → R + such that ◮ f ( e ) ≤ c ( e ) , � � ◮ for all v ∈ V \ { s , t } , f ( uv ) = f ( vw ) , uv ∈ E vw ∈ E � � f ( vs ) = 0 , and f ( tv ) = 0 . ◮ vs ∈ E tv ∈ E � The value | f | of an s , t -flow f is f ( s , v ) sv ∈ E 2 / 12

  3. The Maximum Flow Problem Maximum Flow Problem For a given directed graph and two given vertices s and t , find an s , t -flow f with maximum value. Multi-Source and Multi-Sink Flow ◮ Sources: s 1 , s 2 , . . . , s k ◮ Sinks: t 1 , t 2 , . . . , t l ◮ Add vertex s ′ and edges s ′ s i with c ( s ′ s i ) = ∞ ( 1 ≤ i ≤ k ). ◮ Add vertex t ′ and edges ( t i t ′ ) with c ( t i t ′ ) = ∞ ( 1 ≤ i ≤ l ). ◮ Find maximum s ′ , t ′ -flow. 3 / 12

  4. Max Flow Algorithm “Naive” Approach ◮ Find some path P from s to t where each edge e has f ( e ) < c ( e ) . ◮ Add increase f ( e ) as much as possible for each edge of P . ◮ Repeat. This approach will not always create an optimal solution 1 | 1 0 | 1 1 | 1 1 | 1 s s 1 | 1 t 0 | 1 t 0 | 1 1 | 1 1 | 1 1 | 1 algorithm output optimal solution 4 / 12

  5. Residual Graph Observation ◮ If f ( uv ) = k , we can assume there is an augmented edge vu with c ( vu ) ≥ k , even if vu / ∈ E . Residual Graph G f = ( V , E f ) ◮ E f = { uv | uv ∈ E , f ( uv ) < c ( uv ) } ∪ { vu | uv ∈ E , f ( uv ) > 0 } � c ( uv ) − f ( uv ) if uv ∈ E ◮ c f ( uv ) = f ( vu ) if vu ∈ E f ′ is an s , t -flow for G f if and only if f + f ′ is an s , t -flow for G . 5 / 12

  6. Ford-Fulkerson Algorithm Ford-Fulkerson Algorithm ◮ Start with f ( e ) = 0 for all edges e ∈ E . ◮ Find a simple s , t -path P in G f . ◮ Update f with maximum flow for P . ◮ Update G f . ◮ Repeat. What is the worst case runtime for this algorithm? 6 / 12

  7. Ford-Fulkerson Algorithm – Runtime Consider the following case: u 1 , 000 1 , 000 s 1 t 1 , 000 1 , 000 v If the algorithm picks uv or vu in each iteration, it takes 2 , 000 iterations to find a maximum flow. Worst case runtime ◮ If c : E → N , O ( | E || f max | ) ◮ If c : E → R , algorithm may not terminate. 7 / 12

  8. Edmonds-Karp Algorithm Edmonds-Karp Algorithm ◮ Start with f ( e ) = 0 for all edges e ∈ E . ◮ Find a shortest s , t -path P in G f . ◮ Update f with maximum flow for P . ◮ Update G f . ◮ Repeat. Ford-Fulkerson ◮ Finds some s , t -path in G f . ◮ Runtime: O ( | E || f max | ) (integer capacities) Edmonds-Karp Algorithm ◮ Finds a shortest s , t -path in G f . ◮ Runtime: O ( | V || E | 2 ) Best known result today: O ( | V || E | ) (complicated) 8 / 12

  9. Max-Flow Min-Cut Theorem

  10. Cut s , t -Cut An s , t -cut ( S , T ) in a graph G = ( V , E ) is a partition of V into S and T such that s ∈ S and t ∈ T . The flow f ( S , T ) is defined as � � f ( S , T ) = f ( xy ) − f ( yx ) . x ∈ S , y ∈ T , xy ∈ E x ∈ S , y ∈ T , yx ∈ E The capacity c ( S , T ) is defined as � c ( S , T ) = c ( xy ) . x ∈ S , y ∈ T , xy ∈ E 10 / 12

  11. Flows and Cuts Lemma Maximum s , t -flow ≤ minimum s , t -cut, i. e., max f | f | ≤ min ( S , T ) c ( S , T ) . Proof. Follows from definition. � Lemma For each s , t -cut ( S , T ) , f ( S , T ) = | f | . Proof. ◮ Let V = { s = v 0 , v 1 , v 2 , . . . , v n − 1 , v n = t } and V i = { v i , v i + 1 , . . . , v n } . � � � ◮ | f | = f ( s , v ) and, for all v ∈ V \ { s , t } , f ( uv ) = f ( vw ) . sv ∈ E uv ∈ E vw ∈ E ◮ Thus, f ( { s } , V 1 ) = f ( { s , v 1 } , V 2 ) = . . . = f ( S , T ) . � 11 / 12

  12. Max-Flow Min-Cut Theorem Theorem For any s , t -flow f , the following three conditions are equivalent. ( i ) f is a maximum s , t -flow in G . ( ii ) There is no augmenting s , t -path in G f . ( iii ) There is an s , t -cut ( S , T ) in G with c ( S , T ) = | f | . ( i ) → ( ii ) : If there would be an s , t -path P in G f , | f | could be increased by the capacity of P . ( ii ) → ( iii ) : There is no augmenting s , t -path in G f . Let S be the set of vertices reachable from s in G f and T = V \ S . If c ( S , T ) > f ( S , T ) , there is an edge xy in G f with x ∈ S and y ∈ T . Thus, y is reachable from s . Contradiction. ( iii ) → ( i ) : There is an s , t -cut ( S , T ) in G with c ( S , T ) = | f | . Because max f | f | ≤ min ( S , T ) c ( S , T ) , f is a maximum s , t -flow in G . � 12 / 12

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