Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.

Similar presentations


Presentation on theme: "CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported."— Presentation transcript:

1 CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative Commons Attribution-Share Alike 3.0 Unported License Slides by: Eric Ringger, with contributions from Mike Jones

2 Announcements  HW #20:  Due now.  HW #20.5  Due Monday  Project #6: Linear Programming  In preparation: HW #21  Formulate problem for Proj. #6  NO 2-hour time limit  Due Wednesday

3 Objectives  Better understand the idea of “changing the problem” in the max flow algorithm  Understand the relationship between flows and cuts  Solve Bipartite Matching  See example of Padded matrix-vector representation

4 Max Flow Example s b d t 42 24 4 e f 2 4 6 Summarize the max flow algorithm.

5 Max Flow Example 1.Pick a simple path s  t and increase the flow along that path as much as possible 2.Create the residual graph G R including reverse edges 3. Repeat until there is no path with remaining capacity. s b d t 42 24 4 e f 2 4 6

6 Max Flow Example 1.Pick a simple path s  t and increase the flow along that path as much as possible 2.Create the residual graph G R including reverse edges 3. Repeat until there is no path with remaining capacity. s b d t 42 24 4 e f 2 4 6 Turn to your partner and tell them about a question you have about how this works. Remember / write your partner’s question.

7 Solve s b d t 42 24 4 e f 2 4 6

8 Max Flow Example s b d t 42 24 4 e f 2 6 s b d t e f Residual Graph, incl. reverse edges One solution 4

9 Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges No paths from s to t, so we are done.

10 Max Flow Example s b d t 42 24 4 e f 2 6 s b d t e f Residual Graph, incl. reverse edges One solution 4

11 Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges No paths from s to t, so we are done.

12 Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges

13 Max Flow Example s b d t 42 24 4 e f 2 4 6 s b d t e f Residual Graph, incl. reverse edges Another solution

14 Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges

15 Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges No paths from s to t, so we are done.

16 Key Points about our Max Flow Algorithm  When we transform the problem we create “imaginary edges”  However, in the end our selected paths always produce a flow schedule that involves only the original edges.

17 (s,t)-Cut An (s,t)-cut partitions the vertices into two disjoint sets: L contains s R contains t s b d t 42 24 4 e f 2 4 6 To compute the capacity of a cut, add up the capacities of edges that flow across the cut from L to R. L: Source Side R: Sink Side

18 (s,t)-Cut An (s,t)-cut partitions the vertices into two disjoint sets: L contains s R contains t s b d t 42 24 4 e f 2 4 6 To compute the capacity of a cut, add up the capacities of edges that flow across the cut from L to R. L: Source Side R: Sink Side

19 Cut Property s b d t 42 24 4 e f 2 4 6 Max flow is less than or equal to the flow across any cut. Max-Flow Min-Cut Theorem: The maximum flow through a network is equal to the minimum flow across all cuts. What does a min cut represent?

20 Cut Property s b d t 42 24 4 e f 2 4 6 Max flow is less than or equal to the flow across any cut. Max-Flow Min-Cut Theorem: The maximum flow through a network is equal to the minimum flow across all cuts. What does a min cut represent?

21 Cut Property s b d t 42 24 4 e f 2 4 6 We can call a minimum cut a “matching cut”, since its capacity matches the maximum flow. Max flow is less than or equal to the flow across any cut. Max-Flow Min-Cut Theorem: The maximum flow through a network is equal to the minimum flow across all cuts.

22 Algorithms

23 Match-making

24 Is there a perfect matching?

25 Bipartite Matching Is there a perfect matching? Great example of problem reduction.

26 LP: Padded Matrices & Vectors

27 End

28 Assignment  HW #20.5  Due Monday  HW #21:  Part 1 of Project #6  Just the problem formulation and representations  No time limit  Due Wednesday

29 Another Example

30

31

32

33

34

35


Download ppt "CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported."

Similar presentations


Ads by Google