Notes Chapter 3
Notes Chapter 3
Definition 1 :
Two edges of a graph G are said to be independent if they have no common end-point and
none of them is a loop.
A matching of a graph G is a set of independent edges of G; i.e each vertex in a matching M
has degree 1.
The size or cardinality of a matching is the number of edges in that matching.
Let M be a matching in a graph G. Then a vertex of G is said to be saturated/ covered by M if it
is incident with an edge of M; otherwise it is said to be unsaturated/ not covered by M.
A matching with maximum cardinality is called a maximum matching.
A maximal set of independent edges is a maximal matching.
A matching that saturates all the vertices of G is called a perfect/ complete matching.
Note : A maximal matching is not a maximum matching, and a maximum matching is not a
perfect matching.
M1 M2 M3
A maximal matching M1, a maximum matching M2, a perfect matching M3
Petersen graph has six perfect matchings such that every edge is contained in precisely two
of these perfect matchings.
Perfect Matching in Complete Graphs
- Complete graphs with number of vertices, K2n 1 has no perfect matching.
- K2 has 1 perfect matching :
Consider Kn, a complete graph with even number of vertices. Let fn be the number of ways to
pair up 2n distinct vertices in Kn. There are 2n 1 choices for partner of a vertex v, and for each
such choices there are fn 1 ways to complete the matching. Hence,
fn = (2n 1)(2n 3) 3 1.
v
v
v
Proof : Suppose that G has a matching M that saturates A. Then for every subset S A, we
have
|NG(S)| |NM(S)| = |S|
Obviously if |A| = 1, G will have a matching that saturates the only vertex in A.
Assume G satisfies the Hall s condition and that |A| 2.
Then we can start with an arbitrary edge e = v1v2 E and put e in M. The graph G = G {v1, v2}
satisfies Hall s condition, so we can complete the matching by induction.
G = G[(A \ S) (B \ N(S))], we obtain two disjoint matchings containing |S| and |A| |S| edges
respectively, whose union is a matching that saturates A.
Examples : 1. b c
a d
r s t u
A = {a, b, c, d}
Let S = {a, b, d}; N(S) = {s, u}
|S| = 3; |N(S)| = 2 Hall s condition is violated, hence G does not have a matching that
saturates A and hence G does not have a perfect matching.
2. Emily A = {Emily, Jenn, Claire, Katie}
Ryan
N(Emily) = {Greg, Tim}
Jenn Greg
N(Jenn) = {Greg}
Emily Ryan
Jenn Greg
Claire Tim
Katie Mike
3.
1 2 3 4 5 6
W X Y Z
A = {W, X, Y, Z}
S = {X, Y}; N(S) = {3}
|S| = 2; |N(S)| = 1 Hall s condition is violated, hence G does not have a matching that
saturates A.
Definition 2 :
A factor of a graph G is a spanning subgraph of G.
A k-regular spanning subgraph is called a k-factor.
C4 1-factor of C4
Definition 3 :
A vertex cover of a graph G = (V, E) is a set Q V that contains at least one end-point of every
edge of G.
An independent set (of vertices) is a set S V such that no two vertices in S are adjacent.
An edge cover of G is a set L E such that every vertex of G is incident to some edge of L.
{d, e, f}, {a, b, c}, {c, d} are vertex cover and {c, d} is a minimum
a b c vertex cover.
{a, b, c}, {d, e, f}, {a, b, e, f} are independent vertex set and
{a, b, e, f} is a maximum independent vertex set.
K nig s Theorem
If G is a bipartite graph, then the maximum size of matching in G equals the minimum size of
vertex cover.
Proof :
Definition 4 :
An odd component of a graph is a component of odd order; the number of odd components of H
is O(H).
T e s 1-factor Theorem
O(G S) |S|.
Proof :
a b c b c
S = {a} O(P3 S) = 0 < 1 =|S|
P3 P3 S
but if S = {b}; O(P3 S) = 2 > 1 = |S| violates the Tutte s condition. Hence,
P3 has no perfect matching.
G {a} has 3 odd components. Hence O(G {a}) = 3 > 1, which violates the Tutte s condition.
Hence, G has no perfect matching.
Definition 5 :
Given a matching M, an M-alternating path is a path that alternate between edges in M and
edges not in M.
An M-alternating path whose endpoints are unsaturated by M is an M-augmenting path.
a b c d a b c d a b c d
e f g h e f g h e f g h
G M1 M2
a b c d
Maximum matching :
e f g h
M3
Example
Find a maximum matching for the graph G, using the maximum matching algorithm.
a r
b s
c t
u
d
e v
f w
G
Initial matching M1 : a = r, b = u, c = t, d = s, e = ?, f = ?, ? = v, ? = w
a r
Alternating path : f r=a w
b s
Change status : f = r a=w
c t
u
d
e v
f w
M1
New matching M2 : a = w, b = u, c = t, d = s, e = ?, f = r, ? = v
a r
u
d
e v
f w
M2
New matching M3 : a = r, b = u, c = t, d = v, e = w, f = s
a r
b s
c t
u
d
No more alternating path.
e v
Maximum matching achieved.
f w
M3
Hungarian algorithm : Assignment problem
In assignment problems each worker must do just one task and each task must be done by one
worker. We are seeking a one-to-one solution with the least cost. Hungarian algorithm can be
used to solve these problems.
The Hungarian algorithm
1. Start by finding the reduced cost matrix by
subtracting the least value in each row from each element in that row, and
using the new matrix, subtract the least value in each column from each element
in that column.
2. Determine the minimum number of straight lines (horizontal or vertical), which will cover
all the zeros in the matrix.
3. In an n n matrix, if we cannot cover them in fewer than n lines, we have an optimal
solution and we stop.
4. If in n n matrix we can cover the zeros with fewer than n lines, drawn vertically or
horizontally, the solution can be improved.
5. Draw in these lines and look for the smallest uncovered element, e.
6. Add e to the element(s) covered by two lines, leave the elements covered by just one
line unchanged, and subtract e from the uncovered elements.
7. Repeat steps 2-6 until an optimal solution is found.
Example
The table shows the times taken, in minutes, by four workers to complete each task of a four-
stage production process. The time taken for the process is the sum of the times of the four
separate tasks. Solve this assignment problem.
Four lines are needed to cover the zeros in this 4 4 matrix. We have an optimal solution.
Solution :
Two lines can cover the zeros in this 3 3 matrix. The solution can be improved.
The smallest uncovered element is 20. Add 20 to the element covered by two lines, leave the
elements covered by one line unchanged and subtract 20 from uncovered elements.
Three lines are needed to cover the zeros. Optimal solution is obtained.
Optimal solution