E N D
1. Matching and Factors Matchings and Covers
2. Definitions: A matching M in a graph G is a set of non loop edges with no shared endpoints.
3. Definitions: The vertices incident to the edges of a matching M are saturated by M; the others are unsaturated ( we say M-saturated and M-unsaturated). A perfect matching in a graph is a matching that saturates every vertex.
4. Maximum & Maximal matchings A maximal matching in a graph is a matching that cannot be enlarged by adding an edge. A maximum matching is a matching of maximum size among all matchings in the graph.
Maximal ? maximum
5. M-alternating path Given a matching M, a M-alternating path is a path that alternates between edges in M and edges not in M
6. M-augmenting path M-augmenting paths can be used to enlarge matchings.
7. Theorem 3.1.10 A matching M in a graph G is a maximum matching in G if and only if G has no M-augmenting path.
Only if: Trivial.
8. Symmetric difference If G and H are graphs with vertex set V, then 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.
We also use this notation for sets of edges; If M and M are matchings, then M?M = (M-M)?(M-M)
9. Symmetric difference M ? M
10. Lemma 3.1.9 Every component of the symmetric difference of two matchings is a path or an even cycle
Proof:
Let F = M ? M
1. Every vertix has at most one incident edge from M and M ( d(v) <=2 )
Because M and M are matchings
2. ? ?( F ) <=2,every component of f is a path or a cycle.
11. Lemma 3.1.9 proof (contd) 3. Every path or cycle in F alternates between edges of M and edges of M
?Every cycle has even length, with an equal number of edges from M and M.
12. Proof of Theorem 3.1.10 If part: A matching M in a graph G is a maximum matching in G if G has no M-augmenting path.
Contrapositive: G has a matching larger than M => G has an M-augmenting path.
Proof:
Let M be a matching in G larger than M; we construct an M-augmenting path.
13. Proof of Theorem (contd) Let F = M ? M By Lemma 3.1.9 F consists of paths and even cycles. ( And they are M - M alternating)
Since |M| > |M| F must have a component with more edges of M than of M
Cycles: Edges from M and M are of equal numbers.
Paths: Only start and ends with edges of M
That is an M-augmenting path in G.
14. Halls Matching Condition Seek a matching that saturates X
15. Halls Theorem An X, Y-bigraph G has a matching that saturates X if and only if | N(S)| ? |S| for all S ? X
Proof:
Necessity: The |S| vertices matched to S must lie in N(S)
Sufficiency: Contrapositive: If M is a maximum matching in G and M does not saturate X, then we can find a set S ? X such that |N(S)| < |S|. (Notice that if maximum matching M doesnt saturate X, implies X cannot be saturated anyway)
16. Proof of Halls Theorem (Sufficiency) Let u ? X be a vertex unsaturated by M.
u..M-alternating paths.. reachable: S and T ( u ? S)
17. M matches T with S {u}.
S {u} is reached by an edge in M from a vertex in T.
T is all saturated. Because no M-augmenting path. ( M maximum)
1.&2. Bijection from T to S - {u} ? |T| = |S - {u}|
18. T = N(S)
T ? N(S) ( T are matched with S-{u})
No vertex in N(S) other than T ?T = N(S)
Suppose y ? Y T has a neighbor v ? S.
vy not in M: Because u is unsaturated and all the rest of S is matched to T by M.
thus adding vy to an M-alt. path to v yields an M-alt. path to y => contradiction y not reachable
19. Completes the proof T = N(S) ?|N(S)| = |T| = |S| -1 < |S|
For a X,Y- bigraph which X cannot be saturated, we have found a subset S of X , such that |N(S)| < |S|. We always can find it.
20. Corollary 3.1.13 For k >0, every k-regular bipartite graph has a perfect matching.
Proof:
Counting edges by endpoints in X and in Y. k|X| = k|Y| ?|X|=|Y| . Perfect problem -> Halls condition. (Because saturating X also saturates Y)
For all S ? X, let m : number of edges from S to N(S). From S: m = k|S|. From N(S): m ? k|N(S)|. ? k|S| ? k|N(S)|. Halls condition satisfied.
21. Vertex cover Definition: A vertex cover of a graph G is a set Q ? V(G) that contains at least one endpoint of every edge. Q covers E(G).
Policemen watch(cover); Minimum cover.
22. Vertex cover
Min Vertex Cover of G ? Maximum Matching of G
Existence of equality = PROVES both min and max. Exist??
23. Theorem 3.1.16 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.
Proof: Let Q be a vertex cover, M be a matching in G. |Q| ? |M|. Given a smallest Q, we construct a matching of size |Q|
24. Proof R = QnX,T = QnY.
H: the subgraph of G induced by
R?(Y-T); H the subgraph induced by T?(X-R).
25. Use Halls theorem to show H has a matching that saturates R into Y-T, and H has a matching that saturates T. Since H and H are disjoint, the two matchings form a matching of size |Q| in G.
Since R?T is a vertex cover, G has no edge from Y-T to X R.
For each S ? R, NH(S) is contained in Y-T. If |NH(S) |
< |S| then we can substitute NH(S) for S!!! And form a vertex cover smaller than Q. But Q is minimum. So R is saturated in H. Similarly T is saturated in H.
26. Min-max relation A maximization problem M and a minimization problem N defined on the same instances.
Dual pair: if for every solution m in M and for every solution n in N, m ? n then = proves both.
27. Independent Sets and Covers The Independence number of a graph is the maximum size of an independent set of vertices. (Independent set: within which any pair of vertices is not adjacent)
No edge contains two vertices of an independent set.
(compares: No vertex covers two edges of a matching)
28. Edge cover Definition: And edge cover of G is a set L of edges such that every vertex of G is incident to some edge of L.
Vertices of G are covered by the edges of L.
Only Gs without isolated vertices.
29. Dual problems. Notation: Maximum size of independent set a(G)
Maximum size of matching a(G)
Minimum size of vertex cover (G)
Minimum size of edge cover ߒ(G)
We already have: In bipartite G, a(G) = (G).
ߒ(G) ? a(G)
30. Lemma 3.1.21 In a graph G, S ? V(G) is an independent set if and only if S-bar is a vertex cover, and hence a(G) + (G) = n(G).
Proof:
Only if: since S is an independent set, then every edge is incident to at least one vertex of S-bar. i.e. S-bar is a vertex cover. ( S to S, S to S-bar, S-bar to S-bar)
If: S-bar covers all edges, then there are no edges joining vertices of S (S-bars bar)
31. Theorem 3.1.22 If G is a graph without isolated vertices, then a(G) + ߒ(G) = n(G).
Construction both sides:
From a maximum matching M . An edge cover of size n(G) - |M|. ?ߒ(G) ? n(G) |M| (a(G)).
From a minimum edge cover L..A matching of size n(G) - |L|, ?a(G) ? n(G) |L| (ߒ(G))
32. From a maximum matching M . An edge cover of size n(G) - |M| Adding to M one edge incident to each unsaturated vertex. (We can always find such edge incident to M) This is an edge cover.
Green use 1 vertex, blue use 2
? the size of this edge cover
= n(G) - |M|
33. From a minimum edge cover L . A matching of size n(G) - |L| Every component of L has at most one vertex v such that d(v) > 1, and is a star.
34. From a minimum edge cover L . A matching of size n(G) - |L| (contd) 2. Let L has k components ( k stars). Summing all edges of these stars: |L| = n(G) k .
3. Choosing one edge from each star in L, we form a matching M of size k = n(G) - |L|
35. Corollary By two constructions:
ߒ(G) ? n(G) a(G)
a(G) ? n(G) ߒ(G)
? a(G) + ߒ(G) = n(G).
Corollary: If G is a bipartite graph with no isolated vertices, then a(G) = ߒ(G)
By Lemma 3.1.21 and Theorem 3.1.22 a(G)+(G)= a(G) + ߒ(G)
36. Algorithms and Applications Maximum bipartite matching
Search for augmenting paths.
If non, we find a vertex cover with the same size as the matching, thereby prove it to be maximum.
37. APA Algorithm Input: An X, Y-bigraph G, a matching M in G, and the set U of M-unsaturated vertices in X.
Idea: From U ---? (M alt. Paths) ---? Reachable: S ? X and T ? Y.
Try to extend path. Mark vertices of S that has been tried.
38. APA Algorithm Initialization: S = U and T = ?
Iteration:
If S has no unmarked vertex, terminate and report T?(X-S) as a minimum cover and M as a maximum matching
Else: select an unmarked x?S.
consider each y ? N(x) such that xy ? M
y unsaturated: terminate and report an M- augmenting path from U to y.
y saturated: y is matched to some w ? X by M.
include y in T( reach from x), include w in S(reach from y).
after all y done, mark x, iterate.
39. APA Algorithm
40. Correctness of APA Theorem: Repeatedly applying the APA to a bipartite graph produces a matching and a vertex cover of equal size.
Equivalent: Prove that APA either produces an M-augmenting path or a vertex cover of size |M|.
41. Correctness of APA APA terminate on 2 cases.
Report an M-augmenting path. Finished.
Marking all vertices in S and report R = T?(X-S) to be a vertex cover of size |M|. We must prove R.
42. R is a vertex cover and size =|M| Show there is no edge joining S to Y-T
43. R is a vertex cover and size =|M| Size of R:
The algorithm puts only saturated vertices in T?each vertex in T is matched via M to S.
Since U ? S, every vertex of X-S is saturated; and each vertex in X-S is matched to Y-T via M. (because all T to S)
|M| >= |T| + |X-S|. But no M can be bigger than this.
44. Time complexity of APA Let G be an X, Y- bigraph with n vertices and m edges.
Since a(G) <= n, applying APA in O(n) times.
Each APA explores X at most once before marking it. Each vertex x we look each N(x) once, so each edge in G is looked at most once .. O(m)
Overall: O(mn)
45. Matching and Factors Algorithm
46. APA Algorithm: Iteration 1 end
47. APA Algorithm: Iteration 2
48. APA Algorithm: Iteration 2 end
49. APA Algorithm: Iteration 3
50. APA Algorithm: Iteration 3
51. APA Algorithm: Iteration 3
52. APA Algorithm: Iteration 3 end
53. APA Algorithm: Iteration 4
54. APA Algorithm: Last Iteration
55. APA Algorithm: Last Iteration
56. APA Algorithm: Last Iteration
57. APA Algorithm: Last Iteration
58. APA Algorithm: Last Iteration
59. APA Algorithm: Last Iteration
60. APA Algorithm: Last Iteration end
61. Correctness of APA Vertex cover: because there is no edge joining S to Y-T
62. | T?(X-S) | = | M | T are all matched
X-S are all matched, too.
|M| >= |T| + |X-S|. But no M can be bigger than this.
63. Weighted Bipartite Matching Matching generalized by giving weights on edges; Seek for maximum weighted matching
Fill up to Kn,n with 0
64. Weighted Matching & Cover Dual: farmer and government.
Weights = profit; Cover = compensation
ui + vj ? wi,j
65. Weighted Matching & Cover Farmer: maximize S wi,j
Government: minimize S ( ui + vj )
Cost(u, v) vj ? w(M)
They are dual; Equality holds if M is consist of only ui+vj = wij
66. Matrix representation:
67. Hungarian Algorithm Adjust the cover;until we find a cover C(u,v) = w(M)
Better viewed in Matrix
68. Hungarian Algorithm
69. Hungarian Algorithm
70. Hungarian Algorithm
71. Hungarian Algorithm
72. Hungarian Algorithm
73. Hungarian Algorithm
74. Hungarian Algorithm
75. Hungarian Algorithm
76. Hungarian Algorithm
77. Remark Non-weighted maximum matching & vertex cover problem is a special (1,0) problem.
78. Stable matching a,b,c,d.. matching with x,y,z,w.. with preference (for example: a: z >x >y>w)
Unstable matching: a prefer x, x prefer a, but (a,x) unmatched ? (a,x) unstable
79. Stable matching Stable matching: a perfect matching without unstable pair.
Proposal Algorithm ( greedy)
80. Stable matching Step 1:
81. Stable matching Step 2:
82. Stable matching Step 3:
83. Stable matching Proof of correctness:
There doesnt exist some (a,x) unstable.
Men (the ones who propose) are happier.
84. Matching and Factors Factors
85. Definition Fatctor: spanning subgraph in G
K- factor: spanning k regular subgraph
86. Definition 1 Fatctor
A 1 factor is a perfect match with its vertices.
87. Tuttes condition ?s ? V(G), o(G-s)? |s|
Tuttes theorem: A graph G has a 1-factor, if and only if T.C. holds.
88. Tuttes condition ?s ? V(G), o(G-s)? |s|
Tuttes theorem: A graph G has a 1-factor, if and only if T.C. holds.
Some s that creates too many odd components when we delete s.
89. Tuttes Theorem If G has a 1 factor, T.C. holds
Pf: o(G-s) ? |s|
90. Tuttes Theorem If T.C. holds, then G has a 1 factor
Pf:
91. Tuttes Theorem There exist a step ( the last graph without 1 factor) in which:
Let G and G be such graphs.
92. Tuttes Theorem If G and G are such graphs, we want to show that G also has 1-factor.
Contradiction.
U: degree = n(G)-1
93. Case 1 If (G-U ) consist of only disjoint complete component.
Lets pair G ? G has 1 factor
94. Case 2 If (G-U ) is not a disjoint union of cliques.
In (G-U) there exist:
95. Case 2 G + xz has 1 factor M1 ; G + yw has 1 factor M2
M1 ? M2
96. Case 2 G + xz has 1 factor M1 ; G + yw has 1 factor M2
M1 ? M2 :Only even cycles or isolated vertices
97. Case 2 G + xz has 1 factor M1 ; G + yw has 1 factor M2
M1 ? M2 :Only even cycles or isolated vertices
98. Remark Parity | G-s| = parity o(G-s)
O(G-s) +|s| has the same parity as n(G).
O(G-s) -|s| has the same parity as n(G).
If n(G) is even , and G has no 1-factor (thus o(G-s) > |s|) then at least 2.
99. Berge Tutte Formula In general, o(G-s) > |s| for some s ( no perfect matching)
The largest number of vertices saturated by a matching in G is :
n(G) - d
where d= max s ? V(G) o(G - S)- |S|
100. Berge Tutte Formula G does not satisfy T.C.
But G = G ? Kd does. (? is Join), why?
For all S ? V(G)
101. Petersen Therorem Every regular graph of even degree has a 2 factor.
102. f-Factors of Graph Given a function f: V(G) ? N?{0}, an f-factor of a graph g is a subgraph such that dH(v) = f(v) for all v ? V(G)
Assign degree to each vertex.
f(w) ? d(w) for all w. excess e = d f.
103. Theorem A graph G has an f-factor if and only if its transform H has a 1-factor.
104. Edmonds Blossom Algorithm In Bipartite, APA is quick because we explore from each vertex at most once.
For x ? X, we can only reach via a saturated edge, hence only once can we reach x.
In general graph, this doesnt hold.
105. Edmonds Blossom Algorithm Edmonds flower:
For some x, if it can be reached from u via a saturated edge, and also via an unsaturated edge, then flower exist.
106. Edmonds Blossom Algorithm A blossom can be viewed as a super vertex.
107. Edmonds Blossom Algorithm S: via saturated, T: via unsaturated.
A blossom can be detected if we go via unsaturated edge to a vertex S.
Contract it. Later expand it.