Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25.

Similar presentations


Presentation on theme: "CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25."— Presentation transcript:

1 CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25

2 Certificate of Optimality Corollary: Let f be any flow, and let (A, B) be any cut. If v(f) = cap(A, B), then f is a max flow and (A, B) is a min cut Value of flow = 28 Cut capacity = 28  Flow value  28 10 9 9 14 4 10 4 8 9 1 0 0 0 14 s 2 3 4 5 6 7 t 15 5 30 15 10 8 15 9 6 10 15 4 4 0 A

3 Max-Flow Min-Cut Theorem The Ford-Fulkerson algorithm terminates when the flow has not s-t path in the residual graph There exists a flow which has the same value of the minimum cut –Proof: Consider a flow where the residual graph has no s-t path with positive capacity –Let A be the set of vertices in the residual graph reachable from s with paths of positive capacity –What can we say about the flows and capacity between u and v? stuv A B PROOF DONE IN CLASS

4 Max-Flow Min-Cut Theorem Ford-Fulkerson algorithm finds a flow where the residual graph is disconnected, hence FF finds a maximum flow If we want to find a minimum cut, we begin by looking for a maximum flow

5 Problem Reduction Reduce Problem A to Problem B –Convert an instance of A to an instance of B –Use a solution of B to get a solution to A Practical –Use a program for B to solve A Theoretical –Show that B is at least as hard as A E.g., reduce the problem of finding the Maximum of a set of integers to finding the Minimum of a set of integers Network flow can be applied to many problems that on the surface do not resemble network flow

6 Bipartite Matching Input: Bipartite graph –A graph G = (V, E) is bipartite if V can be partitioned into sets L and R such that every edge in E has one end in L and the other end in R Goal: Find maximum cardinality matching –A matching is M  E with property that each node in V appears in at most one edge of M C 1 5 2 A E 3 B D4 professors courses can teach From Lecture #3: Five Representative Problems n k max-flow based algorithm

7 Bipartite Matching Bipartite matching –Input: undirected, bipartite graph G = (L  R, E) –M  E is a matching if each node appears in at most edge in M –Max matching: find a max cardinality matching 1 3 5 1' 3' 5' 2 4 2' 4' matching 1-2', 3-1', 4-5' RL

8 Bipartite Matching Bipartite matching –Input: undirected, bipartite graph G = (L  R, E) –M  E is a matching if each node appears in at most edge in M –Max matching: find a max cardinality matching 1 3 5 1' 3' 5' 2 4 2' 4' RL max matching 1-1', 2-2', 3-3' 4-4'

9 Converting Matching to Network Flow ts

10 Bipartite Matching Max flow formulation –Create digraph G' = (L  R  {s, t}, E' ) –Direct all edges from L to R, and assign unit capacity –Add source s, and unit capacity edges from s to each node in L –Add sink t, and unit capacity edges from each node in R to t s 1 3 5 1' 3' 5' t 2 4 2' 4' RL G'

11 Bipartite Matching: Proof of Correctness Theorem: Max cardinality matching in G = value of max flow in G‘. Pf.  –Given max matching M of cardinality k –Consider flow f that sends 1 unit along each of k paths –f is a flow, and has cardinality k s 1 3 5 1' 3' 5' t 2 4 2' 4' 1 3 5 1' 3' 5' 2 4 2' 4' G' G

12 Bipartite Matching: Proof of Correctness Theorem: Max cardinality matching in G = value of max flow in G'. Pf.  –Let f be a max flow in G' of value k –Consider M = set of edges from L to R with f(e) = 1 Each node in L and R participates in at most one edge in M |M| = k: consider cut (L  s, R  t) 1 3 5 1' 3' 5' 2 4 2' 4' G s 1 3 5 1' 3' 5' t 2 4 2' 4' G'


Download ppt "CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 25."

Similar presentations


Ads by Google