Tucker 4-4 - Academics

advertisement
Applied Combinatorics,
Alan Tucker
th
4
Ed.
Section 4.4
Algorithmic Matching
Prepared by Joshua
Schoenly and Kathleen
McNamara
04/12/2005
Tucker, Sec. 4.4
1
Some Definitions
Matching - a set of independent edges
Note: independent edges refer to
edges that do not share a
common vertex
X
Y
X-Matching - All vertices in X are used
Maximal Matching - The largest possible
number of independent
edges
Note: an X-matching is necessarily maximal.
04/12/2005
Tucker, Sec. 4.4
2
More Definitions
R(A)
Range of a set A of vertices
Edge Cover
R(A) is the set of
vertices adjacent to at
least one vertex in A
A set of vertices so that
every edge is incident to
at least one of them
A = red, R(A) = green
04/12/2005
Tucker, Sec. 4.4
3
Matching Network
All edges infinite
capacity
a
z
All edges capacity 1
By converting the bipartite graph to a network, we can use
network flow techniques to find matchings.
04/12/2005
Tucker, Sec. 4.4
4
Matching Network
zz
a
asaturation
– z flow at a
Matching
X – matching
04/12/2005
Tucker, Sec. 4.4
5
Matching Network
a
Maximal matching
04/12/2005
z
Maximal flow
Tucker, Sec. 4.4
6
Matching Network
S = red vertices, an edge cover
a
A = red on left, B = red on right
z
P = a, black on left, red on right
P = z, red on left, black on right
Edge cover means that all edges have at least one red endpoint:
P to P,
Thus only uncovered edges,
P to P ,
would go from P to P .
Finite a – z cut
Edge cover
04/12/2005
P to P.
Tucker, Sec. 4.4
7
Matching Network
S = red vertices, NOT an edge cover
a
A = red on left, B = red on right
z
P = a, black on left, red on right
P = z, red on left, black on right
An infinite cut would go through an edge with two black endpoints, which
corresponds to an uncovered edge.
Infinite a – z cut
Not an edge cover
04/12/2005
Tucker, Sec. 4.4
8
Theorem 1
Recall Corollary 2a from Section 4.3:
The size of a maximal flow is equal to the capacity of a minimal cut.
Since….
a – z flow
Matching
and
Finite a – z cut
Edge cover
Then,
The size of a maximal matching is equal
to the size of a minimal edge cover.
04/12/2005
Tucker, Sec. 4.4
9
Finding Matchings
a
z
Take any matching, convert to a network, and then use the
augmenting flow algorithm to find a maximal flow, hence a
maximal matching.
04/12/2005
Tucker, Sec. 4.4
10
An easy way to think about it
1.
Start with any matching.
2.
From an unmatched vertex in X, alternate between nonmatching and matching edges until you hit an unmatched
vertex in Y.
3.
Then switch between the non-matching and matching edges
along to path to pick up one more matching edge.
4.
Continue this until no unmatched vertex in X leads to an
unmatched vertex in Y.
04/12/2005
Tucker, Sec. 4.4
11
Example
Start with any matching
Start at an
unmatched vertex
in X
End at an
unmatched vertex
in Y
Find an alternating path
Switch matching to nonmatching and vice versa
A maximal
matching!
Note: if this does not result in a maximal matching, start from step one and do it again.
04/12/2005
Tucker, Sec. 4.4
12
Theorem 2
Hall’s Marriage Theorem
A bipartite graph has an X-matching if and only if for every
subset A of X, the number of vertices in R(A) is greater
than or equal to the number of vertices in A.
X – matching
A is the set of
red vertices
R(A) is the set
of blue vertices
True for all A in X
04/12/2005
Tucker, Sec. 4.4
13
Proof of
Hall’s Marriage Theorem
“
”: An X-matching implies that for every subset A of X,
|R(A)| is greater than or equal to |A|.
X – matching
04/12/2005
For any A, the X – matching gives
at least one vertex in R(A) for
every vertex in A.
Tucker, Sec. 4.4
14
Proof of
Hall’s Marriage Theorem
“
”: If |R(A)| is greater than or equal to |A| for every
subset A of X, then there is an X-matching.
•
First note that if M is a maximal matching, then M  min  X , Y  .
•
Taking A = X, we have that X  R  X   Y since the range of X is
contained in Y. Thus M  X .
•
Also, by Theorem 1, if S is a minimal edge cover, then M  S .
•
Note that if
•
Thus, it suffices to show that X  S
04/12/2005
M  X , then M must be an X – matching.
Tucker, Sec. 4.4
for all edge covers S.
15
Proof of Hall’s Marriage Theorem
“
”: Continued… we need to show that X  S for all
edge covers S.
Since S   S  X    S  Y  ,
S  S  X  S Y .
Now let A be the vertices in X but not in S, so that S  X  X  A .
Thus, S  S  X  S  Y  X  A  S  Y .
Now, S is an edge-cover, so if it doesn’t contain a  A on the X side, it must
contain all the vertices a goes to on the Y side in order to cover the edges in
between. Thus R  A  S  Y , so R  A  S  Y .
Thus, S  X  A  S  Y  X  A  R  A
R(A)
A
But A  R  A , hence  A  R  A  0 ,
so S  X  A  R  A  X
04/12/2005
as needed. QED
Tucker, Sec. 4.4
S
16
Class Problem
Problem #7
In the following table of remaining games, is it possible
for the Bears to be champions (or co-champions) if they
win all remaining games? Build the appropriate
network model.
Team
Wins to
Date
Games to
Play
With
Bears
With
Lions
With
Tigers
With
Vampires
Bears
26
14
--
4
4
6
Lions
34
5
4
--
0
1
Tigers
32
8
4
0
--
4
Vampires
29
11
6
1
4
--
04/12/2005
Tucker, Sec. 4.4
17
Class Problem
Problem #7
In the following table of remaining games, is it possible
for the Bears to be champions (or co-champions) if they
win all remaining games? Build the appropriate
network model.
Team
Wins to
Date
Games to
Play
With
Bears
With
Lions
With
Tigers
With
Vampires
Bears
26
14
--
4
4
6
Lions
34
1
4
--
0
1
Tigers
32
4
4
0
--
4
Vampires
29
5
6
1
4
--
04/12/2005
Tucker, Sec. 4.4
18
Solution to Class Problem
L
6,1
a
LT
∞,0
T
LV
1,1
8,0
∞,0
z
∞,0
4,4
11,4
V
04/12/2005
0,0
∞,0
∞,1
∞,4
TV
Tucker, Sec. 4.4
19
Solution to Class Problem
L
6,1
a
LT
∞,0
0,0
∞,0
∞,1
T
LV
1,1
8,0
z
∞,0
∞,0
11,4
V
4,4
∞,4
TV
Yay! There is still hope for the Bears! 
04/12/2005
Tucker, Sec. 4.4
20
Download