510 likes | 726 Views
Discrete Mathematics Tutorial 13. Chin chlee@cse.cuhk.edu.hk. 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.
E N D
Discrete MathematicsTutorial 13 Chin chlee@cse.cuhk.edu.hk
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? 5 1 2 3 1 3 4 5 6 4 6 2
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 5 5 5 4 5 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 holds hospitals applicants 1 > 2 a > b a 1 1 > 2 b > a b 2 hospitals applicants 1 > 2 a a 1 a 2
Stable employment • How to model this problem as stable marriage? hospitals applicants 1 > 2 > 3 > 4 > 5 a > b >c a 1 3 > 1 > 2 > 5 > 4 b > a > c b 2 2 > 3 > 5 > 1 > 4 a > c > b c 3 a > b > c 4 b > c > a 5
Stable employment • We add dummy hospitals hospitals applicants 1 > 2 > 3 > 4 > 5 a > b >c a 1 3 > 1 > 2 > 5 > 4 b > a > c b 2 2 > 3 > 5 > 1 > 4 a > c > b c 3 a > b > c d 4 b > c > a e 5
Stable employment • What are the new preference lists? hospitals applicants 1 > 2 > 3 > 4 > 5 a > b > c > d > e a 1 3 > 1 > 2 > 5 > 4 b > a > c > d > e b 2 2 > 3 > 5 > 1 > 4 a > c > b > d > e c 3 1 > 2 > 3 > 4 > 5 a > b > c > d > e d 4 1 > 2 > 3 > 4 > 5 b > c > a > d > e e 5
Stable employment • Unstable pair employment corresponds to unstable marriage? hospitals applicants 1 > 2 > 3 > 4 > 5 a > b > c > d > e a 1 3 > 1 > 2 > 5 > 4 b > a > c > d > e b 2 2 > 3 > 5 > 1 > 4 a > c > b > d > e c 3 1 > 2 > 3 > 4 > 5 a > b > c > d > e d 4 1 > 2 > 3 > 4 > 5 b > c > a > d > e e 5
Stable employment • Unstable pair of the form men women hospitals applicants 1 > 2 > 3 > 4 > 5 a > b > c > d > e a 1 1 > 2 a > b a 1 3 > 1 > 2 > 5 > 4 b > a > c > d > e b 2 1 > 2 b > a b 2 2 > 3 > 5 > 1 > 4 a > c > b > d > e c 3 1 > 2 > 3 > 4 > 5 a > b > c > d > e d 4 1 > 2 > 3 > 4 > 5 b > c > a > d > e e 5
Stable employment • Unstable pair of the form men women 1 > 2 > 3 > 4 > 5 a > b > c > d > e a 1 3 > 1 > 2 > 5 > 4 b > a > c > d > e b 2 2 > 3 > 5 > 1 > 4 a > c > b > d > e c 3 hospitals applicants 1 > 2 > 3 > 4 > 5 a > b > c > d > e d 4 1 > 2 a a 1 1 > 2 > 3 > 4 > 5 b > c > a > d > e e 5 a 2
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: men women 2 > 1 > 3 a > b > c a 1 1 > 2 > 3 b > a > c b 2 2 > 3 > 1 c > b > a c 3
Stable marriage • Woman 2 lies by using the following fake list • b > c > a • and she gets a better partner: men men women women 2 > 1 > 3 2 > 1 > 3 a > b > c a > b > c a a 1 1 1 > 2 > 3 1 > 2 > 3 b > a > c b > c > a b b 2 2 2 > 3 > 1 2 > 3 > 1 c > b > a c > b > a c c 3 3
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: opposing team your team a 1 b 2 c 3
End • Questions • If you have questions before the exam, feel free to email me via: • chlee@cse.cuhk.edu.hk • Good luck in the exam!