Overview of Graph Theory Addendum “The Stable Marriage

Download Report

Transcript Overview of Graph Theory Addendum “The Stable Marriage

Overview of Graph Theory
Addendum
“The Stable Marriage Problem”
Instructor: Carlos Pomalaza-Ráez
Fall 2003
University of Oulu, Finland
1
The Stable Marriage Problem
Problem: Given N men and N women, find a "suitable" matching
between men and women
The problem and the solution can be represented as a bipartite graph
Men
Women
Raimo
Eeva
Saku
Anne
Tarmo
Miina
Urho
Inka
Vesa
Katri
Edges represent all possible matching.
Matching (M) means to select some of the
edges according to some criteria.
Perfect Matching: each man gets exactly
one woman; each woman gets exactly one
man
A matching is unstable if there is a pair,
e.g. (Raimo, Anne), who like each other
more than their spouses; they can improve
their situation by dumping spouses and
eloping
Gale-Shapley Theorem: A stable marriage
always possible, and found in O(n2) time.
2
Matchmaker, Matchmaker, Make Me A Match!
The Gale-Shapley Algorithm
 Each man lists women in order of preference from best to worst
 Each woman lists men in order of preference
Men’s Preference List
Man
Women’s Preference List
Woman
1st
2nd
3rd
4th
5th
Raimo
Anne
Eeva
Inka
Katri
Miina
Eeva
Saku
Inka
Anne
Eeva
Miina
Katri
Tarmo
Anne
Katri
Miina
Inka
Urho
Eeva
Inka
Miina
Vesa
Anne
Inka
Eeva
best
2nd
3rd
4th
Vesa
Raimo
Saku
Urho
Anne
Tarmo
Saku
Urho
Raimo Vesa
Eeva
Miina
Saku
Tarmo
Urho
Vesa
Raimo
Anne
Katri
Inka
Raimo
Vesa
Urho
Tarmo
Saku
Katri
Miina
Katri
Urho
Saku
Vesa
Tarmo
Raimo
worst
1st
best
5th
Tarmo
worst
 All people begin unengaged
 While there are unengaged men, each proposes until a woman accept
 Unengaged women accept 1st proposal they get
 If an engaged woman receives a proposal she likes better, she breaks old engagement and
accepts new proposal; dumped man begins proposing where he left off
3
Gale-Shapley Algorithm
Results of G-S algorithm are always stable
 It requires two people of opposite sex in different couples to break up a marriage
 If a man wants to leave for some woman, then he already proposed to her and she
rejected him, so she won’t leave her husband for him
Man
Woman
2nd
3rd
Urho
Tarmo
Vesa
Anne
Tarmo
Urho
Vesa
Miina
Tarmo
Urho
Vesa
2nd
3rd
Urho
Tarmo
Vesa
Anne
Tarmo
Urho
Vesa
Miina
Tarmo
Urho
Vesa
1st
2nd
3rd
Tarmo
Eeva
Anne
Miina
Eeva
Urho
Anne
Eeva
Miina
Vesa
Eeva
Anne
Miina
Man
1st
2nd
3rd
Tarmo
Eeva
Anne
Miina
Eeva
Urho
Anne
Eeva
Miina
Vesa
Eeva
Anne
Miina
Woman
1st
1st
is a perfect
matching but unstable
because (Anne, Tarmo)
prefer each other to
current partners
is a perfect stable
matching
 When men propose
we call it M0
 When woman
propose we call it M1
4
Gale-Shapley Algorithm
Man
Woman
2nd
3rd
Urho
Tarmo
Vesa
Anne
Tarmo
Urho
Vesa
Miina
Tarmo
Urho
Vesa
1st
2nd
3rd
Tarmo
Eeva
Anne
Miina
Eeva
Urho
Anne
Eeva
Miina
Vesa
Eeva
Anne
Miina
1st
is a also perfect
stable matching but now
Eeva and Anne are
better of than on the
previous matching
What happens when men do the proposing?
 Each man has the best partner he can have in any stable marriage
 Each woman has the worst partner she can have in any stable marriage
 G-S always produces same stable marriage - order of proposals is irrelevant
Final observations
 Historically, men propose to women. Why it has to be that way?
 Men: propose early and often
 Women: ask out the guys
Reference: The Stable Marriage Problem: Structure and Algorithms (Foundations of Computing) by Dan
Gusfield and Robert Irving, MIT Press, 1989.
5