#### On Adaptive Algorithms for Maximum Matching

I C A L P
On Adaptive Algorithms for Maximum Matching
Falko Hegerfeld Humboldt-Universit?t zu Berlin 0
Germany 0
Stefan Kratsch 0
Category Track A: Algorithms, Complexity and Games
0 Humboldt-Universita?t zu Berlin , Germany
In the fundamental Maximum Matching problem the task is to find a maximum cardinality set of pairwise disjoint edges in a given undirected graph. The fastest algorithm for this problem, due to Micali and Vazirani, runs in time O(?nm) and stands unbeaten since 1980. It is complemented by faster, often linear-time, algorithms for various special graph classes. Moreover, there are fast parameterized algorithms, e.g., time O(km log n) relative to tree-width k, which outperform O(?nm) when the parameter is sufficiently small. We show that the Micali-Vazirani algorithm, and in fact any algorithm following the phase framework of Hopcroft and Karp, is adaptive to beneficial input structure. We exhibit several graph classes for which such algorithms run in linear time O(n + m). More strongly, we show that they run in time O(?km) for graphs that are k vertex deletions away from any of several such classes, without explicitly computing an optimal or approximate deletion set; before, most such bounds were at least ?(km). Thus, any phase-based matching algorithm with linear-time phases obliviously interpolates between linear time for k = O(1) and the worst case of O(?nm) when k = ?(n). We complement our findings by proving that the phase framework by itself still allows ?(?n) phases, and hence time ?(?nm), even on paths, cographs, and bipartite chain graphs. 2012 ACM Subject Classification Mathematics of computing ? Matchings and factors; Theory of computation ? Graph algorithms analysis; Theory of computation ? Parameterized complexity and exact algorithms Related Version A full version of the paper is available at https://arxiv.org/abs/1904.11244.
and phrases Matchings; Adaptive Analysis; Parameterized Complexity
Introduction
The objective in the fundamental Maximum Matching problem is to find a set of disjoint
edges of maximum cardinality in a given undirected graph G = (V, E). Maximum Matching
has been heavily studied and was the first problem for which a polynomial-time algorithm
has explicitly been established [17]. Several algorithms [8, 23, 27, 39] achieve the best known
running time of O(?nm) for graphs with n vertices and m edges, starting with the algorithm
of Micali and Vazirani [39] in 1980. Since then, the time of O(?nm) remains unbeaten.
This state-of-the-art has motivated extensive research into faster algorithms for Maximum
Matching on special inputs: Extensive effort went into beating the worst case running time
of O(?nm) for Maximum Matching on special graph classes, resulting in a large number
of publications [14, 21, 22, 24, 26, 29, 34, 35], often even obtaining linear-time algorithms
[
10, 12, 38, 43, 45
]. Similarly, there is a great variety of algorithms whose running time
depends on n and m but also on some structural parameter of the input graph, like its
tree-width, its genus, or its vertex-deletion distance to a certain graph class (summarized in
Table 2). As an example, one can solve Maximum Matching in time O(k(n + m)) when
ET
A
CS
OOO((?(?kkkssm2mm)))
O(?ksm)
O(?k(c mw)mdm)
the input graph G is given together with a set S of k vertices such that G ? S belongs to a
class C in which Maximum Matching can be solved in linear time (cf. [38]): It suffices to
solve the problem on G ? S in linear time and to then apply at most k augmentation steps
to account for vertices in S; each such step can be implemented in linear time.
A caveat of this great number of different algorithms for special cases is that we may have
to first find the relevant structure, e.g., a set S so that G ? S belongs to a certain graph class
C, and to then decide which algorithm to apply. In some cases, finding the relevant optimal
structure is NP-hard and using approximate structure may lead to increase in running time.
Moreover, except for time O(?km) relative to vertex cover number k or maximum matching
size k, which can be seen to follow from the general analysis of Hopcroft and Karp [29], the
previously known time bounds improve on O(?nm) only if k = O(?n), at best.
Our results. We approach the Maximum Matching problem from the perspective of
adaptive analysis (of algorithms). Rather than developing further specialized algorithms
for special classes of inputs, we prove that a single algorithm actually achieves the best
time bounds relative to several graph classes and parameters; in particular, several new or
improved time bounds are obtained. Moreover, that algorithm is known since 1980, namely it
is the Micali-Vazirani-algorithm [39], and it is oblivious to the actual structure and parameter
values. In fact, our analysis does not depend on overly specific aspects of that algorithm and,
rather, applies to any algorithm for Maximum Matching that follows the ?phase framework?
established by Hopcroft and Karp [29] for Bipartite Matching and that implements each
phase in linear time, e.g., the algorithms by Blum [8] and Goldberg and Karzanov [27]. In
this framework, each phase is dedicated to finding a disjoint and maximal packing of shortest
augmenting paths, and it can be shown that O(?n) phases always suffice (cf. [29]).
We show that algorithms following the phase framework adapt to beneficial structure
in the form of inputs from special graph classes or inputs that are few vertex deletions
away from such a class, without running a recognition algorithm or computing the deletion
distance (i.e., they are obliviously adaptive). Concretely, we show that any such algorithm
solves Maximum Matching in linear time on several graph classes such as cluster graphs or
graphs of bounded neighborhood diversity. Moreover, for many such classes we also show
that any such algorithm takes time O(?km) on graphs that are k vertex deletions away
from the class, without explicitly computing such a set of deletions (or even knowing the
class in question). Furthermore, this running time interpolates between the worst-case time
O(?nm) for k ? ?(n) and linear time for k ? ?(1), hence remaining competitive even in the
absence of beneficial input structure. Except for the matching number and the vertex cover
number, time bounds of the form O(?km) are new, even for dedicated algorithms. Besides
that, we improve upon the algorithm by Yuster [46] for the special case of minimum degree
n ? s and we improve upon the algorithm by Kratsch and Nelles [33] for the special case of
bounded neighborhood diversity. Our positive results are summarized in Table 1.
We complement our findings by exhibiting several graph classes on which the phase
framework still allows the worst-case of ?(?n) phases, and hence ?(?nm) time. We prove
this for paths, trivially perfect graphs, which are a subclass of cographs, and bipartite chain
graphs (and hence their superclasses). This, of course, does not contradict the existence of
dedicated linear-time algorithms nor the possibility of tweaking a phase-based algorithm
to avoid the obstructions. Nevertheless, these results do rule out the possibility of proving
adaptiveness of arbitrary phase-based algorithms, and they showcase obstructions that need
to be handled to obtain more general adaptive algorithms for Maximum Matching.
Related work. Our work fits into the recent program of ?FPT in P?1 or efficient
parameterized algorithms, initiated independently by Abboud et al. [1] and Giannopoulou et al. [25].
This program seeks to apply the framework of parameterized complexity to tractable problems
to obtain provable running times relative to certain parameters that outperform the fastest
known algorithms or (conditional) lower bounds obtained in the fine-grained analysis program
(see, e.g., [2, 9, 41]). In particular, Mertzios et al. [38] have suggested Maximum Matching
as the ?drosophila? of FPT in P, i.e., as a central subject of study, similar to the role that
Vertex Cover plays in parameterized complexity. Already, there is a large number of
publications on parameterized algorithms for Maximum Matching [11, 15, 16, 20, 33, 36],
apart from large interest in FPT in P in general [1, 6, 19, 30, 31, 32]. There has also been
interest in linear-time preprocessing, which, relative to some parameter k, reduces the problem
to solving an instance of size f (k) and leads to time bounds of the form O(n + m + g(k)) [37].
Adaptive analysis of algorithms has been most successful in the context of sorting and
searching [3, 4, 13, 18]. We are not aware of prior (oblivious) adaptive analysis of established
algorithms for the Maximum Matching problem but two works have designed dedicated
adaptive algorithms relative to tree-depth [31] and modular-width [33].
Bast et al. [5] analyzed the Micali-Vazirani algorithm for random graphs, obtaining a
running time of O(m log n) with high probability.
Organization. Some preliminaries on graphs and matchings are recalled in Section 2.
Section 3 is dedicated to recalling the analysis of Hopcroft and Karp [29] and defining
phase-based algorithms. In Section 4 we present the positive results, except for results related
to neighborhood diversity and modular decomposition which can be found in the full version
of the paper. The lower bounds for paths and trivially perfect graphs are given in Section 5;
the lower bound for bipartite chain graphs is in the full version of the paper. We conclude in
Section 6.
1 An FPT-algorithm solves a given (usually NP-hard) problem in time f (k)nc where k is some
problemspecific parameter and n is the input size.
vivi?1 . . . vj if i > j.
P[vi,vj] =
We mostly consider simple graphs, unless stated otherwise, and denote an edge between v
and w as the concatenation of its endpoints, vw. Let G = (V, E) denote a graph. A path
P in G is denoted by listing its vertices in order, i.e., P = v1v2 . . . v`. We use the following
notation to refer to subpaths of a path P :
(vivi+1 . . . vj if i ? j,
By disjoint paths we will always mean vertex-disjoint paths. For a set of vertices S ? V ,
we define ?(S) = {vw ? E : v ? S, w ?/ S}. For two sets X, Y their symmetric difference is
denoted by X4Y = (X \ Y ) ? (Y \ X).
A set C ? V is a vertex cover of G if every edge of G has at least one endpoint in C;
the vertex cover number ? (G) of G is the minimum cardinality of any vertex cover of G.
An independent set of G is a set S ? V of pairwise nonadjacent vertices; the independence
number ?(G) of a graph G is the maximum cardinality of any independent set of G. The
maximum degree and minimum degree of G are denoted by ?(G) and ?(G) respectively. For
a class C of graphs we define dC(G) = minS?V :G?S?C |S| to be the vertex deletion distance
of G to C; a set S such that G ? S ? C is called a modulator. E.g., the vertex cover number
? (G) is the vertex deletion distance of G to edgeless graphs, i.e., independent sets.
A matching in a graph is a set of pairwise disjoint edges. Let G = (V, E) be a graph
and let M ? E be a matching in G. The matching M is maximal if there is no matching
M 0 in G such that M ( M 0 and M is maximum if there is no matching M 0 in G such that
|M | < |M 0|; the matching number ?(G) of G is the cardinality of a maximum matching in G.
A vertex v ? V is called M -matched if there is an edge in M that contains v, and v is
called M -exposed otherwise. We do not mention M if the matching is clear from the context.
We say that an edge e ? E is blue if e ?/ M and e is red if e ? M . An M -alternating path
is a path in G that alternatingly uses red and blue edges. An M -augmenting path is an
M -alternating path that starts and ends with an M -exposed vertex; a shortest M -augmenting
path is an M -augmenting path that uses as few edges as possible.
It is well known that matchings can be enlarged along augmenting paths and that an
augmenting path always exists if the matching is not maximum. We say that the matching
M 4E(P ) is obtained by augmenting M along P .
I Lemma 2.1. If M is a matching in G and P is an M -augmenting path, then M 4E(P )
is also a matching in G and has size |M 4E(P )| = |M | + 1.
I Theorem 2.2 ([29]). Let M and N be matchings in G = (V, E) with |N | > |M |. The
subgraph G0 = (V, M 4N ) of G contains at least |N | ? |M | vertex-disjoint M -augmenting paths.
I Corollary 2.3 ([7]). A matching M is maximum if and only if there is no M -augmenting
path.
3
Hopcroft-Karp analysis
Many of the fastest algorithms for Maximum Matching make use of a framework introduced
by Hopcroft and Karp [29] for the special case of bipartite matching. We give an overview of
the framework in this section, mostly following Hopcroft and Karp [29]. The main idea is to
search for shortest augmenting paths instead of arbitrary augmenting paths. Exhaustively
searching for shortest augmenting paths and augmenting along them leads to Algorithm 1.
Algorithm 1: Generic Matching Algorithm.
Input: Graph G
Output: Maximum matching M
1 M ? ?;
2 while M is not maximum do
3 Find a shortest M -augmenting path P ;
4 M ? M 4E(P );
Let P1, P2, . . . , P` be the sequence of augmenting paths in the order found during an
execution of Algorithm 1. Hopcroft and Karp [29] observed the following properties of the
computed shortest augmenting paths.
I Lemma 3.1 ([29]). Let M be a matching, let P be a shortest M -augmenting path, and let
P 0 be a M 4E(P )-augmenting path, then |P 0| ? |P | + 2|P ? P 0|.
I Corollary 3.2 ([29]). The sequence |P1|, . . . , |P`| is non-decreasing.
I Corollary 3.3 ([29]). If |Pi| = |Pj | for some i 6= j, then Pi and Pj are vertex-disjoint.
Following these observations, we can partition the sequence P1, . . . , P` into maximal
contiguous subsequences Pi, Pi+1, . . . , Pj such that |Pi| = |Pi+1| = ? ? ? = |Pj | < |Pj+1|, due
to Corollary 3.3 the paths Pi, Pi+1, . . . , Pj must be pairwise vertex-disjoint. Every such
subsequence is called a phase and corresponds to a maximal set of vertex-disjoint shortest
augmenting paths due to Corollary 3.3. With the terminology of phases introduced, it is
useful to restate Algorithm 1 as follows.
Algorithm 2: Phase Framework.
Input: Graph G
Output: Maximum matching M
1 M ? ?;
2 while M is not maximum do
3 Find a maximal set S of vertex-disjoint shortest M -augmenting paths;
4 Augment M along all paths in S;
In Algorithm 2 each iteration of the while-loop corresponds to a single phase. If an
algorithm implements Algorithm 2 we say that it employs the phase framework. In the
following, we will abstract from the implementation details of algorithms employing the
phase framework and only bound the number of phases that are required in the worst case.
Hopcroft and Karp [29] presented an upper bound in terms of the matching number ?(G).
I Theorem 3.4 ([29]). Every algorithm employing the phase framework requires at most
2 lp?(G)m + 2 phases.
The next bound is a simple corollary of Theorem 3.4 by noticing that ?(G) ? n2 , but we
opt to give an independent proof to serve as an instructive example for the proofs to come.
I Theorem 3.5 (folklore). Every algorithm employing the phase framework requires at most
O(?n) phases.
Proof. Let M denote the matching obtained after performing d?ne phases of Algorithm 2.
Every further M -augmenting path has length at least d?ne by Corollary 3.2. This implies
that we can pack at most d?ne such augmenting paths into G and hence by Theorem 2.2, at
most d?ne augmentations remain. Since we perform at least one augmentation per phase,
Algorithm 2 must have terminated after an additional d?ne phases. Thus, Algorithm 2
terminates after at most 2 d?ne phases. J
Several of the fastest Maximum Matching algorithms employ the phase framework
[8, 27, 39]. Any one of these algorithms yields the following time bound for a single phase.
I Theorem 3.6. There is an algorithm that given a matching M computes a maximal set of
vertex-disjoint shortest M -augmenting paths in time O(m). In particular, each phase of the
phase framework can be implemented to run in time O(m).
With Theorem 3.5 and Theorem 3.4 we obtain the following time bounds.
I Theorem 3.7. There is an algorithm employing the phase framework that solves Maximum
Matching in time O(?nm) and O(p?(G)m).
4
Adaptive parameterized analysis
In this section we will perform an adaptive analysis for algorithms employing the phase
framework by analyzing the required number of phases in terms of various graph parameters.
Theorem 3.6 yields an improved running time if the considered parameter is small enough.
Many of the considered parameters are NP-hard to compute, e.g., the vertex cover number.
This is not an issue, however, as we only require the parameter value for the running time
analysis and not for the execution of the algorithm. In this sense, algorithms employing the
phase framework are proved to obliviously adapt to the studied parameters.
4.1
Short alternating paths
Our main lemma relies on bounding the length of shortest augmenting paths. In the interest
of simplifying later arguments, we will not only bound the length of shortest augmenting
paths, but also of alternating paths that are not necessarily augmenting. The strategy for
obtaining such upper bounds is to take a long alternating path P and deduce that additional
edges must exist in G[V (P )] that enable us to find a shorter alternating path P 0 in G[V (P )]
between the endpoints of P . Hence, the replacement path P 0 will only visit vertices that are
also visited by the original path P . The following definition formalizes this idea.
I Definition 4.1. Given a matching M in a graph G and an M -alternating path P = v1 . . . v`.
We say that an M -alternating path P 0 = w1 . . . wk replaces P if the following is true:
V (P 0) ? V (P ),
w1 = v1 and wk = v`,
P 0 has the same parity as P with respect to M , i.e.,
v1v2 ? M ?? w1w2 ? M and v`?1v` ? M ?? wk?1wk ? M .
In particular, if P 0 replaces P , then P 0 is at most as long as P .
A technicality that arises from considering general alternating paths, as opposed to
augmenting paths, is that an alternating path that starts and ends with a blue edge, i.e.
an edge not in the matching, might have endpoints that are not exposed. If we want to
shortcut by taking a different edge incident to such an endpoint, then this edge might be red
which causes our constructions to fail. To avoid this issue, it suffices to consider the subpath
resulting from the removal of the first and last edge.
I Definition 4.2. A graph G is `-replaceable if for every matching M each M -alternating
path can be replaced by an M -alternating path of length at most `. The class of `-replaceable
graphs is denoted R[`].
We will now show that algorithms employing the phase framework require only few phases
for graphs that are close, in the sense of vertex deletion distance, to `-replaceable graphs.
I Lemma 4.3. Every algorithm employing the phase framework requires at most O(?k`)
phases on graphs G with dR[`](G) ? k. In particular, Maximum Matching can be solved in
time O(?k`m) for such graphs.
Proof. Let S ? V with |S| ? k, such that G ? S ? R[`] and let M be the matching obtained
after performing d?k`e phases of Algorithm 2. We claim that every shortest M -augmenting
path uses at least b?kc vertices of S; every such path has a length of at least d?k`e due
to Corollary 3.2. Consider such a path P , since G ? S is `-replaceable, we can assume that
every time P enters G ? S it uses at most ` + 1 vertices of G ? S before going back to S.
Hence, P must use at least b?kc ? 1 vertices of S to have a length of d?k`e or more.
Since S is of size at most k and due to the properties of replacing paths, this implies that
we can pack at most 2d?ke M -augmenting paths into G as
2 l?km j?kk ? 1 ? 2?k
?k ? 2 = 2k ? 4?k ? k
for k ? 16.
IBnytTothael,orweemn2ee.2d adt?mk`oest+22dd??kkeea?ugOm(e?nkta`)tiponhsasreesm.aTinh,eowrhemich3.r6eqimuiprelieast tmheosttim2ed?bkouenpdh.aseJs.
The following running time bound relative to the vertex cover number ? (G) follows
directly from Theorem 3.7 by the use of the well-known inequality ?(G) ? ? (G).
A1
e1
B1
A2
e2
e
e
B2
A3
e3
B3
I Theorem 4.4. Every algorithm employing the phase framework requires at most O(p? (G))
phases. In particular, Maximum Matching can be solved in time O(p? (G)m).
Alternatively, observe that if C is the class of independent sets, then dC(G) = ? (G) and
hence Theorem 4.4 is implied by Lemma 4.3 as independent sets are trivially 1-replaceable.
More generally, every graph without paths of length ` + 1 is `-replaceable. It is known
that a graph class has bounded path length if and only if it has bounded tree-depth (see,
e.g., [40, Chapter 6]). As a further special case consider the class of star forests, i.e., graphs
where every connected component is a star and therefore must be 2-replaceable. Hence, we
obtain the following corollary of Lemma 4.3.
I Corollary 4.5. Let C be the class of star forests. Every algorithm employing the phase
framework requires at most O(pdC(G)) phases. In particular, Maximum Matching can be
solved in time O(pdC(G)m).
4.2
Independence number
A graph with independence number k contains many edges in the sense that any set of k + 1
vertices must induce an edge. We will use this property to shorten long alternating paths.
I Theorem 4.6. Suppose that G is a graph such that ?(G) ? k, then G is O(k2)-replaceable.
Proof. First, fix a matching M . We show how to replace alternating paths that begin and
end with a blue edge, i.e., an edge not in M . By replacing appropriate subpaths of long
alternating paths with other parities, the general result will follow.
Suppose that P = a1b1a2b2 . . . a`b` is an alternating path that is longer than 4(k + 1)2 + 1
and that starts and ends with a blue edge. We can assume that ` is odd. Distinguishing
the vertices of P by their parity, we define A = {ai : i ? [`]} and B = {bi : i ? [`]}.
Furthermore, we define the sets Ai and A0i for i = 1, . . . , k + 1 by
Ai = {a(i?1)(2k+2)+j : j = 1, 2, 3, . . . , 2k + 1} and A0i = {aj ? Ai : j odd}.
Note that |A0i| = k + 1 > k for all i, hence the A0i cannot be independent sets. Thus, there is
at least one edge ei in G[A0i]. We denote the endpoints of ei by
ei = api aqi , where pi ? qi ? 2, for all i = 1, . . . , k + 1.
(1)
We now consider the vertices of B that lie between the endpoints of ei on P ; we
omit bpi to ensure that the constructed path is shorter than P . Concretely, let Bi =
{bpi+1, bpi+2, . . . , bqi?1} for all i = 1, . . . , k + 1. Equation (1) implies that Bi 6= ?. Now, we
arbitrarily choose a vertex b0i from each Bi and define B0 = {b0i : i = 1, . . . , k + 1}. Observe
that B0 cannot be an independent set as B0 contains k + 1 vertices; thus, there must exist
an edge e? = b0ib0j with i < j. We construct the path P 0 that replaces P by (see Figure 1)
P 0 = P[a1,api ]P[aqi ,b0i]P[b0j,b`],
using edges api aqi and b0ib0j ; note that P[aqi ,b0i] is a subpath of P in reverse order. Note that
both edges are blue because aqi and b0i are already incident with red edges on P . It can be
easily checked that P 0 is an alternating path and, in particular, that it is a valid replacement
for P . We will now show that P 0 is strictly shorter than P . It suffices to compare the length
of P1 = P[api ,b0j] and P2 = P[0api ,b0j] = api P[aqi ,b0i]b0j as P and P 0 agree on the remaining parts.
Let s and t be the indices such that b0i = bs and b0j = bt. The length of P1 is 2(t ? pi) + 1.
For the length of P2 we obtain
|P2| = 1 + (2(s ? qi) + 1) + 1 = 2(s ? qi) + 3 < 2(s ? (pi + 1)) + 3 = 2(s ? pi) + 1
< 2(t ? pi) + 1 = |P1|,
where the first inequality follows from Equation (1).
J
By combining this result with Lemma 4.3 we obtain the following corollary.
I Corollary 4.7. Every algorithm employing the phase framework requires at most O(?(G)2)
phases. In particular, Maximum Matching can be solved in time O(?(G)2m).
Let Ck denote the class of graphs with independence number at most k in each connected
component. Every algorithm employing the phase framework requires at most O(pdCk (G)k2)
phases. In particular, Maximum Matching can be solved in time O(pdCk (G)k2m).
A better analysis in terms of the independence number can be achieved by not using
replaceability, but in exchange we lose the square root dependence on the size of the modulator.
I Lemma 4.8. Every maximal matching M covers at least n ? ?(G) vertices.
Proof. If ?(G) + 1 vertices were exposed, they would not be an independent set and hence
have an edge between them. Thus, M would not be maximal. J
I Corollary 4.9. Every algorithm employing the phase framework requires at most O(?(G))
phases. In particular, Maximum Matching can be solved in time O(?(G)m).
Proof. After the first phase, we know that at most ?(G) vertices are exposed by Lemma 4.8.
Hence, ?(G)/2 further augmentations suffice. J
4.3
s-plexes
An s-plex, s ? 1, is an n-vertex graph G with minimum degree ?(G) ? n ? s. They were
introduced by Seidman and Foster [42] as a generalization of cliques, which are 1-plexes.
Problems related to s-plexes have been studied in parameterized complexity before [28, 44].
Let P[s] denote the class of graphs that are disjoint unions of s-plexes. Given a vertex v and
a set W ? V \ {v} of size at least s in an s-plex, we know that there is an edge vw for some
w ? W . Thus, s-plexes allow for better control than a small independence number as we can
guarantee the existence of an edge incident to some specific vertex instead of just getting
some edge in a large set of vertices.
I Theorem 4.10. If G is a k-plex, i.e., if ?(G) ? n ? k, then G is O(k)-replaceable.
Proof. Let M be a matching in G and suppose that P = v1 . . . v` is an M -alternating path
in G of length ` ? 1 ? 2k + 5. Let i be the smallest integer such that vi is M -exposed or
vi?1vi is red, i.e., vi?1vi ? M . Let j be the largest integer such that vj is M -exposed or
vj vj+1 is red. We have i ? {1, 2, 3} and j ? {` ? 2, ` ? 1, `}.
i
i + 2
Consider the vertices W = {vj , vj?2, vj?4, . . . , vj?2(k?1)} and observe that vi ?/ W as
3 < ` ? 2k. The set W contains k vertices and since G is a k-plex there must be some vs ? W
such that vivs ? E. By choice of i and s the edges vivi+1 and vs?1vs must be blue. Similarly,
by choice of i, the edge vivs is blue. Hence, as seen in Figure 2, we can replace P by the shorter
M -alternating path P 0 = P[v1,vi]P[vs,v`] with length |P 0| ? 2 + 2(k ? 1) + 2 = 2k + 2. J
By Lemma 4.3, we obtain the following corollary.
I Corollary 4.11. Every algorithm employing the phase framework requires at most O(n ?
?(G)) phases. In particular, Maximum Matching can be solved in time O((n ? ?(G))m).
Every algorithm employing the phase framework requires at most O(pdP[s](G)s) phases.
Hence, Maximum Matching can be solved in time O(pdP[s](G)sm). In particular,
Maximum Matching can be solved in time O(?km) on graphs that have distance at most k to
cluster graphs.
5
Lower bounds on the number of phases
In this section, we show that several restrictive graph classes do not admit results such as
those obtained in the previous section. To this end, we show that the assumptions made
about algorithms that follow the phase framework still allow a worst case of ?(?n) phases.
In other words, further assumptions about the behavior of such an algorithm are necessary
to avoid these lower bounds and to again get adaptive running times.
5.1
Paths and forests
H2
H3
I Lemma 5.1. An algorithm employing the phase framework may choose a sequence of
augmentations resulting in at least ?(?n) phases on paths.
Proof. We will concatenate increasingly long paths where we take every second edge into
the matching in such a way that the matching on the newly added path is maximal but not
maximum, so that every one of the concatenated paths requires a separate phase. More
formally, on P2i = v1v2 . . . v2i we use the matching {v2kv2k+1 : k ? [i ? 1]}. This matching
is one edge away from the maximum and the only augmenting path has length 2i ? 1.
Let Hi be obtained by concatenating two copies of P2i through identification of two
endpoints (obtaining a path on 4i ? 1 vertices). The matching on Hi can be augmented once
by an augmenting path of length 2i ? 1. There are two augmenting paths on Hi, we always
choose to augment along the copy of P2i that is attached to the previously constructed path,
i.e., the left copy in Figure 3. Using two copies of P2i in Hi ensures that every Hi requires
at least one augmentation. This is not the case if we simply concatenate P2, P4, . . . , P2k.
We can now define our desired paths. Let G1 = H1 = P3 and in this exceptional case we
assume that the left edge of P3 is matched. Furthermore, let Gi+1 be obtained from Gi by
concatenating Hi+1 at the right. The number of vertices of Gd?ne can be bounded by
d?ne
X 2|V (P2i)| ? 4( ?n )2 ? O(n).
i=1
Now, we argue that our choice of augmentations leads to ?(?n) phases for Gd?ne. In the
first phase we choose to find the maximal matching that we associated with each Hi. Now,
observe that Gd?ne contains augmenting paths of lengths 3, 5, . . . , 2 d?ne ? 1. In phase i,
i ? 2 we augment along the left copy of P2i in Hi. As this does not affect the augmenting
paths in the other Hi, we need d?ne phases in total. J
Using the parameter values on paths, we obtain the following parameterized lower bounds.
I Corollary 5.2. An algorithm employing the phase framework may choose a sequence of
augmentations resulting in ?(p?(G)), ?(p? (G)), ?(pdP[1](G)) or ?(pnd(G)) phases,
where nd(G) is the neighborhood diversity of G.
5.2
Cographs
Mertzios et al. [36] devised a Maximum Matching algorithm parameterized by vertex
deletion distance to cocomparability graphs and there are several Maximum Matching
algorithms parameterized by modular-width [11, 33]. In the interest of showing that these
results cannot be replicated or improved by our approach, we give a lower bound result for
cographs, i.e., the graphs of modular-width 2 and a subclass of cocomparability graphs.
I Definition 5.3. A graph is a cograph if it can be constructed from the following operations:
K1 is a cograph,
the disjoint union G ? H of two cographs G and H is a cograph,
the join G ? H of two cographs G and H is a cograph, where V (G ? H) = V (G) ? V (H)
and E(G ? H) = E(G) ? E(H) ? {vw : v ? V (G), w ? V (H)}.
I Theorem 5.4. There is a family of cographs such that an algorithm employing the phase
framework may choose a sequence of augmentations resulting in ?(?n) phases on this family.
H4
G0
G1
G2
G3
G0
G1
G2
(a) Increasingly long augmenting paths.
(b) Construction of H4.
Observe that Gi has at most 2i + 1 vertices, therefore Hn has O(n) vertices. We will now
describe a sequence of augmentations in Hn that requires ?(?n) phases.
In each Gi, i ? 2, there is exactly one vertex of degree one, which we call wi. For G1, we
fix an arbitrary vertex that is called w1. Furthermore, the vertex that is joined last in the
construction of Gi, i ? 2, is referred to as vi, see Figure 4. First, we describe which maximal
matchings to associate with the graphs Gi. In G0 there is no edge to choose, in G1 we choose
the only possible edge and in G2 we take the edge v2w1. Inductively, for Gi+1, i ? 2, we use
the maximal matching of Gi and add the edge vi+1wi. With Hn we associate the union of
these matchings and add the edge between the two copies of G0 to the matching. In this
way we obtain the matching that is supposed to be found in the first phase.
We now argue that Gi, i ? 2, has exactly one shortest augmenting path of length 2i ? 1.
This is true for i = 2; the other cases follow by induction. Let Pi be the shortest augmenting
path in Gi starting at wi, then Pi+1 = wi+1vi+1Pi is an augmenting path of length 2i + 1
in Gi+1. There are no further augmenting paths as there are only two exposed vertices in
Gi+1 and one of them is wi+1 with degree one; starting at wi+1, we must first take the edge
wi+1vi+1 and then the matched edge vi+1wi, hence we must take the path Pi+1 by induction.
Let v denote the vertex in G0 that is joined last in the construction of Hn. The construction
of Hn does not create any additional augmenting paths as every maximal alternating path
that passes through v must have one matched endpoint, namely the vertex in the other copy
of G0. In phase i we augment the shortest augmenting path of length 2i ? 1 in the copy of
Gi. By repeating the previous argument, these augmentations cannot introduce any new
augmenting paths in the later phases. Hence, we require d?ne phases for this sequence of
augmentations, thereby proving the claimed lower bound. J
The graphs in the previous proof are also C4-free, therefore these graphs are not only
cographs but also trivially perfect graphs.
6
Conclusion
We have conducted an adaptive analysis that applies to all algorithms for Maximum
Matching that follow the phase framework of Hopcroft and Karp [29], such as the algorithms
due to Micali and Vazirani [39], Blum [8], and Goldberg and Karzanov [27]. The main
takeaway message of our paper is that these algorithms not only obtain the best known time
O(?nm) for solving Maximum Matching but that they are also (obliviously) adaptive to
beneficial structure. That is, they run in linear time on several graph classes and they run in
time O(?km) for graphs that are k vertex deletions away from any of several classes; before,
most bounds were ?(km). Arguably, such adaptive algorithms are the best possible result
for dealing with unknown beneficial structure because they are never worse than the general
bound, in this case taking ?(?nm) when k = ?(n), and smoothly interpolate to linear time
on well-structured instances. Moreover, in the present case, they unify several special cases
and remove the need to find exact or approximate beneficial structure.
We complemented our findings by proving that the phase framework alone still allows
taking ?(?n) phases, and, hence, total time ?(?nm), even on restrictive classes like paths,
trivially perfect graphs, and bipartite chain graphs (and their superclasses), despite the
existence of (dedicated) linear-time algorithms. Of course, all of these cases are easy to
handle but it raises the question whether there are simple further properties to demand of a
phase-based algorithm so that it is provably adaptive to larger classes such as cocomparability
or bounded treewidth graphs? In the same vein, it would be interesting whether time O(?km)
is possible relative to feedback vertex number k, i.e., relative to deletion distance to a forest.
More generally, with the large interest in ?FPT in P? (or efficient parameterized
algorithms), it seems interesting what other fundamental problems admit adaptive algorithms
that interpolate between, say, linear time and the best general bound. Are there other cases
where a proven algorithmic paradigm, like the path packing phases of Hopcroft and Karp [29],
also obliviously yields the best known running times relative to beneficial input structure?
1
2
3
4
5
6
7
71:13
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Amir Abboud , Virginia Vassilevska Williams, and Joshua Wang . Approximation and fixed parameter subquadratic algorithms for radius and diameter in sparse graphs . In Proceedings of the twenty-seventh annual ACM-SIAM symposium on Discrete Algorithms , pages 377 - 391 .
SIAM , 2016 .
Amir Abboud , Virginia Vassilevska Williams, and Huacheng Yu . Matching Triangles and Basing Hardness on an Extremely Popular Conjecture . In Rocco A. Servedio and Ronitt Rubinfeld, editors, Proceedings of the Forty-Seventh Annual ACM on Symposium on Theory of Computing, STOC 2015 , Portland , OR , USA, June 14-17, 2015 , pages 41 - 50 . ACM, 2015 .
doi:10.1145/2746539 .2746594.
J?r?my Barbay , Johannes Fischer , and Gonzalo Navarro . LRM-Trees: Compressed indices, adaptive sorting, and compressed permutations . Theor. Comput. Sci. , 459 : 26 - 41 , 2012 .
doi:10 .1016/j.tcs. 2012 . 08 .010.
Theor. Comput. Sci. , 513 : 109 - 123 , 2013 . doi: 10 .1016/j.tcs. 2013 . 10 .019.
Holger Bast , Kurt Mehlhorn, Guido Schafer, and Hisao Tamaki . Matching algorithms are fast in sparse random graphs . Theory of Computing Systems , 39 ( 1 ): 3 - 14 , 2006 .
Matthias Bentert , Till Fluschnik, Andr? Nichterlein, and Rolf Niedermeier . Parameterized aspects of triangle enumeration . In International Symposium on Fundamentals of Computation Theory , pages 96 - 110 . Springer, 2017 .
Claude Berge . Two theorems in graph theory . Proceedings of the National Academy of Sciences , 43 ( 9 ): 842 - 844 , 1957 .
Andrew V. Goldberg and Alexander V. Karzanov . Maximum skew-symmetric flows and matchings . Mathematical Programming , 100 ( 3 ): 537 - 568 , 2004 .
Jiong Guo , Christian Komusiewicz, Rolf Niedermeier, and Johannes Uhlmann . A more relaxed model for graph-based data clustering: s-plex editing . In International Conference on Algorithmic Applications in Management , pages 226 - 239 . Springer, 2009 .
John E. Hopcroft and Richard M. Karp . An n5/2 algorithm for maximum matchings in bipartite graphs . SIAM Journal on computing , 2 ( 4 ): 225 - 231 , 1973 .
Thore Husfeldt . Computing Graph Distances Parameterized by Treewidth and Diameter . In Jiong Guo and Danny Hermelin, editors, 11th International Symposium on Parameterized and Exact Computation (IPEC 2016 ), volume 63 of Leibniz International Proceedings in Informatics (LIPIcs) , pages 16 : 1 - 16 : 11 , Dagstuhl , Germany, 2017 . Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik . doi: 10 .4230/LIPIcs.IPEC. 2016 . 16 .
Yoichi Iwata , Tomoaki Ogasawara, and Naoto Ohsaka . On the Power of Tree-Depth for Fully Polynomial FPT Algorithms . In LIPIcs-Leibniz International Proceedings in Informatics , volume 96 . Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2018 .
Leon Kellerhals . Parameterized Algorithms for Network Flows. Master's thesis , TU Berlin, 2018 .
Stefan Kratsch and Florian Nelles . Efficient and Adaptive Parameterized Algorithms on Modular Decompositions . In Yossi Azar, Hannah Bast, and Grzegorz Herman, editors, 26th Annual European Symposium on Algorithms (ESA 2018 ), volume 112 of Leibniz International Proceedings in Informatics (LIPIcs) , pages 55 : 1 - 55 : 15 , Dagstuhl , Germany, 2018 . Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik . doi: 10 .4230/LIPIcs.ESA. 2018 . 55 .
Information Processing Letters , 45 ( 4 ): 185 - 190 , 1993 .
Aleksander Madry . Navigating central path with electrical flows: From flows to matchings, and back . In Foundations of Computer Science (FOCS) , 2013 IEEE 54th Annual Symposium on , pages 253 - 262 . IEEE, 2013 .
George B. Mertzios , Andr? Nichterlein, and Rolf Niedermeier . Fine-grained algorithm design for matching . Technical report, Technical Report , 2016 .
George B. Mertzios , Andr? Nichterlein, and Rolf Niedermeier . The Power of Linear-Time Data Reduction for Maximum Matching . In Kim G. Larsen, Hans L. Bodlaender , and Jean-Francois Raskin, editors, 42nd International Symposium on Mathematical Foundations of Computer Science (MFCS 2017 ), volume 83 of Leibniz International Proceedings in Informatics (LIPIcs) , pages 46 : 1 - 46 : 14 , Dagstuhl , Germany, 2017 . Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik .
doi:10 .4230/LIPIcs.MFCS. 2017 . 46 .
George B. Mertzios , Andr? Nichterlein, and Rolf Niedermeier . A Linear-Time Algorithm for Maximum-Cardinality Matching on Cocomparability Graphs . SIAM Journal on Discrete Mathematics , 32 ( 4 ): 2820 - 2835 , 2018 .
Silvio Micali and Vijay V. Vazirani . An O(p|V ||E|) algorithm for finding maximum matching in general graphs . In 21st Annual Symposium on Foundations of Computer Science , 1980 , pages 17 - 27 . IEEE, 1980 .
J. Ne?et?il and P. Ossona de Mendez. Sparsity (Graphs, Structures, and Algorithms) , volume 28 of Algorithms and Combinatorics. Springer, 2012 .
Mihai Patrascu and Ryan Williams . On the Possibility of Faster SAT Algorithms . In Moses Charikar, editor, Proceedings of the Twenty-First Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2010 , Austin, Texas, USA, January 17 - 19 , 2010 , pages 1065 - 1075 . SIAM, 2010 . doi: 10 .1137/1.9781611973075.86.
Stephen B. Seidman and Brian L. Foster . A graph-theoretic generalization of the clique concept . Journal of Mathematical sociology , 6 ( 1 ): 139 - 154 , 1978 .
George Steiner and Julian S Yeomans . A linear time algorithm for maximum matchings in convex, bipartite graphs . Computers & Mathematics with Applications , 31 ( 12 ): 91 - 96 , 1996 .
Ren? Van Bevern , Hannes Moser , and Rolf Niedermeier . Approximation and tidying-a problem kernel for s-plex cluster vertex deletion . Algorithmica , 62 ( 3-4 ): 930 - 950 , 2012 .
Ming-Shing Yu and Cheng-Hsing Yang . An O(n) time algorithm for maximum matching on cographs . Information Processing Letters , 47 ( 2 ): 89 - 93 , 1993 .
Raphael Yuster . Maximum matching in regular and almost regular graphs . Algorithmica , 66 ( 1 ): 87 - 92 , 2013 .
Raphael Yuster and Uri Zwick . Maximum matching in graphs with an excluded minor . In Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms , pages 108 - 117 . Society for Industrial and Applied Mathematics, 2007 .