Section 2.1 “Matching in bipartite graphs” in Graph Theory Handout for reading seminar.

Slides:



Advertisements
Similar presentations
Piyush Kumar (Lecture 3: Stable Marriage) Welcome to COT5405.
Advertisements

Min-Max Relations, Hall’s Theorem, and Matching-Algorithms Graphs & Algorithms Lecture 5 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Chapter 8 Topics in Graph Theory
Lecture 5 Graph Theory. Graphs Graphs are the most useful model with computer science such as logical design, formal languages, communication network,
Bipartite Matching, Extremal Problems, Matrix Tree Theorem.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
Great Theoretical Ideas in Computer Science for Some.
1 Discrete Structures & Algorithms Graphs and Trees: III EECE 320.
Graph Matching prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Matching1.
1 Lecture 5 (part 2) Graphs II Euler and Hamiltonian Path / Circuit Reading: Epp Chp 11.2, 11.3.
Combinatorial Algorithms
Great Theoretical Ideas in Computer Science.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Matchings Matching: A matching in a graph G is a set of non-loop edges with no shared endpoints.
Chapter 26 of CLSR Bipartite Matching By Dr. M. Sakalli, Sources: Levitin and many other CSE, Marmara Univ. May/2009.
Maximum Bipartite Matching
Matchings Matching: A matching in a graph G is a set of non-loop edges with no shared endpoints Maximal Matching: A maximal matching in a graph is a matching.
Vertex Cut Vertex Cut: A separating set or vertex cut of a graph G is a set SV(G) such that S has more than one component. Connectivity of G ((G)): The.
1 Bipartite Matching Lecture 3: Jan Bipartite Matching A graph is bipartite if its vertex set can be partitioned into two subsets A and B so that.
3/24/03Tucker, Section 4.31 Tucker, Applied Combinatorics, Sec. 4.3, prepared by Jo E-M Bipartite GraphMatching Some Definitions X-Matching Maximal Matching.
Khabbazian1 Copyright © Dale Carnegie & Associates, Inc. Mohammad Khabbazian Department of computer engineering,sharif University,Tehran,iran.
Lecture 11. Matching A set of edges which do not share a vertex is a matching. Application: Wireless Networks may consist of nodes with single radios,
Vertex Cut Vertex Cut: A separating set or vertex cut of a graph G is a set SV(G) such that G-S has more than one component. d f b e a g c i h.
K-Coloring k-coloring: A k-coloring of a graph G is a labeling f: V(G)  S, where |S|=k. The labels are colors; the vertices of one color form a color.
Maximum Bipartite Matching In a graph G, if no M-augmenting path exists, then M is a maximum matching in G. Idea: Iteratively seek augmenting paths to.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Introduction to Graph Theory
Week 11 - Friday.  What did we talk about last time?  Exam 2 post mortem  Cycle detection  Connectivity.
CSE, IIT KGP Matchings and Factors. CSE, IIT KGP Matchings A matching of size k in a graph G is a set of k pairwise disjoint edges.A matching of size.
3.3 Matchings and Factors: Matchings in General Graphs This copyrighted material is taken from Introduction to Graph Theory, 2 nd Ed., by Doug West; and.
The Turán number of sparse spanning graphs Raphael Yuster joint work with Noga Alon Banff 2012.
5.8 Graph Matching  Example: Set of worker assign to a set of task  Four tasks are to be assigned to four workers.  – Worker 1 is qualified to do tasks.
CS 473Lecture ?1 CS473-Algorithms I Lecture ? Network Flows Finding Max Flow.
All Pair Shortest Path IOI/ACM ICPC Training June 2004.
3.2 Matchings and Factors: Algorithms and Applications This copyrighted material is taken from Introduction to Graph Theory, 2 nd Ed., by Doug West; and.
Chapter 1 Fundamental Concepts Introduction to Graph Theory Douglas B. West July 11, 2002.
Connectivity and Paths 報告人:林清池. Connectivity A separating set of a graph G is a set such that G-S has more than one component. The connectivity of G,
Bipartite Matching. Unweighted Bipartite Matching.
1 Decomposition into bipartite graphs with minimum degree 1. Raphael Yuster.
5.8 Graph Matching  Example: Set of worker assign to a set of task  Four tasks are to be assigned to four workers.  – Worker 1 is qualified to do tasks.
Graph Theory and Applications
Matching Lecture 19: Nov 23.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
CSCI 256 Data Structures and Algorithm Analysis Lecture 2 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
Introduction to Graph Theory
12. Lecture WS 2012/13Bioinformatics III1 V12 Menger’s theorem Borrowing terminology from operations research consider certain primal-dual pairs of optimization.
Approximation Algorithms by bounding the OPT Instructor Neelima Gupta
Matching and Factors Matchings and Covers. Definitions: A matching M in a graph G is a set of non loop edges with no shared endpoints. G M.
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
Proof of correctness of Dijkstra’s algorithm: Basically, we need to prove two claims. (1)Let S be the set of vertices for which the shortest path from.
1 Graphs Chapters 10.1 and 10.2 University of Maryland Chapters 10.1 and 10.2 Based on slides by Y. Peng University of Maryland.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
IOI/ACM ICPC Training 4 June 2005.
Chapter 10 Iterative Improvement
Bipartite Matching Lecture 8: Oct 7.
Graph theory Definitions Trees, cycles, directed graphs.
Hamiltonian Graphs Graphs Hubert Chan (Chapter 9.5)
Maximum Flow - Best algorithms
Great Theoretical Ideas in Computer Science
Lecture 12 Algorithm Analysis
Chapter 5. Optimal Matchings
Various Graph Algorithms
Discrete Mathematics for Computer Science
CS 583 Analysis of Algorithms
Lecture 12 Algorithm Analysis
Systems of distinct representations
5.4 T-joins and Postman Problems
N(S) ={vV|uS,{u,v}E(G)}
Lecture 12 Algorithm Analysis
Presentation transcript:

Section 2.1 “Matching in bipartite graphs” in Graph Theory Handout for reading seminar

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.

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

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

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

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

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

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’

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

Theorem (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.

Theorem (König 1931) (2/6) n Proof for |M|  |U’| (showing |M|  |T|  |U’|) – –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’

Theorem (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

Theorem (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

Theorem (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. (*) aU?aU? aUaU (*) aUaU 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’

Theorem (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 aU?aU? aUaU 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

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| S {a, a’, a’’} {a’’} {a’, a’’} |N(S)| 3 2 |S| Matching of A unavailable 

Theorem (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.

Theorem (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.

Theorem (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 |

Theorem (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})B1B2B1B2 a |B 1  B 2 | |B 1 ||B 2 | |B 1  B 2 | =+–

Theorem (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.

Corollary 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

Proof of Corollary (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

Proof of Corollary (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 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

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: 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 

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:

Theorem (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.”

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

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.

Proof for Theorem (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’  

Proof for Theorem (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’  

Corollary 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.

Proof of Corollary (1/3) n G contains an Euler tour by Theorem –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

Proof of Corollary (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. : + : 

Proof of Corollary (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

Any Questions?

Theorem (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

Any Questions?