Chapter 6 Matchings and Factorizations

advertisement
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
Ch6-2
Copyright  黃鈴玲
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, where
each woman knows some of the men, under what
conditions can every woman marry a man she
knows? A variation of this problem is to find the
maximum number of woman, each of whom can
marry a man she knows.
Ch6-3
Copyright  黃鈴玲
Model the problem:
bipartite graph G = (S1S2, E),
S1={men}, S2={women},
abE 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?
Ch6-4
Copyright  黃鈴玲
Optimal Assignment Problem:
Given several job openings and applicants for
one or more of these positions. The hiring company
wishes to receive the maximum possible benefit as
a result of its hiring. For example, the experience
of the applicants may be an important factor to
consider during the hiring process. The company
may benefit by employing fewer people with more
experience than a larger number with less
experience.
Ch6-5
Copyright  黃鈴玲
Model the problem:
weighted bipartite graph G = (S1S2, E),
S1={applicants}, S2={jobs},
a S1, b S2, abE 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.
Ch6-6
Copyright  黃鈴玲
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.
Ch6-7
Copyright  黃鈴玲
a
b
c
d
e
M = { ab, cd, ef }
is a maximum matching
M’ = { bc, de } is maximal,
not maximum.
f
Maximum (所有matching中最多edge的)
 Maximal (此matching不可再加邊成為
更大的matching)
Ch6-8
Copyright  黃鈴玲
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.
Ch6-9
Copyright  黃鈴玲
Definition:
A matching in a weighted graph G 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.
Ch6-10
Copyright  黃鈴玲
v1 1
v2 2
v3
3
v5
1
v6
1
v4
M = { v1v2, v3v5 }is a maximum weight
matching (weight sum=4)
M’ = {v1v2, v3v4, v5v6 }is a maximum
matching
Ch6-11
Copyright  黃鈴玲
Definition:
M : a matching of a graph G,
e: an edge, v: a vertex
(1). eM : e is called a matched edge
(2). e M : e is an unmatched edge
(3). v is a matched vertex if v is 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.
Ch6-12
Copyright  黃鈴玲
An augmenting path P of G :
M
M
M
M
M
M
Single
vertex
P中的邊將M的與M的性質交換,
M中的邊數會加一。
Ch6-13
Copyright  黃鈴玲
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)
Ch6-14
Copyright  黃鈴玲
Example:
G:
M1
M2
H : ( V(H)=V(G) )
H裡沒有degree  3的點
Ch6-15
Copyright  黃鈴玲
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
Ch6-16
Copyright  黃鈴玲
Homework
Exercise 6.1:
1
Ch6-17
Copyright  黃鈴玲
Outline
6.1 An Introduction to Matchings
6.2 Maximum Matchings in
Bipartite Graphs
6.3 Maximum Matchings in General
Graphs
6.4 Factorizations
Ch6-18
Copyright  黃鈴玲
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 matching M1.]
1. i 1, M  M1
2. If i < p, then continue;
otherwise, stop, M is a maximum matching now.
3. If vi is 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.
Ch6-19
Copyright  黃鈴玲
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.
Ch6-20
Copyright  黃鈴玲
Example (Fig 6.6)
x1
y1
x2
y2
x3
y3
x4
y4
x5
y5
x6
y6
Initial matching M1
Augmenting path
i=1, x1 is matched.
i=2, v=x2
Q:
x2 x3 x5 x4 x1 x6
x2
y2
y6
x3
x5
y3
y4
y5
x4
x1
x6
y1
Ch6-21
Copyright  黃鈴玲
Example (Fig 6.6)
x1
y1
x2
y2
i=3, x3 is matched.
x3
y3
i=4, x4 is matched.
x4
y4
…
x5
y5
x6
y6
i=12, y6 is matched.
New matching M
M = { x2y6, x5y4, x1y1, x4y3, x3y2, x6y5 } is maximum.
Ch6-22
Copyright  黃鈴玲
Homework
Exercise 6.2:
3
Ch6-23
Copyright  黃鈴玲
Outline
6.1 An Introduction to Matchings
6.2 Maximum Matchings in
Bipartite Graphs
6.3 Maximum Matchings in General
Graphs
6.4 Factorizations
Ch6-24
Copyright  黃鈴玲
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中允許點重複,
但每點不可同時是自己的祖先
Ch6-25
Copyright  黃鈴玲
Example (Fig 6.9)
c
a
d
a
b
b
c
u
u
z
y
x
d
d
v
w
Initial matching M1
y
w
v
x
v
w
w
x
v
y
Augmenting path
c
z
Ch6-26
Copyright  黃鈴玲
Example (Fig 6.10)
1
4
2
3
4
10
2
5
6
5
7
11
8
9
3
6
7
1
8
9
9
8
7
6
Initial matching M1
Augmenting path
10
Ch6-27
Copyright  黃鈴玲
Homework
Exercise 6.3:
3 (先任給一個matching)
Ch6-28
Copyright  黃鈴玲
Outline
6.1 An Introduction to Matchings
6.2 Maximum Matchings in
Bipartite Graphs
6.3 Maximum Matchings in General
Graphs
6.4 Factorizations
Ch6-29
Copyright  黃鈴玲
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
n
such that U i=1E(Gi) = E(G). Then G is
factorable or factored into the subgraphs or
factors G1, G2, …, Gn, and we write G = G1 
G2 …  Gn. This expression is also called a
factorization of G into the factors G1, G2, …,
Gn.
Ch6-30
Copyright  黃鈴玲
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.
Ch6-31
Copyright  黃鈴玲
A 1-factorization of K3,3
H1
H
H2
H3
Ch6-32
Copyright  黃鈴玲
A 2-factorization of K5
H
H1
H2
Ch6-33
Copyright  黃鈴玲
A 1-factorable cubic (3-regular)graph
G
H1
H2
H3
Ch6-34
Copyright  黃鈴玲
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的分解方法)
Ch6-35
Copyright  黃鈴玲
A 1-factorization of K6
H1
H3
H4
H2
H5
中心點 v 每次先連一點 x,再將剩下的點配對,
產生的邊需垂直於 vx
Ch6-36
Copyright  黃鈴玲
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 n
Hamiltonian cycles.
Proof. (參考下頁K7的分解方法)
Ch6-37
Copyright  黃鈴玲
3 Hamiltonian cycles of K7
v1
v1
v6
v0
v2
v3
v5
v4
F1
v6
v1
v2
v6
v2
v0
v0
v5
v3
v4
F2
v5
v3
v4
F3
Ch6-38
Copyright  黃鈴玲
Petersen Graph
(在圖論的一些性質中常扮演反例的角色)
Petersen graph is not 1-factorable.
(證明略過)
Ch6-39
Copyright  黃鈴玲
Homework
Exercise 6.4:
3, 4 (參考Fig 6.14)
Ex 3. Show that CnK2 is 1-factoriable for every n  4.
C4K2 :

Ch6-40
Copyright  黃鈴玲
Download