S IMPLE MAX - CUT for unit interval graphs and graphs with few P 4s Hans L. Bodlaender a,1 Ton Kloks b Rolf Niedermeier c a Department b Department
of Computer Science, Utrecht University, Padualaan 14, 3584 CH Utrecht, The Netherlands,
[email protected]. of Mathematics and Computer Science, Vrije Universiteit Amsterdam, 1081 HV Amsterdam, The Netherlands,
[email protected].
c Wilhelm-Schickard-Institut
f¨ur Informatik, Universit¨at T¨ubingen, Sand 13, 72076 T¨ubingen, Fed. Rep. of Germany,
[email protected].
Abstract The SIMPLE MAX - CUT problem can be solved in linear time for unit interval graphs. We show also that for each constant q, the SIMPLE MAX - CUT problem can be solved in polynomial time for (q, q − 4)-graphs.
1 Introduction
The MAXIMUM CUT problem (or the MAXIMUM BIPARTITE SUBGRAPH problem) asks for a bipartition of the graph (with edge weights) with a total weight as large as possible. In this paper we consider only the simple case, i.e., all edges in the graph have weight one. Then the objective of this SIMPLE MAX - CUT problem is to delete a minimum number of edges such that the resulting graph is bipartite. We only consider the unweighted case since the graphs we consider in this paper have arbitrary clique numbers and this implies that the WEIGHTED MAXIMUM CUT problem remains NP-complete. For an excellent recent survey we refer to [21]. The problem is NP-complete [18,21]. The NP-completeness of the SIMPLE MAX - CUT problem was shown in [8]. Yannakakis showed that this remains even true for graphs with maximum degree three [23]. 1
The research of this author was partially supported by ESPRIT Long Term Research Project 20244 (project ALCOM IT: Algorithms and Complexity in Information Technology).
Preprint submitted to Elsevier Preprint
29 April 1999
There are also numerous results for special graph classes. (Have a look at the classics [11,7] for general information on numerous graph classes.) For example it was shown that the SIMPLE MAX - CUT problem remains NP-complete for cobipartite graphs, splitgraphs and graphs with chromatic number three [5]. On the positive side the problem can be solved for cographs [5], linegraphs [1], planar graphs [20,12] and for graphs with bounded treewidth [22]. In this paper we consider two classes of graphs. We first consider the class of unit interval graphs. We show that there is a straightforward linear time algorithm to solve the simple max-cut problem for unit interval graphs. We are also interested in the class of (q, q − 4)-graphs (introduced in [2]). These are graphs for which no set of at most q vertices induces more than q − 4 distinct P4 ’s. (A P4 is a path with four vertices.) In this terminology, the cographs are exactly the (4, 0)-graphs. The class of (5, 1)-graphs are called P4 -sparse graphs. Recently it was shown that (q, q − 4)-graphs allow a nice decomposition similar to cographs [17]. This decomposition can be used to find fast solutions for many NP-complete problems (see, e.g., [3,19]). In this note we show that the SIMPLE MAX - CUT problem can be solved efficiently for (q, q − 4)-graphs for every constant q.
2 Preliminaries Let G = (V, E) be a graph with vertex set V and edge set E. We usually let n denote the number of vertices of G. For a subset S of vertices we write δ(S) for the set of edges with exactly one endpoint in S (and the other endpoint in V − S). Definition 1 Define mc(G) = maxS⊂V |δ(S)|. The the following:
SIMPLE MAX - CUT
problem is
Instance: A graph G = (V, E) Task: Determine the value of mc(G). Instead of calculating mc(G) directly it is sometimes more convenient to calcultate first for i = 1, . . . , n the values mc(G, i) = maxS⊂V,|S|=i |δ(S)|.
2.1 Some preliminaries on unit interval graphs
Definition 2 An interval graph is a graph for which one can associate with each vertex an interval on the real line such that two vertices are adjacent if and only if their corresponding intervals have a nonempty intersection. If all intervals can be taken of the same length then the graph is called a unit interval graph. 2
The class of unit interval graphs coincides with that of the proper interval graphs (for a recent proof see, e.g., [6]). They can be characterized as those interval graphs without an induced claw, (i.e., a K1,3 ). The following characterization of interval graphs appeared in [10]. Theorem 3 A graph G is an interval graph if and only if the maximal cliques of G can be linearly ordered such that for each vertex x the maximal cliques containing x occur consecutively. We use the notation (C1 , C2 , . . . , Ct ) for a consecutive clique arrangement of an interval graph. Membership of the class of (unit) interval graphs can be tested in linear time. 2.2 Some preliminaries on (q, q − 4)-graphs Definition 4 A graph is a (q, t)-graph if no set of at most q vertices induces more than t distinct P4 ’s. The class of cographs are exactly the (4, 0)-graphs, i.e., cographs are graphs without induced P4 . The class of so-called P4 -sparse graphs coincides with the (5, 1)graphs. The class of P4 -sparse graphs was extensively studied in [14–16,9]. It was shown in [3] that many problems can be solved efficiently for (q, q − 4)graphs for each constant q. These results make use of a decomposition theorem which we state below. In this paper we show that this decomposition can also be used to solve the SIMPLE MAX - CUT problem. In order to state the decomposition for (q, q − 4)-graphs we need some preliminaries. Recall that a splitgraph is a graph of which the vertex set can be split into two sets K and S such that K induces a clique and S induces an independent set in G. Definition 5 A spider is a splitgraph consisting of a clique and an independent set of equal size (at least two) such that each vertex of the independent set has precisely one neighbor in the clique and each vertex of the clique has precisely one neighbor in the independent set, or it is the complement of such a graph. We call a spider thin if every vertex of the independent set has precisely one neighbor in the clique. A spider is thick if every vertex of the independent set is nonadjacent to precisely one vertex of the clique. The smallest spider is a path with four vertices (i.e., a P4 ) and this spider is at the same time both thick and thin. The SIMPLE
MAX - CUT
problem is easy to solve for spiders: 2
Lemma 6 Let G be a thin spider with 2n vertices. Then mc(G) = n4 + n. If G 3
is a thick spider mc(G) = n(n − 1). Definition 7 A graph G is p-connected if for every partition into two non-empty sets there is a crossing P4 , that is a P4 with vertices in both ends of the partition. A p-connected graph is separable if there is a partititon (V1 , V2 ) such that every crossing P4 has its midpoints in V1 and its endpoints in V2 . Recall that a module is a non-trivial (i.e., not ∅ or V ) set of vertices which have equivalent neighborhoods outside the set. The characteristic of a graph is obtained by shrinking the non-trivial modules to single vertices. It can be shown (see [2]) that a p-connected graph is separable if and only if its characteristic is a splitgraph. Our main algorithmic tool is the following structural theorem (proved in [17]). Theorem 8 For an arbitrary graph G exactly one of the following holds: • G or G is disconnected • There is a unique proper separable p-connected component H of G with separation (V1 , V2 ) such that every vertex outside H is adjacent to all vertices of V1 and to none of V2 . • G is p-connected. The following characterization of p-connected graphs for (q, q − 4)-graphs was obtained in [2]. Theorem 9 Let G = (V, E) be a (q, q−4)-graph which is p-connected. Then either |V | < q or G is a spider. According to Theorem 8 and Theorem 9 there exists a decomposition tree for (q, q− 4)-graphs. This decomposition tree can be found in linear time [4]. Leaves of this tree correspond with spiders or graphs with less than q vertices. Internal nodes of this tree have one of three possible labels. If the label is 0 or 1 then the graph corresponding with this node is the sum or union of the graphs corresponding with the children of the node. If the label of the node is 2, one of the graphs, say G1 , is either a spider or a graph with less than q vertices of which the characteristic is a splitgraph. If G1 is a spider, all vertices of G2 are made adjacent exactly to all vertices of the clique of G1 . If G1 is a graph of which the characteristic is a splitgraph, all vertices of G2 are made adjacent exactly to all vertices of every clique module of G1 .
3 The SIMPLE
MAX - CUT
for unit interval graphs
In this section we show that the SIMPLE time for unit interval graphs.
MAX - CUT
4
problem can be solved in linear
Consider a unit interval graph G = (V, E) with a unit interval model. (An intersection model for G can be found in linear time.) Sort the vertices of the graph according to the increasing right endpoints of their intervals. Let x1 , . . . , xn be the vertices of G according to this ordering. Define S = {x2i | i = 1, . . . , n2 }. Lemma 10 mc(G) = |δ(S)|. PROOF. Let t be the number of maximal cliques of G and let (C1 , . . . , Ct ) be a consecutive clique arrangement of G. We proof the claim by induction on t. Assume t = 1 (i.e., G is a clique). In that case S contains half of the vertices and 2 mc(G) = |δ(S)| = n4 . Assume t > 1 and assume that the claim holds for all unit interval graphs with less than t maximal cliques. We write G for the subgraph of G induced by C1 , . . . , Ct−1 . Let D = Ct ∩ Ct−1 and d = |D| and c = |Ct |. Notice that, since G is a unit interval graph, the set S contains half of the vertices of D. Consider an optimal bipartition (S ∗ , V − S ∗ ) of G. Let a = |S ∗ ∩ D| and p = |S ∗ ∩ (Ct \ D)|. Using this notation we can write |δ(S ∗)| = |δ + a(c − d − 2p) + p(c − p). Here δ is the the number of edges of G in |δ(S )| with S = S ∩ V \ (Ct \ Ct−1 ). By induction |δ(S ∗ )| ≤ mc(G ) + a(c − d − 2p) + p(c − p) c2 c2 − d2 ≤ mc(G ) + ≤ mc(G ) + a2 − ad + 4 4 Hence |δ(S ∗ )| ≤ |δ(S)| and this proves the lemma. Corollary 11 There exists a linear time algorithm to solve the SIMPLE problem for unit interval graphs.
4 The SIMPLE
MAX - CUT
MAX - CUT
for (q, q − 4)-graphs
In the following subsections we briefly describe the method to compute the simple max-cut for graphs with few P 4s. 4.1 Cographs We review the algorithm for the SIMPLE MAX - CUT problem for cographs which was published in [5]. A cograph which is not a simple vertex is either the sum or the union of two (smaller) cographs. 5
Lemma 12 Let G = (V, E) be the union of G1 = (V1 , E1 ) and G2 = (V2 , E2 ). Then mc(G, i) = max{mc(G1 , j) + mc(G2 , i − j) | 0 ≤ j ≤ i ∧ |V1 | ≥ j ∧ |V2 | ≥ i − j} Let G = (V, E) be the sum of G1 = (V1 , E1 ) and G2 = (V2 , E2 ). Then mc(G, i) = max{mc(G1 , j) + mc(G2 , i − j) + j(|V2 | − (i − j)) + (|V1 | − j)(i − j) | 0 ≤ j ≤ i ∧ |V1 | ≥ j ∧ |V2 | ≥ i − j} Corollary 13 There exists an O(n2 ) algorithm to compute the simple max-cut of a cograph. 4.2 P4 -sparse graphs We consider the case where G is obtained from the graph G2 and G1 where G1 is a spider. Let K be the clique and S be the independent set of G1 . Let ni indicate the number of vertices of Gi . According to the structure theorem every vertex of G2 is adjacent to every vertex of the clique of G1 . Lemma 14 Let G1 is a thick spider. Then mc(G, i) = max{mc(G2 , j) + j(|K| − j ) + j (n2 − j) + (i − j − j )(|K| − 1) | 0 ≤ j, j ≤ i} Let G1 be a thin spider. Then mc(G, i) = max{mc(G2 , j) + j(|K| − j ) + j (n2 − j) + (i − j − j ) | 0 ≤ j, j ≤ i} A (5, 1)-graph is also called P4 -sparse. For the construction of P4 -sparse graphs it is sufficient to consider the construction using spiders only [15]. Corollary 15 There exists an O(n2 ) algorithm to compute the simple max-cut for a P4 -sparse graph. 4.3 |V1 | < q and the characteristic of G1 is a splitgraph Finally we consider the case where G1 is a graph with less than q vertices. In this case the vertex set of G2 acts as a module, i.e., every vertex of G2 has exactly the same set of neighbors in G1 . Let K be the set of vertices of G1 which are adjacent to all vertices of G2 . 6
Definition 16 Let mc(G1 , j, j ) be the maximum cut in G1 with exactly j vertices in K and j vertices in V1 − K. Since G1 is constant size the numbers mc(G1 , j, j ) can easily be computed in constant time. Lemma 17 mc(G, i) = max{mc(G2 , j) + mc(G1 , j , i − j − j ) + j(|K| − j ) + j (n2 − j) + (i − j − j ) | 0 ≤ j, j ≤ i} Theorem 18 There exists a polynomial time algorithm for the problem on (q, q − 4)-graphs for each constant q.
SIMPLE MAX - CUT
5 Conjecture
We conjecture that the SIMPLE time for interval graphs.
MAX - CUT
problem can be solved in polynomial
References [1] Arbib, C., A polynomial characterization of some graph partitioning problem, Information Processing Letters 26, (1987/88), pp. 223–230. [2] Babel, L., On the P4 -structure of graphs, Habilitationsschrift, Zentrum f¨ur Mathematik, Technische Universit¨at M¨unchen, 1997. [3] Babel, L., T. Kloks, J. Kratochv´ıl, D. Kratsch, H. M¨uller, and S. Olariu, Efficient algorithms for graphs with few P4 s. Manuscript 1999. [4] Baumann, S., A linear algorithm for the homogeneous decomposition of graphs, Report No. M-9615, Zentrum f¨ur Mathematik, Technische Universit¨at M¨unchen, 1996. [5] Bodlaender, H. and K. Jansen, On the complexity of the Maximum Cut problem, Proc. STACS94, Springer-Verlag, Lecture Notes in Computer Science 775, (1994), pp. 769– 780. [6] Bogart, K. P. and D. B. West, A short proof that ‘proper = unit’, Discrete Mathematics 201, (1999), pp. 21–23. [7] Brandst¨adt, A., Special graph classes – A survey, Schriftenreihe des Fachbereichs Mathematik, SM-DU-199 (1991), Universit¨at Duisburg Gesamthochschule. [8] Garey, M. R., D. S. Johnson, and L. Stockmeyer, Some simplified NP-complete graph problems, Theoretical Computer Science 1, (1976), pp. 237–267.
7
[9] Giakoumakis, V., F. Roussel and H. Thuillier, On P4 -tidy graphs, Discrete Mathematics and Theoretical Computer Science 1, (1997), pp. 17–41. [10] Gilmore, P. C. and A. J. Hoffman, A characterization of comparability and interval graphs, Canad. J. Math. ]bf 16, (1964), pp. 539–548. [11] Golumbic, M. C, Algorithmic graph theory and perfect graphs, Academic Press, New York, 1980. [12] Hadlock, F. O., Finding a maximum cut of a planar graph in polynomial time, SIAM J. Comput. 4, (1975), pp. 221–225. [13] Jamison, B. and S. Olariu, On a tree representation for P4 -extendible graph, Discrete Appl. Math. 34, (1991), pp. 151–164. [14] Jamison, B. and S. Olariu, A tree representation for P4 -sparse graphs, Discrete Appl. Math. 35, (1992), pp. 115–129. [15] Jamison, B. and S. Olariu, Recognizing P4 -sparse graphs in linear time, SIAM J. Comput. 21, (1992), pp. 381–406. [16] Jamison, B. and S. Olariu, Linear time optimization algorithms for P4 -sparse graphs, Discrete Appl. Math. 61, (1995), pp. 155–175. [17] Jamison, B. and S. Olariu, p-components and the homogeneous decomposition of graphs, SIAM J. Discrete Mathematics 8, (1995), pp. 448–463. [18] Karp, R. M., Reducibility among combinatorial problems, Complexity of computation (R. E. Miller and J. W. Thather eds.), (1972), pp. 85–103. [19] Kloks, T. and R. B. Tan, Bandwidth and topological bandwidth of graphs with few P4s, Technical report WS-511, November 1998, Department of Computer Science, Vrije Universiteit Amsterdam. [20] Orlova, G. I. and Y. G. Dorfman, Finding the maximal cut in a graph, Engrg. Cybernetics 10, (1972), pp. 502–504. [21] Poljak, S. and Z. Tuza, Maximum cuts and large bipartite subgraphs, DIMACS Series in Discrete Mathematics and Theoretical Computer Science (W. Cook, L. Lov´asz, and P. Seymour eds.), 20, (1995), pp. 181–244. [22] Wimer, T. V., Linear algorithms on k-terminal graphs, PhD Thesis, Department of Computer Science, Clemson University, South Carolina, 1987. [23] Yannakakis, M., Node-deletion NP-complete problems, Proc. 10th Ann. A.C.M. Symp. on Theory of Comp., (1978), pp. 253–264.
8