The Use of a Pruned Modular Decomposition for Maximum Matching Algorithms on Some Graph Classes
I S A A C
The Use of a Pruned Modular Decomposition for Maximum Matching Algorithms on Some Graph Classes
Alexandru Popa 0 1
0 University of Bucharest, Bucharest, Romania ICI  National Institute for Research and Development in Informatics , Bucharest , Romania
1 Guillaume Ducoffe ICI  National Institute for Research and Development in Informatics, Bucharest, Romania The Research Institute of the University of Bucharest ICUB , Bucharest , Romania
We address the following general question: given a graph class C on which we can solve Maximum Matching in (quasi) linear time, does the same hold true for the class of graphs that can be modularly decomposed into C? As a way to answer this question for distancehereditary graphs and some other superclasses of cographs, we study the combined effect of modular decomposition with a pruning process over the quotient subgraphs. We remove sequentially from all such subgraphs their socalled onevertex extensions (i.e., pendant, antipendant, twin, universal and isolated vertices). Doing so, we obtain a “pruned modular decomposition”, that can be computed in quasi linear time. Our main result is that if all the pruned quotient subgraphs have bounded order then a maximum matching can be computed in linear time. The latter result strictly extends a recent framework in (Coudert et al., SODA'18). Our work is the first to explain why the existence of some nice ordering over the modules of a graph, instead of just over its vertices, can help to speed up the computation of maximum matchings on some graph classes. 2012 ACM Subject Classification Mathematics of computing → Graph theory, Theory of computation → Design and analysis of algorithms Funding This work was supported by the Institutional research programme PN 1819 “Advanced IT resources to support digital transformation processes in the economy and society  RESINFOTD” (2018), project PN 18190101 “Modeling, simulation, optimization of complex systems and decision support in new areas of IT&C research”, funded by the Ministry of Research and Innovation, Romania.
and phrases maximum matching; FPT in P; modular decomposition; pruned graphs; onevertex extensions; P4structure

Can we compute a maximum matching in a graph in lineartime? – i.e., computing a
maximum set of pairwise disjoint edges in a graph. – Despite considerable years of research
and the design of elegant combinatorial and linear programming techniques, the bestknown
algorithms for this fundamental problem have stayed blocked to an O(m√n)time complexity
on nvertex medge graphs [22]. Nevertheless, we can use some wellstructured graph classes
in order to overcome this superlinear barrier for particular cases of graphs. Our work
combines two successful approaches for this problem, namely, the use of a vertexordering
characterization for certain graph classes [5, 10, 21], and a recent technique based on the
decomposition of a graph by its modules [9]. We detail these two approaches in what follows,
before summarizing our contributions.
A cornerstone of most Maximum Matching algorithms is the notion of augmenting paths [2,
15]. However, although we can compute a set of augmenting paths in lineartime [16], this
is a tedious task that involves the technical notion of blossoms and this may need to be
repeated Ω(√n) times before a maximum matching can be computed [19]. A wellknown
greedy approach consists in, given some total ordering (v1, v2, . . . , vn) over the vertices in
the graph, to consider the exposed vertices vi by increasing order, then to try to match them
with some exposed neighbour vj that appears later in the ordering [12]. The vertex vj can
be chosen either arbitrarily or according to some specific rules depending on the graph class
we consider. Our initial goal was to extend similar reduction rules to moduleorderings.
Modular decomposition. A module in a graph G = (V, E) is any vertexsubset X such
that every vertex of V \ X is either adjacent to every of X or nonadjacent to every of
X. The modular decomposition of G is a recursive decomposition of G according to its
modules [18]. We postpone its formal definition until Section 2. For now, we only want to
stress that the vertices in the “quotient subgraphs” that are outputted by this decomposition
represent modules of G (e.g., see Fig. 1 for an insightful illustration). Our main motivation for
considering modular decomposition in this note is its recent use in the field of parameterized
complexity for polynomial problems. More precisely, let us call modularwidth of a graph G
the minimum k ≥ 2 such that every quotient subgraph in the modular decomposition of G
is either “degenerate” (i.e., complete or edgeless) or of order at most k. With Coudert, we
proved in [9] that many “hard” graph problems in P – for which no lineartime algorithm is
likely to exist – can be solved in kO(1)(n + m)time on graphs with modularwidth at most k.
In particular, we proposed an O(k4n + m)time algorithm for Maximum Matching.
One appealing aspect of our approach in [9] was that, for most problems studied, we
obtained a lineartime reduction from the input graph G to some (smaller) quotient subgraph
G0 in its modular decomposition. – We say that the problem is preserved by quotient. –
This paved the way to the design of efficient algorithms for these problems on graph classes
with unbounded modularwidth, assuming their quotient subgraphs are simple enough w.r.t.
the problem at hands. We illustrated this possibility through the case of (q, q − 3)graphs
(i.e., graphs where no set of at most q vertices, q ≥ 7, can induce more than q − 3 paths of
length four). However, this approach completely fell down for Maximum Matching. Indeed,
our Maximum Matching algorithm in [9] works on supergraphs of the quotient graphs
that need to be repeatedly updated every time a new augmenting path is computed. Such
approach did not help much in exploiting the structure of quotient graphs. We managed
to do so for (q, q − 3)graphs only through the help of a deeper structural theorem on the
nontrivial modules in this class of graphs. Nevertheless, to take a shameful example, it was
not even known before this work whether Maximum Matching could be solved faster than
with the stateofthe art algorithms on graphs that can be modularly decomposed into paths!
We propose pruning rules on the modules in a graph (some of them new and some others
revisited) that can be used in order to compute Maximum Matching in lineartime on
several new graph classes. More precisely, given a module M in a graph G = (V, E),
recall that M is corresponding to some vertex vM in a quotient graph G0 of the modular
decomposition of G. Assuming vM is a socalled onevertex extension in G0 (i.e., it is pendant,
antipendant, universal, isolated or it has a twin), we show that a maximum matching for G
can be computed from a maximum matching of G[M ] and a maximum matching of G \ M
efficiently (see Section 4). Our rules are purely structural, in the sense that they only rely on
the structural properties of vM in G0 and not on any additional assumption on the nontrivial
modules. Some of these rules (e.g., for isolated or universal modules) were first introduced
in [9] – although with slightly different correctness proofs. Our main technical contributions
in this work are the pruning rules for, respectively, pendant and antipendant modules (see
Sections 4.2 and 4.3). The latter two cases are surprisingly the most intricate. In particular,
they require amongst other techniques: the computation of specified augmenting paths of
length up to 7, the addition of some “virtual edges” in other modules, and a careful swapping
between some matched and unmatched edges.
Then, we are left with pruning every quotient subgraph in the modular decomposition
by sequentially removing the onevertex extensions. We prove that the resulting “pruned
quotient subgraphs” are unique (independent from the removal orderings) and that they can
be computed in quasi lineartime using a trie datastructure (Section 3). Furthermore, as
a casestudy we prove that several superclasses of cographs are totally decomposable w.r.t.
this new “pruned modular decomposition”. These classes are further discussed in Section 5.
Note that for some of them, such as distancehereditary graphs, we so obtain the first known
lineartime algorithm for Maximum Matching – thereby extending previous partial results
obtained for bipartite and chordal distancehereditary graphs [10]. Our approach actually
has similarities with a general greedy scheme applied to distancehereditary graphs [7]. With
slightly more work, we can extend our approach to every graph that can be modularly
decomposed into cycles. The case of graphs of bounded modular treewidth [23] is left as an
interesting open question.
Definitions and our first results are presented in Section 2. We introduce the pruned
modular decomposition in Section 3, where we show that it can be computed in quasi
lineartime. Then, the core of the paper is Section 4 where the pruning rules are presented
along with their correctness proofs. In particular, we state our main result in Section 4.4.
Applications of our approach to some graph classes are discussed in Section 5. Finally, we
conclude in Section 6 with some open questions. Due to lack of space, several proofs are
omitted. Full proofs can be found in our technical report [14].
For the standard graph terminology, see [3]. We only consider graphs that are finite, simple
and unweighted. For any graph G = (V, E) let n = V  and m = E. Given a vertex
v ∈ V , we denote its (open) neighbourhood by NG(v) = {u ∈ V  {u, v} ∈ E} and its closed
neighbourhood by NG[v] = NG(v) ∪ {v}. Similarly, we define the neighbourhood of any
vertexsubset S ⊆ V as NG(S) = Sv∈S NG(v) \ S. In what follows, we introduce our main
algorithmic tool for the paper as well as the graph problems we study.
a b
edgeless
e
f
h j
edgeless
i k
edgeless
Figure 1 A graph and its modular decomposition.
A module in a graph G = (V, E) is any subset M ⊆ V (G) such that for any u, v ∈ M we
have NG(v) \ M = NG(u) \ M . There are trivial examples of modules such as ∅, V, and {v}
for every v ∈ V . Let P = {M1, M2, . . . , Mp} be a partition of the vertexset V . If for every
1 ≤ i ≤ p, Mi is a module of G, then we call P a modular partition of G. By abuse of
notation, we will sometimes identify a module Mi with the induced subgraph Hi = G[Mi],
i.e., we will write P = {H1, H2, . . . Hp}. The quotient subgraph G/P has vertexset P, and
there is an edge between every two modules Mi, Mj ∈ P such that Mi × Mj ⊆ E. Conversely,
let G0 = (V 0, E0) be a graph and let P = {H1, H2, . . . Hp}. be a collection of subgraphs.
The substitution graph G0(P) is obtained from G0 by replacing every vertex vi ∈ V 0 with a
module inducing Hi. In particular, for G0 =def G/P we have that G0(P) = G.
We say that G is prime if its only modules are trivial (i.e., ∅, V, and the singletons {v}).
We call a module M strong if it does not overlap any other module, i.e., for any module
M 0 of G, either one of M or M 0 is contained in the other or M and M 0 do not intersect.
Let M(G) be the family of all inclusion wise maximal strong modules of G that are proper
subsets of V . The family M(G) is a modular partition of G [18], and so, we can define
G0 = G/M(G). The following structure theorem is due to Gallai.
1. G is disconnected;
We now formally define the modular decomposition of G – introduced earlier in Section 1.
We output the quotient graph G0 = G/M(G) and, for any strong module M ∈ M(G) that is
nontrivial (possibly none if G = G0), we also output the modular decomposition of G[M ]. By
Theorem 1 the subgraphs from the modular decomposition are either edgeless, complete, or
prime for modular decomposition. See Fig. 1 for an example. The modular decomposition of
a given graph G = (V, E) can be computed in lineartime [25]. There are many graph classes
that can be characterized using the modular decomposition.In particular, G is a cograph
if and only if every quotient subgraph in its modular decomposition is either complete or
disconnected [8].
A matching in a graph is defined as a set of edges with pairwise disjoint end vertices. The
maximum cardinality of a matching in a given graph G = (V, E) is denoted by μ(G).
We remind the reader that Maximum Matching can be solved in O(m√n)time on
general graphs [22] – although we do not use this result directly in our paper. Furthermore,
let G = (V, E) be a graph and let F ⊆ E be a matching of G. We call a vertex matched if it
is incident to an edge of F , and exposed otherwise. Then, we define an F augmenting path
as a path where the two ends are exposed, and the edges belong alternatively to F and not
to F . It is wellknown and easy to check that, given an F augmenting path P , the matching
E(P )ΔF (obtained by symmetric difference on the edges) has larger cardinality than F .
In this paper, we will consider an intermediate matching problem, first introduced in [9].
I Problem 4 (Module Matching).
Input: A graph G0 = (V 0, E0) with the following additional information;
a collection of subgraphs P = {H1, H2, . . . , Hp};
a collection F = {F1, F2, . . . , Fp},
with Fi being a maximum matching of Hi for every i.
Output: A matching of G = G0(P) with maximum cardinality.
A natural choice for Module Matching would be to take P = M(G). However, we
will allow P to take different values for our reduction rules.
Additional notations. Let hG0, P, F i be any instance of Module Matching. The order of
G0, equivalently the cardinality of P, is denoted by p. For every 1 ≤ i ≤ p let Mi = V (Hi) and
let ni = Mi be the order of Hi. We denote δi = E(Mi, Mi) the size of the cut E(Mi, Mi)
with all the edges between Mi and NG(Mi). In particular, we have δi = Pvj∈NG0 (vi) ninj.
Let us define Δm(G0) = Pip=1 δi. We will omit the dependency in G0 if it is clear from the
context. Finally, let Δμ = μ(G) − Pip=1 μ(Hi).
Our framework is based on the following lemma (inspired from [9]).
I Lemma 5. Let G = (V, E) be a graph. Suppose that for every H0 in the modular
decomposition of G we can solve Module Matching on any instance hH0, P, F i in time
T (p, Δm, Δμ), where T is a subadditive function1. Then, we can solve Maximum Matching
on G in time O(T (O(n), m, n)).
An important observation for our subsequent analysis is that, given any module M of a
graph G, the internal structure of G[M ] has no more relevance after we computed a maximum
matching FM for this subgraph. More precisely, we will use the following lemma:
I Lemma 6 ([9]). Let M be a module of G = (V, E), let G[M ] = (M, EM ) and let FM ⊆ EM
be a maximum matching of G[M ]. Then, every maximum matching of G0M = (V, (E \ EM ) ∪
FM ) is a maximum matching of G.
By Lemma 6 we can modify our algorithmic framework as follows. For every instance
hG0, P, F i for Module Matching, we can assume that Hi = (Mi, Fi) for every 1 ≤ i ≤ p.
1 We stress that every polynomial function is subadditive.
Data structures. Finally, let hG0, P, F i be any instance for Module Matching. A
canonical ordering of Hi (w.r.t. Fi) is a total ordering over V (Hi) such that the exposed
vertices appear first, and every two vertices that are matched together are consecutive. In
what follows, we will assume that we have access to a canonical ordering for every i. Such
orderings can be computed in time O(Pi Mi + Fi) by scanning all the modules and the
matchings in F , that is an O(Δm) provided G0 has no isolated vertex.
Furthermore, let F be a (not necessarily maximum) matching for the subdivision G =
G0(P). We will make the standard assumption that, for every v ∈ V (G), we can decide in
constanttime whether v is matched by F , and if so, we can also access in constanttime to
the vertex matched with v.
A pruned modular decomposition
In this section, we introduce a pruning process over the quotient subgraphs, that we use in
order to refine the modular decomposition.
I Definition 7. Let G = (V, E) be a graph. We call v ∈ V a onevertex extension if it falls
in one of the following cases:
NG[v] = V (universal) or NG(v) = ∅ (isolated);
NG[v] = V \ u (antipendant) or NG(v) = {u} (pendant), for some u ∈ V \ v;
NG[v] = NG[u] (true twin) or NG(v) = NG(u) (false twin), for some u ∈ V \ v.
A pruned subgraph of G is obtained from G by sequentially removing onevertex extensions
(in the current subgraph) until it can no more be done. This terminology was introduced
in [20], where they only considered the removals of twin and pendant vertices. Also, the
cliquewidth of graphs that are totally decomposed by the above pruning process (i.e., with
their pruned subgraph being a singleton) was studied in [24] 2. Our contribution in this part
is twofold. First, we show that the gotten subgraph is “almost” independent of the removal
ordering, i.e., there is a unique pruned subgraph of G (up to isomorphism). The latter can
be derived from the following (easy) lemma:
I Lemma 8. Let G = (V, E) be a graph and let v, v0 ∈ V be onevertex extensions of G. If
v, v0 are not pairwise twins then v0 is a onevertex extension of G \ v.
I Corollary 9. Every graph G = (V, E) has a unique pruned subgraph up to isomorphism.
For many graph classes a pruning sequence can be computed in lineartime. We observe
that the same can be done for any graph (up to a logarithmic factor).
Proof. By Corollary 9, we are left with greedily searching for, then eliminating, the onevertex
extensions. We can compute the ordered degree sequence of G in O(n+m)time. Furthermore,
after any vertex v is eliminated, we can update this sequence in O(N (v))time. Hence, up
to a total update time in O(n + m), at any step we can detect and remove in constanttime
any vertex that is either universal, isolated, pendant or antipendant. Finally, in [20] they
proposed a trie datastructure supporting the following two operations: suppression of a
vertex; and detection of true or false twins (if any). The total time for all the operations on
this datastructure is in O(n + m log n) [20]. J
2 Antitwins are also defined as onevertex extensions in [24]. Their integration to this framework remains
to be done.
We will term “pruned modular decomposition” of a graph G the collection of the pruned
subgraphs for all the quotient subgraphs in the modular decomposition of G. Note that
there is a unique pruned modular decomposition of G (up to isomorphism) and that it can
be computed in O(n + m log n)time by Proposition 10 (applied to every quotient subgraph
in the modular decomposition separately). Furthermore, we remark that most cases of
onevertex extensions imply the existence of non trivial modules, and so, they cannot exist
in the prime quotient subgraphs of the modular decomposition. Nevertheless, such vertices
may appear after removal of pendant or antipendant vertices (e.g., in the bull graph).
Let hG0, P, F i be any instance of Module Matching. Suppose that v1, the vertex
corresponding to M1 in G0, is a onevertex extension. Under this assumption, we present reduction
rules to a smaller instance hG∗, P∗, F ∗i where P∗ < P. Each rule can be implemented to
run in O(Δm(G0) − Δm(G∗))time. Due to lack of space, we skip the complexity analysis.
In Section 4.1 we recall the rules introduced in [9] for universal and isolated modules
(explicitly) and for false or true twin modules (implicitly). Our main technical contributions
are the reduction rules for pendant and antipendant modules (in Sections 4.2 and 4.3,
respectively), which are surprisingly the most intricate. Finally, we end this section stating
our main result (Theorem 29).
We introduce two local operations on a matching, first used in [26] for cographs. Let F ⊆ E
be a matching and let M ⊆ V be a module.
I Operation 11 (MATCH). While there are x ∈ M, y ∈ N (M ) exposed, add {x, y} to F .
I Operation 12 (SPLIT). While there are x, x0 ∈ M, y, y0 ∈ N (M ) such that x and x0 are
exposed, and {y, y0} ∈ F , replace {y, y0} in F by {x, y}, {x0, y0}.
Let G = H1 ⊕ H2 be the join of the two graphs H1, H2 and let F1, F2 be maximum
matchings for H1, H2, respectively. The “MATCH and SPLIT” technique consists in
applying Operations 11 then 12 to M = V (H1) and F = F1 ∪ F2, thereby obtaining a new
matching F 0, then to M = V (H2) and F = F 0. Based on this technique, we design the
following rules:
I Reduction rule 13 (see also [9]). Suppose v1 is isolated in G0. We set G∗ = G0 \ v1,
P∗ = P \ {H1}, and F ∗ = F \ {F1}. Furthermore, let F ∗ be a maximum matching of
G∗(P∗) = G[V \ M1]. We output F ∗ ∪ F1.
I Reduction rule 14 (see also [9]). Suppose v1 is universal in G0. We set G∗ = G \ v1,
P∗ = P \ {H1}, F ∗ = F \ {F1}. Furthermore, let F ∗ be a maximum matching of the
subdivision G∗(P∗) = G[V \ M1]. We apply the “MATCH and SPLIT” technique to M1, F1
with V \ M1, F ∗.
I Reduction rule 15. Suppose v1, v2 are false twins in G0. We set G∗ = G0 \ v1, P∗ =
{H1 ∪ H2} ∪ (P \ {H1, H2}), F ∗ = {F1 ∪ F2} ∪ (F \ {F1, F2}). We output a maximum
matching of G∗(P∗) = G.
I Reduction rule 16. Suppose v1, v2 are true twins in G0. Let F2∗ be the matching of H1 ⊕H2
obtained from the “MATCH and SPLIT” technique applied to M1, F1 with M2, F2. We set
G∗ = G \ v1, P∗ = {H1 ⊕ H2} ∪ (P \ {H1, H2}), F ∗ = {F2∗} ∪ (F \ {F1, F2}). We output a
maximum matching of G∗(P∗) = G.
Figure 2 An augmenting path of length 5 with ends x1, x2. Matched edges are drawn in bold.
Suppose v1 is antipendant in G0. W.l.o.g., v2 is the unique vertex that is nonadjacent to
v1 in G0. By Lemma 6, we can also assume w.l.o.g. that E(Hi) = Fi for every i. In this
situation, we start applying Reduction rule 13, i.e., we set G∗ = G0 \ v1, P∗ = P \ {H1},
F ∗ = F \ {F1}. Then, we obtain a maximum matching F ∗ of G \ M1 (i.e., by applying our
reduction rules to this new instance). Finally, from F1 and F ∗, we compute a maximum
matching F of G, using an intricate procedure. We detail this procedure next.
First phase: preprocessing. Our correctness proofs in what follows will assume that some
additional properties hold on the matched vertices in F ∗. So, we start correcting the initial
matching F ∗ so that it is the case. For that, we introduce two “swapping” operations. Recall
that v2 is the unique vertex that is nonadjacent to v1 in G0.
I Operation 17 (REPAIR). While there exist x2, y2 ∈ M2 such that {x2, y2} ∈ F2 and y2 is exposed in F ∗, we replace any edge {x2, w} ∈ F ∗ by {x2, y2}. I Operation 18 (ATTRACT). While there exist x2 ∈ M2 exposed and {u, w} ∈ F ∗ such that u ∈ NG(M2), w ∈/ M2, we replace {u, w} by {u, x2}.
Let F (0) = F1 ∪ F ∗. Summarizing, we get:
I Definition 19. A matching F of G is good if it satisfies the following two properties:
1. every vertex matched by F1 ∪ F2 is also matched by F ;
2. either every vertex in M2 is matched, or there is no matched edge in NG(M2) × NG(M1).
I Fact 20. F (0) is a good matching of G.
Main phase: a modified Match and Split. We now apply the following three operations
sequentially:
1. Match(M1, F (0)) (Operation 11). Doing so, we obtain a larger good matching F (1).
2. Split(M1, F (1)) (Operation 12). Doing so, we obtain a larger good matching F (2).
3. the operation Unbreak, defined in what follows (see also Fig. 2 for an illustration):
I Operation 21 (Unbreak). While there exist x1 ∈ M1 and x2 ∈ M1 ∪ M2 exposed,
and there also exist {y2, z2} ∈ F2 \ F (2), we replace any two edges {y2, u}, {z2, w} ∈ F (2)
by the three edges {x2, u}, {y2, z2} and {w, x1}.
We stress that the two edges {y2, u}, {z2, w} ∈ F (2) always exist since F (2) is a good
matching of G. Furthermore doing so, we obtain a larger matching F (3).
The resulting matching F (3) is not necessarily maximum. However, this matching satisfies
the following crucial property:
I Lemma 22. No vertex of M1 can be an end in an F (3)augmenting path.
x2 y2
Figure 3 An augmenting path of length 7 with ends x2, c. Matched edges are drawn in bold.
Finalization phase: breaking some edges in F1. Intuitively, the matching F (3) may not
be maximum because we sometimes need to borrow some edges of F1 in augmenting paths.
So, we complete our procedure by performing the following two operations: Let U1 contain
all the exposed vertices in N (M1). Consider the subgraph G[M1 ∪ U1] = G[M1] ⊕ G[U1].
The set U1 is a module of this subgraph. We apply Split(U1, F (3)) in G[M1 ∪ U1]. Doing
so, we obtain a larger good matching F (4). Then, we apply LocalAug, defined next (see
also Fig. 3 for an illustration):
I Operation 23 (LocalAug). While there exist x2 ∈ M2 and c ∈ N (M1) exposed, and
there also exist {x1, y1} ∈ F1 ∩ F (4) and {y2, z2} ∈ F2 \ F (4), we do the following:
we remove {x1, y1} and any edge {a, y2}, {b, z2} from F (4);
we add {x2, a}, {y2, z2}, {b, x1} and {y1, c} in F (4).
We stress that the two edges {y2, a}, {z2, b} ∈ F (4) always exist since F (4) is a good matching
of G. Furthermore doing so, we obtain a larger matching F (5).
I Lemma 24. F (5) is a maximumcardinality matching of G.
Suppose v1 is pendant in G0. W.l.o.g., v2 is the unique vertex that is adjacent to v1 in G0.
This last case is arguably more complex than the others since it requires both a preprocessing
and a postprocessing treatment on the matching.
First phase: greedy matching. We apply the “Match and Split” technique to M1. Doing
so, we obtain a set F1,2 of matched edges between M1 and M2. We remove V (F1,2), the set
of vertices incident to an edge of F1,2, from G. Then, there are three cases. If M2 ⊆ V (F1,2)
then M1 \ V (F1,2) is isolated. We apply Reduction rule 13. If M1 ⊆ V (F1,2) then M1 is
already eliminated. The interesting case is when both M1 \ V (F1,2) and M2 \ V (F1,2) are
nonempty. In particular, suppose there remains an exposed vertex x1 ∈ M1 \ V (F1,2). Since
M2 \ V (F1,2) 6= ∅, there exists {x2, y2} ∈ F2 such that x2, y2 ∈/ V (F1,2). We remove x1 from
M1, x2 from M2, {x2, y2} from F2 and then we add {x1, x2} in F1,2. Our first result in this
section is that there always exists an optimal solution that contains F1,2. This justifies a
posteriori the removal of V (F1,2) from G.
I Lemma 25. There is a maximum matching of G that contains all edges in F1,2.
We stress that during this phase, all the operations except maybe the last one increase the
cardinality of the matching. Furthermore, the only possible operation that does not increase
the cardinality of the matching is the replacement of an edge in F2 by an edge in F1,2. Doing
so, either we fall in one of the two pathological cases M1 ⊆ V (F1,2) or M2 ⊆ V (F1,2) (easy to
solve), or then we obtain through the replacement operation the following stronger property:
I Property 26. All vertices in M1 are matched by F1.
We will assume Property 26 to be true for the remaining of this section.
Second phase: virtual split edges. We complete the previous phase by performing a Split
between M2, M1 (Operation 12). That is, while there exist two exposed vertices x2, y2 ∈ M2
and a matched edge {x1, y1} ∈ F1 we replace {x1, y1} by {x1, x2}, {y1, y2} in the current
matching. However, we encode the Split operation using virtual edges in H2. Formally, we
add a virtual edge {x2, y2} in H2 that is labeled by the corresponding edge {x1, y1} ∈ F1. Let
H2∗ and F2∗ be obtained from H2 and F2 by adding all the virtual edges. We set G∗ = G0 \ v1,
P∗ = {H2∗} ∪ (P \ {H1, H2}) and F ∗ = {F2∗} ∪ (F \ {F1, F2}).
Intuitively, virtual edges are used in order to shorten the augmenting paths crossing M1.
Third phase: postprocessing. Let F ∗ be a maximumcardinality matching of the
subdivision G∗(P∗) (i.e., obtained by applying our reduction rules to the new instance). We
construct a matching F for G as follows. We add in F all the non virtual edges in F ∗. For
every virtual edge {x2, y2}, let {x1, y1} ∈ F1 be its label. If {x2, y2} ∈ F ∗ then we add
{x1, y2}, {x2, y1} in F , otherwise we add {x1, y1} in F . In the first case, we say that we
confirm the Split operation, whereas in the second case we say that we cancel it. Finally,
we complete F with all the edges of F1 that do not label any virtual edge (i.e., unused during
the second phase).
I Lemma 27. F is a maximumcardinality matching of G.
The above result is proved by contrapositive. More precisely, we prove intricate properties
on the intersection of shortest augmenting paths with pendant modules. Using these
properties and the virtual edges, we could transform any shortest F augmenting path into
an F ∗augmenting path, a contradiction.
Our framework consists in applying any reduction rule presented in this section until it can
no more be done. Then, we rely on the following result:
I Theorem 28 ([9]). We can solve Module Matching for hG0, P, F i in O(Δμ · p4)time.
We are now ready to state our main result in this paper (the proof of which directly
follows from all the previous results in this section).
I Theorem 29. Let G = (V, E) be a graph. Suppose that, for every prime subgraph H0 in
the modular decomposition of G, its pruned subgraph has order at most k. Then, we can
solve Maximum Matching for G in O(k4 · n + m log n)time.
We conclude this paper presenting applications and refinements of our main result to some
graph classes. Recall that cographs are exactly the graphs that are totally decomposable
by modular decomposition [8]. We start showing that several distinct generalizations of
cographs in the literature are totally decomposable by the pruned modular decomposition.
Distancehereditary graphs. A graph G = (V, E) is distancehereditary if it can be reduced
to a singleton by pruning sequentially the pendant vertices and twin vertices [1]. Conversely,
G is codistance hereditary if it is the complement of a distancehereditary graph, i.e., it can
be reduced to a singleton by pruning sequentially the antipendant vertices and twin vertices.
In both cases, the corresponding pruning sequence can be computed in lineartime [11, 13].
Therefore, we can derive the following result from our framework:
I Proposition 30. We can solve Maximum Matching in lineartime on graphs that can
be modularly decomposed into distancehereditary graphs and codistance hereditary graphs.
Trees are a special subclass of distancehereditary graphs. We say that a graph has
modular treewidth at most k if every prime quotient subgraph in its modular decomposition
has treewidth at most k. In particular, graphs with modular treewidth at most one are
exactly the graphs that can be modularly decomposed into trees3. We stress the following
consequence of Proposition 30:
I Corollary 31. We can solve Maximum Matching in lineartime on graphs with
modulartreewidth at most one.
The case of graphs with modular treewidth k ≥ 2 is left as an intriguing open question.
Treeperfect graphs. Two graphs G1, G2 are P4isomorphic if there exists a bijection from
G1 to G2 such that a 4tuple induces a P4 in G1 if and only if its image in G2 also induces a
P4 [6]. The notion of P4isomorphism plays an important role in the study of perfect graphs.
A graph is treeperfect if it is P4isomorphic to a tree [4]. We prove the following result:
I Proposition 32. Treeperfect graphs are totally decomposable by the pruned modular
decomposition. In particular, we can solve Maximum Matching in lineartime on
treeperfect graphs.
Our proof is based on a deep structural characterization of treeperfect graphs [4].
The case of unicycles. We end up this section with a refinement of our framework for the
special case of unicyclic quotient graphs (a.k.a., graphs with exactly one cycle).
I Proposition 33. We can solve Maximum Matching in lineartime on the graphs that
can be modularly decomposed into unicycles.
For that, we reduce the case of unicycles to the case of cycles (removing pendant modules).
Then, we test for all possible numbers of matched edges between two adjacent modules.
Doing so, we reduce the case of cycles to the case of paths.
The pruned modular decomposition happens to be an interesting add up in the study of
Maximum Matching algorithms. An exhaustive study of its other algorithmic applications
remains to be done. Moreover, another interesting question is to characterize the graphs that
are totally decomposable by this new decomposition. We note that our pruning process can
3 Our definition is more restricted than the one in [23] since they only impose the quotient subgraph G0
to have bounded treewidth.
be seen as a repeated update of the modular decomposition of a graph after some specified
modules (pendant, antipendant) are removed. However, we can only detect a restricted
family of these new modules (i.e., universal, isolated, twins). A fully dynamic modular
decomposition algorithm could be helpful in order to further refine our framework.
H.J. Bandelt and H. Mulder . Distancehereditary graphs . J . of Combinatorial Theory, Series B, 41 ( 2 ): 182  208 , 1986 .
C. Berge . Two theorems in graph theory . Proceedings of the National Academy of Sciences , 43 ( 9 ): 842  844 , 1957 .
J. A. Bondy and U. S. R. Murty . Graph theory . Grad. Texts in Math., 2008 .
A. Brandstädt and V. Le . Treeand forestperfect graphs . Discrete applied mathematics, 95 ( 13 ): 141  162 , 1999 .
M. Chang . Algorithms for maximum matching and minimum fillin on chordal bipartite graphs . In ISAAC , pages 146  155 . Springer, 1996 .
V. Chvátal . A semistrong perfect graph conjecture . In NorthHolland mathematics studies, volume 88 , pages 279  280 . Elsevier, 1984 .
Discrete Optimization , 2 ( 2 ): 185  188 , 2005 .
D. Corneil , Y. Perl , and L. Stewart . A linear recognition algorithm for cographs . SIAM Journal on Computing , 14 ( 4 ): 926  934 , 1985 .
D. Coudert , G. Ducoffe , and A. Popa . Fully polynomial FPT algorithms for some classes of bounded cliquewidth graphs . In SODA'18 , pages 2765  2784 . SIAM, 2018 .
E. Dahlhaus and M. Karpinski . Matching and multidimensional matching in chordal and strongly chordal graphs . Discrete Applied Mathematics, 84(1 3 ): 79  91 , 1998 .
G. Damiand , M. Habib , and C. Paul . A simple paradigm for graph recognition: application to cographs and distance hereditary graphs . Theoretical Computer Science , 263 ( 12 ): 99  111 , 2001 .
F. Dragan . On greedy matching ordering and greedy matchable graphs . In WG'97 , volume 1335 of LNCS , pages 184  198 . Springer, 1997 .
S. Dubois , V. Giakoumakis , and C. El Mounir. On codistance hereditary graphs . In CTW , pages 94  97 , 2008 .
G. Ducoffe and A. Popa . The use of a pruned modular decomposition for Maximum Matching algorithms on some graph classes . Technical Report arXiv:1804 .09407, arXiv, 2018 .
J. Edmonds . Paths, trees, and flowers. Canadian J. of mathematics , 17 ( 3 ): 449  467 , 1965 .
In STOC'83 , pages 246  251 . ACM, 1983 .
Tibor Gallai . Transitiv orientierbare graphen . Acta Math. Hungarica , 18 ( 1 ): 25  66 , 1967 .
Computer Science Review, 4 ( 1 ): 41  59 , 2010 .
J. Hopcroft and R. Karp . An nˆ5/2 algorithm for maximum matchings in bipartite graphs .
SIAM Journal on computing , 2 ( 4 ): 225  231 , 1973 .
J. Lanlignel , O. Raynaud, and E. Thierry . Pruning graphs with digital search trees. application to distance hereditary graphs . In STACS , pages 529  541 . Springer, 2000 .
G. Mertzios , A. Nichterlein , and R. Niedermeier . Lineartime algorithm for maximumcardinality matching on cocomparability graphs . arXiv , 2017 . arXiv: 1703 .05598.
S. Micali and V. Vazirani . An O(√V E) Algorithm for Finding Maximum Matching in General Graphs . In FOCS'80 , pages 17  27 . IEEE, 1980 .
D. Paulusma , F. Slivovsky , and S. Szeider . Model counting for cnf formulas of bounded modular treewidth . Algorithmica , 76 ( 1 ): 168  194 , 2016 .
M. Rao . Cliquewidth of graphs defined by onevertex extensions . Discrete Mathematics , 308 ( 24 ): 6157  6165 , 2008 .
M. Tedder , D. Corneil , M. Habib , and C. Paul . Simpler LinearTime Modular Decomposition Via Recursive Factorizing Permutations . In ICALP, pages 634  645 . Springer, 2008 .
Information processing letters , 47 ( 2 ): 89  93 , 1993 .