Presentation is loading. Please wait.

Presentation is loading. Please wait.

Maximum Flow Problem flow capacity Actual flow  capacity

Similar presentations


Presentation on theme: "Maximum Flow Problem flow capacity Actual flow  capacity"— Presentation transcript:

1 Maximum Flow Problem flow capacity Actual flow  capacity
The source node can produce flow as much as possible For every node other than s and t, flow out  flow in Source s actual flow 3/ 4 2/ 2 1/ 1 a b 2/ 3 2/ 2 1/ 2 our textbook says = d c e e The target node’s flow-in is called the flow of the graph f g A node may have different ways to dispatch its flow-out . 1/ 2 2/ 3 t What is the maximum flow of the graph? Target (sink) 11/21/2018 IT 279

2 What makes the maximum flow problem more difficult than the shortest path problem?
Source s The shortest path of t is based on the shortest path of g. 3/ 4 2/ 2 once a node’s shortest path from s is determined, we will never have to revise the decision 1/ 1 a b 2/ 3 2/ 2 1/ 2 d c e e The maximum flow to t is not based on the maximum flows to f and g. f g 1/ 2 2/ 3 t Target 11/21/2018 IT 279

3 local optimum does not imply global optimum
Source Source Source s s s 5/5 2/2 4/5 2/2 5/5 2/2 1/1 0/1 a 1/1 a b a b b 4/4 3/3 1/4 2/3 0/3 3/4 3/3 3/3 1/3 0/3 d 3/3 d c 1/3 d c c Target Target 2/2 5/5 sc max flow = 6 sd max flow = 7 t Target st max flow = 7 11/21/2018 IT 279

4 A naïve approach: adding all possible paths together
Source Source Source s s s 1 2/ 2 1/ 1 2/ 3 2 1 1 1 a a a b b b 1/ 4 4 4 1 2/ 2 1 2/ 3 2 d d d c c c 2/ 3 1/ 1 2/ 2 3 t t t Target Target Target Residual Graph Residual Graph 11/21/2018 IT 279

5 Not always work. 3/3 2/2 1 1 3 1/4 1 3 2/2 2/ 2 3/3 We are just lucky
Source Source s s 3/3 2/2 1 a 1 b a b 3 1/4 1 3 2/2 d c d c 2/ 2 3/3 t t Target Not always work. Target We are just lucky Residual Graph 11/21/2018 IT 279

6 A wrong choice: 3/ 3 2 2 1 1 3/ 4 1 3 2 3 2 2 3/ 3 2 s s a b a b d c d
Source Source s s 3/ 3 2 2 1 a 1 b a b 3/ 4 1 3 2 3 2 d c d c 2 3/ 3 2 t t Target Target 11/21/2018 IT 279

7 Keep a path for changing decision:
Source Source s s 3/ 3 2 2 3 1 a 1 b a b 3/ 4 1 3 2 3 2 3 d c d c 2 3/ 3 2 3 t t Target Target Augmented Graph 11/21/2018 IT 279

8 Find another path in the augmented graph
No more path from s to t Source s s s 2/ 2 3 2 2 3 3 1 a 1 1 b a a b b 2 1 2/ 3 2/ 2 3 1 2 1 2 1 2/ 3 2 2 d 1 1 c d d c c 2/ 2 3 2 2 3 3 t t t Target Augmented Graph new Augmented Graph 11/21/2018 IT 279

9 + = Add flows together 3 3 2 2 3 2 2 2 2 2 1 3 3 2 2 Maximum Flow s s
Source + = s s 3 s 3 2 2 a b a b a b 3 2 2 2 2 2 1 d c d c d c 3 3 2 2 t t Target t Target Target Maximum Flow 11/21/2018 IT 279

10 An algorithm for finding the maximum flow of graphs
Input: G = (V, E), and s,t  V Let Gmax = (, ), Gaug = G Find a path p from s to t in Gaug If no such p exists, output Gmax and stop the program Add p into Gmax and update Gaug Repeat 1, 2, and, if possible, 3 Complexity: O(f |E|) 11/21/2018 IT 279

11 Claim: This algorithm always terminates with a maximum flow of the input graph
Our textbook says: The proof is somewhat difficult and beyond the scope of this text. Input: G = (V, E), and s,t  V Let Gmax = (, ), Gaug = G Find a path p from s to t in Gaug If no such p exists, output Gmax and stop the program Add p into Gmax and update Gaug Repeat 1, 2, and 3 if possible I say: No, it is not difficult and every one here should know. Since any given graph has a finite maximum flow, and every path from s to t, if any, provides a positive flow, the program therefore cannot run forever. By contradiction, suppose the algorithm terminates with a flow in Gmax. that is not maximum. Then, there must be a flow not included in Gmax. But, if this is the case, there must be a path from s to t to carries this flow, and hence the program should not terminate at this moment. A contradiction. 11/21/2018 IT 279

12 An inefficient situation
Source s 1/ 1/ 1000 1/ 1000 1/ 1 a b 1/ 1 1/ 1000 1/ 1000 t Target 11/21/2018 IT 279

13 An inefficient situation
Source s 2/ 1/ 1000 2/ 1/ 1000 1/ 1 a b 2/ 1/ 1000 2/ 1/ 1000 t Target 11/21/2018 IT 279

14 Always chose the maximum next edge
Solution Always chose the maximum next edge Source s 1000/ 1000 1000 a b 1000/ 1000 1/ 1000 t Target 11/21/2018 IT 279


Download ppt "Maximum Flow Problem flow capacity Actual flow  capacity"

Similar presentations


Ads by Google