This preview shows pages 1–11. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Algorithms – Matchings Matchings Design and Analysis of Algorithms Andrei Bulatov Algorithms – Matchings 112 Matchings A matching M of a graph G = (V,E) is a set of edges such that every vertex is incident to at most one edge from M Bipartite graphs: bipartition X, Y The Bipartite Matching Problem Instance : A bipartite graph G Objective : Find a matching in G of maximal size Algorithms – Matchings 113 Algorithm We show how to reduce the Bipartite Matching problem to Network Flow Let G be a bipartite graph with bipartition X, Y orient all edges from X to Y add source s and sink t add arcs from s to all nodes in X, and from all nodes in Y to t set the weight of all arcs to be 1 t s Algorithms – Matchings 114 Analysis Lemma Suppose there is a matching of G containing k edges. Then there is a flow in G’ of value k ) , ( , ), , ( ), , ( 2 2 1 1 k k y x y x y x K Proof Straightforward t s Algorithms – Matchings 115 Analysis (cntd) Lemma Suppose there is a flow in G’ of value k, the there is a matching of G containing k edges. Proof t f be a flow in G’ of value k. Let f be a flow in G’ of value k. Since all capacities in G’ are integer, there is an integer flow of value at least k. So we can assume f is integer. f(e) equals 0 or 1 for every edge e Let M be the set of arc with the flow value 1 Algorithms – Matchings 116 Analysis (cntd) M contains k edges Indeed, consider the cut (A,B) with A = X ∪ {s} The value of the flow through the cut equals the number of arcs from X to Y where the flow is nonzero he set of such arcs is exactly the set M The set of such arcs is exactly the set M Every node from X is the beginning of at most one arc from M It follows straightforwardly from the conservation property Every node from Y is the end of at most one arc from M Same argument Therefore M is a matching Algorithms – Matchings 117 Running Time roof Theorem The FordFalkerson algorithm can be used to find a maximal matching in a bipartite graph in O(mn) time Proof We can assume that G has no isolated vertices, and so m ≥ n/2 The maximal value of a flow in G’ does not exceed C = c(s) = X ≤ n By the theorem on the running time of the F.F. algorithm, it runs in O(mC) = O(mn) time QED Algorithms – Matchings 118 Augmenting Paths in Bipartite Graphs There is another algorithm for Bipartite Matching. It finds alternating paths t s Algorithms – Matchings 119 Perfect Matching and Hall’s Theorem If both parts of a bipartite graph have the same number of elements , a perfect matching can exist, that is a matching that includes all vertices of the graph How is it possible that a bipartite graph does not have a perfect matching If there is A ⊆ X such that for the set of neighbors N(A) N(A) ≤ A (or same for Y) Theorem (Hall) If G is a bipartite graph, and for any A ⊆ X and any B ⊆ Y, we have A ≤ N(A), B ≤ N(B), then there is a perfect matching of G. Algorithms – Matchings 1110 Perfect Matching and Hall’s Theorem (cntd)...
View
Full
Document
This note was uploaded on 11/11/2009 for the course CS 405/705 taught by Professor Bulatov during the Fall '09 term at Simon Fraser.
 Fall '09
 Bulatov
 Algorithms

Click to edit the document details