100% found this document useful (1 vote)
162 views4 pages

Bipartite Matching

The document presents an algorithm for finding the maximum matching in a bipartite graph. It summarizes existing algorithms such as one with O(n1/2m) time complexity and the Ford-Fulkerson method with O(VE) time complexity. It then proposes a new algorithm that selects the vertex with the minimum number of incident edges at each step to build the matching. The proposed algorithm runs in O(E) time, which is less than the time complexity of existing algorithms. It provides an example of applying the algorithm to a sample bipartite graph and proves that the proposed algorithm's time complexity is optimal.

Uploaded by

sanchit_h
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
162 views4 pages

Bipartite Matching

The document presents an algorithm for finding the maximum matching in a bipartite graph. It summarizes existing algorithms such as one with O(n1/2m) time complexity and the Ford-Fulkerson method with O(VE) time complexity. It then proposes a new algorithm that selects the vertex with the minimum number of incident edges at each step to build the matching. The proposed algorithm runs in O(E) time, which is less than the time complexity of existing algorithms. It provides an example of applying the algorithm to a sample bipartite graph and proves that the proposed algorithm's time complexity is optimal.

Uploaded by

sanchit_h
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DUET Journal

Vol. 1, Issue 1, June 2010

Finding the Maximum Matching in a Bipartite Graph


B. M. Monjurul Alom, Someresh Das and Md. Saiful Islam
Department of Computer Science and Engineering,
Dhaka University of Engineering & Technology, Gazipur, Bangladesh
Email : [email protected]

ABSTRACT
A matching M of the graph G is an edge set such that no two edges of M share their endpoints. For a bipartite
graph G = (V, E) maximum matching are matching whose cardinalities are maximum among all matchings.
Existing enumerating algorithm of maximum matching has time complexity is O(|V |) per matching. FordFulkerson method finds the maximum matching on a bipartite graph with O(VE) time. In this paper, an
algorithm to find the maximum matching on a bipartite graph with O(E) time is presented which is less than
the time complexity of the existing algorithms.
1. INTRODUCTION
Bipartite graph is a connected undirected graph such that (i)
the vertices of G partitioned into two sets X and Y, (ii)
every edge of G has one end point in X and the other in Y.
Matching M in G a set of edges that have no end points in
common. Maximum Bipartite Matching Problem finds a
matching with the greatest number of edges (over all
matching). A matching M of the graph G is an edge set
such that no two edges of M share their endpoints. Edges of
a matching are called matching edges. If a vertex is incident
to a matching edge, the vertex is covered by the matching,
and otherwise uncovered. Matching with the maximum
cardinality among all matching in G a maximum matching,
and a matching which is properly contained in no other
matching a maximal matching. In bipartite graph vertex set
can be partitioned into V=LR; where L and R are
disjointed and all edges in E go between L and R. Our
algorithm starts selection the vertex from left side or right
side (vertex) of a bipartite graph, which has minimum
number of incident edge on it, and its neighbour vertex. So
the selected vertex and neighbour vertex represent the edge.
This algorithm discard all the incident edges to that edge.
This process continue until to cover all the edges. Therefore
the selected edges are the maximum matchings.
2. RELATED WORK
Takeaki Uno [1] described, Algorithms for Enumerating
All Perfect, Maximum and Maximal matching in Bipartite
Graphs. This algorithm takes only O(n) time per a
matching; where n is the number of vertexes in a graph.
For perfect matching in a bipartite graph, K. Fukuda and T.

Dhaka University of Engineering & Technology, Gazipur

Matsui proposed an enumeration algorithm [2]. Their


algorithm takes O(n1/2m+mNp) time where Np is the
number of perfect matchings in the given graph and m is
the number of edges in a graph. Thomas H.
Cormen, et. al. describe an algorithm in [3]. This method is
known as Ford-Fulkerson method. This algorithm finds the
maximum matching on a bipartite graph with O(VE) time.
A comprehensive research has been done on matching on
bipartite graph described in [2, 4-12].
3. EXISTING MATCHING ALGORITHM
The existing algorithm is given in Fig 1:
ALGORITHM Enum Maximum Matchings (G)
Step 1: Find a maximum matching M of G
and output M.
Step 2: Trim unnecessary arcs from
D(G,M) by a strongly connected
component decomposition
algorithm.
Step 3: Call Enum Maximum Matchings iter
(G,M,D(G,M)).
ALGORITHM Enum Maximum Matchings iter
(G,M,D(G,M))
Step 1: If G has no edge, stop.
Step 2: If D(G,M) contains no cycle,
Go to Step 8.
Step 3: Choose an edge e as the same
manner in
Enum_Perfect_Matchings_iter.
Step 4: Find a cycle containing e by a
depth-firstrst-search algorithm.

33

DUET Journal
Step 5: Exchange edges along the cycle
and output the obtained maximum
matching M.
Step 6: Enumerate all maximum matchings
including e by Enum Maximum
Matchings iter with G+(e), M and
trimmed D(G+(e),M / e).
Step 7: Enumerate all maximum matchings
not including e by
Enum_Maximum_Matchings_iter with
G-(e),
M and trimmed D(G-(e),

M ). Stop.
Step 8: Find a feasible path with length
2 and generate a new maximum
matching M. Let e be the edge
of the path not included in M.
Step 9: Call Enum Maximum Matchings iter
(G+(e), M, ).
Step 10: Call Enum Maximum Matchings
iter (G -(e), M, ).
Fig. 1: Algorrithm_Enum_maximum matching.
3.1 Complexity Analysis of the Algorithm
The algorithm Enum Maximum Matching takes O(n1/2m)
time. The algorithm Enum Maximum Matching iteration
takes O(n) time except for trimming in steps 9 and 10. In
steps 9 and 10 of each recursive call, spending time
proportional to the size of D(G, M). But in the previous
section, it is showed that this time can be assigned to their
descendants such that the total assigned time for each
vertex of the enumeration tree does not exceed O(n).
Therefore the total time spent by the algorithm is O(n) time
per a maximum matching. Where n is the number of
vertices in a graph.
4. PROPOSED MATCHING ALGORITHM
A matching of size K in a graph G is a set of K pair wise
disjoint edges. If a matching saturates every vertex of G
then it is a perfect matching or 1-factor. Given an
undirected graph G = (V, E) matching is a subset of edges
such that for all vertex v V at mast one edge of M is
incident on v. It is said that a vertex v V is matched by
matching M if some edge in M is incident on v. otherwise v
is unmatched. A maximum matching is a matching of
maximum cardinality, that is a matching M such that for
any matching M/, |M|>|M/|. In bipartite graph vertex set can
be partitioned into V=LR. Where L and R are disjointed
and all edges in E go between L and R. Explanation of the
algorithm is given in Fig. 3.
Algorithm Maximum_matching (E, L, R){
// E is the edges of the graph,
// L is the set of left nodes
// R is set of right nodes Count
incident edge of all vertexes;
1. m ;
2. While (E ) {
3. i=find vertex from L and R which
has minimum incident edge;
4. If (i>1) j=Neighbor of i has
minimum edge;
5. Else j=Neighbor of i;
6.
m=m (i, j);

Dhaka University of Engineering & Technology, Gazipur

Vol. 1, Issue 1, June 2010


7.
8.

Delete
all
edges
which
are
incident of i and j;
Count incident edge of other
vertex ;}
Fig. 2: Algorithm_maximum_matching.

4.1 Explanation of the Algorithm


Figure 3(a) shows a Bipartite graph which has 5 left nodes,
6 right nodes and 10 edges. Figure 3(d) is the final position
of maximum matching. Solid line indicate matching edge
and dashed line indicate the edges which are incident of
matching edge. Maximum matching here is 5.
In Fig. 3 (a) L2 has minimum edge and R1 is its neighbor.
So select it and discurd the L1R1 edge, shown in Fig. 3 (b).
In this position L1 has minimum edge and R2 is its
neighbor, then the graph becomes to Fig. 3 (c). Same way
select the edge L5R4. After that R5 will have minimum
edge and will select L3R5. Finally select L4R3 and graph
becomes to Fig. 3 (f).
4.2 Complexity Analysis of the Vertex Cover Algorithm
Since the number of iterations of the loop on lines (2-8) is
at most E. So time complexity of this algorithm is O(E).
4.3 Mathematical Proof of the Proposed Algorithm
Let E1P, E2P, E3P En are the selected edges for
matching from the bipartite graph, and E1P, E2P,
E3P. EnP are the discarded edges from the
incident vertexs of the selected edges in the graph. Let L
and R be the vertex which have minimum incident edges.
So L1 and R1 must be subset of E1P that means L1 and R1
E1. Similarly L2 and R2 E2P ..Ln Rn EnP.
But either L1 E1P or R1 E2P, similarly .Ln En or
Rn EnP .
Given, SEnP = E1P + E2P +En P
and SEnP = E1P + E2P ++EnP.
But the cardinality of matching must be less than or equal
to the cardinality of discarded edges during the period to
find maximum matching or matching.
So it can be written SEn SEnP , but in a bipartite graph
SEnP must be less than E[G] that means
SEnP < E[G].
So SEnP < E[G].
The total time complexity may be at most O(E). Hence
proved.

34

DUET Journal

Vol. 1, Issue 1, June 2010

(c)

(b)

(a)

(e)

(d)

(f)
Fig. 3: Explanation of the proposed algorithm
E n u m A lg o

F o rd -F u lk A lg o

P ro p o s e d A lg o

Time complexity (no of steps in unit)

10000

1000

100

10

1
1

N o o f v e r t e x a n d e dge s ( in dif f e r e n t D a t a se t s)

Fig. 4: Comparative analysis for Time Efficiency.

Dhaka University of Engineering & Technology, Gazipur

35

DUET Journal

Vol. 1, Issue 1, June 2010

4.4 Application of Maximum Bipartite Matching


Considering an environment of a university, if L (left
nodes) denote the set of all teacher R (Right nodes) denote
the set of class room and E (Li, Ri) denote the discipline,
then this algorithm can be applied for a particular period to
find the maximum number of discipline can be executed, to
maximize the use of university room. Another Application:
X represents a set of college courses; Y represents a set of
classrooms. Let there be an edge joining x in X and y in Y,
if x course can be taught in classroom y (based on
audiovisual needs, enrollment, etc.).

[3]

T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C.


Stein, "Introduction to Algorithms," MIT, September
2001.

[4]

Y. D. Liang and N. Blum, "Circular Convex Bipartite


Graphs: Maximum Matching and Hamiltonian
Circuits," Inf. Process Lett., vol. 56:4, pp. 215-219,
1995.

[5]

G. Kortsarz, "An Improved Approximation of the


Achromatic Number on Bipartite Graphs Source"
SIAM Journal, vol. 21:2, pp. 361-373 2007.

[6]

J. E. Hopcroft and R. M. Karp, " An n^{5/2}


algorithm for maximum matchings in bipartite graphs
" SIAM Journal vol. 2:4, pp. 225-231, 1973.
S.Tsukiyama, M.Ide, H.Ariyoshi, and I.Shirakawa, "A
New Algorithm for Generating All the Maximum
Independent Sets," SIAM Journal, vol. 6:3, pp. 505517, 1977.

5. DISCUSSION
Our algorithm finds the maximum matching on a bipartite
graph. From Fig. 3(f) it is observed that cardinality of
maximum matching is 5. The complexity of the algorithm
is almost O(E). A comparative analysis of the time
efficiency between proposed system and existing (best
known) algorithms is presented in Fig. 4.

[7]

[8]

Z. Galil, "Efficient Algorithms for Finding Maximum


Matching in Graphs " Computing Surveys, vol. 18, pp.
23-39, 1986.

[9]

K. Giaro, R. Janczewski, and M. Kubale, "A 27/26Approximation Algorithm for the Chromatic Sum
Coloring of Bipartite Graphs," in LNCS 2462, 2002,
pp. 135-145.

6. CONCLUSION
The existing enumerating algorithm of maximum matching
has time complexity O(|V |) per matching. Ford-Fulkerson
method finds the maximum matching on a bipartite graph
with O(VE) time. The proposed algorithm to find the
maximum matching on a bipartite graph with O(E) time is
less than the time complexity of the existing algorithm. The
comparative analysis of time efficiency also shows that the
proposed algorithm takes less time than that of the other
existing (well known) algorithms.

[10] R. Jain and J. Werth, "Analysis of approximate


algorithms for edge-coloring bipartite graphs " Elsevier
Journal, vol. 54, pp. 163-168, 1995.
[11]

REFERENCES
[1]

[2]

www.springerlink.com/index/7328p0x9v216l357.pdf,
"Algorithms for Enumerating All Perfect, Maximum
and Maximal Matchings in Bipartite Graphs ".
http://www.misojiro.t.u-tokyo.ac.jp/~tomomi,
"Finding All Minimum Cost Perfect Matchings in
Bipartite Graphs ".

Dhaka University of Engineering & Technology, Gazipur

Y. D. Liang and N. Blum, "Circular convex bipartite


graphs: Maximum matching and Hamiltonian circuits
" Elsevier Journal (Information Processing Letters),
vol. 56, pp. 215-219, 1995.

[12] V. Polishchuk and J. Suomela, "A simple local 3approximation algorithm for vertex cover " Elsevier
Journal, vol. 109, pp. 642-645, 2009.
[13] R. E. Tarjan, "Depth-First Search and Linear Graph
Algorithm," SIAM Journal, vol. 1, pp. 146-169, 1972.

36

You might also like