550 likes | 997 Views
Graph Theory Chapter 6 Matchings and Factorizations. 大葉大學 (Da-Yeh Univ.) 資訊工程系 (Dept. CSIE) 黃鈴玲 (Lingling Huang). Outline. 6.1 An Introduction to Matchings 6.2 Maximum Matchings in Bipartite Graphs 6.3 Maximum Matchings in General Graphs 6.4 Factorizations.
E N D
Graph TheoryChapter 6 Matchings and Factorizations 大葉大學(Da-Yeh Univ.)資訊工程系(Dept. CSIE)黃鈴玲(Lingling Huang)
Outline 6.1 An Introduction to Matchings 6.2 Maximum Matchings in Bipartite Graphs 6.3 Maximum Matchings in General Graphs 6.4 Factorizations
6.1 An Introduction to Matchings Focus: Find 1-regular subgraphs of maximum size in a graph. Marriage Problem:Given a collection of men and women, whereeach woman knows some of the men, under whatconditions can every woman marry a man she knows? A variation of this problem is to find themaximum number of woman, each of whom canmarry a man she knows.
Model the problem:bipartite graph G = (S1S2, E),S1={men}, S2={women}, abE if a knows b.(1) Under what conditions does G have a 1-regular subgraph that contains all the vertices that represent the women?(2) What is the maximum size of a 1-regular subgraph of G?
Optimal Assignment Problem:Given several job openings and applicants for one or more of these positions. The hiring companywishes to receive the maximum possible benefit as a result of its hiring. For example, the experienceof the applicants may be an important factor to consider during the hiring process. The company may benefit by employing fewer people with moreexperience than a larger number with lessexperience.
Model the problem:weighted bipartite graph G = (S1S2, E),S1={applicants}, S2={jobs}, a S1,b S2,abE if a has applied b, w(a,b) is the benefit that the company will gain by hiring applicant a. To find a 1-regular subgraph H of G where the sum of the weights of the edges in H is a maximum.
Definition: A matching in a graph G is a 1-regular subgraph of G, that is, a subgraph induced by a collection of pairwise nonadjacent edges. We also refer to a matching as a collection of edges that induces a matching. A matching of maximum cardinality in a graph G is called a maximum matching of G.
a b M={ ab, cd, ef }is amaximum matching M’ = { bc, de } is maximal, not maximum. c d e f Maximum (所有matching中最多edge的) Maximal (此matching不可再加邊成為 更大的matching)
Definition:If G is a graph of order p that has a matching of cardinality p/2, then such a matching is called a perfect matching. Note:If a graph of order p has a perfect matching, then p must be even. 反之未必成立e.g. K1,3 has even order but no perfect matching.
Definition: A matching in a weighted graphG is a set of edges of G, no two of which are adjacent. A maximum weight matching in a weighted graph is a matching in which the sum of the weights of its edges is maximum. Note:A maximum weight matching need not be a maximum matching.
1 2 3 1 v1 v2 v3 v5 v6 1 v4 M ={ v1v2, v3v5 }is amaximum weight matching (weight sum=4) M’ = {v1v2, v3v4, v5v6 }is amaximum matching
Definition: M : a matching of a graph G, e: an edge, v: a vertex (1). eM : e is called a matched edge (2). e M : e is an unmatched edge (3). v is a matched vertex ifvis incident with a matched edge; v is a single vertex otherwise. (4). An alternating path of G is a path whose edges are alternately matched and unmatched. (5). An augmenting path of G is an alternating path that begins and ends with single vertices.
Singlevertex An augmenting path P of G : M M M M M M P中的邊將M的與M的性質交換, M中的邊數會加一。
Thm 6.1 : M1, M2 : matchings of G E=(M1-M2)∪(M2-M1), H is the spanning subgraph of G with E(H)=E, then every component of H is one of the following type: (a) K1 (b) C2n for some n (c) a path (alternating path)
Example: M1M2 G : H : ( V(H)=V(G) ) H裡沒有degree 3的點
Thm 6.2 A matching M in a graph G is a maximum matching if and only if there is no augmenting path, with respect to M, in G. Pf: ) trivial ) by Thm 6.1
Homework Exercise 6.1: 1
Outline 6.1 An Introduction to Matchings 6.2 Maximum Matchings in Bipartite Graphs 6.3 Maximum Matchings in General Graphs 6.4 Factorizations
6.2 Maximum Matchings in Bipartite Graphs Algorithm 6.1 (A maximum matching algorithm for bipartite graphs)[To determine a maximum matching in a bipartite graph G with V(G)={v1, v2, …, vp} and an initial matchingM1.] 1. i1, M M1 2. If i < p, then continue; otherwise, stop, M is a maximum matching now. 3. If viis matched, then i i +1 and return to Step 2;otherwise, v vi and Q is initialized to contain v only. 4. 4.1 For j = 1, 2, …, p and j i, let Tree(vj)=F. (表示vj不在alternating tree中)Also, Tree(vi)=T.
4.2 If Q= , then i i +1 and return to step 2; otherwise, delete a vertex x from Q and continue. 4.3 4.3.1 Suppose that N(x)={y1, y2, …, yk}. Let j 1. 4.3.2 If j k, then y yj; otherwise, return to Step 4.2. 4.3.3 If Tree(y)=T, then j j + 1 and return to Step 4.3.2; otherwise, continue.4.3.4 If y is incident with a matched edge yz, then Tree(y)T, Tree(z)T, Parent(y)x, Parent(z)y and add z to Q, j j + 1, and return to Step 4.3.2. Otherwise, y is a single vertex (找到了!) and we continue. 4.3.5 Use array Parent to determine the alternating v-x path P’ in the tree. Let P P’U{xy} be the augmenting path. 5. Augment M along P to obtain a new matching M’.Let M M’,i i +1 , and return to step 2.
Q : x2 x2 y2 y6 x5 x3 y3 y4 y5 x1 x4 x6 Augmenting path y1 Example (Fig 6.6) i=1, x1 is matched. x1 y1 i=2, v=x2 x2 y2 x3 x5 x4 x1 x6 x3 y3 x4 y4 y5 x5 x6 y6 Initial matching M1
Example (Fig 6.6) x1 y1 i=3, x3 is matched. x2 y2 i=4, x4 is matched. x3 y3 x4 y4 … y5 x5 i=12, y6 is matched. x6 y6 New matching M M = { x2y6, x5y4, x1y1, x4y3, x3y2, x6y5 } is maximum.
Homework Exercise 6.2: 3
Outline 6.1 An Introduction to Matchings 6.2 Maximum Matchings in Bipartite Graphs 6.3 Maximum Matchings in General Graphs 6.4 Factorizations
6.3 Maximum Matchings in General Graphs • For general graphs, the task of finding augmenting paths is complicated by the presence of odd cycles that have a maximum number of matched edges. 將Alg 6.1 修改為tree中允許點重複,但每點不可同時是自己的祖先
a b c d u c d y w w v x v v w x y z Augmenting path Example (Fig 6.9) c d a b u z v y w x Initial matching M1
4 2 5 3 6 7 1 8 9 9 8 7 6 10 Augmenting path Example (Fig 6.10) 1 2 3 4 5 10 6 7 11 8 9 Initial matching M1
Homework Exercise 6.3: 3 (先任給一個matching)
Outline 6.1 An Introduction to Matchings 6.2 Maximum Matchings in Bipartite Graphs 6.3 Maximum Matchings in General Graphs 6.4 Factorizations
6.4 Factorizations Definition. A factor of a graph G is a spanning subgraph of G. (It is possible that a factor has no edges.) Suppose that G1, G2, …, Gn are pairwise edge-disjoint spanning subgraphs of G such that Uni=1E(Gi) = E(G). Then G is factorable or factored into the subgraphs or factorsG1, G2, …, Gn, and we write G = G1 G2 … Gn. This expression is also called a factorization of G into the factors G1, G2, …, Gn.
Definition. An r-regular factor of a graph G is an r-factor of G. Thus, a graph has a 1-factor if and only if it contains a perfect matching. Definition. If there is a factorization of a graph G into r-factors, then G is said to be r-factorable. In this case, G is k-regular for some k that is a multiple of r.
H1 H2 H3 A 1-factorization of K3,3 H
H1 H2 A 2-factorization of K5 H
G H1 H3 H2 A 1-factorable cubic (3-regular)graph
Theorem 6.10 Every regular bipartite multigraph of degree r 1 is 1-factorable. Proof. (by induction on r) Theorem 6.11 For every positive integer n, the graph K2n is 1-factorable. Proof. (參考下頁K6的分解方法)
H1 H2 H5 H4 H3 A 1-factorization of K6 中心點 v 每次先連一點 x,再將剩下的點配對,產生的邊需垂直於 vx
Definition A spanning cycle in a graph G is called a Hamiltonian cycle. Theorem 6.12 For every positive integer n, the graph K2n+1 is can be factored into nHamiltonian cycles. Proof. (參考下頁K7的分解方法)
3 Hamiltonian cycles of K7 v1 v1 v1 v2 v6 v2 v6 v6 v2 v0 v0 v0 v3 v5 v5 v3 v5 v3 v4 v4 v4 F1 F2 F3
Petersen Graph (在圖論的一些性質中常扮演反例的角色) Petersen graph is not 1-factorable.(證明略過)
Homework Exercise 6.4: 3, 4 (參考Fig 6.14) Ex 3. Show that CnK2 is 1-factoriable for every n 4. C4K2 :