**Journal of Applied Mathematics and Physics**

Vol.06 No.09(2018), Article ID:87139,10 pages

10.4236/jamp.2018.69152

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

Yingtai Xie^{ }

College of Information Science and Technology of Chengdu University, Chengdu, China

Received: June 5, 2018; Accepted: August 31, 2018; Published: September 7, 2018

ABSTRACT

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.

**Keywords:**

Matching, Augmenting Path, Blossom, Equivalent Digraph

1. 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 $o({n}^{4})$ algorithm for maximum matching in general graphs. After further improvement there are $o({n}^{3})$ or $o(nm)$ algorithms [2] [3] for it.

In 1973 Hoperoft and Karp [5] proved the following fact. If one computes in one phase a maximal set of shortest augmenting paths, then $o(\sqrt{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(\sqrt{n}m)$ 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(\sqrt{n}m)$ 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.

2. The Basic Theory and Contribution of Hopcroft and Karp

Let $G=\{V,E\}$ be a finite undirected graph (without loops or multiple edges) having the vertex set $V(G)$ and the edge set $E(G)$ . An edge $e\in E(G)$ incident with vertices u and v is written $e=uv$ . A path in G is a sequence of vertices and edges (without repeated vertices)

$P=({u}_{0},{u}_{1},{u}_{2},\mathrm{...},{u}_{r},{u}_{r+1})$

In which ${e}_{i}={u}_{i}{u}_{i+1}\in E(G)$ (i = 0, 1, ∙∙∙, r). Two vertices ${u}_{0}$ and ${u}_{r+1}$ are called end-poinds of the path. Especially, when ${u}_{0}={u}_{r+1}$ , i.e. two end-poinds overlap then

$c=({u}_{0},{u}_{1},\mathrm{...},{u}_{r},{u}_{0})$

Is a circuit.

Let $u\in V(G)$

$N(u)=\{v:uv\in E(G)\}$

is called neighborhood of u.

A set $M\subseteq E$ is a matching if no vertex is incident with more than one edge in M. A matching of maximum cardinality is called a maximum matching. We say the maximum matching is complete, or perfect when $\left|v\right|=2m$ and $\left|M\right|=m$ . We make the following definitions relative to a matching M. Edges in M are called matched edges; the others are free. A vertex v is free if it is incident with no edge in M otherwise it is matched.

A path

$P=({v}_{0},{v}_{1},{v}_{2},\mathrm{...},{v}_{2r},{v}_{2r+1})$

is called M-alternating path if its edges are alternately in E-M and in M; i.e.

$P\cap M=\{{v}_{1}{v}_{2},{v}_{3}{v}_{4},{v}_{5}{v}_{6},\mathrm{...},{v}_{2r-1}{v}_{2r}\}$ (1.1)

$P-(P\cap M)=\{{v}_{0}{v}_{1},{v}_{2}{v}_{3},\mathrm{...},{v}_{2r}{v}_{2r+1}\}$ (1.2)

A path with odd length 2r + 1 (without repeated vertices) is called an M-augmenting path if its end vertices ${v}_{0}$ and ${v}_{2r+1}$ are both free.

It is easy to result in the lemma by Equation (1.1) and Equation (1.2):

Lemma 1.1. $M\text{'}=P\oplus M=(P\cup M)-(P\cap M)$ is a new matching and $\left|M\text{'}\right|=\left|M\right|+1$ .

And the following theorem is also well known.

Theorem 1.1. (Berge) M is not a maximum matching if and only if there is an augmenting path relative to M.

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\oplus 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 ${P}_{1},{P}_{2},\mathrm{...},{P}_{k}$ and augment current matching to $M\oplus {P}_{1}\oplus {P}_{2}\oplus \mathrm{...}\oplus {P}_{k}$ and proved that the number of phases at most $2[\sqrt{n}]+2$ .

Algorithm A: Maximum Matching Algorithm (Hopcroft and Karp).

1) $M\leftarrow \phi $

2) Let $\mathcal{l}(M)$ be the length of a shortest M-augmenting path. Find a maximum set of paths $\{{P}_{1},{P}_{2},\mathrm{...},{P}_{t}\}$ with the properties that:

a) For each i, ${P}_{i}$ is an M-augmenting path and $\left|{P}_{i}\right|=\mathcal{l}(M)$ ;

b) The ${P}_{i}(i=1,2,\mathrm{...},t)$ are vertex-disjoint.

3) $M\leftarrow M\oplus {P}_{1}\oplus {P}_{2}\oplus \mathrm{...}\oplus {P}_{t}$ ; go to step 1.

Theorem 1.2. (Hopcroft and Karp). [5] If the cardinality of a maximum matching is S then Algorithm A constructs a maximum matching within $2[\sqrt{s}]+2$ executions of step 1.

This way of describing the construction of a maximum matching suggests that we should concentrate on the efficient implementation of an entire phase (i.e., the execution of Step 1 in Algorithm A).

For the bipartite case，Hopcroft and Karp showed that a phase can be implemented by a breath-first search followed by a depth-first search，which has time complexity $o(m)$ . Hence, by theorem 1.2, the algorithm A has time complexity $o(\sqrt{n}m)$ .

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 $2k+1$ 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,

${c}_{1}=({v}_{4},{v}_{5},{v}_{6},{v}_{4})$

${c}_{2}=({v}_{2},{v}_{3},{v}_{4},{v}_{5},{v}_{6},{v}_{7},{v}_{8},{v}_{2})$

${c}_{3}=({v}_{11},{v}_{1},{v}_{2},{v}_{8},{v}_{7},{v}_{6},{v}_{5},{v}_{4},{v}_{3},{v}_{9},{v}_{10},{v}_{11})$

are blossoms. The only vertex incident with no matched edges in the blossom is called basis of the blossom, as ${v}_{4},{v}_{2}$ and ${v}_{11}$ .

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.

4. Equivalent Digraph

A digraph $\Gamma $ is defined by a set $V(\Gamma )$ of elements called vertices, a set $W(\Gamma )$ 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 with a vertex $t(d)$ called its tail. A dart $d\in W(\Gamma )$ incident with $h(d)=v$ , $t(d)=u$ is written $d=\overrightarrow{uv}$ and ${d}^{-}=\overrightarrow{vu}$ is called inverse of d.

Figure 1. M-matched graph.

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
${\mathrm{deg}}^{-}(v)$
and its out degree is denoted by deg^{+}(v).

A path in digraph $\Gamma $ is a sequence of $r\ge 1$ darts,

$P=({d}_{0},{d}_{1},\mathrm{...},{d}_{r-1})$ (3.1)

Or

$P=\overrightarrow{{v}_{0}{v}_{1}\mathrm{...}{v}_{r}}$ (3.2)

where ${d}_{j}=\overrightarrow{{v}_{j}{v}_{j+1}}$ of $\Gamma $ , not necessarily all distinct. It requires that the $t({d}_{k+1})=h({d}_{k})$ , whenever $0\le k\le r-1$ . The first and last vertices of path P, that is $t({d}_{0})$ and $h({d}_{r-1})$ , are called the tail $t(P)$ and head $h(P)$ of path P, respectively. The number r is called the length $\left|P\right|$ of path P.

${p}^{-}=\overrightarrow{{v}_{r}{v}_{r-1}{v}_{r-2}\mathrm{...}{v}_{2}{v}_{1}{v}_{0}}=({d}_{r-1}^{-},{d}_{r-2}^{-},\mathrm{...},{d}_{2}^{-},{d}_{1}^{-},{d}_{0}^{-})$

Is called inverse of path P, where ${d}_{j}^{-}=\overrightarrow{{v}_{j+1}{v}_{j}}$ .

Consider two paths P and Q in $\Gamma $ , 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 $t(PQ)=t(P),h(PQ)=h(Q)$ and $PQR=(PQ)R=P(RQ)$ , ${(PQR)}^{-}={R}^{-}{Q}^{-}{P}^{-}$ , $\left|PQ\right|=\left|P\right|+\left|Q\right|$ .

One dart is a path with length 1. One path $P=({d}_{0},{d}_{1},\mathrm{...},{d}_{r-1})$ is the product of r darts ${d}_{0},{d}_{1},\mathrm{...},{d}_{r-1}$ , i.e. $P={d}_{0}{d}_{1}\mathrm{...}{d}_{r-1}$ .

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=\overrightarrow{u}\overrightarrow{v}$ and ${d}^{-}=\overrightarrow{v}\overrightarrow{u}$ called the opposite darts on e. We form an equivalent digraph $\overrightarrow{G}$ of G from the given graph G.

$V(\overrightarrow{G})=V(G)$ and $W(\overrightarrow{G})=\{d,{d}^{-}:e\in E(G),\text{}d,{d}^{-}\text{are opposits darts on}e\}$

A path in $\overrightarrow{G}$ is edge-simple if no two of its terms are darts on the same edge of G. Thus an edge-simple is necessarily dart-simple.

Let M be a matching in G. Edges in M and the darts on them are called matched. The other edges and darts on them are free. A path in $\overrightarrow{G}$ is M-alter- nating if its darts are alternately free and matched and the first dart is necessarily free.

Let $P={d}_{0}{d}_{1}\mathrm{...}{d}_{i}\mathrm{...}{d}_{r}$ be M-alternating then ${d}_{i}$ is free when i is even and ${d}_{i}$ is matched when i is odd.

Lemma 3.1. Let

$P={d}_{0}{d}_{1}\mathrm{...}{d}_{r}({d}_{i}={\overrightarrow{{v}_{i}v}}_{i+1};0\le i\le r)$

be a M-alternating path in equivalent digraph $\overrightarrow{G}$ of G from a free vertex ${v}_{0}=t({d}_{0})$ to another free vertex ${v}_{r+1}=h({D}_{r})$ . If P is edge-simple in $\overrightarrow{G}$ then the alternating path $P\text{'}=({v}_{0},{v}_{1},\mathrm{...},{v}_{r+1})$ is a M-augmenting path in G.

Proof: Each vertex in P is the head or tail of a matched dart, except ${v}_{0},{v}_{r+1}$ , but ${v}_{0}\ne {v}_{r+1}$ , so if $0<i<t<r+1;{v}_{i}={v}_{t}$ then the matched darts, which incident with ${v}_{i},{v}_{t}$ , are on the same edge of G, because no two of matched edges share an vertex. This would conflict with that P is edge-simple. Then the vertices ${v}_{0},{v}_{1},\mathrm{...},{v}_{r},{v}_{r+1}$ in P are all distinct. $P\text{'}$ is a M-augmenting in G. We call a edge-simple path P a M-augmenting path, for simple.

Definition 3.1. Assume i is odd, t. is even and $i<t$ , the M-alternating path $P={d}_{0}{d}_{1}\mathrm{...}{d}_{i-1}{d}_{i}\mathrm{...}{d}_{t-1}{d}_{t}\mathrm{...}{d}_{r}$ meet the condition that ${d}_{t}={d}_{i-1}^{-}$ . We call ${P}_{b(i,t)}={d}_{i}{d}_{i+1}\mathrm{...}{d}_{t-1}$ a blossom and ${d}_{i-1}$ in-dart, ${d}_{t}$ out-dart of the blossom.

It is easy to see:

1) ${d}_{i-1},{d}_{t}$ are matched therefore ${d}_{i},{d}_{t-1}$ are free, because $i-1,t$ are even.

2) ${P}_{{b}^{-}(i,t)}^{-}={d}_{t-1}^{-}{d}_{t-2}^{-}\mathrm{...}{d}_{i}^{-}$ is also a blossom in ${P}^{-}={d}_{r}^{-}{d}_{r-1}^{-}\mathrm{...}{d}_{t}^{-}{P}_{{b}^{-}(t,i)}^{-}{d}_{i}^{-}{d}_{i-1}^{-}\mathrm{...}{d}_{0}^{-}$ and ${d}_{t}^{-},{d}_{i-1}^{-}$ 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.

Lemma 3.2. Let $P={d}_{0}{d}_{1}\mathrm{...}{d}_{r}({d}_{i}=\overrightarrow{{v}_{i}{v}_{i+1}},i=0,1,\mathrm{...},r)$ be a shortest M-alternating path in $\overrightarrow{G}$ from a free vertex ${v}_{0}=t({d}_{0})$ to an another free vertex ${v}_{r+1}=h({d}_{r})$ ( ${v}_{r+1}\ne {v}_{0}$ ) , 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$ , ${v}_{i}={v}_{t}$ . Let t be as small as possible, so that ${v}_{i-1}\ne {v}_{t-1}$ then ${d}_{i-1}\ne {d}_{t-1}$ , but ${d}_{i-1},{d}_{t-1}$ share vertex ${v}_{i}={v}_{t}$ as their head, so ${d}_{t-1}$ is necessarily free, because ${d}_{i-1}{d}_{i}$ is alternating. If ${d}_{i}\in M$ then ${d}_{t}={d}_{i}$ . We can obtain a shorter alternating path from ${v}_{0}$ to ${v}_{r+1}$ by deleting ${d}_{i},{d}_{i+1},\mathrm{...},{d}_{t-1}$ from P. This is contradict with that P is shortest.

Can only be the case that ${d}_{t}={d}_{i-1}^{-}$ , because they share ${v}_{t}$ as their tail. The ${d}_{i}{d}_{i+1}\mathrm{...}{d}_{t-1}$ is a blossom and ${d}_{i-1}$ is in-dart, ${d}_{t}$ is out-dart of it. □

5. The Algorithm to Implement Step 1 of Algorithm A in General Graph

We construct a directed graph

$\stackrel{\ufe39}{G}=(\stackrel{\ufe39}{V},\stackrel{\ufe39}{D})$ (4.1)

from the equivalent digraph $\overrightarrow{G}$ of G, which exhibits conveniently all shortest M-augmenting paths in $\overrightarrow{G}$ .

Let $\overrightarrow{G}$ be the equivalent digraph of G. D is a set of darts. Define:

$h(D)=\{h(d):d\in D\}$

$t(D)=\{t(d):d\in D\}$

$t\left({D}_{0}\right)=\{v:v\in V(G)\&v\text{is}M-free\}$

For $i=0,1,2,\mathrm{...}$

${D}_{2}{}_{i}=\{\overrightarrow{uv}:(u\in t({D}_{0}\text{)(}i=0)\text{;}u\in h({D}_{2i-1})(i>0))\&uv\in E(G)-M\}$

${D}_{2i+1}=\{\overrightarrow{uv}:u\in h({D}_{2i}),uv\in M\}$

The construction continues until for the first time a set ${D}_{2{I}^{*}}$ is constructed so that there is a $d\in {D}_{2{I}^{*}}$ and $h(d)$ is M-free. Then

$\stackrel{\ufe39}{V}=t({D}_{0})\cup {\displaystyle \underset{j=0}{\overset{2{I}^{*}}{\cup}}h({D}_{j})}\text{}\stackrel{\ufe39}{D}={\displaystyle \underset{j=0}{\overset{2{I}^{*}}{\cup}}{D}_{j}}$

For example, the $\stackrel{\ufe39}{G}$ shown by Figure 2 (the direction of all darts as shown by the big arrow) is constructed from the equivalent digraph $\stackrel{\rightharpoonup}{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 $\stackrel{\ufe39}{G}$ is easy to see:

1) Each path from a free vertex
$u\in {D}_{0}$
to a free vertex
$v\in {D}_{2{I}^{*}}$
in
$\stackrel{\ufe39}{G}$
is a shortest M-alternating path with length 2I^{*}+1.We call it regular M-alternating path in
$\stackrel{\ufe39}{G}$

2) If a M-alternating path $P\in \stackrel{\ufe39}{G}$ , $u=t(P)\in {D}_{0}$ and $v=h(P)\in {D}_{2{I}^{*}}$ then ${P}^{-}\in \stackrel{\ufe39}{G}$ and $t({P}^{-})=h(P)=v,h({P}^{-})=t(P)=u$ . ${P}^{-}$ is also a regular M-alter- nating path in $\stackrel{\ufe39}{G}$ .

3) Let $\mathbb{R}$ be the set all regular M-alternating paths in $\stackrel{\ufe39}{G}$ then $t(\mathbb{R})\subseteq t({D}_{0})$ , $h(\mathbb{R})\subseteq h({D}_{2{I}^{*}})$ and $t(\mathbb{R})=h(\mathbb{R})$ , by (b).

4) If $\left|h(\mathbb{R})\right|=1$ then there is no augmenting path in $\stackrel{\ufe39}{G}$ because there is only one M-alternating path P in $\stackrel{\ufe39}{G}$ and $t(P)=h(P)$ . In this case we remove the vertex $h(P)$ from $h({D}_{2{I}^{*}})$ , and continue to construct.

Let $\left|h(\mathbb{R})\right|>1$ Then it’s a matter of finding out the shortest M-augmenting paths in $\stackrel{\ufe39}{G}$ , i.e. to implement the step 1 in Algorithm A .

Let $d\in {D}_{2{I}^{*}}$ and $v=h(d)\in h({D}_{2{I}^{*}})$ is M-free. We construct a directed graph

$J({L}_{0},v)$ (4.2)

which is set of all shortest M-alternating paths with length 2I^{*} + 1 from a set
${L}_{0}\subseteq t({D}_{0})$
of M-free vertices to the free vertex
$v\in h({D}_{2{I}^{*}})$

${D}_{2{I}^{*}}^{f}=\{d:d\in {D}_{2{I}^{*}}\text{\&}h(d)=v\}$

${D}_{j}^{f}=\{d\in {D}_{j}\text{\&}h(d)\in t({D}_{j+1}^{f})\}(j=2{I}^{*}-1,\mathrm{...},2,1,0)$

$J({L}_{0},v)=(\overrightarrow{V},\overrightarrow{D})$

where

${L}_{0}={D}_{0}^{f}-\left\{v\right\},\text{}\overrightarrow{V}={L}_{0}\cup {\displaystyle \underset{j=0}{\overset{2{I}^{\text{*}}}{\cup}}{D}_{j}^{f}},\text{}\stackrel{\rightharpoonup}{D}={\displaystyle \underset{j=0}{\overset{2{I}^{*}}{\cup}}{D}_{j}^{f}}$

Case 1: ${L}_{0}=\phi $ . In this case there is no augmenting path with V as a end- vertex.

Figure 2. Directed graph including shortest M-alternating paths.

Case 2: ${L}_{0}\ne \phi $ . In this case there is at least one M-alternating path from a free vertex $u$ (other than V) to V in $J({L}_{0},v)$ .

For example, Figure 3 is $J(11,0)$ constructed from Figure 3, in which,. ${L}_{0}=\left\{11\right\}$ , ${D}_{5}^{f}$ include two darts $\overrightarrow{(5,6)}$ and $\overrightarrow{(6,5)}$ . ${D}_{9}^{f}$ include only one dart $\overrightarrow{(2,1)}$ called Cut-dart . General, if ${d}_{i}\in {D}_{i}^{f}$ is a only one of ${D}_{i}^{f}$ we call ${d}_{i}$ a cut-dart in $J({L}_{0},v)$ . If ${d}_{i}$ is a cut-dart then all of the paths in $J({L}_{0},v)$ pass ${d}_{i}$ .

Claim 4.1. Each path $P\in J({L}_{0},v)$ , either P is a M-augmenting path or P pass through a blossom, by lemma 3.2.

Claim 4.2. If d_{i} is a cut-dart and there is a M-augmenting path in J(L_{0, }v) then
${d}_{i}^{-}$
is not a cut-dart.

Claim 4.3 Each path $P\in J({L}_{0},v)$ is a M-augmenting path if there is no blossom in $J({L}_{0},v)$ .

Claim 4.4. Let P be a M-alternating path in $J({L}_{0},v)$ and $u=t(P)\in t({D}_{0})$ , $v=h(P)\in ({D}_{2{I}^{*}})$ then ${P}^{-}$ is in $\stackrel{\ufe39}{G}$ and $v=t({P}^{-})\in t({D}_{0})$ ; $u=h({P}^{-})\in ({D}_{2{I}^{*}})$ therefore ${P}^{-}\in J({L}_{0}^{-u},u)$ , where $u\notin {L}_{0}^{-u}\subset t({D}_{0})$ .

Claim 4.5. If $P\in J({L}_{0},v)$ pass through a blossom and dart d is the in-dart (out-dart) of the blossom then ${P}^{-}\in J({L}_{0}^{-u},u)$ is also pass through a blossom and ${d}^{-}$ is the in-dart (out-dart) of it.

A blossom will be broken if to remove the in-dart or out-dart from a path $P\in J({L}_{0},v)$ , which traverse the blossom .

Following theorem is the basis of the Algorithm to implement step1 of algorithm A.

Theorem 4.0 Let P be a augmenting path in $J({L}_{0},v)$ and

$u=t(P)\in t({D}_{0})$ , $v=h(P)\in ({D}_{2{I}^{*}})$

d is a in-dart(out-dart) of a blossom in $J({L}_{0},v)$ and d isn’t a cut-dart then $P\in J({L}_{0},v)$ or ${P}^{-}\in J({L}_{0}^{-u},u)$ can’t be broken after removing d.

Proof: If d is not on P then it can’t be broken after removing d. If pass through d is on P then ${d}^{-}$ is on ${P}^{-}\in J({L}_{0}^{-u},u)$ and d is not on ${P}^{-}$ . Therefore d isn’t a cut-dart and it is a in-dart(out-dart) of a blossom in ${P}^{-}\in J({L}_{0}^{-u},u)$ .

Algorithm A1. The algorithm to implement step 1 of Algorithm A

1) to construct $\stackrel{\ufe39}{G}$ by (4.1). Let ${D}_{2{I}^{*}}^{o}=\{d:d\in {D}_{{\text{2I}}^{\text{*}}}\&h(d)\text{isM-free}\}$

2) If $\left|h({D}_{2{I}^{*}}^{o})\right|=0$ then end

3) For a $v\in h({D}_{2{I}^{*}}^{o})$ to construct $J({L}_{0},v)$ by (4.2)

Figure 3. In-dart (1,2) being not cut-dart.

4) If $J({L}_{0},v)=\phi $ then remove $v$ from $h({D}_{2{I}^{*}}^{o})$ go to 1.

5) Get a M-alternating path P in $J({L}_{0},v)$ .

6) If P is edge-simple then get a M-augmenting path and remove P and ${P}^{-}$ from $\stackrel{\ufe39}{G}$ , go to 1.

7) P Traverse a blossom and d is in-dart of it: if d isn’t cut-dart then remove d else remove ${d}^{-}$ from $J({L}_{0},v)$ , go to 3.

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:

B: Deletion algorithm

For $i=2{I}^{*}$ to 0 step −1

For each
$v\in h({D}_{i})$
if
${\mathrm{deg}}^{-}(v)=0$
then remove v from D_{i}

For j = 0 to 2I^{* }

For each
$v\in t({D}_{j})$
if
${\mathrm{deg}}^{+}(v)=0$
then remove v from D_{j} in
$J(11,0)$
(Figure 3)_{.}

For example, to get a M-alternating path $P=\overrightarrow{(11,1,2,3,4,5,6,4,3,2,1,0)}$ in $J(11,0)$ (Figure 3). Dart $\overrightarrow{(1,2)}$ on P is a in-dart and isn’t a cut-dart To remove $\overrightarrow{(1,2)}$ from $J(11,0)$

The digraph after removing $\overrightarrow{(1,2)}$ from $J(11,0)$ is shown by Figure 4, to get a M-alternating path $P=\overrightarrow{(11,10,9,3,4,5,6,4,3,2,1,0)}$ in it, $d=\overrightarrow{(3,4)}$ is a in-dart and is a cut-dart. We remove out-dart ${d}^{-1}=\overrightarrow{(4,3)}$ and get a M-augmenting path $P=(11,10,9,3,4,5,6,8,7,2,1,0)$ in the result digraph.

The implementation of a phase consists of the construction of a digraph $\stackrel{\ufe39}{G}$ , followed by an iteration which alternately finds an augmenting path and executes the deletion algorithm. The iteration stops when ${D}_{2{I}^{*}}^{o}=\varphi $ . It is easy to see that each dart of $\stackrel{\ufe39}{G}$ is examined once when $\stackrel{\ufe39}{G}$ is first constructed, and once more if the $h(d)$ or $t(d)$ of that dart d is deleted.

The execution time of a phase is $o(2m+n)$ , where m is the number of edges in G, and n is the number of vertices. Hence the execution time of the entire algorithm is $o((2m+n)s)$ , where s is the carnality of a maximum matching.

If G has n vertices then $m\le \frac{{n}^{2}}{4}$ and $s\le \sqrt{n}$ , so that the execution time is bounded by $o({n}^{5/2})$ .

Figure 4. Out-dart being not cut-dart.

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

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

Cite this paper

Xie, Y.T. (2018) An o(n^{2.5}) Algorithm: For Maximum Ma- tchings in General Graphs. Journal of Applied Mathematics and Physics, 6, 1773- 1782. https://doi.org/10.4236/jamp.2018.69152

References

- 1. Berge, C. (1957) Two Theorems in Graph Theory. Proceedings of the National Academy of Sciences of the USA, 43, 449-844. https://doi.org/10.1073/pnas.43.9.842
- 2. Balinski, M.L. (1969) Labelling to Obtain a Maximum Matching, in Combinatorial Mathematics and Its Applications. In: Bose, R.C. and Dowling, T.A., Eds., University of North Carolina Press, Chapel Hill, 585-602.
- 3. Witzgall, C. and Zahn Jr., C.T. (1965) Modification of Edmond’s Maximum Matching Algorithm. Journal of Research of the National Bureau of Standards, 69B, 91-98.
- 4. Edmonds, J. (1965) Paths, Trees, and Flowers. Canadian Journal of Mathematics, 17, 449-467. https://doi.org/10.4153/CJM-1965-045-4
- 5. Hopcroft, J. and Karp, R.M. (1973) An n5/2 Algorithm for Maximum Matching in Bipartite Graphs. SIAM Journal on Computing, 225-231. https://doi.org/10.1137/0202019
- 6. Micali, S. and Vazirani, V.V. (1980) An Algorithm for Finding Maximum Matching in General Graphs. IEEE Annual Symposium on Foundations of Computer Science.
- 7. Peterson, P.A. and Lout, M.C. (1988) The General Matching Algorithm of Micali and Vazirani. Algorithmica, 511-533. https://doi.org/10.1007/BF01762129