chapter 5 2 5 8 matchings
play

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


  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

  2. Scenario: People applying for jobs / schools / . . . A=People a b c d 1 2 3 4 5 B=Jobs 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 one 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

  3. Scenario: People applying for jobs / schools / . . . A=People A=People a b c d a b c d 1 2 3 4 5 1 2 3 4 5 B=Jobs B=Jobs 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

  4. Scenario: People applying for jobs / schools / . . . A=People A=People a b c d a b c d 1 2 3 4 5 1 2 3 4 5 B=Jobs B=Jobs 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

  5. Neighborhood of a set of vertices 1 2 3 4 5 6 Let G be a graph and X ⊆ V ( G ) . There are two ways to define the neighborhood of X : N ( X ) = { y ∈ V ( G ) \ X : xy ∈ E ( G ) for some x ∈ X } Our book: � Some books: Γ ( X ) = N ( x ) and some books call that N ( X ) x ∈ 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

  6. 2nd example A=People a b c d 1 2 3 4 B=Jobs 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 of 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

  7. Hall’s Condition A=People a b c d 1 2 3 4 B=Jobs 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

  8. Hall’s Condition A=People a b c d 1 2 3 4 5 B=Jobs 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

  9. Hall’s Marriage Theorem A=People a b c d 1 2 3 4 B=Jobs It turns out that Hall’s Condition is the only roadblock to the existence of 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

  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

  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

  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

  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: | N ( X ) | > | X | for all nonempty proper subsets X of A . 1 | N ( X ) | = | X | for at least one nonempty proper subset X of A . 2 Prof. Tesler Ch. 5.2 – 5.8: Matchings Math 154 / Winter 2020 13 / 64

  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 } : N H ( X ) equals either N G ( X ) or N G ( X ) \ { b } . So | N H ( X ) | � | N G ( X ) | − 1 . Also, | N G ( X ) | > | X | , so | N G ( X ) | − 1 � | X | . Combining those, | N H ( 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

  15. Proof of Hall’s Theorem A=People a b c d 1 2 3 4 5 B=Jobs 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

  16. Proof of Hall’s Theorem H: X H’: X’ a b c d 1 2 3 4 5 Y Y’ 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

  17. Proof of Hall’s Theorem H: X H’: X’ a b c d 1 2 3 4 5 Y Y’ 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

  18. Proof of Hall’s Theorem H: X H’: X’ a b c d 1 2 3 4 5 Y Y’ 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 N H ( S ) = N G ( X ) since all edges on X in G remain in H . Then | N H ( S ) | = | N G ( 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

Recommend


More recommend