A linear-time algorithm for the weighted feedback vertex problem on interval graphs

A linear-time algorithm for the weighted feedback vertex problem on interval graphs

Information Processing Letters ELSEVIER Information Processing Letters 61 ( 1997) 107-I 11 A linear-time algorithm for the weighted feedback verte...

459KB Sizes 0 Downloads 162 Views

Information Processing Letters ELSEVIER

Information

Processing

Letters 61 ( 1997) 107-I 11

A linear-time algorithm for the weighted feedback vertex problem on interval graphs Department

Chin Lung Lu, Chuan Yi Tang * of Computer Science, National Tsing Hua Universiry Hsin-Chu, 30043, Taiwan, ROC Received 29 June 1995; revised 11 June 1996 Communicated by K. Ikeda

Abstract We present a linear-time algorithm for finding a minimum weighted feedback vertex set on interval graphs using the dynamic programming technique. Since the weighted feedback vertex problem, the weighted C3.1 problem, the maximum weighted 2-colorable subgraph problem and the maximum weighted 2-independent set problem are equivalent on chordal graphs, we can solve the latter three problems in linear-time on interval graphs, too. @ 1997 Elsevier Science B.V. Keywords:

Algorithms;

Feedback

vertex problem; C3.1 problem; 2-colorable

1. The weighted feedback vertex problem and its variants Let G = (r! E) be a simple graph, i.e., finite, undirected, and loopless without multiple edges, with vertex set V of size n and edge set E of size m. A subset C of V is a cycle-free vertex set (CVS) if G[C] has no cycle. A subset F of V is afeedback vertex set (FVS) of G if V \ F is a CVS. The feedback vertex problem is to find an FVS with the minimum cardinality in G. If each vertex u of G is associated with a real number w(u), called the weight of vertex u, then G is called a weighted graph. For any subset S C V, the weight of S, denoted by W(S), is the sum of the weights of all vertices in S. The weighted feedback vertex problem is to find an FVS with the minimum weight on a weighted graph G.

’ Corresponding 0020-0190/97/$17.00

author. Email: [email protected]. @ 1997 Elsevier Science B.V. All rights reserved.

PII SOO20-0190(96)00193-7

subgraph

problem; 2-independent

set problem;

Interval graphs

It is well known that the feedback vertex problem is NP-complete on general graphs [ 71, and even on bipartite graphs [ 161. For the weighted feedback vertex problem, an O(n6) time algorithm was developed by Brandstadt et al. on permutation graphs [ 21. This result was later improved to O(nmZ) by Brandstadt [ l] and to O(nm) by Liang [ 121, where Wi is the number of edges in the complement of G. In this paper, we give an O(n + m) time algorithm for the weighted feedback vertex problem on interval graphs. Given a graph G = (r! E), a set S of j-cliques (i.e., cliques of size j) is called a &-j cover of G if every i-clique of G includes at least one element of S. The Ci,j problem is to find a minimum cardinality Ki-j cover of G [5]. This problem is known to be NP-complete on the following classes of graphs, such as general graphs when i > j 2 1 [ 71, chordal graphs when i > j > 2 [4], and split graphs when i-l =j>2andiispartoftheinput[S].Gavril [6]

108

CL. Lu, C.E Tang/Information Processing Letters 61

gave a polynomial-time algorithm for the C2,t problem, which is exactly the vertex cover problem and is reducible to the maximum independent set problem, on chordal graphs. Corneil et al. [ 51 presented a polynomial-time algorithm, which is exponential in i, for the Ci,i problem on chordal graphs when i is fixed (if i is not fixed, then this problem is NP-complete) . Chang et al. [ 31 proposed an 0( n + m) time algorithm for the C,,t problem on strongly chordal graphs even when i is not fixed. Marathe et al. [ 131 devised an O(n + m) time algorithm for the Ci,t problem on interval graphs even when i is not fixed. For a weighted graph G = (v E) , we define the weighted Ci,l problem to find a Ki-1 cover of G with the minimum weight. Marathe et al. [ 131 pointed out that the C3,t problem is equivalent to the feedback vertex problem on chordal graphs. In fact, S C V is an FVS of G if and only if S is a Ks-1 cover of G. Hence, the weighted Cs,t problem and the weighted feedback vertex problem are equivalent on chordal graphs. Given a graph G = (YE), a set of vertices is called independent if no two of its elements are adjacent. A subgraph of G is said to be k-colorable if its vertices can be colored with k colors such that every two adjacent vertices have different colors. The maximum k-colorable subgraph problem is to find a maximum k-colorable subgraph of G. This problem is equivalent to the maximum k-independent set problem which is to find k independent sets of G covering a maximum number of vertices. For a weighted graph G = (‘r! E), the maximum weighted k-colorable subgraph problem (respectively, maximum weighted k-independent set problem) is to find a k-colorable subgraph (respectively, k independent sets) of G with the maximum weight. The maximum k-colorable subgraph problem is well known to be NP-complete on general graphs, even when k = 1 [7] or k = 2 [ 141. Gavril [ 81 and Yannakakis et al. [ 171 gave polynomial-time algorithms for the maximum k-colorable subgraph problem on comparability graphs and chordal graphs, respectively. Sarrafzadeh et al. [ 151 devised an O(kr?) time algorithm for the maximum weighted k-colorable subgraph problem on interval graphs. Hsiao et al. [lo] proposed an 0( n2) time algorithm for the maximum weighted 2-colorable subgraph problem on interval graphs.

(1997)

107-I

I I

Lemma 1 (see [5]). 1fG = (YE) isapetfectgraph with S C V then G[ S] is k-colorable if and only if V\Sisa Kk+l-1 coverofG (k>2). Corollary 2. If G = (YE) is a weighted perfect graph with S c V then G[ S] is a maximum weighted k-colorable subgraph if and only if V\ S is a minimum weighted Kk+l- 1 cover of G (k > 2). According to Corollary 2, the maximum weighted k-colorable subgraph problem is equivalent to the weighted C&t J problem on weighted perfect graphs. Since chordal graphs are subclass of perfect graphs, we have that the weighted feedback vertex problem, the weighted Cs,t problem, the maximum weighted 2-colorable subgraph problem and the maximum weighted 2-independent set problem are equivalent on chordal graphs. Therefore, our result for the weighted feedback vertex problem on interval graphs also implies a linear-time algorithm for these problems. It is worth mentioning that the greedy method proposed by Marathe et al. [ 131 for the C3,t problem on interval graphs can not be applied to weighted interval graphs.

2. The algorithm Let G = (YE) be a graph. According to the defmition, a subset S of V is an FVS of G if and only if V \ S is a CVS of G. Consequently, when G is weighted, S is a minimum weighted FVS (MWFVS) of G if and only if V\ S is a maximum weighted CVS (MWCVS) of G. Therefore, we will devote ourselves to finding an MWCVS of G in the rest of the paper, instead of an MWFVS of G. A graph G = (YE) is an intersection graph if there exists a one-to-one correspondence between V and a family F of sets such that two vertices in V are adjacent if and only if their corresponding sets in F intersect. If F is a family of intervals on a real line, then G is called an interval graph and F is called an interval representation of G. An interval representation, with end-points sorted, of an interval graph can be constructed in 0( n + m) time [ 111. Let I be an interval representation of a weighted interval graph G. Without loss of generality, assume that no two intervals share a common end-point. Then, we can label the end-points of all intervals from 1 to 2n. Denote the

C.L. Lu, C.E Tang/Information Processing Letters 61 (1997)

interval i by [a(i) , b(i) 1, where a(i) and b(i) represent the left and right end-points of the interval i, respectively. Note that 1 < a(i) < 2n and 1 < b(i) < 2n. We label the intervals of I from 1 to n according to their ascending right end-points. For the algorithm’s simplicity, we augment I to I+ by adding two isolated and positive weighted intervals 0 and n + 1 such that a(O) = -1, b(0) = 0, u(n + 1) = 2n + 1, and 6( n + 1) = 2n + 2. Clearly, if C is an MWCVS of G[ Z+] , then C includes intervals 0 and II + 1, and C\{O,n+l}isanMWCVSofG[Z]. For any pair of intervals i and j with 6(i) < 6(j), denote by I,,; the set {j} U {k 1 k E I+ and b(k) < b(i)}. Define A, = {S ( S is a CVS of G[ Zij]}, Bij = {S 1S is a CVS of G[ Zij ] and includes both intervals i and j}, and C, = {S 1 S is a CVS of G[Zij] and includes the interval j}. Let MAij, MBij and MCij denote arbitrary maximum weighted cycle-free vertex sets in Aij, Bij and Cij, respectively. For each interval i, let pred( i) be the largest interval in the set {k E I+ 1 b(k) < u(i)}, i.e., there does not exist any interval j with b(pred(i)) < b(j) < u(i). Define N(i) = {pred(i)} U {k E I+ 1 k < i and k overlaps with i}. Note that ]N( i) 1 6 deg(i) + 1, where deg(i) is the degree of the interval i. For any set X of sets of intervals, Max X denotes the maximum weighted set in X if X is not empty; otherwise, MaxX denotes a set of zero weight. Since I+ = Z,(,+t), MA,(,,+l) is an MWCVSofG[Z+].Therefore,MA,(,+t)\{O,n+l} is an MWCVS of G[Z]. Lemma 3. (1) For1
MAoi = (2)

{O,i}

ifw(i)

(01

otherwise.

For i,j E I+ with 6(i)

MAij =

MA(i-l)iU i MA(i-l)i

(3)

> 0,

< u(j), {j}

ifw(j)

> 0,

otherwise.

For i, j E I+ with u(j)

< 6(i) < 6(j),

MAij = Max{MAci-l)i,

MAci_l)j,

MBij}.

Proof. Statements ( 1) and (2) can be easily verified according to the definition.

107-111

109

(3)Leti,j~Z+andu(j) <6(i)
(3) (4)

<

u(j),

MBij

=

U {A.

For i, j E I+ MB, = MCkj For&j E I+ MBij = MCki

with u(j) < u(i) < b(i) < 6(j), U {i}, where k = pred( i). withu(i)
Proof. Statements ( 1) and (2) can be verified easily according to the definition. (3) Let i,j E I’ and u(j) < u(i) < 6(i) < b(j). Then, MBij does not contain any interval h with u(i) < b(h) < b(i); otherwise intervals h, i, and j create a cycle h-i-j-h. Let k = p&(i). MCkj U {i} a CVS of G[ Zij] including i and j since Zkj C Zij. Hence, W( MBij) 3 W( MCkj U {i}) . Suppose that W( MBij) > W( MCkj U {i}). Then MBij \ {i} is a CVS of G[ Zkj] including j with the weight larger than W( MCkj), a contradiction. Therefore, W( MBij) = W( MCkj U {i}), i.e., MBij = MCkj U {i}. (4) Let i,j E Z+ and u(i) < u(j) < 6(i) < b(j). Then, MBij does not contain any interval h with u(j) < b(h) < 6(i); otherwise, intervals h, i, and j create a cycle h-i-j-h. Let k = pred( j). MCki U {j} a CVS of G[ Zij] including i and j since Zki c Zij. Thus, W(MBij) > W(MCki U {j}).

C.L. Lu, C.E Tang/Information Processing Letters 61 (1997) 107-111

110

Algorithm MWCVS Input: An interval representation I of a weighted interval graph G with end-points sorted. Output: A maximum weighted cycle-free vertex set of G. Step 1: Augment I to I+ by adding two positive weighted intervals 0 and n+lsuchthata(O)=-l,b(O)=O,a(n+l)=2n+l,andb(n+l)=2n+2. Step 2: /f Find pred(n for each interval i, where 1 < i < n + 1. */ k=O. fori=l to2n+l do if i = a(j) then pred(j) = k. if i = b(j) then k = j. Step 3: P Initialization. */ for i = 1 to n + 1 do if w(i) > 0 then MAoi = (0, i} else MAoi = (0). MB& = MCoi = (0.i). Step 4: for j = 2 to n + 1 do for i = pred( j) to j - 1 do if i # 0 then I* Compute MZQ by Lemma 4 *I if b(i) < a(j) then MBij = MC(i_l)i U {j}. if a(j) < a(i) < b(i) < b(j) then k = pRd(i) and MEij = MCkj U {i}. if a(i) < a(j) < b(i) < b(j) then k = pred( j) and MBij = MCki U {j}. P Compute MAtj by Lemma 3 */ if b(i) < a(j) then if w(j) > 0 then MAij = MA(i_l)i U {j} else MAij = MA(i_l);. if a(j) < b(i)
\ {O,n + 1). Fig. 1.

Suppose that W( MBij) > W(MCki U {j}). Then MBii \ {j} is a CVS of G[lki] including i with the weight larger than W( MCki), a contradiction. Therefore, W( MBij) = W( MCki U {j}), i.e., MBij = MC&i U {j}. q Lemma 5.

(1) For1
E

I+

MCoi={O,i}. With b(i)

MA(i-l)i U {_i). (3) For i, j E I+ with a(j) MaX{MCci-l,j, MBij}.

<

< b(i)

u(j),

MCij =

< b(j),

MCij =

Proof. Statements ( 1) and (2) can be verified easily

according to the definition. (3) Let i,j E I+ and a(j) < b(i) < b(j). We discuss the following two cases.

Case 1: i $ MCijv Since Zij = I(i_l)i U {j}, MCij is a CVS of G[lci_l,j] including j. Therefore, W(MCij) < W(MCci_l,j). Suppose that W(MCij) < W(MC(i-l)j). Then MCci-l)j is a CVS of G[ Zij] not including i with the weight larger than W( MCij), a contradiction. Hence, W( MCij) = W( MCci_1 ,j) 3 i.e., MCij = MCci- 1)j. Case 2: i E MCij. Clearly, MCij = MBij. According to two cases above, MCij = MU{MCci_,)j, MBij}.

0

According to the lemmas above, the computation of M&,+I) can be carried out by a dynamic programming algorithm. Our algorithm scans all intervals from 1 to n + 1. For each interval j our algorithm scans, we only have to consider all intervals i’s

C.L. La, C.E Tang/Information Processing Letters 61 (1997) 107-111

of N(j) in the order of their ascending labels to calculate MBij, MAij and MCij according to Lemmas 4, 3 and 5, respectively. The detailed algorithm is shown in Fig. 1. Theorem 6. Algorithm MWCVS finds a maximum weighted cycle-free vertex set on interval graphs in O(n + m) time. Proof. The correctness of Algorithm MWCVS immediately follows from the lemmas in this section. The computation of all pred( i) ‘s in Step 2 takes O(n) time. For each pair of i and j in Step 4, MBij, MAij, and MCij can be calculated in constant time, and the number of iterations of computing them is (deg(j) -t 1)) = O(n + m). Therefore, o(C*.

0

Corollary 7. The weighted feedback vertex problem on interval graphs can be solved in O(n + m) time.

[3] MS. Chang, Y.H. Chen, C.J. Chang and J.H. Yan, Algorithmic aspects of the generalized clique-transversal problem on chordal graphs, Discrete Appl. Math. 66 (3) (1996)

189-203.

[4] M. Conforti, D.G. Comeil and A.R. Mahjoub, &-covers I: Complexity and polytopes, Discrete Math. 58 (1986) 121142. [ 51 D.G. Comeil and J. Fonlupt, The complexity of generalized clique covering, Discrete Appl. Math. 22 ( 1988789) 109118. [61 E Gavril, Algorithms for minimum coloring, maximum

clique, minimum covering by cliques, and maximum independent set of a chordal graph, SIAM J. Comput. 1 (1972) 180-187. [71 M.R. Gamy and D.S. Johnson, Computer and Intractability: A Guide to the Theory of NP-Completeness (Freeman, San Francisco, CA, 1979). [81 F. Gavril, Algorithms for maximum k-colorings and kcoverings of transitive graphs, Networks 17 ( 1987) 465-470. [91 M.C. Golumbic, Algorithmic Graph Theory and Perfect Graphs (Academic Press, New York, 1980). [lOI J.Y. Hsiao, C.Y. Tang and R.S. Chang, An efficient algorithm for finding a maximum weight 2-independent set on interval graphs, Inform. Process. Lett. 43 (1992) 229-235. [ill N. Korte and R.H. Mbhring, An incremental linear-time algorithm for recognizing interval graphs, SIAM J. Comput. 18 (1989)

Acknowledgements The authors would like to thank Professor M.S. Chang, Professor C.J. Chang and the anonymous referees for their help and constructive suggestions.

111

68-81.

[ITI Y.D. Liang, On the feedback vettex set problem in permutation graphs, Inform. Process. Lett. 52 (1994)

123-

129. [I31 M.V. Marathe, R. Ravi and CR Rangan, Generalized vertex covering in interval graphs, Discrete Appl. Math. 39 ( 1992) 87-93. [I41 M. Sarrafzadeh and D.T. Lee, A new approach to topological via minimization, IEEE Trans. Comput. Aided Design 8

(1989) 890-900.

References

[I51 M. Sarrafzadeh and R.D. Lou, Maximum k-covering of

[ 1] A. BrandsUidt, On improved time bounds for permutation graph problem, in: EW. Mayr, ed., Proc. 18th Workshop on Graph-Theoretic in Computer Science, Lecture Notes in Computer Science, Vol. 657 (Springer, Berlin, 1993) l-10. [2] A. Brandstadt and D. Kratsch, On domination problems for permutation and other graphs, Theoret. Comput. Sci. 54 (1987)

181-198.

weighted transitive graphs with applications, Algorithmica 9 (1993)

84-100.

[I61 M. Yannakakis, Node-deletion problem on bipartite graphs, SIAM .t. Compur. 10 (1981) 310-327. [I71 M. Yannakakis and E Gavril, The maximum k-colorable subgraph problem for chordal graphs, Inform. Process. Lett. 24 (1987) 133-137.