Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,

Slides:



Advertisements
Similar presentations
Min-Max Relations, Hall’s Theorem, and Matching-Algorithms Graphs & Algorithms Lecture 5 TexPoint fonts used in EMF. Read the TexPoint manual before you.
Advertisements

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.
Graph Matching prepared and Instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University March 2014Graph Matching1.
R. Johnsonbaugh Discrete Mathematics 5 th edition, 2001 Chapter 8 Network models.
Algorithms and Networks
Breadth-First Search of Graphs Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Augmenting path algorithm Two theorems to recall: Theorem (Berge). A matching M in a graph G is a maximum matching in G iff G has no M-augmenting.
(Algorithms in Bipartite Graphs). Introduction Algorithms in unweighted bipartite graph (Yehong & Gordon) Maximum matching A simple algorithm Hopcroft-Karp.
1 Weighted Bipartite Matching Lecture 4: Jan Weighted Bipartite Matching Given a weighted bipartite graph, find a matching with maximum total weight.
Finding a Maximum Matching in Non-Bipartite Graphs Alicia Thilani Singham Goodwin /22/2013.
k-Factor Factor: a spanning subgraph of graph G
Matchings Matching: A matching in a graph G is a set of non-loop edges with no shared endpoints.
Graph Theory Ming-Jer Tsai. Outline Graph Graph Theory Grades Q & A.
Matchings Lecture 3: Jan 18. Bipartite matchings revisited Greedy method doesn’t work (add an edge with both endpoints free)
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.
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.
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,
Factor Factor: a spanning subgraph of graph G
Factor Factor: a spanning subgraph of graph G k-Factor: a spanning k-regular subgraph Odd component: a component of odd order o(H): the number of odd components.
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,
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.
CS 290H Lecture 17 Dulmage-Mendelsohn Theory
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.
Analysis of Algorithms Uri Zwick April 2014 Maximum matching 1 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAA.
Hungarian Algorithm Vida Movahedi Elderlab, York University June 2007.
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.
CSE, IIT KGP Graph Theory: Introduction Pallab Dasgupta Dept. of CSE, IIT
Section 2.1 “Matching in bipartite graphs” in Graph Theory Handout for reading seminar.
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.
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Introduction Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
All Pair Shortest Path IOI/ACM ICPC Training June 2004.
Graph Theory Ch. 3. Matchings and Factors 1 Chapter 3 Matchings and Factors Matchings and Covers Algorithms and Applications Matchings in General Graph.
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.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Chapter 1 Fundamental Concepts Introduction to Graph Theory Douglas B. West July 11, 2002.
Bipartite Matching. Unweighted Bipartite Matching.
1 “Graph theory” Course for the master degree program “Geographic Information Systems” Yulia Burkatovskaya Department of Computer Engineering Associate.
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.
Matching Algorithms and Networks. Algorithms and Networks: Matching2 This lecture Matching: problem statement and applications Bipartite matching Matching.
Assignments and matchings Chapter 12 Presented by Yorai Geffen.
Matching Lecture 19: Nov 23.
Network Flows Chun-Ta, Yu Graduate Institute Information Management Dept. National Taiwan University.
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Hamiltonian Cycles Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering,
Graph Algorithms Maximum Flow - Best algorithms [Adapted from R.Solis-Oba]
CSE, IIT KGP Graph Theory: Introduction Pallab Dasgupta Dept. of CSE, IIT
Introduction to Graph Theory
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Trees Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT
1 Assignment #3 is posted: Due Thursday Nov. 15 at the beginning of class. Make sure you are also working on your projects. Come see me if you are unsure.
Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Planarity Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
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.
Graph Theory Ch. 3. Matchings and Factors 1 Chapter 3 Matchings and Factors.
IOI/ACM ICPC Training 4 June 2005.
Chapter 10 Iterative Improvement
Chapter 5 Fundamental Concept
Algorithms and Networks
Maximum Flow - Best algorithms
Chapter 5. Optimal Matchings
Various Graph Algorithms
Analysis of Algorithms
Graph Theory: Cuts and Connectivity
Graph Theory: Proof Techniques
Graph Theory: Euler Graphs and Digraphs
Graph Theory: Degree Sequences and Digraphs
Presentation transcript:

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Graph Theory: Matchings and Factors Pallab Dasgupta, Professor, Dept. of Computer Sc. and Engineering, IIT

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Matchings A matching of size k in a graph G is a set of k pairwise disjoint edges. – The vertices belonging to the edges of a matching are saturated by the matching; the others are unsaturated. – If a matching saturates every vertex of G, then it is a perfect matching or 1-factor.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Alternating Paths Given a matching M, an M-alternating path is a path that alternates between the edges in M and the edges not in M. – An M-alternating path P that begins and ends at M- unsaturated vertices is an M-augmenting path – Replacing M  E(P) by E(P)  M produces a new matching M with one more edge than M.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Symmetric Difference If G and H are graphs with vertex set V, then the symmetric difference, G  H is the graph with vertex set V whose edges are all those edges appearing in exactly one of G and H. – If M and M are matchings, then M  M = (M  M)  (M  M)

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Key result A matching M in a graph G is a maximum matching in G iff G has no M-augmenting path.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Bipartite Matching When G is a bipartite graph with bipartition X,Y we may ask whether G has a matching that saturates X. – We call this a matching of X into Y.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Results… [Hall’s Theorem: 1935] If G is a bipartite graph with bipartition X,Y, then G has a matching of X into Y if and only if |N(S)|  |S| for all S  X. For k>0, every k -regular bipartite graph has a perfect matching.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Vertex Cover & Bipartite Matching A vertex cover of G is a set S of vertices such that S contains at least one endpoint of every edge of G. – The vertices in S cover the edges of G. [König and Egerváry: 1931] If G is a bipartite graph, then the maximum size of a matching in G equals the minimum size of a vertex cover of G.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Edge Cover An edge cover of G is a set of edges that cover the vertices of G. – only graphs without isolated vertices have edge covers.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Notation… We will use the following notation for independence and covering problems  (G) :maximum size of independent set  (G) :maximum size of matching  (G) :minimum size of vertex cover  (G) :minimum size of edge cover

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Min-max Theorems In a graph G, S  V(G) is an independent set if and only if S is a vertex cover, and hence  (G) +  (G) = n(G). If G has no isolated vertices, then  (G) +  (G) = n(G). If G is a bipartite graph with no isolated vertices, then  (G) =  (G) (max independent set = min edge cover)

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Augmenting Path Algorithm Input: A bipartite graph G with a bipartition X,Y, a matching M in G, and the set U of all M- unsaturated vertices in X. Idea: Explore M- alternating paths from U, letting S  X and T  Y be the sets of vertices reached. Mark vertices of S that have been explored for extending paths. For each x  (S  T)  U, record the vertex before x on some M - alternating path from U.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Augmenting Path Algorithm Initialization: Set S=U and T=  Iteration: If S has no unmarked vertex, the stop and report T  (X  S) as a minimum cover and M as a maximum matching. Otherwise, select an unmarked x  S. To explore x, consider each y  N(x) such that xy  M. If y is unsaturated, terminate and trace back from y to report an M -augmenting path from U to y. Otherwise, y is matched to some w  X by M. In this case, include y in T and w in S. After exploring all such edges incident to x, mark x and iterate.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Augmenting Path Algorithm Repeated application of the Augmenting Path Algorithm to a bipartite graph produces a matching and vertex cover of the same size. – The complexity of the algorithm is O(n 3 ). – Since matchings have at most n/2 edges, we apply the augmenting path algorithm at most n/2 times. – In each iteration, we search from a vertex of X at most once, before we mark it. Hence each iteration is O(e(G)), which is O(n 2 ).

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Weighted Bipartite Matching A transversal of an n X n matrix A consists of n positions – one in each row and each column. – Finding a transversal of A with maximum sum is the assignment problem. – This is the matrix formulation of the maximum weighted matching problem, where A is the matrix of weights w ij assigned to the edges x i y j of K n,n and we seek a perfect matching M with maximum total weight w(M).

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Minimum Weighted Cover Given the weights {w ij }, a weighted cover is a choice of labels {u i } and {v j } such that u i + v j  w ij for all i,j. The cost c(u,v) of a cover u,v is  u i +  v j. The minimum weighted cover problem is the problem of finding a cover of minimum cost.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Min Cover & Max Matching If M is a perfect matching in a weighted bipartite graph G and u,v is a cover, then c(u,v)  w(M). – Furthermore, c(u,v) = w(M) if and only if M consists of edges x i y j such that u i + v j = w ij. In this case, M is a maximum weight matching and u,v is a minimum weight cover.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Hungarian Algorithm Input: A matrix of weights on the edges of K n,n with bipartition X,Y. Idea: Maintain a cover u,v, iteratively reducing the cost of the cover until the equality subgraph, G u,v has a perfect matching. Initialization: Let u,v be a feasible labeling, such as u i = max j w ij and v j = 0, and find a maximum matching M in G u,v.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Hungarian Algorithm Iteration: If M is a perfect matching, stop and report M as a maximum weight matching. Otherwise, let U be the set of M-unsaturated vertices in X. Let S be the set of vertices in X and T the set of vertices in Y that are reachable by M-alternating paths from U. Let  = min{u i + v j  w ij : x i  S, y j  Y  T} Decrease u i by  for all x i  S, and increase v j by  for all y j  T. If the new equality subgraph G contains an M-augmenting path, replace M by a maximum matching in G and iterate. Otherwise, iterate without changing M.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Hungarian Algorithm The Hungarian Algorithm finds a maximum weight matching and a minimum cost cover.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Stable Matchings Given n men and n women, we wish to establish n stable marriages. – If man x and woman a prefers each other over their existing partners, then they might leave their current partners and switch to each other. – In this case we say that the unmatched pair (x,a) is an unstable pair. – A perfect matching is a stable matching if it yields no unstable matched pair.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Gale-Shapley Proposal Algorithm Input: Preference rankings by each of n men and n women. Iteration: – Each man proposes to the highest woman on his preference list who has not previously rejected him. – If each woman receives exactly one proposal, stop and use the resulting matching. – Otherwise, every woman receiving more than one proposal rejects all of them except the one that is highest on her preference list. – Every woman receiving a proposal says “ maybe ” to the most attractive proposal received. The algorithm produces a stable matching.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Matchings in General Graphs A factor of a graph G is a spanning sub-graph of G. A k-factor is a spanning k-regular sub-graph. An odd component of a graph is a component of odd order; the number of odd components of H is o(H). [Tutte 1947]: A graph G has a 1-factor iff o(G – S)  |S| for every S  V(G). [Peterson 1891]: Every 3-regular graph with no cut-edge has a 1-factor.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Edmond’s Blossom Algorithm Let M be a matching in a graph G, and let u be an M-unsaturated vertex. A flower is the union of two M -alternating paths from u that reach a vertex x on steps of opposite parity. The stem of the flower is the maximal common initial path. The blossom of the flower is the odd cycle obtained by deleting the stem.

Indian Institute of Technology Kharagpur PALLAB DASGUPTA Edmond’s Blossom Algorithm Input:A graph G, a matching M in G, and an M-unsaturated vertex u. Initialization: S = { u } and T = { } Iteration: – Is S has no unmarked vertex, stop – Otherwise, select an unmarked vertex v  S. To explore from v, successively consider each y  N(v) such that y  T. – If y is unsaturated by M, then trace back from y to report an M-augmenting u,y -path. – If y  S, then a blossom has been found. Contract the blossom and continue the search from this vertex in the smaller graph. – Otherwise, y is matched to some w by M. Include y in T (reached from v ), and include w in S. – After exploring all such neighbors of v, mark v and iterate.