Download presentation
Presentation is loading. Please wait.
Published byMelvyn Jacob Walton Modified over 9 years ago
1
Section 2.1 “Matching in bipartite graphs” in Graph Theory Handout for reading seminar
2
Matching n Task: Find independent edges as many as possible. Independent edges: edges not sharing any vertex. –Q: Are there independent edges containing all vertices? n Matching M E of U given G=(V,E) and U V –Every vertex in U is incident with an edge in M. A set M E of independent edges in graph G. G Vertices in U are matched by M 1. unmatched U={v 1, v 2, v 3, v 4 } v1v1 v2v2 v3v3 v4v4 Vertices in V are matched by M 2.
3
k-factor n k-factor: a k-regular spanning subgraph –k-regular graph any of whose vertex has the same degree k –spanning subgraph one having all vertices of the original graph n The followings are equivalent. –A subgraph H G=(V,E) is a 1-factor of G. –E(H) (a set of edges in H) is a matching of V. G 2-regular M 2 (matched) unmatched
4
Notation in this section –G = (V, E): bipartite graph with bipartition {A, B} V=A B, A B = . a, a’,… represent vertices in A. No edge between a, a’. b, b’,… represent vertices in B. No edge between b, b’. G AB a b ab ABAB Examples of matchings
5
Matching and augmenting paths (1/3) n How can we find a (large) matching? –By expanding a small one with augmenting paths. Augmenting path –Starts an unmatched vertex in A, and ends at an unmatched one in B. –Vertices except 1st and last in the path are attached to edges in M. –In finding an augmenting path, the followings are repeated: »Move from A to B through an edge in E – M. »Move from B to A through an edge in M. ABAB Matching M Augmenting path P
6
Matching and augmenting paths (2/3) n How can we find a (large) matching? –By expanding a small one with augmenting paths. Suppose M and an augmenting path P are given. (E(P) M) (M E(P)) is also a matching. –Each vertex on P is incident with just one edge in E(P) M. Then E(P) M is a matching. –M E(P) is obviously a matching. –These sets do not share any vertex, so the union is also a matching. ABABAB Matching M Matching M’Augmenting path P
7
Matching and augmenting paths (3/3) n How can we find a matching? –By expanding a small one with augmenting paths. Two new vertices (the first and the last vertices in the path) are included in the new matching with one expansion. n Alternating path –Augmenting one w/o the condition on the end vertex. The end is not necessarily an unmatched vertex in B. ABABAB Matching M Matching M’Augmenting path P
8
Exercise 1 n Suppose that M is a matching not maximal. –M has less edges than some other matching M’ in G. n Then G contains an augmenting path w.r.t. M. n Proof –A edge e in M’ – M is an augmenting path. n What happens when M is not maximum but maximal? (HW) AB G AB Matching M AB Aug. path w.r.t. M AB New matching M’
9
Vertex cover n A set U E is a vertex cover of E if every edge of G is incident with a vertex in U. AB G AB v. cover AB G not a v. cover AB v. cover
10
Theorem 2.1.1 (König 1931) (1/6) n Let M and U be a maximum matching and a minimum vertex cover in G=(A B, E). n Then, |M| = |U|. n Its proof consists of three parts. –Show that |M| |U’|, where U’ is any vertex cover. –Construct U from M, where |U|=|M|. If U is a vertex cover, it is the minimum since |M| |U’|. –Show that U is a (minimum) vertex cover.
11
Theorem 2.1.1 (König 1931) (2/6) n Proof for |M| |U’| (showing |M| |T| |U’|) –www.cs.mcgill.ca/~kaleigh/teaching/360_tutorials/tutorial_07.html –All the endpoints of the edges in M are distinct. -- (1) By definition of matching. –A vertex cover T of M requires at least one end for each edge in M. -- (2) –T then has to have at least |M| vertices (|M| |T|). –G contains at least the same edges of M. –To cover edges in M, |U’| (vc of G) must be at least |T|. (1)(2) T G U’
12
Theorem 2.1.1 (König 1931) (3/6) n Construction of U from M –We will construct a vertex cover U from M as follows: Choose one end a or b from each edge ab M as follows: Choose b in B if some alternating path ends in the vertex. Choose a in A otherwise. AB AB ABAB Alternating pathsVertex cover
13
Theorem 2.1.1 (König 1931) (4/6) n Proof that U is a vertex cover –For any edge ab E(G), show a U or b U (that is, ab is covered by U) (*). ab E ab M? ab M ab M By the construction of U, a U or b U (*). Any matching incident with a or b ? ab’ M for some b’ a’b M for some a’ ab’ M and a’b M for any a’ and b’ {ab} M is a matching. This contradicts with that M is maximum. b’ a’ a b a b a b
14
Theorem 2.1.1 (König 1931) (5/6) n Proof that U is a vertex cover –For any edge ab E(G), show a U or b U (that is, ab is covered by U) (*). ab E ab’ M for some b’ a’b M for some a’ impossible Any matching incident with a or b ? ab is an alt. path. Since a’b M, b U by def. of U. (*) aU?aU? aUaU (*) aUaU b’ U since ab’ M. Since b’ is selected, there must be an alt. path P ending at b’ by definition of U. a b’ b a’ a b P aiai bjbj akak b’
15
Theorem 2.1.1 (König 1931) (6/6) n Proof that U is a vertex cover –For any edge ab E(G), show a U or b U (that is, ab is covered by U) (*). ab E aU?aU? aUaU b’ U since ab’ M. b’ is selected, then there must be an alt. path P ending at b’ by definition of U. P’=Pb P’=Pb’ab M is not maximum. Then, a must be in U. From P, we can create an alt. path P’ ending at b. P aiai bjbj akak b’ aiai bjbj akak aiai bjbj akak b (if b P) P ab (if b P) P’ is an aug. path ending at b. A matching larger than M can be obtained with P’. a b’ b
16
Conditions for the existence of 1-factor n Consider a matching containing all vertices in A. n Necessary condition –|N(S)| |S| for all S A (the marriage condition; MC), where S: any subset of A N(S): neighbors of vertices in S n The condition is in fact a sufficient condition. {a, a’, a’’} {a’’} {a’, a’’} |N(S)| 3 1 |S| 3 2 1 S {a, a’, a’’} {a’’} {a’, a’’} |N(S)| 3 2 |S| 3 2 1 Matching of A unavailable
17
Theorem 2.1.2 (Hall 1935) (1/5) n G contains a matching M of A iff |N(S)| |S| for all S A. n ( ) –a A has at least one neighbor, i.e., |N({a})| |{a}|=1. For any a A, there is an edge ab in M for some b B. –Neighbors of a and a’ in M can be distinct if a a’. We can choose the other ends of a, a’ in M as the neighbors. –For any S, at least |S| distinct neighbors can be found. That is, |N(S)| |S| for all S A.
18
Theorem 2.1.2 (Hall 1935) (2/5) n G contains a matching iff |N(S)| |S| for all S A. –We follow here the third proof in the textbook. n ( ) –Consider a spanning subgraph H of G that satisfies the marriage condition (MC), and is edge-minimal with MC. –Note d H (a)=|N H (a)| |{a}|=1for every a A by MC. –We show d H (a) =1 for every a A. Then, E(H) forms a matching of A. –MC guarantees that no two such edges can share a vertex in B. d H (a)=1 d H (a’)=1 a’ a |{a 1,a 2 }|=2, |N({a 1,a 2 })|=1.
19
Theorem 2.1.2 (Hall 1935) (3/5) n G contains a matching iff |N(S)| |S| for all S A. n ( ) –Proof by contradiction on H –Suppose d H (a) 2, and the neighbors are b 1 and b 2. –Since the edge of H is minimal for MC, H – ab 1 and H – ab 2 should violate MC for some A 1, A 2 A. –B i :=N H – abi (A i ). a b1b1 b2b2 A1A1 a b1b1 b2b2 A2A2 B1B1 B2B2 |A 1 |=| N H (A 1 ) | |A 1 |>| N H – ab1 (A 1 )|= |B 1 | |A 2 |=| N H (A 2 ) | |A 2 |>| N H – ab2 (A 2 )|= |B 2 |
20
Theorem 2.1.2 (Hall 1935) (4/5) n G contains a matching iff |N(S)| |S| for all S A. n ( ) –|N H (A 1 A 2 –{a})| |N H-ab1-ab2 (A 1 A 2 )| – |N H-ab1-ab2 (A 1 ) N H-ab1-ab2 (A 2 )| – = |B 1 B 2 | – = |B 1 | + |B 2 | – |B 1 B 2 | – = … b1b1 b2b2 A1A1 a b1b1 b2b2 A2A2 N H (A 1 A 2 –{a})B1B2B1B2 a |B 1 B 2 | |B 1 ||B 2 | |B 1 B 2 | =+–
21
Theorem 2.1.2 (Hall 1935) (5/5) n G contains a matching iff |N(S)| |S| for all S A. n ( ) –|N H ( A 1 A 2 –{a})| … – |B 1 | + |B 2 | – |B 1 B 2 | – |A 1 | – 1+ |A 2 | – 1– |A 1 A 2 | By the definition of A i and B i (|A i | > |B i | |A i | – 1 |B i |) – = |A 1 | + |A 2 |– |A 1 A 2 | – 2 – = |A 1 A 2 | – 2 = |A 1 A 2 –{a}| – 1. –Hence H violates the marriage condition, contrary to the assumption. –Therefore, d H (a) =1 for every a A.
22
Corollary 2.1.3 n If G is k-regular with k 1, then G has a 1-factor. –k-factor: a k-regular spanning subgraph k-regular –graph any of whose vertex has the same degree k spanning subgraph –one having all vertices of the original graph –A 1-factor is also called a perfect matching. 2-regular3-regularIts 1-factor
23
Proof of Corollary 2.1.3 (1/2) n |A|=|B|. –Since G is k-regular, d A = v A d(v)=k|A| and d B = v B d(v)=k|B|. –Since G is bipartite, each edge connects a vertex in A to a vertex in B. Then, d A = d B, that is, k|A|=k|B|. n We will see that |N(S)| |S| for all S A. –By Theorem 2.1.2, G then has a 1-factor (perfect matching). d A =3*4 d B =3*4
24
Proof of Corollary 2.1.3 (2/2) n We will see that |N(S)| |S| for all S A. –Every set S A is joined to N(S) by k|S| edges. –These k|S| edges ( ) are among the k|N(S)| edges ( ) of G incident with N(S). –Then, k|S| k|N(S)| for any S, which satisfies the condition of Theorem 2.1.2. n Since |A|=|B|, every vertex is included in the matching. S N(N(S)) N(S)N(S) k|N(S)| edges S N(S)N(S) N(S)N(S) k|S| edges
25
Stable matching (1/2) n Suppose a graph G and its preference are given. n For example, the following matching is unstable. –Because choosing pair (A, M) as a matching makes both A and M happier. A and M might be going to break the current matching (engagement) for their preference. n A matching is called stable if it has no such pair. Alice (A) Bill (B) Charles (C) David (D) Kathy (K) Lucy (L) Mary (M) Nancy (N) This example was taken from a transcript of a lecture: http://www.misojiro.t.u-tokyo.ac.jp/~iwata/dmi/dmi03j.pdf ranks of preference A K M N B L K C L M D M N L K B A L D B C M A C D N D A
26
Stable matching (2/2) n A stable matching M is defined as follows: –For any e =(a, b) in E – M, there exists some f M s.t f a e or f b e, –where f a e denotes the order of preference for edges of a. In the example below, (A, K) A (A, M) A (A, N). ranks of preference A K M N B L K C L M D M N L K B A L D B C M A C D N D A Alice (A) Bill (B) Charles (C) David (D) Kathy (K) Lucy (L) Mary (M) Nancy (N) This example was taken from a transcript of a lecture: http://www.misojiro.t.u-tokyo.ac.jp/~iwata/dmi/dmi03j.pdf
27
Theorem 2.1.4 (Gale and Shapley 1962) n For every set of preferences, G has a stable matching. n Its proof is based on an algorithm called the Gale- Shapley algorithm to find a stable matching for G. –The algorithm finds a male-optimal matching. By interchanging a set of males and a set of females, it is also able to find a female-optimal matching. n Note that a stable matching is not unique. –There might be another stable matching having them happier. It depends on the definition of “happiness.”
28
Gale-Shapley algorithm n Algorithm GS(G) # G=({A,B}, E) –M u :=A; –while M u for each a M u # a is an unengaged man –M u := proposal(a, b) s.t. b B is highest-ranked not yet proposed to for a) end-for –end-while –function proposal(a, b) if b is engaged with someone, say, a’ –if a < b a’ then b is engaged with a; M u :=M u {a’} {a} –# else b keeps the engagement with a’ else b is engaged with a; M u :=M u {a} –return M u
29
Example of results by the G-S algorithm A K M N B L K C L M D M N L K B A L D B C M A C D N D A A K M N B L K C L M D M N L K B A L D B C M A C D N D A Each of A, B, C, and D proposed to 1st-ranked female. C failed to find his fiance. C proposed to the highest-ranked female not yet proposed to. M changed her fiance, and D then lost his fiance. A K M N B L K C L M D M N L K B A L D B C M A C D N D A D proposed to the highest- ranked female not yet proposed to. Then, each of them has found her/his fiance.
30
Proof for Theorem 2.1.4 (1/2) n We will see G-S finds a stable matching by following the transcript. –It terminates in finite steps because the number of candidates for proposal is monotonically decreased in the while loop of the G-S algorithm. –The matching the G-S algorithm finds is stable. Suppose that there is an unstable pair in the result of G-S. –The pair (a, b’), where (a, b’) a (a, b), (a, b’) b’ (a’, b). In the matching by G-S, (a, b) and (a’, b’) are selected. a a’ b b’ a b’ b a’ b’ b a b’ a a’
31
Proof for Theorem 2.1.4 (2/2) –Suppose that there is an unstable pair in the result of G-S. The pair (a, b’), where (a, b’) A (a, b), (a, b’) b’ (a’, b’). In the matching by G-S, (a, b) and (a’, b’) were selected. –By the construction of G-S, it must be that the proposed to b’ by a must be taken place before the proposal to b by a. –This case can be occurred only when (1) or (2). (1) b’ refused the proposal from a. –(1) never happens because (a, b’) b’ (a’, b’), and then b also should refuse the proposal from a’. (2) b’ accepted the proposal from a’ by breaking the relation with a. –(2) never happens because b’ should engage with a, not a’ when a’ proposed to b. –From these observations, any matching by G-S is always stable. a b’ b a’ b’ b a b’ a a’
32
Corollary 2.1.5 n Every regular graph G of positive even degree 2k has a 2-factor. n Proof consists of three steps. –G contains an Euler tour. –Every vertex in G is replaced by a pair (v +, v ). The resulting graph is k-regular bipartite graph. By Corollary 2.1.3, a k-regular bipartite graph has a 1-factor. –Every pair is collapsed into a single vertex. The 1-factor graph is turned into a 2-factor graph.
33
Proof of Corollary 2.1.5 (1/3) n G contains an Euler tour by Theorem 1.8.1. –Theorem 1.8.1: A connected graph is Eulerian iff every vertex has even degree. If G is not a connected graph, we consider each connected subgraph for the corollary. 4-regular Former and latter halves of an Euler tour
34
Proof of Corollary 2.1.5 (2/3) Every vertex in G is replaced by a pair (v +, v ). –Edge (v i, v i+1 ) by (v + i, v i+1 ). –The resulting graph is a k-regular bipartite graph. : + :
35
Proof of Corollary 2.1.5 (3/3) Every vertex in G is replaced by a pair (v +, v ). –The resulting graph is a k-regular bipartite graph. By Corollary 2.1.3, a k-regular bipartite graph has a 1-factor. n Every pair is collapsed into a single vertex. –The 1-factor graph is turned into a 2-factor graph. : + : 1-factork-regular bipartite 2-factor
36
Any Questions?
37
Theorem 2.1.1 (König 1931) (3/6) n Construction of U from M –We will construct a vertex cover U from M as follows: Choose one end a or b from each edge ab M as follows: Choose b in B if some alternating path ends in the vertex. –Some edge in E– M is incident with b. Choose a in A otherwise. AB ABAB
38
Any Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.