170 likes | 232 Views
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License . CS 312: Algorithm Analysis. Lecture #28: Network Flow and Cuts. Slides by: Eric Ringger, with contributions from Mike Jones. Objectives.
E N D
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License. CS 312: Algorithm Analysis Lecture #28: Network Flow and Cuts Slides by: Eric Ringger, with contributions from Mike Jones
Objectives • Understand the idea of “changing the problem” in the max flow algorithm • Solve min-cut (using max-flow) • Solve Bipartite Matching (using max-flow) • See example of Padded matrix-vector representation
Volunteer 6 4 b e 2 s 4 2 t d f 2 4 4
Max Flow • Key points • 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.
Cut L: Source Side R: Sink Side An (s,t)-cut partitions the vertices into two disjoint sets: L contains s R contains t 6 4 b e 2 s 4 2 t To compute the capacity of a cut, add up the capacitiesof edges that flow across the cut from L to R (not R to L!). d f 2 4 4
Max-flow min-cut Theorem 6 4 b e 2 s 4 2 t d f 2 4 4 Max flow is less than or equal to the capacity of any cut. Max flow is equal to the capacity of the min cut.
We can now find the min cut in the original graph by finding all of the nodes that are reachable from the source in the final residual graph . The min cut value is equal to the max flow.
Bipartite Matching • We can use our solution to the max-flow problem to find maximal matchings.
Big ideas • Max-flow is a nice graphical version of the Simplex algorithm • Proceed greedily, but use slack variables so that you can change your decisions later on. • Find a quick & dirty solution (not necessarily optimal) in order to remove some slack from the problem; then transform the problem and try again! • Max-flow can be used to solve other interesting problems • Min-cut • Matching
LP: Padded Matrices & Vectors Standard Form (Step #1) Subject to: Matrix/vector notation (Step #1) Subject to: Where is an optional constant in the objective function Standard Form (Step #2) Subject to: Matrix/vector notation (Step #2) Subject to: Where are the indices of the nonbasic (original) variables and are the indices of the basic (slack) variables.
Project #6 • Linear Programming • Important: LP Notes available on the schedule • Works through the ideas up through the Simplex algorithm • Sets you up to succeed on project #6 • Includes the pseudo-code for Simplex (and Pivot) • HW #21: • Formulate problem for Proj. #6 • NO 2-hour time limit • Early day: next Thursday • Due: next Friday • How to Test: Use online solver to verify your result!