discrete mathematics tutorial 13
DESCRIPTION
Discrete Mathematics Tutorial 13. Chin [email protected]. Complete graph. A graph is complete if for every pair of vertices, there exists an edge between them e.g. Complete graph. Is this a complete graph ? Yes. Complete graph. Is this a complete graph ? No. Complete graph. - PowerPoint PPT PresentationTRANSCRIPT
Discrete MathematicsTutorial 13
Complete graph
• A graph is complete if for every pair of vertices, there exists an edge between them
• e.g.
Complete graph
• Is this a complete graph?
• Yes
Complete graph
• Is this a complete graph?
• No
Complete graph
• Is this a complete graph?
• No
Complete graph
• How many edges are there in a complete graph on n vertices?
Complete graph
• How many edges are there in a complete graph on n vertices?
Complete graph
• How many edges are there in a complete graph on n vertices?
• Proof idea of induction step
Complete graph
• If a graph on n vertices has n(n-1)/2 edges, is it always a complete graph?
• Proof by contradiction
Matching
• A matching is a subset of edges so that– Each vertex in the graph is incident to at most one
edge in the matching• i.e. each vertex has degree at most 1
• A vertex is matched if – It is incident to an edge in the matching
Matching
• Is the following a matching of the above graph?
• No
Matching
• Is the following a matching of the above graph?
• No
Matching
• Is the following a matching of the above graph?
• Yes
Perfect matching
• A matching is perfect if– Every vertex in the graph is matched– i.e. each vertex has degree exactly 1
Perfect matching
• Is there a perfect matching in this graph?
• No
Perfect matching
• Is there a perfect matching in this graph?
• Yes
Perfect matching
• How many perfect matching can you find in this graph?
Perfect matching
• How many perfect matching can you find in this graph?
Bipartite graph
• A graph is bipartite if you can partition the vertices into two sets for every edge– one end vertex belongs to one set, and– the other end vertex belongs to the other
• e.g.– vertices = boys and girls, edges = relationship– vertices = students and course, edges = enrollment
Bipartite graph
• Is this a bipartite graph?
• No.
Bipartite graph
• Is this a bipartite graph?
Bipartite graph
• Is this a bipartite graph?
2
5
1
4
3
6 2
51
4
3
6
Complete bipartite graph
• Is this a complete bipartite graph?
Complete bipartite graph
• Is this a complete bipartite graph?
Complete bipartite graph
• Is this a complete bipartite graph?
Complete bipartite graph
• How to check?– Count the degree of each vertex
5
5
5
4
55
5
5
4
5
Perfect matching
• Is there a perfect matching in this graph?
• Yes
Perfect matching
• Is there a perfect matching in this graph?
• No
Perfect matching
• Is there a perfect matching in this graph?
• Yes
Perfect matching
• How many perfect matching can you find in this graph?
Perfect matching
• How many perfect matching can you find in this graph?
Perfect matching
• How many perfect matching can you find in this graph?
Perfect matching
• How many perfect matching can you find in this graph?
Stable employment
• There are n positions in n hospitals, and m > n applicants– Every applicant has a list of preferences over the n
hospitals– Every hospital has a list of preferences over the m
applicants
• What is a stable employment in this case?
Stable employment
• An employment is unstable if one of the following holds1.
2.
a
b
1
2
1 > 2
b > a1 > 2
a > bhospitals applicants
a 1
2
1 > 2
a
a
hospitals applicants
Stable employment
• How to model this problem as stable marriage?
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c
a > b >c
hospitals applicants
3
4
5
b
c a > c > b
a > b > c
b > c > a
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
Stable employment
• We add dummy hospitals
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c
a > b >c
hospitals applicants
3
4
5
b
c a > c > b
a > b > c
b > c > a
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
d
e
Stable employment
• What are the new preference lists?
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c > d > e
a > b > c > d > e
hospitals applicants
3
4
5
b
c a > c > b > d > e
a > b > c > d > e
b > c > a > d > e
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
d
e
1 > 2 > 3 > 4 > 5
1 > 2 > 3 > 4 > 5
Stable employment
• Unstable pair employment corresponds to unstable marriage?
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c > d > e
a > b > c > d > e
hospitals applicants
3
4
5
b
c a > c > b > d > e
a > b > c > d > e
b > c > a > d > e
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
d
e
1 > 2 > 3 > 4 > 5
1 > 2 > 3 > 4 > 5
Stable employment
• Unstable pair of the form
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c > d > e
a > b > c > d > e
men women
3
4
5
b
c a > c > b > d > e
a > b > c > d > e
b > c > a > d > e
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
d
e
1 > 2 > 3 > 4 > 5
1 > 2 > 3 > 4 > 5
a
b
1
2
1 > 2
b > a1 > 2
a > bhospitals applicants
Stable employment
• Unstable pair of the form
a 1
2
1 > 2 > 3 > 4 > 5
b > a > c > d > e
a > b > c > d > e
men women
3
4
5
b
c a > c > b > d > e
a > b > c > d > e
b > c > a > d > e
3 > 1 > 2 > 5 > 4
2 > 3 > 5 > 1 > 4
d
e
1 > 2 > 3 > 4 > 5
1 > 2 > 3 > 4 > 5
a 1
2
1 > 2
a
a
hospitals applicants
Stable employment
• Does there always exist stable employment?
• We’ve just shown there is a correspondence between employment and marriage
• Since there is always a stable marriage, there always exists a stable employment.
Stable matching
• Show that a women can get a better partner by lying
• Men-optimal marriage:
a 1
2
3
b
c
men women
2 > 1 > 3
b > a > c
a > b > c
c > b > a
1 > 2 > 3
2 > 3 > 1
Stable marriage
• Woman 2 lies by using the following fake list– b > c > a
• and she gets a better partner:
a 1
2
3
b
c
men women
2 > 1 > 3
b > a > c
a > b > c
c > b > a
1 > 2 > 3
2 > 3 > 1
a 1
2
3
b
c
men women
2 > 1 > 3
b > c > a
a > b > c
c > b > a
1 > 2 > 3
2 > 3 > 1
Maximum matching
• What is the maximum matching of this graph?
Maximum matching
• What is the maximum matching of this graph?
Maximum matching
• Your chess club is playing a match against another club.– Each club enters N players into the match– Each player plays one game against a player from
the other team– Each game won is worth 2 points– Each game drawn is worth 1 points
• For each member of you team, you know who in the opposing team he can win.
• How to maximize your score?
Maximum matching
• e.g.– Your team = {a, b, c}– Opposing team = {1, 2, 3}
– You also know that• a can win 1 and 2• b can win 1• c can win no one
Maximum matching
• We can formulate this problem as finding maximum matching in the following bipartite graph:
a 1
2
3
b
c
your team opposing team
End
• Questions
• If you have questions before the exam, feel free to email me via:– [email protected]
• Good luck in the exam!