10.4 How to Find a Perfect Matching We have a condition for the existence of a perfect matching in a graph that is necessary and sufficient. Does this.

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

CS 336 March 19, 2012 Tandy Warnow.
Great Theoretical Ideas in Computer Science
Chapter 8 Topics in Graph Theory
CSE 636 Data Integration Conjunctive Queries Containment Mappings / Canonical Databases Slides by Jeffrey D. Ullman.
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Great Theoretical Ideas in Computer Science for Some.
1 Discrete Structures & Algorithms Graphs and Trees: III EECE 320.
Approximation, Chance and Networks Lecture Notes BISS 2005, Bertinoro March Alessandro Panconesi University La Sapienza of Rome.
Section 7.4: Closures of Relations Let R be a relation on a set A. We have talked about 6 properties that a relation on a set may or may not possess: reflexive,
Lectures on Network Flows
Great Theoretical Ideas in Computer Science.
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
R. Bar-Yehuda © 1 קומבינטוריקה למדעי - המחשב – הרצאה #17 Chapter 2: TREES מבוסס על הספר : S. Even, "Graph Algorithms",
CS5371 Theory of Computation
Increasing graph connectivity from 1 to 2 Guy Kortsarz Joint work with Even and Nutov.
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
1 Perfect Matchings in Bipartite Graphs An undirected graph G=(U  V,E) is bipartite if U  V=  and E  U  V. A 1-1 and onto function f:U  V is a perfect.
1 Bipartite Matching Lecture 3: Jan Bipartite Matching A graph is bipartite if its vertex set can be partitioned into two subsets A and B so that.
Matching Polytope, Stable Matching Polytope Lecture 8: Feb 2 x1 x2 x3 x1 x2 x3.
3/24/03Tucker, Section 4.31 Tucker, Applied Combinatorics, Sec. 4.3, prepared by Jo E-M Bipartite GraphMatching Some Definitions X-Matching Maximal Matching.
Complexity ©D.Moshkovitz 1 Paths On the Reasonability of Finding Paths in Graphs.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Minimal Spanning Trees What is a minimal spanning tree (MST) and how to find one.
Called as the Interval Scheduling Problem. A simpler version of a class of scheduling problems. – Can add weights. – Can add multiple resources – Can ask.
Induction and recursion
 Jim has six children.  Chris fights with Bob,Faye, and Eve all the time; Eve fights (besides with Chris) with Al and Di all the time; and Al and Bob.
7 Graph 7.1 Even and Odd Degrees.
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Copyright © Cengage Learning. All rights reserved. 2 Descriptive Analysis and Presentation of Single-Variable Data.
The Pumping Lemma for Context Free Grammars. Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar.
10 Matchings in Graphs 10.1 A Dancing Problem
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
 2004 SDU Lecture 7- Minimum Spanning Tree-- Extension 1.Properties of Minimum Spanning Tree 2.Secondary Minimum Spanning Tree 3.Bottleneck.
10.3 The Main Theorem. Theorem (The Marriage Theorem) A bipartite graph has a perfect matching if and only if IAI = IBI and for any subset of (say)
Graph Colouring L09: Oct 10. This Lecture Graph coloring is another important problem in graph theory. It also has many applications, including the famous.
Bipartite Matching. Unweighted Bipartite Matching.
1 Decomposition into bipartite graphs with minimum degree 1. Raphael Yuster.
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Chapter 9 Finding the Optimum 9.1 Finding the Best Tree.
Matching Lecture 19: Nov 23.
Chapter 8 Maximum Flows: Additional Topics All-Pairs Minimum Value Cut Problem  Given an undirected network G, find minimum value cut for all.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
1 Finding a decomposition of a graph T into isomorphic copies of a graph G is a classical problem in Combinatorics. The G-decomposition of T is balanced.
Introduction to Graph Theory
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
COSC 3101A - Design and Analysis of Algorithms 14 NP-Completeness.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Greedy Algorithms.
Graphs Hubert Chan (Chapter 9) [O1 Abstract Concepts]
Bipartite Matching Lecture 8: Oct 7.
Chapter 2 Sets and Functions.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Bipartite Graphs What is a bipartite graph?
Algorithms and Networks
Algorithm Design and Analysis
Lectures on Network Flows
Chapter 5. Optimal Matchings
Discrete Mathematics for Computer Science
Maximal Independent Set
Instructor: Shengyu Zhang
Bipartite Graph 1. A graph G is bipartite if the node set V can be partitioned into two sets V1 and V2 in such a way that no nodes from the same set are.
5.4 T-joins and Postman Problems
Switching Lemmas and Proof Complexity
Presentation transcript:

10.4 How to Find a Perfect Matching We have a condition for the existence of a perfect matching in a graph that is necessary and sufficient. Does this condition settle this issue once and for all? To be more precise: Suppose that somebody gives us a bipartite graph; what is a good way to decide whether it contains a perfect matching? And how do we find a perfect matching if there is one?

We may assume that IAI = IBI (where, as before, A is the set of nodes on the left and B is the set of nodes on the right). This is easy to check, and if it fails, then it is obvious that no perfect matching exists, and we have nothing else to do. One thing we can try is to look at all subsets of the edges, and see whether any of these is a perfect matching. It is easy enough to do so; but there are terribly many subsets to check! Say, in our introductory example, we have 300 nodes, so IAI = IBI = 150; every node has degree 50, so the number of edges is 150· 50 = 7500; the number of subsets of a set of this size is 2 > 10, a number that is more than astronomical. We can do a little bit better if instead of checking all subsets of the edges, we look at all possible ways to pair up elements of A with elements of B, and check whether any of these pairings matches only nodes that are connected to each other by an edge. Now the number of ways to pair up the nodes is "only" 150! :::;, 10. Still hopeless

Can we use Theorem ? To check that the necessary and sufficient condition for the existence of a perfect matching is satisfied, we have to look at every subset S of A, and see whether the number of it neighbors in B is at least as large as S itself. Since the set A has 2 ≒ 10 subsets, this takes a much smaller number of cases to check than any of the previous possibilities, but still astronomical! So Theorem does not really help too much in deciding whether a given graph has a perfect matching. We have seen that it does help in proving that certain properties of a graph imply that the graph has a perfect matching. We'll come back to this theorem later and discuss its significance. Right now, we have to find some other way to deal with our problem. Let us introduce one more expression: By a matching we mean a set of edges that have no endpoint in common. A perfect matching is the special case when, in addition, the edges cover all the nodes. But a matching can be much smaller: the empty set, or any edge by itself, is a matching

Let's try to construct a perfect matching in our graph by starting with the empty set and building up a matching one by one. So we select two nodes that are connected, and mark the edge between them; then we select two other nodes that are connected, and mark the edge between them etc. we can do this until no two unmatched nodes are connected by an edge. The edges we have marked form a matching M. This is often called the greedy matching, since it is constructed greedily, without consideration for the future consequences of our choice. If we are lucky, then the greedy matching is perfect, and we have nothing else to do. But what do we do if M is not perfect? Can we conclude that the graph has no perfect matching at all? No, we cannot; it may happen that the graph has a perfect matching, but we made some unlucky choices when selecting the edges of M. The trick is the following. We look for a path P in G of the following type: P starts and ends at nodes u and v that are unmatched by M; and every second edge of P belongs to M (Figure 10.6). Such a path is called an augmenting path. It is clear that an augmenting path P contains an odd number of edges, and in fact, the number of its edges not in M is one larger than the number of its edges in M.

If we find an augmenting path P, we can delete those edges of P that are in M and replace them by those edges of P that are not in M. It is clear that this results in a matching M' that is larger than M by one edge. (The fact that M' is a matching follows from the observation that the remaining edges of M cannot contain any node of P: The two endpoints of P were supposed to be unmatched, while the interior nodes of P were matched by edges of M that we deleted.) So we can repeat this until we get either a perfect matching or a matching M for which no augmenting path exists. Let U be the set of unmatched nodes in A and let W be the set of unmatched nodes in B. As we noted, any augmenting path must have an odd number of edges, and hence it must connect a node in U to a node in W. Let us try to find such an augmenting path starting from some node in U. Let's say that a path Q is almost augmenting if it starts at a node in U, ends at a node in A, and every second edge of it belongs to M. An almost augmenting path must have an even number of edges, and must end with an edge of M.

We look for an edge that connects a node s ∈ S to some node r ∈ B that is not in T. Let Q be an almost augmenting path starting at some node u ∈ U and ending at s. Now there are two cases to consider: - If r is unmatched (which means that it belongs to W), then by appending the edge sr to Q we get an augmenting path P. So we can increase the size of M (and forget about Sand T). - If r is matched with a node q E A, then we can append the edges sr and rq to Q to get an almost augmenting path from U to q. So we can add q to S.

(a) The graph in which we want to find a perfect matching. (b) Pick a starting matching, and mark the unmatched nodes. There are 3 black and 3 white unmatched nodes. Broken lines indicate an augmenting path. (c) The new matching and the unmatched nodes after augmentation. Broken lines indicate a new augmenting path (much longer this time).

(d) The final situation: Nodes that are accessible on almost augmenting paths are marked black.