An o ( n 2.5 ) Algorithm: For Maximum Matchings in General Graphs

This article extend the John E. Hopcroft and Richart M. Karp Algorithm (HK Algorithm) for maximum matchings in bipartite graphs to the non-bipartite case by providing a new approach to deal with the blossom in alternating paths in the process of searching for augmenting paths, which different from well-known “shrinking” way of Edmonds and makes the algorithm for maximum matchings in general graphs more simple.


Introduction
A matching in a graph is a set of edges, no two of which share a vertex. Given a graph, it is a well-known problem to find a matching of maximum carnality. All these algorithms for maximum matching, by berge's theorem in 1957 [1], are led to search for augmenting paths. In the case of bipartite graphs, it is easier to search for augmenting paths using of bread-first search. These algorithms require ( ) o mn steps. But in the non-bipartite case, the problem becomes even more difficult so that until 1965 only exponential algorithm for finding a maximum matching in general graphs were known. The reason was that one did not know how to deal with odd cycles (Blossoms) in alternating paths in the process of searching for augmenting paths. Edmonds [4] defined the key notion of blossoms and finessed this difficulty in non-bipartite graphs by "shrinking" blossom.
The straightforward implementation of his approach led to an 4 ( ) o n algorithm for maximum matching in general graphs. After further improvement there are one phase a maximal set of shortest augmenting paths, then ( ) o n such phases would be sufficient. For the bipartite case they showed that a phase can be implemented by a breath-first search followed by a depth-first search. This led to an ( ) o n m + implementation of one phase and hence to an ( ) o nm algorithm for maximum matching in bipartite graphs. The HK Algorithm for maximum matching in bipartite graphs [1] is still the most efficient known algorithm for the problem.
The success of Hopcroft and Karp algorithm in bipartite graphs has made many people attempt to extend it to non-bipartite case. In fact ,in their paper almost all the results are derived for general graphs. The specialization to the bipartite case occurs in computing in one phase a maximal set of shortest augmenting paths only.
In 1980 Mieali and Vijay Vazirani [6] stated a matching algorithm in pseudocode, claimed to have an ( ) o m implementation of a phase in general graphs.
Although their result led to a most efficient general graph maximum matching algorithm running time of ( ) o nm and is cited in many papers and also in some textbooks but no proof of correctness was available. Also the paper of Peterson and Loui [7] does not clarify the situation.
In this article a new approach to deal with the blossom is proved, which makes a phase can be implemented by a breath-first search followed by a depth-first search.
After summarizing basic theory of matched problem and introducing the HK algorithm in bipartite graph in Section 1, we discuss the obstacle to extend the HK algorithm to the non-bipartite case, that is blossom, in Section 2. The theoretical basis of the new approach is established in Section 3 and then we construct the new algorithm, which extend HK algorithm in bipartite graph to non-bipartite case in Section 4. Let { , } G V E = be a finite undirected graph (without loops or multiple edges) having the vertex set ( ) V G and the edge set ( )

The Basic Theory and Contribution of Hopcroft and Karp
incident with vertices u and v is written e uv = . A path in G is a sequence of vertices and edges (without repeated vertices) is called neighborhood of u.
A path with odd length 2r + 1 (without repeated vertices) is called an M-augmenting path if its end vertices 0 v and 2 1 r v + are both free.
It is easy to result in the lemma by Equation And the following theorem is also well known. According to above theorems, the algorithm for finding the maximum matching in a graph boils down repeatedly to search for a augmenting path P relative to current matching M and augment current matching to M P ⊕ .
The contribution of Hopcroft and Karp is to compute in one phase a maximal set of shortest vertex-disjoint augmenting paths with a same length 1 2 , ,..., k P P P and augment current matching to 1 2 ... b) The ( 1, 2,..., ) 3)

Nonbipartite Matching: Blossoms
Unfortunately, in non-bipartite graphs, the lack of bipartite structure makes one might be fail of searching augmenting path by breath-first search in the execution of Step 1 in Algorithm A and this situation makes the task of implementing a phase far more difficult.
The problem remains how to deal with blossoms in computing in one phase a maximal set of shortest augmenting paths in non-bipartite case. Definition 2.1. A odd circuit with 2 1 k + vertices having k matched edges is called a blossom.
In Figure 1 (the matched edge are drawn with heavy line, the free vretices are drawn with small cycle). The odd circuits, The only vertex incident with no matched edges in the blossom is called basis of the blossom, as 4 2 , v v and 11 v . The Hopkroft and Karp's Algorithm [5] of implementation of step 1 of Algorithm A might fail when using it in the non-bipartite graph if which contains a blossom, because one alternating path at the basis of a blossom traverses this blossom and starts "folding" on itself, with a disastrous consequence .
Edmond's method of dealing with blossoms are also not adequate for the task of finding shortest augmenting paths since by "shrinking" them, length information is completely lost.
We attempt to find a way to through the barrier of blossom keeping length information in finding augmenting paths and then extend the John E. Hopcroft and Richart M. Karp Algorithm (HK Algorithm) for maximum matchings in bipartite graphs to general graphs.

Equivalent Digraph
A digraph Γ is defined by a set ( ) V Γ of elements called vertices, a set ( ) W Γ of elements called directed edges or darts, and two relations of incidence. These associate each dart d, the one with a vertex ( ) h d called its head and the other For a vertex, the number of darts sharing the vertex as head is called the indegree of the vertex and the number of darts sharing it as tail is called its outdegree.
The in degree of v is denoted by deg ( ) v − and its out degree is denoted by , whenever 0 1 k r ≤ ≤ − . The first and last vertices of path P, that are called the tail ( ) t P and head ( ) h P of path P, respectively. The number r is called the length P of path P.
Is called inverse of path P, where Consider two paths P and Q in Γ , if ( ) ( ) h P t Q = , there is a path PQ, called the product of P and Q, formed by writing down the terms of P, in their order in P, and continuing with the terms of Q, in their order in Q. It is easy to verify that One dart is a path with length 1. One path We say that P is dart-simple if no dart repeated in it. For a given graph G, we associate with each edge e uv = of G two distinct elements d uv = and d vu − = called the opposite darts on e. We form an equivalent digraph G of G from the given graph G.  ...
is also a blossom in are in-dart and out-dart of it respectively.
The M-alternating path P from a free vertex v to a free vertex u is called shortest if P is of least carnality among these M-alternating paths. v v + ≠ ) , then either P is a M-augmenting path or P pass though a blossom. Proof: If P be not M-augmenting then there is i t Let t be as small as possible, so that We can obtain a shorter alternating path from 0 v to 1 r v + by deleting 1 1 , ,..., from P. This is contradict with that P is shortest.
Can only be the case that

The Algorithm to Implement Step 1 of Algorithm A in General Graph
We construct a directed graph from the equivalent digraph G of G, which exhibits conveniently all shortest M-augmenting paths in G . Let G be the equivalent digraph of G. D is a set of darts. Define:

∪ ∪
For example, the G shown by Figure 2 (the direction of all darts as shown by the big arrow) is constructed from the equivalent digraph G of the graph G shown by Figure 1. Figure 2 exhibit all of the shortest M-alternating paths from free vertex to free vertex in Figure 1.
The following properties of G is easy to see: 1) Each path from a free vertex 0 u D ∈ to a free vertex shortest M-alternating path with length 2I * +1.We call it regular M-alternating path in G 2) If a M-alternating path P G ∈ , 0 ( ) u t P D = ∈ and * 2 ( ) P − is also a regular M-alternating path in G .

3) Let » be the set all regular M-alternating paths in G then
then there is no augmenting path in G because there is only one M-alternating path P in G and ( ) ( ) t P h P = .
In this case we remove the vertex ( ) h P from which is set of all shortest M-alternating paths with length 2I * + 1 from a set   A blossom will be broken if to remove the in-dart or out-dart from a path 0 ( , ) P J L ∈ v , which traverse the blossom .
Following theorem is the basis of the Algorithm to implement step1 of algorithm A.  To remove such vertices or darts (as in algorithm A1) may render certain other vertices useless, in the sense that they cannot be in any M-alternating paths. These vertices and darts must also be deleted; for, these dead-ends will make searching for an augmenting path more complicate. Hence we need an algorithm which deletes these dead-ends. This is achieved as follows:

Conclusion
In this paper an algorithm running time of ( ) o m to implement step 1 of Algorithm A in general graph has been proved. Different from the way of "shrinking" blossoms, which need to store the shrinked blossoms, the removed darts don't need to be stored when run this algorithm, because they can never be on any augmenting paths. The space complexity of this algorithm is also ( ) o m . The proved algorithm is very easy to program. The Mieali and Vijay Vazirani [6] algorithm, by contrast, is quite elaborate and its pseudo code is extensive.