Discrete Mathematics Tutorial 13

# Discrete Mathematics Tutorial 13

Télécharger la présentation

## Discrete Mathematics Tutorial 13

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Discrete MathematicsTutorial 13 Chin chlee@cse.cuhk.edu.hk

2. Complete graph • A graph is complete if for every pair of vertices, there exists an edge between them • e.g.

3. Complete graph • Is this a complete graph? • Yes

4. Complete graph • Is this a complete graph? • No

5. Complete graph • Is this a complete graph? • No

6. Complete graph • How many edges are there in a complete graph on n vertices?

7. Complete graph • How many edges are there in a complete graph on n vertices?

8. Complete graph • How many edges are there in a complete graph on n vertices? • Proof idea of induction step

9. Complete graph • If a graph on n vertices has n(n-1)/2 edges, is it always a complete graph? • Proof by contradiction

10. 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

11. Matching • Is the following a matching of the above graph? • No

12. Matching • Is the following a matching of the above graph? • No

13. Matching • Is the following a matching of the above graph? • Yes

14. Perfect matching • A matching is perfect if • Every vertex in the graph is matched • i.e. each vertex has degree exactly 1

15. Perfect matching • Is there a perfect matching in this graph? • No

16. Perfect matching • Is there a perfect matching in this graph? • Yes

17. Perfect matching • How many perfect matching can you find in this graph?

18. Perfect matching • How many perfect matching can you find in this graph?

19. 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

20. Bipartite graph • Is this a bipartite graph? • No.

21. Bipartite graph • Is this a bipartite graph?

22. Bipartite graph • Is this a bipartite graph? 5 1 2 3 1 3 4 5 6 4 6 2

23. Complete bipartite graph • Is this a complete bipartite graph?

24. Complete bipartite graph • Is this a complete bipartite graph?

25. Complete bipartite graph • Is this a complete bipartite graph?

26. Complete bipartite graph • How to check? • Count the degree of each vertex 5 5 5 4 5 5 5 4 5 5

27. Perfect matching • Is there a perfect matching in this graph? • Yes

28. Perfect matching • Is there a perfect matching in this graph? • No

29. Perfect matching • Is there a perfect matching in this graph? • Yes

30. Perfect matching • How many perfect matching can you find in this graph?

31. Perfect matching • How many perfect matching can you find in this graph?

32. Perfect matching • How many perfect matching can you find in this graph?

33. Perfect matching • How many perfect matching can you find in this graph?

34. 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?

35. 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

36. 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

37. 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

38. 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

39. 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

40. 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

41. 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

42. 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.

43. 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

44. 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

45. Maximum matching • What is the maximum matching of this graph?

46. Maximum matching • What is the maximum matching of this graph?

47. 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?

48. 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

49. 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

50. 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!