Top Banner
3/24/03 Tucker, Section 4.3 1 Tucker, Applied Combinatorics, Sec. 4.3, prepared by Jo E-M Bipartite Graph Matching Some Definitions X-Matching Maximal Matching A set of independent edges Edges only between X and Y X Y All vertices in X are used The largest possible number of edges Note: an X-matching is necessarily maximal.
17

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.

Dec 21, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 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.

3/24/03 Tucker, Section 4.3 1

Tucker, Applied Combinatorics, Sec. 4.3, prepared by Jo E-M

Bipartite Graph MatchingSome Definitions

X-Matching Maximal Matching

A set of independent edgesEdges only between X and Y

X Y

All vertices in X are used The largest possible number of edges

Note: an X-matching is necessarily maximal.

Page 2: 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.

3/24/03 Tucker, Section 4.3 2

More Definitions

Edge Cover

A set of vertices so that every edge is incident to at least one of them

R(A)

Range of a set A of vertices

R(A) is the set of vertices adjacent to at least one vertex in A

A = red, R(A) = blue

Page 3: 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.

3/24/03 Tucker, Section 4.3 3

Matching Network

za

All edges capacity 1

All edges infinite capacity

By converting the bipartite graph to a network, we can use network flow techniques to find matchings.

Page 4: 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.

3/24/03 Tucker, Section 4.3 4

Matching Network

za

All edges capacity 1

All edges infinite capacity

Matching a – z flow

Page 5: 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.

3/24/03 Tucker, Section 4.3 5

Matching Network

za

All edges capacity 1

All edges infinite capacity

X – matching saturation at a

Page 6: 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.

3/24/03 Tucker, Section 4.3 6

Matching Network

Maximal matching Maximal flow

za

All edges capacity 1

All edges infinite capacity

Page 7: 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.

3/24/03 Tucker, Section 4.3 7

Matching Network

Edge cover Finite a – z cut

za

All edges capacity 1

All edges infinite capacity

A = red on left, B = red on right

S = red vertices, an edge cover

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, to , to P.

Thus only uncovered edges, would go from P to .

P P P

P

Page 8: 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.

3/24/03 Tucker, Section 4.3 8

Matching Network

Not an edge cover Infinite a – z cut

za

All edges capacity 1

All edges infinite capacity

A = red on left, B = red on right

S = red vertices, NOT an edge cover

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.

Page 9: 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.

3/24/03 Tucker, Section 4.3 9

Theorem 1Recall Corollary 3a from Section 4.2:

The size of a maximal flow is equal to the capacity of a minimal cut.

Since….

Then,

The size of a maximal matching is equal

to the size of a minimal edge cover.

Edge cover Finite a – z cut

Matching a – z flow

and

Page 10: 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.

3/24/03 Tucker, Section 4.3 10

Finding Matchings

za

All edges capacity 1

All edges infinite capacity

Take any matching, convert to a network, and then use the augmenting flow algorithm to find a maximal flow, hence a maximal matching.

Page 11: 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.

3/24/03 Tucker, Section 4.3 11

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

Page 12: 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.

3/24/03 Tucker, Section 4.3 12

Example

Start with any matching

Find an alternating path

Start at an unmatched vertex

in X

End at an unmatched vertex

in Y

Switch matching to nonmatching and vice versa

A maximal matching!

Page 13: 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.

3/24/03 Tucker, Section 4.3 13

Theorem 2Hall’s Matching Theorem

A bipartite graph has an X-matching if and only if for every subset A of X, |R(A)| is greater than or equal to |A|.

X – matching True for all A in X

Page 14: 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.

3/24/03 Tucker, Section 4.3 14

Proof ofHall’s Matching Theorem

“ ”: An X-matching implies that for every subset A of X, |R(A)| is greater than or equal to |A|.

X – matching For any A, the X – matching gives at least one vertex in R(A) for every vertex in A.

Page 15: 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.

3/24/03 Tucker, Section 4.3 15

Proof ofHall’s Matching 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 .

• Taking A = X, we have that since the range of X is contained in Y. Thus .

• Also, by Theorem 1, if S is a minimal edge cover, then .

• Note that if , then M must be an X – matching.

• Thus, it suffices to show that for all edge covers S.

min X , YM

M S

X X YR XM

XM

X S

Page 16: 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.

3/24/03 Tucker, Section 4.3 16

Since , .

Now let A be the vertices in X but not in S, so that .

Thus, .

Now, S is an edge-cover, so if it doesn’t contain 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 , so .

Thus,

But , hence ,

so as needed. ///

Proof of Hall’s Matching Theorem“ ”: Continued… we need to show that for all

edge covers S. X S

S S X S Y S S X S Y

S X X A

S S X S Y X A S Y

a A

R A S Y R A S Y

S X A S Y X A R A

0A R A A R A

S X A R A X

Page 17: 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.

3/24/03 Tucker, Section 4.3 17

Example To Try

Make up a random bipartite graph with about 20 vertices total. Swap with someone, and then both of you find an X-matching