discrete mathematics tutorial 13

50
Discrete Mathematics Tutorial 13 Chin [email protected]

Upload: devona

Post on 10-Feb-2016

34 views

Category:

Documents


0 download

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 Presentation

TRANSCRIPT

Page 1: Discrete Mathematics Tutorial 13

Discrete MathematicsTutorial 13

[email protected]

Page 2: Discrete Mathematics Tutorial 13

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

Complete graph

• Is this a complete graph?

• Yes

Page 4: Discrete Mathematics Tutorial 13

Complete graph

• Is this a complete graph?

• No

Page 5: Discrete Mathematics Tutorial 13

Complete graph

• Is this a complete graph?

• No

Page 6: Discrete Mathematics Tutorial 13

Complete graph

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

Page 7: Discrete Mathematics Tutorial 13

Complete graph

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

Page 8: Discrete Mathematics Tutorial 13

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

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

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

Matching

• Is the following a matching of the above graph?

• No

Page 12: Discrete Mathematics Tutorial 13

Matching

• Is the following a matching of the above graph?

• No

Page 13: Discrete Mathematics Tutorial 13

Matching

• Is the following a matching of the above graph?

• Yes

Page 14: Discrete Mathematics Tutorial 13

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

Perfect matching

• Is there a perfect matching in this graph?

• No

Page 16: Discrete Mathematics Tutorial 13

Perfect matching

• Is there a perfect matching in this graph?

• Yes

Page 17: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 18: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 19: Discrete Mathematics Tutorial 13

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

Bipartite graph

• Is this a bipartite graph?

• No.

Page 21: Discrete Mathematics Tutorial 13

Bipartite graph

• Is this a bipartite graph?

Page 22: Discrete Mathematics Tutorial 13

Bipartite graph

• Is this a bipartite graph?

2

5

1

4

3

6 2

51

4

3

6

Page 23: Discrete Mathematics Tutorial 13

Complete bipartite graph

• Is this a complete bipartite graph?

Page 24: Discrete Mathematics Tutorial 13

Complete bipartite graph

• Is this a complete bipartite graph?

Page 25: Discrete Mathematics Tutorial 13

Complete bipartite graph

• Is this a complete bipartite graph?

Page 26: Discrete Mathematics Tutorial 13

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

Perfect matching

• Is there a perfect matching in this graph?

• Yes

Page 28: Discrete Mathematics Tutorial 13

Perfect matching

• Is there a perfect matching in this graph?

• No

Page 29: Discrete Mathematics Tutorial 13

Perfect matching

• Is there a perfect matching in this graph?

• Yes

Page 30: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 31: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 32: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 33: Discrete Mathematics Tutorial 13

Perfect matching

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

Page 34: Discrete Mathematics Tutorial 13

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

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

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

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

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

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

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

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

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

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

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

Maximum matching

• What is the maximum matching of this graph?

Page 46: Discrete Mathematics Tutorial 13

Maximum matching

• What is the maximum matching of this graph?

Page 47: Discrete Mathematics Tutorial 13

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

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

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

End

• Questions

• If you have questions before the exam, feel free to email me via:– [email protected]

• Good luck in the exam!