Consider a complete bipartite graph with sets A and B, each with n vertices.

Similar documents
COMP251: Bipartite graphs

COMP251: Bipartite graphs

PROBLEMS OF MARRIAGE Eugene Mukhin

Analysis of Algorithms Fall Some Representative Problems Stable Matching

Matchings in Graphs. Definition 3 A matching N in G is said to be stable if it does not contain a blocking pair.

Ma/CS 6b Class 3: Stable Matchings

1. REPRESENTATIVE PROBLEMS

Omega notation. Transitivity etc.

Ma/CS 6b Class 3: Stable Matchings

Bipartite Matchings and Stable Marriage

Stable Matching Existence, Computation, Convergence Correlated Preferences. Stable Matching. Algorithmic Game Theory.

1. REPRESENTATIVE PROBLEMS

CSC2556. Lecture 5. Matching - Stable Matching - Kidney Exchange [Slides : Ariel D. Procaccia]

Algorithm Design and Analysis

Game Theory: Lecture #5

Matching Theory and the Allocation of Kidney Transplantations

Matching Problems. Roberto Lucchetti. Politecnico di Milano

Algorithm Design and Analysis

Matching Problems. Roberto Lucchetti. Politecnico di Milano

CS320 Algorithms: Theory and Practice. Course Introduction

Algorithms. [Knuth, TAOCP] An algorithm is a finite, definite, effective procedure, with some input and some output.

What do you do when you can t use money to solve your problems?

Math 301: Matchings in Graphs

An improved approximation algorithm for the stable marriage problem with one-sided ties

1 Definitions and Things You Know

Matching and Stable Matching

Approximation and Randomized Algorithms (ARA) Lecture 1, September 3, 2012

Assignment 3 Logic and Reasoning KEY

Matching. Terence Johnson. April 17, University of Notre Dame. Terence Johnson (ND) Matching April 17, / 41

1. REPRESENTATIVE PROBLEMS

Subramanian s stable matching algorithm

Cheating to Get Better Roommates in a Random Stable Matching

We set up the basic model of two-sided, one-to-one matching

1. STABLE MATCHING. stable matching problem Gale Shapley algorithm hospital optimality context

1.1 First Problem: Stable Matching. Six medical students and four hospitals. Student Preferences. s6 h3 h1 h4 h2. Stable Matching Problem

The Complexity of the Comparator Circuit Value Problem

Two-Sided Matching. Terence Johnson. December 1, University of Notre Dame. Terence Johnson (ND) Two-Sided Matching December 1, / 47

Dynamic Matching under Preferences

CS 6901 (Applied Algorithms) Lecture 2

Lecture 5: The Principle of Deferred Decisions. Chernoff Bounds

Stable Marriage with Ties and Bounded Length Preference Lists

The key is that there are two disjoint populations, and everyone in the market is on either one side or the other

STABLE MARRIAGE PROBLEM WITH TIES AND INCOMPLETE BOUNDED LENGTH PREFERENCE LIST UNDER SOCIAL STABILITY

Matching Theory. Mihai Manea. Based on slides by Fuhito Kojima. MIT

Midterm 1. Your Exam Room: Name of Person Sitting on Your Left: Name of Person Sitting on Your Right: Name of Person Sitting in Front of You:

CS 598RM: Algorithmic Game Theory, Spring Practice Exam Solutions

Greedy Homework Problems

CPSC 320 Sample Final Examination December 2013

CPSC 320 Sample Solution, Reductions and Resident Matching: A Residentectomy

CSE 421 Algorithms. Richard Anderson Autumn 2015 Lecture 1

Stable matching. Carlos Hurtado. July 5th, Department of Economics University of Illinois at Urbana-Champaign

Algorithms: COMP3121/3821/9101/9801

Applying Predicate Detection to the Constrained Optimization Problems

THREE ESSAYS ON GAME THEORY. Demet Yilmazkuday. Dissertation. Submitted to the Faculty of the. Graduate School of Vanderbilt University

Improving Man-Optimal Stable Matchings by Minimum Change of Preference Lists

Complexity Theory Part II

Chapter 7 Matchings and r-factors

An Efficient Algorithm for Batch Stability Testing

The Man-Exchange Stable Marriage Problem

CS/SE 2C03. Sample solutions to the assignment 1.

The Generalized Stable Allocation Problem

Matching Residents to Hospitals

CPSC 320 Sample Solution, The Stable Marriage Problem

Algorithmics of Two-Sided Matching Problems

Two-Sided Matching. Terence Johnson. September 1, University of Notre Dame. Terence Johnson (ND) Two-Sided Matching September 1, / 37

Creating new worlds inside the computer. COS 116: 2/10/2011 Sanjeev Arora

The Complexity and Proof Complexity of the Comparator Circuit Value Problem

Dynamic Matching with a Fall-back Option

arxiv: v2 [cs.gt] 25 Jul 2014

A (ln 4)-Approximation Algorithm for Maximum Stable Matching with One-Sided Ties and Incomplete Lists

Strategic Behavior and Manipulation in Gender- Neutral Matching Algorithms

Egalitarian solutions in the stable roommates problem

CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand Midterm 1 Solutions

Two Algorithms for the Student-Project Allocation Problem

Stable Matching with Uncertain Pairwise Preferences

Local Search Approaches in Stable Matching Problems

Discrete Mathematics and Probability Theory Fall 2014 Anant Sahai Homework 3. This homework is due September 22, 2014, at 12:00 noon.

Friday Four Square! Today at 4:15PM, Outside Gates

Socially stable matchings in the Hospitals/Residents problem

Faster Algorithms For Stable Allocation Problems

Stable Matching Problems with Exchange Restrictions

CSE 417, Winter Introduc6on, Examples, and Analysis. Ben Birnbaum Widad Machmouchi

Combinatorial Optimisation, Problems I, Solutions Term /2015

M-saturated M={ } M-unsaturated. Perfect Matching. Matchings

Lecture 2: Just married

CSEP 521 Applied Algorithms. Richard Anderson Winter 2013 Lecture 1

Two Sided Matching: An Algorithm with both sides making proposals

1 Matchings in Non-Bipartite Graphs

Two s Company, Three s a Crowd: Stable Family and Threesome Roommates Problems

Stable Matching Beyond Bipartite Graphs

Theory of Computation

Graph Theory. Thomas Bloom. February 6, 2015

Input. A set of men M, and a set of women W.

A PARALLEL ALGORITHM TO SOLVE THE STABLE MARRIAGE PROBLEM. S. S. TSENG and R. C. T. LEE

APPROXIMATION ALGORITHMS FOR THE STABLE MATCHING PROBLEM

Complexity. CS 320, Fall Dr. Geri Georg, Instructor Some materials adapted from Prof. Wim Bohm.

Review Asympto&c Bounds

Chapter 29 out of 37 from Discrete Mathematics for Neophytes: Number Theory, Probability, Algorithms, and Other Stuff by J. M.

Distributed Stable Matching with Similar Preference Lists

Matching: The Theory. Muriel Niederle Stanford and NBER. September 26, 2011

Transcription:

When DFS discovers a non-tree edge, check if its two vertices have the same color (red or black). If all non-tree edges join vertices of different color then the graph is bipartite. (Note that all tree edges, by the definition of the coloring, join vertices of the different color). Note that this test is basically the same as the test in the claims above: two vertices in each non-tree edge also define a path in the tree. That path needs to be of odd length for the graph to be bipartite, since otherwise (the path is of even length), there would be a cycle of odd length.

Consider a complete bipartite graph with sets A and B, each with n vertices. Each member of set A has a preference ordering of the members of B. Each member of set B has a preference ordering of the members of A. The problem is usually explained in terms of men (A) and women (B). Think of these as preferences for marriage (matching). Algorithm for finding a matching (see next slide): Each A member proposes to a B, in order from most to least preferred. Each B member accepts the first proposal from an A, but then rejects that proposal if/when it receives a proposal from an A that it prefers more. (Men propose to women. Woman accept the first offer made to them, but women will drop their partner when/if a prefered man proposes to them.) Note the asymmetry between A and B.

Gale-Shapley algorithm (1962) for finding a perfect matching For each in A, let preflist( ) be the ordering of its B preferences. For each in B, let preflist( ) be the ordering of its A preferences. Let matching be a set of crossing edges between A and B. matching = empty set while there is in A that is not yet matched { // use a list of unmatched A's. = preflist( ).removefirst() if is not yet matched { // there is no ( ' in matching matching.add(, ) else // already matched if prefers over 's current match { // unstable matching.remove( 's current match, ) matching.add(, ) } } return matching Properties of the algorithm: If in B is not yet matched, then has not been proposed to yet (i.e. must accepts the first offer that comes along). 's match gets better (or stays the same) over time. (After in B is matched, will only change its match if it is proposed to by an that it prefers over its current match.) 's match worsens (or stays the same) over time. (Once in A is matched, it can become unmatched, namely if its current match accepts the offer of a different ' in A. We'll see that becomes matched again but, when it does, this match is less preferred.) Claim: the Gale-Shapley algorithm always finds a perfect matching. Proof: We show that when the algorithm terminates, every has a match. If in A is not matched during the algorithm, then: - there must be some in B that is not yet matched (because there are the same number of A's and B's.) What is the O( ) running time of the algorithm? A = B = n. Each pass through the main while loop reduces the size of the (remaining) preference list of one of the in A. Since there are n preferences lists for all the members of A, each list of length n, there are n^2 passes through the main loop. Hence the running time is O( n^2 ). - could not yet have proposed to this because an unmatched will always accept a proposal offer.) It cannot happen that the algorithm terminates in such a state, since still must have the chance to propose to Thus, every will eventually be matched (and since there are the same number in A and B, it follows that every will have a match too). When the algorithm terminates, what properties does the matching have? Is there a sense in which it is a good matching? Our intuition is that the A's have the advantage here. But in what technical sense? How can we characterize this advantage? We will deal with these questions shortly, but first we need to introduce the concept of a stable matching. What can happen in general with an arbitrary matching? Suppose there are two edges ( and ( in the matching and the preferences are such that would prefer to be matched with and similarly would prefer to be matched with If the two above matches/edges are deleted so that (, ) can match up, then and would become unmatched. would go down its preference list and seek another match which could lead to a chain a broken matches. In this situation, we say that the matching is not stable (or unstable). A matching is stable when there are no two elements, and that prefer each other over their partners.

Claim: the Gale-Shapley algorithm finds a stable matching. Proof: Suppose we run the algorithm and it gives us matches ( and ( Could it happen that prefers over and prefers over? No, that can't happen. Why not? If prefered over then would have proposed to before it proposed to But since is matched with we know that must have rejected 's proposal in favor of someone that it preferred more than Since can only improve its matches over time and it ended up matched with it follows that prefers over (not over Is the match found by the Gale-Shapley algorithm the only stable matching? Not necessarily. Sometimes there is more than one. For example, suppose that the first choices of each of the A's were different from each other. Then Gale-Shapley would give each of the A's their first choice. Now further suppose the B's first choices (most preferred) were also different from each other, and that the B's first choices don't correspond to the A's first choices. If we were to swap the roles of A and B in the algorithm and run this algorithm, then we would end up with a different matching than before, namely a matching in which each in B would get its first choice instead of each in A getting its first choice (recall what we assumed above). Both algorithms work with the same A and B preferences, and both give stable matchings. Thus, in this example at least, there exist two different stable matchings. We will see next that the Gale-Shapley algorithm finds the best possible stable matching, where "best" is defined from the perspective of the A's. Definition: Given A and B and their preferences, a particular edge ( in the complete bipartite graph is valid if there exists a stable perfect matching between A and B that contains (. Note: the algorithm finds stable matchings, hence it finds only valid edges. Definition: Given A and B and their preferences, for each define bestvalid( to be the in B that ( is a valid edge and it is a better match from 's perspective than any other valid edge. Claim: The Gale-Shapley algorithm yields the matching: { ( bestvalid( for all in A Proof: The proof is similar to the proof that the (Gale-Shapley) algorithm finds a stable matching. Suppose the claim were not true. This means that, during the execution of the algorithm, some in A would be rejected by bestvalid( and so would end up matched to an element of B that it preferred less. If such an event occurs, then there must be a first time that it occurs. Assume without loss of generality that the above rejection of by bestvalid( is the first time such an event occurs. Let ' in A be the one that caused this rejection (by proposing to and so, at the time of rejection, we have:

Since ( is a valid edge, there must exist a stable matching that contains it. For that stable matching, ' is matched with ', like so: But since prefers ' over and since the matching shown above is stable, it must be that ' prefers ' over. Can this be the case? No. If ' prefered ' over then ' would have proposed to ' before it proposed to Recall that ' had not been rejected by any of its valid matches when it proposed to Definition: Given A and B and their preferences, for each in B, define worstvalid( to be the valid in A that prefers least. (Here "valid" is relative to the particular Claim: Gale-Shapley finds the worst valid matching for each of the B's. Proof: By contradiction. Suppose that, for some, the algorithm finds a match ( ) where is not the worst possible match for. I didn't have time to do this proof in class. So I have included it as an Exercise. Since the Gale-Shapley algorithm finds the best valid matching for each of the A's and the worst valid matchings for each of the B's, it follows that Gale- Shapley finds the perfect matching: Related Problems - "stable roommate problem": this is just the stable marriage problem where we allow straight and gay marriage (but no polygamy). The problem is to put all people together into one set, and then each person now ranks all others. The problem again is to find a stable perfect matching (assuming there is an even number of people). It can be shown that there does not necessarily exist a stable matching in this case. (Algorithms have been invented for deciding if a stable matching exists, and finding the stable matching if they do exist.) - "hospital/residents problem" (or employer/employee problem, or college/admissions problem): An employer might have several positions open. Very similar to the stable marriage problem. http://en.wikipedia.org/wiki/hospital_resident#matching_algorithm { (, bestvalid( ) ) : in A } = { (worstvalid( ), ) : in B}.