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
![Page 2: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/2.jpg)
Complete graph
• A graph is complete if for every pair of vertices, there exists an edge between them
• e.g.
![Page 3: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/3.jpg)
Complete graph
• Is this a complete graph?
• Yes
![Page 4: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/4.jpg)
Complete graph
• Is this a complete graph?
• No
![Page 5: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/5.jpg)
Complete graph
• Is this a complete graph?
• No
![Page 6: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/6.jpg)
Complete graph
• How many edges are there in a complete graph on n vertices?
![Page 7: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/7.jpg)
Complete graph
• How many edges are there in a complete graph on n vertices?
![Page 8: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/8.jpg)
Complete graph
• How many edges are there in a complete graph on n vertices?
• Proof idea of induction step
![Page 9: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/9.jpg)
Complete graph
• If a graph on n vertices has n(n-1)/2 edges, is it always a complete graph?
• Proof by contradiction
![Page 10: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/10.jpg)
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
![Page 11: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/11.jpg)
Matching
• Is the following a matching of the above graph?
• No
![Page 12: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/12.jpg)
Matching
• Is the following a matching of the above graph?
• No
![Page 13: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/13.jpg)
Matching
• Is the following a matching of the above graph?
• Yes
![Page 14: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/14.jpg)
Perfect matching
• A matching is perfect if– Every vertex in the graph is matched– i.e. each vertex has degree exactly 1
![Page 15: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/15.jpg)
Perfect matching
• Is there a perfect matching in this graph?
• No
![Page 16: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/16.jpg)
Perfect matching
• Is there a perfect matching in this graph?
• Yes
![Page 17: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/17.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 18: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/18.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 19: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/19.jpg)
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
![Page 20: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/20.jpg)
Bipartite graph
• Is this a bipartite graph?
• No.
![Page 21: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/21.jpg)
Bipartite graph
• Is this a bipartite graph?
![Page 22: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/22.jpg)
Bipartite graph
• Is this a bipartite graph?
2
5
1
4
3
6 2
51
4
3
6
![Page 23: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/23.jpg)
Complete bipartite graph
• Is this a complete bipartite graph?
![Page 24: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/24.jpg)
Complete bipartite graph
• Is this a complete bipartite graph?
![Page 25: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/25.jpg)
Complete bipartite graph
• Is this a complete bipartite graph?
![Page 26: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/26.jpg)
Complete bipartite graph
• How to check?– Count the degree of each vertex
5
5
5
4
55
5
5
4
5
![Page 27: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/27.jpg)
Perfect matching
• Is there a perfect matching in this graph?
• Yes
![Page 28: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/28.jpg)
Perfect matching
• Is there a perfect matching in this graph?
• No
![Page 29: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/29.jpg)
Perfect matching
• Is there a perfect matching in this graph?
• Yes
![Page 30: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/30.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 31: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/31.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 32: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/32.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 33: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/33.jpg)
Perfect matching
• How many perfect matching can you find in this graph?
![Page 34: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/34.jpg)
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?
![Page 35: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/35.jpg)
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
![Page 36: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/36.jpg)
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
![Page 37: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/37.jpg)
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
![Page 38: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/38.jpg)
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
![Page 39: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/39.jpg)
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
![Page 40: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/40.jpg)
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
![Page 41: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/41.jpg)
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
![Page 42: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/42.jpg)
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.
![Page 43: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/43.jpg)
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
![Page 44: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/44.jpg)
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
![Page 45: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/45.jpg)
Maximum matching
• What is the maximum matching of this graph?
![Page 46: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/46.jpg)
Maximum matching
• What is the maximum matching of this graph?
![Page 47: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/47.jpg)
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?
![Page 48: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/48.jpg)
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
![Page 49: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/49.jpg)
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
![Page 50: Discrete Mathematics Tutorial 13](https://reader036.vdocuments.mx/reader036/viewer/2022070419/56815c5f550346895dca66c2/html5/thumbnails/50.jpg)
End
• Questions
• If you have questions before the exam, feel free to email me via:– [email protected]
• Good luck in the exam!