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
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
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
Max Flow Example s b d t e f Summarize the max flow algorithm.
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 e f 2 4 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 e f Turn to your partner and tell them about a question you have about how this works. Remember / write your partner’s question.
Solve s b d t e f 2 4 6
Max Flow Example s b d t e f 2 6 s b d t e f Residual Graph, incl. reverse edges One solution 4
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.
Max Flow Example s b d t e f 2 6 s b d t e f Residual Graph, incl. reverse edges One solution 4
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.
Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges
Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges Another solution
Max Flow Example s b d t e f s b d t e f Residual Graph, incl. reverse edges
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.
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.
(s,t)-Cut An (s,t)-cut partitions the vertices into two disjoint sets: L contains s R contains t s b d t e f 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
(s,t)-Cut An (s,t)-cut partitions the vertices into two disjoint sets: L contains s R contains t s b d t e f 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
Cut Property s b d t e f 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?
Cut Property s b d t e f 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?
Cut Property s b d t e f 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.
Algorithms
Match-making
Is there a perfect matching?
Bipartite Matching Is there a perfect matching? Great example of problem reduction.
LP: Padded Matrices & Vectors
End
Assignment HW #20.5 Due Monday HW #21: Part 1 of Project #6 Just the problem formulation and representations No time limit Due Wednesday
Another Example