8
Algorithmica (2008) 52: 440–447 DOI 10.1007/s00453-007-9045-2 Maximum Induced Matchings for Chordal Graphs in Linear Time Andreas Brandstädt · Chính T. Hoàng Received: 24 October 2005 / Accepted: 16 May 2007 / Published online: 13 October 2007 © Springer Science+Business Media, LLC 2007 Abstract The Maximum Induced Matching (MIM) Problem asks for a largest set of pairwise vertex-disjoint edges in a graph which are pairwise of distance at least two. It is well-known that the MIM problem is NP-complete even on particular bi- partite graphs and on line graphs. On the other hand, it is solvable in polynomial time for various classes of graphs (such as chordal, weakly chordal, interval, circular-arc graphs and others) since the MIM problem on graph G corresponds to the Maximum Independent Set problem on the square G = L(G) 2 of the line graph L(G) of G, and in some cases, G is in the same graph class; for example, for chordal graphs G, G is chordal. The construction of G , however, requires O(m 2 ) time, where m is the number of edges in G. Is has been an open problem whether there is a linear-time algorithm for the MIM problem on chordal graphs. We give such an algorithm which is based on perfect elimination order and LexBFS. Keywords Maximum induced matchings · Chordal graphs · Perfect elimination order · Lexicographic breadth-first search · Linear time algorithm 1 Introduction For a given finite undirected graph G = (V,E), an induced matching is a subset E E of pairwise vertex-disjoint edges in G which are pairwise of distance at least two (i.e., edge pairs in E induce a 2K 2 in G). A. Brandstädt Institut für Informatik, Universität Rostock, 18051 Rostock, Germany e-mail: [email protected] C.T. Hoàng ( ) Department of Physics and Computer Science, Wilfrid Laurier University, Waterloo, ON N2L 3C5, Canada e-mail: [email protected]

Maximum Induced Matchings for Chordal Graphs in Linear Time

Embed Size (px)

Citation preview

Page 1: Maximum Induced Matchings for Chordal Graphs in Linear Time

Algorithmica (2008) 52: 440–447DOI 10.1007/s00453-007-9045-2

Maximum Induced Matchings for Chordal Graphsin Linear Time

Andreas Brandstädt · Chính T. Hoàng

Received: 24 October 2005 / Accepted: 16 May 2007 / Published online: 13 October 2007© Springer Science+Business Media, LLC 2007

Abstract The Maximum Induced Matching (MIM) Problem asks for a largest setof pairwise vertex-disjoint edges in a graph which are pairwise of distance at leasttwo. It is well-known that the MIM problem is NP-complete even on particular bi-partite graphs and on line graphs. On the other hand, it is solvable in polynomial timefor various classes of graphs (such as chordal, weakly chordal, interval, circular-arcgraphs and others) since the MIM problem on graph G corresponds to the MaximumIndependent Set problem on the square G∗ = L(G)2 of the line graph L(G) of G,and in some cases, G∗ is in the same graph class; for example, for chordal graphs G,G∗ is chordal. The construction of G∗, however, requires O(m2) time, where m isthe number of edges in G. Is has been an open problem whether there is a linear-timealgorithm for the MIM problem on chordal graphs. We give such an algorithm whichis based on perfect elimination order and LexBFS.

Keywords Maximum induced matchings · Chordal graphs · Perfect eliminationorder · Lexicographic breadth-first search · Linear time algorithm

1 Introduction

For a given finite undirected graph G = (V ,E), an induced matching is a subsetE′ ⊆ E of pairwise vertex-disjoint edges in G which are pairwise of distance at leasttwo (i.e., edge pairs in E′ induce a 2K2 in G).

A. BrandstädtInstitut für Informatik, Universität Rostock, 18051 Rostock, Germanye-mail: [email protected]

C.T. Hoàng (�)Department of Physics and Computer Science, Wilfrid Laurier University,Waterloo, ON N2L 3C5, Canadae-mail: [email protected]

Page 2: Maximum Induced Matchings for Chordal Graphs in Linear Time

Algorithmica (2008) 52: 440–447 441

The Maximum Induced Matching (MIM) Problem on G asks for a largest inducedmatching in G. Let μi(G) denote the largest size of an induced matching in G. Re-cently, the MIM problem attracted much attention—see [2–6, 8–11, 13, 14].

It is known that, unlike the Maximum Matching problem, the MIM problem is NP-complete [2, 13] and remains NP-complete on very special bipartite graphs [10] suchas planar bipartite graphs with maximum degree 4 with one side of the bipartitionconsisting only of degree 2 vertices and such that the length of each cycle is congruentto 2k for some k. Moreover, the MIM problem remains NP-complete for line graphs[11] and thus also for claw-free graphs.

Induced matchings in graph G correspond precisely to stable (or independent)vertex sets in the square G∗ = L(G)2 of the line graph L(G) of G [2] since twoedges induce a 2K2 (i.e., a disconnected subgraph consisting of four vertices and twonon-incident edges) in G if and only if they are of distance at least 2 in G∗. Thus,the MIM problem can be solved in polynomial time whenever the MIS (MaximumIndependent Set) Problem can be solved in polynomial time for G∗ = L(G)2. Forvarious graph classes C , it can be shown that if G is in C then G∗ = L(G)2 is in C . Inparticular, this is the case for interval, chordal, circular-arc, trapezoid, cocomparabil-ity and weakly chordal graphs. Thus, the induced maximum matching problem canbe solved in polynomial time for

• Interval graphs and chordal graphs [2]• Circular-arc graphs [8]• Trapezoid graphs and cocomparability graphs [9]• Asteroidal-triple-free graphs [3, 5]• Weakly chordal graphs [4]• Interval-filament graphs [3]

Note that interval-filament graphs include chordal graphs, polygon-circle graphs,circular-arc graphs, circle graphs and outerplanar graphs.

For some classes, there are MIM algorithms avoiding the construction of G∗ whichleads to better time bounds: There are direct linear time algorithms for MIM on in-terval graphs [9], on bipartite permutation graphs [5] and on trees [6, 9, 14].

Chordal graphs are an important class of graphs that have been intensively stud-ied. It is one of the first classes of graphs to be recognized as being perfect. Thewidely used Lexicographic Breadth-First Search (LexBFS) was invented to recognizechordal graphs in linear time. The classical problems of finding an optimal colouringand a largest clique can be solved in polynomial time for chordal graphs. For moreinformation on chordal graphs, see [7].

In this note, we present a linear time LexBFS-based algorithm for MIM on chordalgraphs. This extends the previous linear-time results for interval graphs and trees.

2 Basic Notions

Throughout this note, let G = (V ,E) be a finite undirected graph without self-loopsand multiple edges with vertex set V and edge set E, and let |V | = n, |E| = m. Fora vertex v ∈ V , let N(v) = {u | uv ∈ E} denote the (open) neighborhood of v in G,and let N [v] = {v} ∪ {u | uv ∈ E} denote the (closed) neighborhood of v in G.

Page 3: Maximum Induced Matchings for Chordal Graphs in Linear Time

442 Algorithmica (2008) 52: 440–447

For U ⊆ V , let G[U ] denote the subgraph of G induced by U . Throughout thispaper, all subgraphs are understood to be induced subgraphs. Let F denote a set ofgraphs. A graph G is F -free if none of its induced subgraphs is in F .

A vertex set U ⊆ V is stable (or independent) in G if the vertices in U are pairwisenonadjacent. The Maximum Independent Set (MIS) Problem asks for a stable set ofmaximum size.

For k ≥ 1, let Pk denote a chordless path with k vertices and k − 1 edges, and fork ≥ 3, let Ck denote a chordless cycle with k vertices and k edges. The 2K2 is thecomplement graph of C4.

Let L(G) = (E,E′) denote the line graph of G = (V ,E), i.e., the vertex set ofL(G) is E, and two edges e = {x, y}, e′ = {x′, y′} are adjacent in E′ if they have avertex in common, i.e., {x, y} ∩ {x′, y′} = ∅.

The square G2 of a graph G = (V ,E) has the same vertex set as G, and twovertices x, y are adjacent in G2 if their distance in G is at most two.

Thus, two edges e, e′ ∈ E are adjacent in G∗ = L(G)2 = (E,E∗) if and only ifthey either have a vertex in common or there is an edge of E between them. In otherwords, ee′ ∈ E∗ if and only if e and e′ induce a 2K2 in G.

A graph is chordal if it contains no induced Ck , k ≥ 4. A vertex is simplicial inG if its neighborhood N [v] is a clique. A vertex ordering (v1, . . . , vn) is a perfectelimination ordering (p.e.o.) of G if for every i ∈ {1, . . . , n}, vi is simplicial in thesubgraph Gi = G[{vi, . . . , vn}].

The following characterization is well-known:

Theorem 1 ([12]) A graph G is chordal if and only if G has a p.e.o., and for givenchordal graph, every LexBFS ordering is a p.e.o.

LexBFS will be defined in Sect. 4. Having a p.e.o. of G, one can easily determinea maximum stable set of G by repeatedly choosing a simplicial vertex and deletingits neighbors.

3 Perfect Elimination Ordering of G∗ in Linear Time

K. Cameron has shown:

Theorem 2 ([2]) If a graph G is chordal then G∗ = L(G)2 is also chordal.

As will be explained later, the above algorithm gives a polynomial, but not linear,time algorithm for the MIM problem for chordal graphs.

Let σ = (v1, . . . , vn) be a p.e.o. of G. In order to simplify notations, we identifyeach vertex vi , i ∈ {1, . . . , n}, with its position i = σ−1(vi) in σ . We are going toshow that the following ordering σ ∗ = (e1, . . . , em) of E is a p.e.o. of G∗: For edgesuv,xy ∈ E, let uv <∗ xy if either

max{u,v} < max{x, y}

Page 4: Maximum Induced Matchings for Chordal Graphs in Linear Time

Algorithmica (2008) 52: 440–447 443

or

max{u,v} = max{x, y} and min{u,v} < min{x, y}.The following theorem gives a linear time algorithm for the MIM problem for chordalgraphs.

Theorem 3 If σ = (v1, . . . , vn) is a p.e.o. of G then σ ∗ is a p.e.o. of G∗.

Proof Assume that σ = (v1, . . . , vn) is a p.e.o. of G but σ ∗ is no p.e.o. of G∗, thatis,

(∗) There are edges ab, cd, ef ∈ E such that ab <∗ cd <∗ ef , (ab, cd) ∈ E∗,(ab, ef ) ∈ E∗ but (cd, ef ) ∈ E∗.

The non-edge (cd, ef ) ∈ E∗ means that cd, ef induce a 2K2 in G.We will denote by a bad triple (x, y, z) three vertices x, y, z of G with x < y, z

and xy, xz ∈ E,yz ∈ E. The existence of a bad triple contradicts the assumption that< is a p.e.o.

Without loss of generality, let a < b, c < d , e < f . Then ab <∗ cd <∗ ef and(cd, ef ) ∈ E∗ imply b < d < f , or b = d < f .

First, we will show

b < d. (1)

Assume that b = d . Then there is an edge between a and {e, f } since (ab, ef ) ∈ E∗and be /∈ E, bf /∈ E. We must have af ∈ E, for otherwise (a, b, f ) is a bad triple;but if ae ∈ E then (a, b, e) (if a < e) or (e, a, f ) (if e < a) is a bad triple. Thisproves (1).

The edge (ab, cd) ∈ E∗ means that either ab and cd have a vertex in common ortheir distance in G is one. Analogously, the edge (ab, ef ) ∈ E∗ means that either ab

and ef have a vertex in common or their distance in G is one.We will first show that

if a vertex x ∈ {a, b} is adjacent to e or f, then xd, xc ∈ E. (2)

Suppose x ∈ {a, b} is adjacent to e or f . It follows that there is a vertex y ∈ {e, f },such that xy ∈ E and x < y (if xf ∈ E and xe ∈ E, then x < e, else (e, x, f ) is a badtriple). We have xd ∈ E, else (x, d, y) is a bad triple. We have xc ∈ E, else (x, c, y)

(if x < c), or (c, x, d) (if c < x) is a bad triple. (2) is proved.A symmetrical argument proves that

if a vertex x ∈ {a, b} is adjacent to c or d, then xf, xe ∈ E. (3)

We claim that

af ∈ E. (4)

Suppose that af ∈ E. We have

(i) ad, ac ∈ E by (2)

Page 5: Maximum Induced Matchings for Chordal Graphs in Linear Time

444 Algorithmica (2008) 52: 440–447

(ii) bf ∈ E, else (a, b, f ) is a bad triple(iii) bd, bc ∈ E by (2)

It follows that (ab, cd) ∈ E∗, a contradiction to (∗). Equation (4) is established. (Thisimplies a = e.) A similar argument using (3) shows

ad ∈ E. (5)

Next, we will prove

ae ∈ E. (6)

Suppose that ae ∈ E. From (4), it follows that a < e, else (e, a, f ) is a bad triple.We must have b = e, for otherwise (2) implies (ab, cd) ∈ E∗, a contradiction to(∗). Now, we have be ∈ E, else (a, b, e) is a bad triple. But it follows from (2) that(ab, cd) ∈ E∗, a contradiction to (∗).

A similar argument using (3) shows

ac ∈ E. (7)

Now, since (ab, cd), (ab, ef ) ∈ E∗, in G vertex b must be adjacent to a vertex of{c, d} and a vertex of {e, f }, a contradiction to (2) and (3).

This shows that σ ∗ is a p.e.o. of G∗. �

By Theorem 1, Theorem 3 implies Theorem 2: If G is chordal then G∗ is chordal.The advantage of Theorem 3 is that it gives a linear time algorithm with respect to

the input graph G as described in the last section.

4 LexBFS Orderings of G and G∗

As already mentioned in Theorem 1, LexBFS is a way to construct a p.e.o. of a givenchordal graph G in linear time. LexFS is based on the use of vertex labels which areordered in a lexicographic way as follows:

Let s1 = (a1, . . . , ak) and s2 = (b1, . . . , b�) be sequences of positive integers withdecreasing elements, i.e., a1 > a2 > · · · > ak and b1 > b2 > · · · > b�. Then s1 islexicographically smaller than s2 if either

there is an index i ≤ min{k, �} such that ai < bi andfor all j ∈ {1, . . . , i − 1}, aj = bj ork < � and aj = bj for all j ∈ {1, . . . , k}.

LexBFS generates an enumeration (i.e., linear ordering) of the vertex set V of G; itworks as follows: from n, n = |V |, downto 1:

1. LexBFS starts by picking an arbitrary vertex, gives it number n and labels all itsneighbors with label n.

2. In every round i, i from n−1 downto 1, LexBFS chooses a vertex of lexicograph-ically maximum label, gives it number i and labels all its unnumbered neighborswith label i until all vertices are numbered.

Page 6: Maximum Induced Matchings for Chordal Graphs in Linear Time

Algorithmica (2008) 52: 440–447 445

It is well-known [12] that every LexBFS ordering of a graph G fulfills the followingproperty

(P1) If a < b < c and ac ∈ E and bc /∈ E then there is a vertex d such that c < d ,bd ∈ E and ad /∈ E.

In [1], it is shown that the converse is also true:

Lemma 1 Every vertex ordering of G fulfilling (P1) can be generated by LexBFS.

In a very similar way as in the proof of Theorem 3, we can show the following The-orem 4, based on Lemma 1. Then Theorems 2 and 1 lead to the same consequences.Since Theorem 4 is of independent interest, we give its proof here.

Theorem 4 If G is chordal and σ = (v1, . . . , vn) is a LexBFS ordering of G then σ ∗is a LexBFS ordering of G∗.

Proof We will show that σ ∗ has property (P1). By Lemma 1, this implies that σ ∗ isa LexBFS ordering on G∗.

Assume that ab, cd, ef ∈ E with ab <∗ cd <∗ ef and (ab, ef ) ∈ E∗, (cd, ef ) ∈E∗. This implies de, df, ce, cf ∈ E. Without loss of generality, let a < b, c < d ,e < f . Then ab <∗ cd <∗ ef implies b < d < f or b = d < f . Note that b = d isimpossible by the same argument as for (1).

The edge (ab, ef ) ∈ E∗ means that either ab and ef have a vertex in common ortheir distance in G is one.

In order to show property (P1) of σ ∗, we have to show that there is an edge gh ∈ E

such that ef <∗ gh and (cd, gh) ∈ E∗, (ab, gh) ∈ E∗.

Case 1. ab and ef have a vertex in common.

Clearly, the common vertex cannot be f since a < b < f .

Case 1.1. b = e.

Since σ is a p.e.o., ad /∈ E (else (a, b, d) is a bad triple). Since σ fulfills (P1) andb < d < f , bf ∈ E, df /∈ E, there is a vertex g > f such that dg ∈ E, bg /∈ E. Nowlet gh = dg. Obviously, ef <∗ dg and (cd, dg) ∈ E∗. We claim that (ab, dg) ∈ E∗;if not then ag ∈ E but now (a, b, g) is a bad triple.

Case 1.2. a = e.

Since a < b,f and σ is a p.e.o., bf ∈ E follows. It follows from b < d < f , bf ∈ E,df /∈ E, and (P1) that there is a vertex g > f such that dg ∈ E, bg /∈ E. Sinceb < d,f , df /∈ E, we have bd /∈ E. Since a < b,g, bg /∈ E, we have ag /∈ E. Sincea < b,d and bd ∈ E, we have ad ∈ E. Now dg is the desired edge for (P1) of σ ∗.

Case 2. {a, b} ∩ {e, f } = ∅.

Since (ab, ef ) ∈ E∗, there is an edge of E between {a, b} and {e, f }.Case 2.1. bf ∈ E.

Page 7: Maximum Induced Matchings for Chordal Graphs in Linear Time

446 Algorithmica (2008) 52: 440–447

Since b < d,f and df ∈ E, bd ∈ E follows. Since a < b,d and bd ∈ E, ad ∈ E

follows. By (P1) of σ and b < d < f with bf ∈ E, df /∈ E, there is a vertex g > f

with gd ∈ E, gb /∈ E. Since a < b,g and bg ∈ E, ag ∈ E follows. But now, dg is thedesired edge for (P1) of σ ∗.

Case 2.2. bf ∈ E, be ∈ E.

We have b < e, for otherwise (e, b, f ) is a bad triple. Since b < d, e and eb ∈ E,bd ∈ E follows. Since a < b,d and bd ∈ E, ad ∈ E follows.

Case 2.2.1. e < d .

Since e < d < f , by (P1) of σ , there is a vertex g > f such that dg ∈ E, eg ∈ E.Since b < e,g and eg ∈ E, bg ∈ E follows. Since a < b,g and bg ∈ E, ag ∈ E

follows; but now, dg is the desired edge for (P1) of σ ∗.

Case 2.2.2. d < e.

Since b < d < e, by (P1) of σ , there is a vertex g > e such that dg ∈ E, bg ∈ E.Since a < b,g and bg ∈ E, ag ∈ E follows. Now, dg is the desired edge for (P1)

of σ ∗.

Case 2.3. be ∈ E, bf ∈ E, ae ∈ E or af ∈ E.

Impossible since a < b,f and be ∈ E, bf ∈ E.

This ends the case analysis and shows that σ ∗ has property (P1). �

5 MIM on Chordal Graphs in Linear Time

Given a p.e.o. of a graph H , one can easily determine in linear time a maximumstable set of H by repeatedly choosing a simplicial vertex and deleting its neighbors.Thus, the MIM problem on a chordal graph G = (V ,E) with |V | = n, |E| = m canbe solved in polynomial time by constructing G∗ and find a p.e.o. and a maximumstable set of it. But G∗ contains O(m2) edges, so this does not give a linear timealgorithm.

The following algorithm gives a linear time solution for the MIM problem ongiven chordal input graph G:

(1) Determine a LexBFS ordering σ on G (which is a p.e.o. of G [12]).(2) Repeatedly, do the following until the remaining graph G is empty:

(i) Determine an edge xy ∈ E in G with smallest max{σ−1(x), σ−1(y)} in theremaining graph (such an edge is element of a maximum induced matchingin G).

(ii) Determine all neighbors of x, y in the remaining graph G, and delete alledges incident to them.

Since the edges of G that are determined in step (i) correspond to simplicial ver-tices of G∗ by Theorem 3, the correctness of the algorithm is established (it is im-portant to observe that after each round of deleting edges in step (ii), the remain-

Page 8: Maximum Induced Matchings for Chordal Graphs in Linear Time

Algorithmica (2008) 52: 440–447 447

ing subgraph is an induced subgraph of G). As an aside, correctness of the algo-rithm is also implied by Theorems 4 and 1 (the LexBFS order σ ∗ is also a p.e.o.of G∗).

We now are going to describe an implementation of the algorithm in linear time.Assume that the input graph G is given by its adjacency lists, and σ = (v1, v2, . . . , vn)

is the LexBFS order on its vertices. Let Li be the adjacency list of vertex vi . Itis well known and easy to see that we can in linear time sort all lists Li , say,in decreasing order (see [7], p. 36). We now construct the order σ ∗ on the edgesof G∗ (as in Theorem 3); σ ∗ is implemented by an ordered list. The largest (last)edge in σ ∗ is the edge vnvn,1, where vn,1 is the first vertex in Ln. The secondlargest edge in σ ∗ is the edge vnvn,2, where vn,2 is the second vertex in Ln,and so on. The smallest (first) edge in σ ∗ is the edge v1v1,k , where v1,k is lastvertex in L1. Thus σ ∗ is the reversal of the concatenation of the ordered listsLn,Ln−1, . . . ,L1. To avoid having duplicate edges in σ ∗, we only consider edgesvivj with i > j . In particular, vertices in L1 will not be considered. The edgev1v1,k , as described above, is added to σ ∗ when the list L1,k is processed. Eachedge has a pointer to its position in σ ∗. Thus step (ii) takes time linear in the num-ber of edges deleted. This shows the algorithm can be implemented to run in lineartime.

Corollary 1 MIM is solvable in linear time on chordal graphs.

Corollary 2 MIM is solvable in linear time on interval graphs and on trees.

References

1. Brandstädt, A., Dragan, F.F., Nicolai, F.: LexBFS-orderings and powers of chordal graphs. DiscreteMath. 171, 27–42 (1997)

2. Cameron, K.: Induced matchings. Discrete Appl. Math. 24, 97–102 (1989)3. Cameron, K.: Induced matchings in intersection graphs (extended abstract). Electron. Notes Discrete

Math. 5 (2000)4. Cameron, K., Sritharan, R., Tang, Y.: Finding a maximum induced matching in weakly chordal graphs.

Discrete Math. 266, 133–142 (2003)5. Chang, J.-M.: Induced matchings in asteroidal-triple-free graphs. Discrete Appl. Math. 132, 67–78

(2004)6. Fricke, G., Laskar, R.: Strong matchings on trees. Congr. Numer. 89, 239–243 (1992)7. Golumbic, M.C.: Algorithmic Graph Theory and Perfect Graphs. Academic, San Diego (1980)8. Golumbic, M.C., Laskar, R.C.: Irredundancy in circular-arc graphs. Discrete Appl. Math. 44, 79–89

(1993)9. Golumbic, M.C., Lewenstein, M.: New results on induced matchings. Discrete Appl. Math. 101, 157–

165 (2000)10. Ko, C.W., Shepherd, F.B.: Bipartite domination and simultaneous matroid covers. SIAM J. Discrete

Math. 16, 517–523 (2003)11. Kobler, D., Rotics, U.: Finding maximum induced matchings in subclasses of claw-free and P5-free

graphs, and in graphs with matching and induced matching of equal maximum size. Algorithmica 37,327–346 (2003)

12. Rose, D.J., Tarjan, R.E., Lueker, G.S.: Algorithmic aspects of vertex elimination on graphs. SIAM J.Comput. 5, 266–283 (1976)

13. Stockmeyer, L.J., Vazirani, V.V.: NP-completeness of some generalizations of the maximum matchingproblem. Inform. Process. Lett. 15, 14–19 (1982)

14. Zito, M.: Linear time maximum induced matching algorithm for trees. Nord. J. Comput. 7, 58–63(2000)