Chapter 5.2 5.8 Matchings Prof. Tesler Math 154 Winter 2020 - - PowerPoint PPT Presentation

chapter 5 2 5 8 matchings
SMART_READER_LITE
LIVE PREVIEW

Chapter 5.2 5.8 Matchings Prof. Tesler Math 154 Winter 2020 - - PowerPoint PPT Presentation

Chapter 5.2 5.8 Matchings Prof. Tesler Math 154 Winter 2020 Prof. Tesler Ch. 5.2 5.8: Matchings Math 154 / Winter 2020 1 / 64 Scenario: People applying for jobs / schools / . . . A=People a b c d 1 2 3 4 5 B=Jobs


slide-1
SLIDE 1

Chapter 5.2 – 5.8 Matchings

  • Prof. Tesler

Math 154 Winter 2020

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 1 / 64

slide-2
SLIDE 2

Scenario: People applying for jobs / schools / . . .

A=People 3 1 2 4 5 B=Jobs a b c d

Consider people applying for jobs: A is the set of people B is the set of jobs Draw an edge uv when u ∈ A applies for v ∈ B. This is a bipartite graph. Each job can only go to one person, and each person can only get

  • ne job. It might not be possible to accommodate all people / jobs.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 2 / 64

slide-3
SLIDE 3

Scenario: People applying for jobs / schools / . . .

3 1 2 4 5 B=Jobs a b c d A=People 3 1 2 4 5 B=Jobs a b c d A=People

There are two solutions that match everyone in A to some job in B. Vertices incident to an edge in the matching are saturated (also called covered). So on the left, a, b, c, d and 1, 2, 3, 4 are saturated. Vertices not contained in any edge of the matching are unsaturated (also called exposed). On the left, job 5 is exposed.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 3 / 64

slide-4
SLIDE 4

Scenario: People applying for jobs / schools / . . .

3 1 2 4 5 B=Jobs a b c d A=People 3 1 2 4 5 B=Jobs a b c d A=People

A complete matching from A to B means every vertex of A is in an edge of the matching. These solutions give a complete matching from A to B, but not from B to A. A perfect matching has no exposed vertices; all vertices are in the

  • matching. For a bipartite graph, this requires |A| = |B|, though

that’s not sufficient.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 4 / 64

slide-5
SLIDE 5

Neighborhood of a set of vertices

4 5 6 1 2 3

Let G be a graph and X ⊆ V(G). There are two ways to define the neighborhood of X: Our book: N(X) = { y ∈ V(G) \ X : xy ∈ E(G) for some x ∈ X } Some books: Γ(X) =

  • x∈X

N(x) and some books call that N(X) N({1, 3}) = {2, 4, 6} Γ({1, 3}) = {2, 4, 6} N({1, 2}) = {3, 4, 5} Γ({1, 2}) = {1, 2, 3, 4, 5} For a bipartite graph G(A, B) with X ⊆ A or X ⊆ B, there are no edges between vertices of X, so both definitions are the same.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 5 / 64

slide-6
SLIDE 6

2nd example

B=Jobs 3 1 2 4 a b c d A=People

Find a complete matching from A to B.

Need to match c − 2. But then both a and b can only be matched to 1, so only one of them can be matched.

Find a perfect matching.

In addition to the same problem as above, we can only match one

  • f 3 or 4, since the only option for both of them is d.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 6 / 64

slide-7
SLIDE 7

Hall’s Condition

B=Jobs 3 1 2 4 a b c d A=People

Consider N({a, b, c}) = {1, 2}. These 3 people only have 2 job applications between them. If there were a complete matching from A to B, then a, b, c would each be matched to a different neighbor. So N({a, b, c}) would have at least three elements.

Hall’s Condition

A necessary condition for a complete matching from A to B is: for all X ⊆ A: |N(X)| |X|

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 7 / 64

slide-8
SLIDE 8

Hall’s Condition

A=People 3 1 2 4 5 B=Jobs a b c d

We saw the above graph has a complete matching from A to B but not from B to A. N({4, 5}) = {d}, so |N({4, 5})| < | {4, 5} | (that is, 1 < 2). Hall’s condition doesn’t hold for a complete matching from B to A.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 8 / 64

slide-9
SLIDE 9

Hall’s Marriage Theorem

B=Jobs 3 1 2 4 a b c d A=People

It turns out that Hall’s Condition is the only roadblock to the existence

  • f a complete matching! Let G be a bipartite graph with parts A and B:

Hall’s Marriage Theorem (complete matching version)

G has a complete matching from A to B iff for all X ⊆ A: |N(X)| |X|

Hall’s Marriage Theorem (perfect matching version)

G has a perfect matching between A and B iff for all X ⊆ A and all X ⊆ B: |N(X)| |X|

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 9 / 64

slide-10
SLIDE 10

Hall’s Marriage Theorem

Hall’s example of matchings was matching men and women to marry. Let A be a set of n women and B be a set of n men. Form edge ab if a ∈ A and b ∈ B are potentially willing to marry. A perfect matching pairs up everyone, consistent with the graph.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 10 / 64

slide-11
SLIDE 11

Proof of Hall’s Theorem (complete matching version)

Hall’s Marriage Theorem (complete matching version)

G has a complete matching from A to B iff for all X ⊆ A: |N(X)| |X| Proof of ⇒: (easy direction) Suppose G has a complete matching M from A to B. Then for every X ⊆ A, each vertex in X is matched by M to a different vertex of B. The vertices of X may also have additional neighbors in B not accounted for by that matching. So |N(X)| |X|.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 11 / 64

slide-12
SLIDE 12

Proof of Hall’s Theorem

Hall’s Marriage Theorem

G has a complete matching from A to B iff for all X ⊆ A: |N(X)| |X| Proof of ⇐: (hard direction) Hall’s condition holds, and we must show that G has a complete matching from A to B. We’ll use strong induction on the size of A. Base case: |A| = 1, so A = {x} has just one element. Since |N(A)| |A| = 1, vertex x has at least one neighbor, y ∈ B. Then {xy} is a complete matching from A to B.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 12 / 64

slide-13
SLIDE 13

Proof of Hall’s Theorem

Hall’s Marriage Theorem

G has a complete matching from A to B iff for all X ⊆ A: |N(X)| |X| Proof of ⇐, continued: Induction step: Next we consider |A| > 1, and assume the theorem is true for all bipartite graphs G(A′, B′) where |A′| < |A|. We will consider two cases:

1

|N(X)| > |X| for all nonempty proper subsets X of A.

2

|N(X)| = |X| for at least one nonempty proper subset X of A.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 13 / 64

slide-14
SLIDE 14

Proof of Hall’s Theorem

Hall’s Marriage Theorem

G has a complete matching from A to B iff for all X ⊆ A: |N(X)| |X| Proof of ⇐, Case 1: |N(X)|>|X| for all nonempty proper subsets X of A Pick any edge ab in G, with a ∈ A and b ∈ B. Form H = G − {a, b} by deleting vertices a and b. This is a bipartite graph with parts A \ {a} and B \ {b}. Hall’s condition holds in H because for all X ⊆ A \ {a}:

NH(X) equals either NG(X) or NG(X) \ {b}. So |NH(X)| |NG(X)| − 1. Also, |NG(X)| > |X|, so |NG(X)| − 1 |X|. Combining those, |NH(X)| |X|.

Form any complete matching in H from A \ {a} to B \ {b}. Add edge ab to get a complete matching from A to B in G.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 14 / 64

slide-15
SLIDE 15

Proof of Hall’s Theorem

A=People 3 1 2 4 5 B=Jobs a b c d

Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A Here, X = {a, b, c} has N(X) = {1, 2, 3}, with |X| = |N(X)| = 3.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 15 / 64

slide-16
SLIDE 16

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A We will split the graph G into smaller graphs. X is a nonempty proper subset of A with |N(X)| = X. H (green graph): Let Y = N(X) and H = G[X ∪ Y]. H′ (blue graph): Let X ′ = A \ X and Y ′ = B \ Y. Let H ′ = G[X ′ ∪ Y ′].

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 16 / 64

slide-17
SLIDE 17

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A Since X is a nonempty proper subset of A, both X and X ′ are nonempty and smaller than A. We split the graph G into smaller graphs. We’ll find complete matchings in each and combine them into a complete matching in

  • G. In computer science, this strategy is called divide and conquer.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 17 / 64

slide-18
SLIDE 18

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A In G:

All edges from X go to Y; none go to Y ′. All edges from Y ′ go to X ′; none go to X. No edges between X & Y ′, but there may be edges between X ′ & Y.

Hall’s Condition holds in H:

For any S ⊆ X, we have NH(S) = NG(X) since all edges on X in G remain in H. Then |NH(S)| = |NG(S)| |S|. Since |X| < |A|, by induction, H has a complete matching from X to Y.

Finding a complete matching in H ′ from X ′ to Y ′ is harder.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 18 / 64

slide-19
SLIDE 19

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A Goal: Find a complete matching in H ′ from X ′ to Y ′. Let S ⊆ X ′. We’ll show |NH ′(S)| |S|. Consider NG(X ∪ S) = NG(X) ∪ NG(S). NG(X ∪ S) = NG(X) ∪ NH ′(S) since any neighbors of S in Y are in the union with NG(X) = Y. So |NG(X ∪ S)| |NG(X)| + |NH ′(S)|. Since |NG(X)| = |X|, this gives |NG(X ∪ S)| |X| + |NH ′(S)|.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 19 / 64

slide-20
SLIDE 20

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A Let S ⊆ X ′. We showed: |NG(X ∪ S)| |X| + |NH ′(S)|. By Hall’s condition in G, |NG(X ∪ S)| |X ∪ S| = |X| + |S|. Put those together: |X| + |NH ′(S)| |NG(X ∪ S)| |X| + |S| so |NH ′(S)| |S|. Thus, Hall’s condition holds in H ′!

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 20 / 64

slide-21
SLIDE 21

Proof of Hall’s Theorem

3 1 2 a b c 4 5 d X’ Y’ X Y H: H’: Proof of ⇐, Case 2: |N(X)|=|X| for some nonempty X A We showed Hall’s condition holds in H (from X to Y) and in H ′ (from X ′ to Y ′). Take complete matchings in each, and combine them to get a complete matching in G from A to B.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 21 / 64

slide-22
SLIDE 22

Applications of Hall’s Theorem

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 22 / 64

slide-23
SLIDE 23

k-regular graph

A graph is k-regular when every vertex has degree k. This graph is 4-regular.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 23 / 64

slide-24
SLIDE 24

Bipartite graph

B A Suppose that in a bipartite graph G(A, B), all vertices of A have degree k and all vertices of B have degree ℓ.

Above, k = 2 and ℓ = 1.

We could count the edges as |E(G)| = k|A| = ℓ|B|. If the graph is k-regular, then k = ℓ, so |A| = |B|.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 24 / 64

slide-25
SLIDE 25

Matchings in k-regular bipartite graphs

We’ll show that a k-regular bipartite graph G(A, B) has a perfect matching. Let X ⊆ A. There are k|X| edges leaving X. Since the vertices in B each have degree k, the minimum number

  • f vertices these edges can go to in B is k|X|/k = |X|.

It’s also possible these edges go to more vertices of B. Thus, |N(X)| |X|. Hall’s condition holds, so there’s a complete matching from A to B. Since |A| = |B|, it’s a perfect matching.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 25 / 64

slide-26
SLIDE 26

1-factorization of a k-regular bipartite graph

A 1-factorization of a graph is to split the edges into perfect matchings M1, . . . , Mk, with each edge occurring in exactly one of the matchings. This can only exist if the graph is k-regular. Every k-regular bipartite graph has a 1-factorization!

Apply Hall’s Theorem to get a perfect matching M1. Removing M1 leaves a (k − 1)-regular bipartite graph. Iterate to get M1, . . . , Mk.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 26 / 64

slide-27
SLIDE 27

Systems of distinct representatives

Let S1, . . . , Sn be sets. A system of distinct representatives (also called a transversal) is a selection of elements s1 ∈ S1, s2 ∈ S2, · · · sn ∈ Sn such that s1, . . . , sn are all different. Example:

S1 = {1,2,3}, S2 = {2,3,4}, S3 = {1,3,4}, S4 = {1,2,4} s1 = 1, s2 = 2, s3 = 3, s4 = 4 is a transversal. s1 = 2, s2 = 3, s3 = 4, s4 = 1 is another.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 27 / 64

slide-28
SLIDE 28

Systems of distinct representatives

Let S1, . . . , Sn be sets. Let A = {1, . . . , n} and B = S1 ∪ · · · ∪ Sn. Make a bipartite graph G with

Vertices A ∪ B Edges ab for a ∈ A, b ∈ B such that b ∈ Sa.

Suppose there’s a complete matching from A to B: M = {1b1, 2b2, 3b3, . . .}. Then bi ∈ Si, and b1, b2, b3, . . . are all distinct, so they give a system of distinct representatives! Conversely, any system of distinct representatives s1, . . . , sn gives a complete matching {1s1, 2s2, . . .} from A to B.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 28 / 64

slide-29
SLIDE 29

Systems of distinct representatives

By applying Hall’s Theorem to this graph, we get:

Theorem

Sets S1, . . . , Sn have a system of distinct representatives iff

  • i∈X

Si

  • |X|

for all X ⊆ {1, 2, . . . , n}

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 29 / 64

slide-30
SLIDE 30

Cards

3♣ 4 J♠ 9♣ J 2♣ 4 5♣ 6 6 6♣ Q 7 K♣ 5♠ 6♠ 9♠ 8 10♠ 9 Q♣ 7 3♠ 9 5 A J♣ 5 A 7♠ 2♠ K K 4♠ 3 4♣ 3 A♠ 10♣ Q A♣ 7♣ J 2 10 Q♠ 10 K♠ 8 2 8♣ 8♠ Shuffle a standard 52-card deck and deal 13 piles of 4 cards each. No matter how it was shuffled, you can always pick one card from each pile s.t. each rank A, 2, 3, · · · , 10, J, Q, K occurs

  • nce!
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 30 / 64

slide-31
SLIDE 31

Cards

A solution shown in yellow

3♣ 4 J♠ 9♣ J 2♣ 4 5♣ 6 6 6♣ Q 7 K♣ 5♠ 6♠ 9♠ 8 10♠ 9 Q♣ 7 3♠ 9 5 A J♣ 5 A 7♠ 2♠ K K 4♠ 3 4♣ 3 A♠ 10♣ Q A♣ 7♣ J 2 10 Q♠ 10 K♠ 8 2 8♣ 8♠

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 31 / 64

slide-32
SLIDE 32

Cards

1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 3♣ 4 J♠ 9♣ J 2♣ 4 5♣ 6 6 6♣ Q 7 K♣ 5♠ 6♠ 9♠ 8 10♠ 9 Q♣ 7 3♠ 9 5 A J♣ 5 A 7♠ 2♠ K K 4♠ 3 4♣ 3 A♠ 10♣ Q A♣ 7♣ J 2 10 Q♠ 10 K♠ 8 2 8♣ 8♠ For each of the 13 ranks r ∈ {A, 2, . . . , 10, J, Q, K}, let Sr be the set of which rows have r in any suit. E.g., S9 = {1, 5, 6}. For any k ranks r1, . . . , rk, we claim |Sr1 ∪ · · · ∪ Srk| k. Each row has 4 cards, so at least k rows are needed to account for the 4k cards of these ranks. Hall’s condition is met, so there is a system of distinct representatives.

This SDR gives a row # in each Sr, with the row #’s all different. Pick a card of rank r from the row # selected from Sr.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 32 / 64

slide-33
SLIDE 33

Cards

3♣ 4 J♠ 9♣ J 2♣ 4 5♣ 6 6 6♣ Q 7 K♣ 5♠ 6♠ 9♠ 8 10♠ 9 Q♣ 7 3♠ 9 5 A J♣ 5 A 7♠ 2♠ K K 4♠ 3 4♣ 3 A♠ 10♣ Q A♣ 7♣ J 2 10 Q♠ 10 K♠ 8 2 8♣ 8♠ We can iterate this! After removing the first solution, we have 13 piles of 3 cards, and all 13 ranks

  • ccur 3 times each. We get another

solution from the remaining cards. Repeat to split it into 4 solutions, shown in different colors.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 33 / 64

slide-34
SLIDE 34

Latin Squares

1 5 4 3 2 4 1 2 5 3 2 3 1 4 5 3 4 5 2 1 5 2 3 1 4 a e d c b d a b e c b c a d e c d e b a e b c a d A Latin Square of order n is an n × n array, with n symbols, such that every row and every column has each symbol exactly once. Euler studied these using Latin letters for the symbols, but you can use numbers or any other symbols as well.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 34 / 64

slide-35
SLIDE 35

Applications of Latin Squares

In group theory (Math 100 and 103), the multiplication table of a finite group is a Latin square. Randomized block designs in statistics (Math 181F). Sudoku puzzles are 9 × 9 Latin squares with additional constraints. Magic squares: 8 1 6 3 5 7 4 9 2

A magic square is an n × n array with entries 1, . . . , n2, such that every row, column, and both n-long diagonals, have the same sum. Here, every row and column adds up to 15. Also the diagonals: 8 + 5 + 2 = 15 and 4 + 5 + 6 = 15. There is a way to construct them using two Latin squares.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 35 / 64

slide-36
SLIDE 36

Latin Rectangles

a c b d d a c b A Latin Rectangle of size m × n is an array filled with the n symbols, with each symbol occurring once in each row and at most once in each column.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 36 / 64

slide-37
SLIDE 37

Latin Rectangles

a c b d d a c b → a c b d d a c b Can you complete this to a Latin square?

Theorem

An m × n Latin rectangle can always be extended to an n × n Latin square.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 37 / 64

slide-38
SLIDE 38

Latin Rectangles

a c b d d a c b

B=Columns 3 1 2 4 a b c d A=Symbols

Proof: Let A be the set of symbols (here, A = {a, b, c, d}). Let B = {1, 2, . . . , n} be the column numbers (here, B = {1, 2, 3, 4}). Make a bipartite graph G with parts A and B:

Add edge uv (u ∈ A, v ∈ B) if symbol u doesn’t occur in column v.

The graph is (n − m)-regular:

Each symbol u ∈ A occurs m times in the Latin rectangle, so there are n − m columns that don’t have it. Thus, d(u) = n − m. Each column v ∈ B has n − m symbols not yet in it, so d(v) = n − m.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 38 / 64

slide-39
SLIDE 39

Latin Rectangles

a c b d d a c b

B=Columns 3 1 2 4 a b c d A=Symbols

Proof, continued: We showed that G is (n − m)-regular. Thus, there’s a perfect matching, which lets us extend it by one row to (m + 1) × n.

E.g., matching 1 − b, 2 − d, 3 − a, 4 − c gives a new row bdac. Or, matching 1 − c, 2 − b, 3 − d, 4 − a gives a new row cbda.

Alternately, since G is (n − m)-regular, it has a 1-factorization M1, . . . , Mn−m. Each matching specifies how to fill in one row, giving a solution for all remaining rows simultaneously.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 39 / 64

slide-40
SLIDE 40

Maximum matchings in bipartite graphs

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 40 / 64

slide-41
SLIDE 41

König-Ore Formula

A=People 3 1 2 4 5 B=Jobs a b c d

Any maximum matching in this graph has one exposed vertex (also called an unsaturated vertex). Recall α′(G) is the number of edges in the largest matching in G. Let ex(G, A) = |A| − α′(G) = # vertices of A exposed by a maximum matching Here, α′(G) = 4, ex(G, A) = 0 and ex(G, B) = 1.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 41 / 64

slide-42
SLIDE 42

König-Ore Formula

A=People 3 1 2 4 5 B=Jobs a b c d

König-Ore Formula

Let G(A, B) be a bipartite graph. Then ex(G, A) = max

S⊆A

  • |S| − |N(S)|
  • ex(G, B) = max

S⊆B

  • |S| − |N(S)|
  • This also gives a formula for the maximum size of a matching:

α′(G) = |A| − ex(G, A) = |B| − ex(G, B)

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 42 / 64

slide-43
SLIDE 43

König-Ore Formula

3 1 2 4 5 B=Jobs a b c d A=People e

Proof: Let r = max

S⊆B

  • |S| − |N(S)|
  • . We’ll show ex(G, B) = r.

Since S = ∅ gives |S| − |N(S)| = 0 − 0 = 0, we have r 0. Form graph H by adding r new vertices to A, and edges connecting these new vertices to all vertices in B (in red above). Hall’s condition holds in H: |N(S)| |S| for all S ⊆ B. So H has a complete matching from B to A. Remove red vertices/edges. G has a matching of size |B| − r, so ex(G, B) r.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 43 / 64

slide-44
SLIDE 44

König-Ore Formula

A=People 3 1 2 4 5 B=Jobs a b c d

Proof, continued: Let r = max

S⊆B

  • |S| − |N(S)|
  • . So far we showed ex(G, B) r.

Let M be a matching of max size α′(G). It has ex(G, B) exposed vertices in B. Using M, each S ⊆ B has at least |S| − ex(G, B) neighbors in A. So |N(S)| |S| − ex(G, B). Rearranging, ex(G, B) |S| − |N(S)|. Maximizing over all S ⊆ B gives ex(G, B) r. Since ex(G, B) is both and r, we have ex(G, B) = r.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 44 / 64

slide-45
SLIDE 45

König’s Theorem on Maximum Matchings

Don’t confuse it with the König-Ore Formula

König’s Theorem on Maximum Matchings

1

For any bipartite graph, α′(G) = β(G): max # edges in a matching = min # vertices in a vertex cover.

2

Further, if the graph has no isolated vertices, then α(G) = β′(G): max # independent vertices = min # edges in an edge cover. Recall α(G) + β(G) = |V(G)| for any graph, and α′(G) + β′(G) = |V(G)| for any graph w/o isolated vertices. So part 2 follows from part 1. We only have to prove part 1. This only applies to bipartite graphs! E.g., a cycle of odd length n 3 has α′(G) = n

2

  • and

β(G) = n

2

  • = α′(G) + 1.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 45 / 64

slide-46
SLIDE 46

König’s Theorem on Maximum Matchings

König’s Theorem on Maximum Matchings

For any bipartite graph, α′(G) = β(G): max # edges in a matching = min # vertices in a vertex cover. Proof: In any graph, α′(G) β(G): for any perfect matching M, a min. vertex cover of G must have at least one vertex of each edge of M, and possibly more vertices to cover other edges. We will show that in any bipartite graph, α′(G) β(G) as well. This isn’t true for arbitrary graphs (e.g., odd length cycle).

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 46 / 64

slide-47
SLIDE 47

König’s Theorem on Maximum Matchings

3 1 2 a b c 4 5 d

B \ C H0: C A B A \ C B \ C A \ C H:

Proof of α′(G) ≥ β(G) (max size matching ≥ min vertex cover): Let C be a minimum vertex cover (pink vertices above). Split C into A ∩ C and B ∩ C (pink on top vs. on bottom). Split A into A ∩ C and A \ C (two parts on top). Split B into B ∩ C and B \ C (two parts on bottom). There are no edges between A\C and B\C: if there were, they wouldn’t be covered by C, contradicting that C is a vertex cover.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 47 / 64

slide-48
SLIDE 48

König’s Theorem on Maximum Matchings

3 1 2 a b c 4 5 d

B \ C H0: C A B A \ C B \ C A \ C H:

Proof of α′(G) ≥ β(G) (max size matching ≥ min vertex cover): Let S ⊆ A ∩ C. If |NH ′(S)| < |S|, then replace S by NH ′(S) in C to get a smaller vertex cover, (C \ S) ∪ NH ′(S). But C is a min. vertex cover! So |NH ′(S)| |S| for all S ⊆ A ∩ C. So H ′ has a complete matching from A ∩ C to B \ C, of size |A ∩ C|. Similarly, H has a comp. matching from B ∩ C to A \ C, size |B ∩ C|. Combined, G has a matching of size |A ∩ C| + |B ∩ C| = |C|. So α′(G) |C| = β(G). Since α′(G) β(G) too, they’re equal.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 48 / 64

slide-49
SLIDE 49

Perfect matchings in any graph, not just bipartite graphs

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 49 / 64

slide-50
SLIDE 50

Tutte’s 1-Factor Theorem

Hall’s Theorem only works in bipartite graphs. Tutte’s 1-Factor Theorem is an analogous result for any graph. For any set of vertices S ⊆ V(G), let

  • dd(G − S) = # components of G − S with an odd # vertices.

Tutte’s 1-Factor Theorem

A graph G has a perfect matching iff |S| odd(G − S) for all S ⊆ V(G).

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 50 / 64

slide-51
SLIDE 51

Tutte’s 1-Factor Theorem

Does this graph have a perfect matching?

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 51 / 64

slide-52
SLIDE 52

Tutte’s 1-Factor Theorem

G G − S Let S be the 4 vertices highlighted in pink (so |S| = 4). G − S has 9 components (black):

Three with 3 vertices (odd components). Three with 2 vertices (even components). Three with 1 vertex (odd components).

  • dd(G − S) = 6.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 52 / 64

slide-53
SLIDE 53

Tutte’s 1-Factor Theorem

G − S If there’s a perfect matching of G, then in each odd component of G − S, at least 1 vertex has to be matched to a vertex of S. That uses odd(G−S) vertices of S, so it requires |S| odd(G−S). Here, |S| < odd(G − S) (4 < 6), so there is no perfect matching. This shows Tutte’s condition is necessary for a perfect matching. It turns out it’s also sufficient! We’ll skip the proof (see the book).

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 53 / 64

slide-54
SLIDE 54

Tutte-Berge Formula

G − S Max matching Now consider a maximum matching instead of a perfect matching. Here, |V(G)| = 22, |S| = 4, and odd(G − S) = 6. In any matching in this graph:

4 odd components have a vertex matched to a vertex of S. 6 − 4 = 2 odd components have an exposed vertex (yellow). Any matching has at most 22−2

2

= 10 edges.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 54 / 64

slide-55
SLIDE 55

Tutte-Berge Formula

G − S Max matching This graph has a matching with 10 edges (red). However, other choices of S may give other bounds:

E.g., S = ∅ gives |S| = 0 and odd(G − S) = 0. So, at least odd(G − S) − |S| = 0 − 0 exposed vertices, and at most 22−0

2

= 11 edges in a perfect matching. Compare over all S ⊆ V(G) to get the best bounds.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 55 / 64

slide-56
SLIDE 56

Tutte-Berge Formula

Tutte-Berge Formula

For any graph, the # vertices exposed in a maximum matching is ex(G) = max

S⊆V(G)

  • dd(G − S) − |S|
  • .

Thus, the maximum # edges in a matching is α′(G) = |V(G)| − ex(G) 2 with ex(G) given by the above formula This is analogous to the König-Ore formula for a bipartite graph.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 56 / 64

slide-57
SLIDE 57

Augmenting paths

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 57 / 64

slide-58
SLIDE 58

Using augmenting paths to extend matchings

3 1 2 4 5 B=Jobs a b c d A=People

The matching shown in red cannot be extended by adding any edges; all remaining edges touch one of the red edges.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 58 / 64

slide-59
SLIDE 59

Using augmenting paths to extend matchings

3 1 2 4 5 B=Jobs a b c d A=People

A matching, M, is shown in red. The path in yellow is an M-alternating path. The edges alternate between edges of M and edges not in M. If the path starts and ends at exposed vertices of the matching M, it’s called an M-augmenting path.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 59 / 64

slide-60
SLIDE 60

Using augmenting paths to extend matchings

3 1 2 4 5 B=Jobs a b c d A=People 3 1 2 4 5 B=Jobs a b c d A=People

If you have an M-augmenting path, then switch which edges are

  • utside M / inside M.

An M-augmenting path must have odd length, 2k + 1. It has k edges in M and k + 1 outside M. Switching these adds one edge to the matching. The graph on the right has a different matching, M ′. The yellow path is not M ′-augmenting: the endpoints aren’t exposed in M ′.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 60 / 64

slide-61
SLIDE 61

Using augmenting paths to extend matchings

3 1 2 4 5 B=Jobs a b c d A=People 3 1 2 4 5 B=Jobs a b c d A=People

Use another augmenting path (left) to extend the matching (right). There are no more augmenting paths. We matched all but one vertex. But what if we ran out of augmenting paths and there were still 2 exposed vertices?

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 61 / 64

slide-62
SLIDE 62

Berge’s Lemma

Berge’s Lemma

A matching M in a graph G is maximum iff M does not admit any augmenting paths. Application: Iteratively find M-augmenting paths to increase the size of a matching until it’s maximum. There are algorithms that do this in about

  • |V| · |E| steps.

Proof of Berge’s Lemma: If there is an augmenting path, we saw how to increase the number of edges in the matching by 1. In the other direction, suppose M does not admit any augmenting

  • paths. We will show that M is a maximum matching.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 62 / 64

slide-63
SLIDE 63

Berge’s Lemma

Proof, continued: We are given that M does not admit any augmenting paths. Suppose N is a larger matching. Above: matchings M (blue, 9 edges) and N (red, 10 edges). In M ∪ N, every vertex has degree 1 or 2, so the connected components of M ∪ N are paths; cycles; and edges that occur in both M and N.

  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 63 / 64

slide-64
SLIDE 64

Berge’s Lemma

Proof, continued: Any cycle alternates edges between M and N, so it has an equal number of edges from each. Since |N| > |M|, there must be a path with more edges from N than M (shown in yellow). So it must start and end with an edge from

  • N. So it’s an M-augmenting path, contradicting that there isn’t one.
  • Prof. Tesler
  • Ch. 5.2 – 5.8: Matchings

Math 154 / Winter 2020 64 / 64