[go: up one dir, main page]

Academia.eduAcademia.edu
Algorithmica (1997) 17:416--425 Algorithmica 9 1997 Springer-VerlagNew York Inc. An O(n 3) Recognition Algorithm for Bithreshold Graphs S. De Agostino, 1 R. Petreschi, 1 and A. Sterbini 1 Abstract. A bithreshold graph is the edge intersection of two threshold graphs such that every independent set is independentin at least one of the threshold components.Recognizinga bithreshold graph is polynomially equivalent to recognizingits complement, i.e., a cobithresholdgraph. In this paper we introducea coloringof the vertices and of the edges of a cobithresholdgraph that leads to a recognitionand decompositionalgorithm. This algorithmworks in O(n 3) time improvingthe previouslyknown O(n 4) result [HM]. Key Words. Recognitionalgorithm, Bithreshold graph, Threshold cover. 1. Introduction. Threshold graphs are a class of graphs rich in properties that find applications to different fields such as synchronization of parallel processes [HZ], lOrd], [DP], aggregation of inequalities in integer programming [CH], bin packing [T], boolean functions [M], and opinion scaling [CL]. In trying toextend such a variety of characterizations and properties on general graphs and to broaden the field of applications, research moved to see if a given graph may be covered with a constant number of threshold graphs. Unfortunately, checking if it is possible to cover a graph with three or more threshold graphs is an NP-complete problem [Y]. Then research focused attention on classes of graphs that are covered by two threshold components lIP], [HM], [HMP2], [HMP1], [PS]. In this paper we consider bithreshold graphs, i.e., threshold dimension 2 graphs such that every independent set is independent in one of the two threshold components. Recognizing a bithreshold graph is polynomially equivalent to recognizing a cobithreshold graph, i.e., a complement of a bithreshold graph, a graph that can be covered by two threshold subgraphs such that every clique is a clique in at least one of them. In [HM] an O (//4) recognition algorithm for bithreshold graphs was presented, working on forbidden configurations. In this paper we give an O (n3)-time algorithm to recognize cobithreshold graphs (and consequently bithreshold graphs) by means of a "canonical coloring" of the vertices and the edges, based on a characterization given in [HMP2]. The relevant background material is collected in Section 2. In Sections 3 and 4 we show the "canonical" coloring technique and describe the algorithm based on this technique. 2. Preliminary Definitions. In this paper we follow the standard graph-theoretical terminology of [G]. We consider only finite, simple, loopless graphs G = (V, E) where l Department of Computer Science, University "La Sapienza," Via Salaria 113, 00198 Rome, Italy. {deagostino,petreschi,andrea}@dsi.uniroma1.it. Received January 12, 1995;revised October 12, 1995. Communicatedby A. C.-C. Yao. An O (n3) Recognition Algorithm for Bithreshold Graphs 417 Fig. 1. The forbidden configuration of a threshold graph ( shows a present edge, - - - shows an absent edge). V is the vertex set of G with cardinality n and E is the edge set of G with cardinality m. For any x e V, we denote by N ( x ) the neighborhood of x: N ( x ) = {v ~ V : x v E E}. For any graph G, the vicinalpreorder on V is defined as follows: x < y r N ( x ) - {y} ___ N ( y ) - {x}. Two vertices x and y belonging to V such that neither x < y nor y < x are called incomparable and are denoted by x # y . Two vertices x and y that are equal in the vicinal preorder, i.e., such that x < y m y < x, are called twins. The twin relation is an equivalence relation that partitions the vertices of V in classes named brotherhoods. The graph obtained as the quotient of the original graph with respect to the twin relation is called the supergraph. The vertices and the edges of the supergraph are named supervertices and superedges, respectively. Observe that a supervertex is a subgraph induced by a brotherhood of G and that it is either a clique or an independent set. A superedge is the complete set of edges that connects two brotherhoods. A graph G = (V, E) is threshold if there is an integer t and a nonnegative integer labeling Ix associated with each vertex x ~ V such that a subset S ___ V is independent if and only if the sum of the labels ls for all s e S is less than or equal to t. The following definitions are equivalent [CH], [HZI: 9 G is threshold. 9 The vicinal preorder of G is total. 9 G does not include the subgraph in Figure 1. Two O(n + m) algorithms to recognize threshold graphs are given in [HZ] and [Orl]. A graph G is defined to be split if there is a partition of its vertices V = K t_J I such that the subgraphs induced by K and I are a clique and an independent set, respectively. Threshold graphs are a proper subset of the class of split graphs. We call the set of vertices F in K connected to some vertex in I base. A box is the set of vertices with the same degree in a graph. FACT 1. Let x be any vertex o f a graph G. Let Bl . . . . . Bk be the boxes o f G - x in decreasing degree order. G is threshold if and only if x is connected to all the vertices o f boxes Bl . . . . . ni and to a subset o f the vertices o f box Bi+l, f o r some 1 < i < k - 1. A graph G is bithreshold if it is the edge-intersection of two threshold graphs Tt and T2 (i.e., a 2-threshold graph), with the additional condition that every independent set in the graph must be independent in at least one of its threshold components (Tl or 7"2). We call the complement of a bithreshold graph, i.e., the edge-union of two threshold graphs such that every clique belongs at least to one of the threshold component, cobithreshold. A clique that does not satisfy the above condition is called mixed. A property 79 is hereditary if all the induced subgraphs of a graph with property 79 have property 79. 418 FACT 2. erties. s. De Agostino, R. Petreschi, and A. Sterbini Thresholdness, bithresholdness, and cobithresholdness are hereditary prop- The pair of threshold components ofa cobithreshold graph are called the cobithreshold cover. Given such a cover (TI, T2), we associate red and black to the edges of T1 and/'2, respectively, and we call it a cobithreshold coloring. From Fact 2 we have: FACT 3. Given an induced subgraph X c_ G, a cobithreshold coloring o f G induces on X a coloring that is cobithreshold. FACT 4 [ HMP2]. If G is the union of two threshold graphs 7"1 and T2 such that all the cliques of G o f sizes3 and 4 are also cliques of Tt or T2, then G is cobithreshold. A clique (independent set) that cannot be made larger by removing at most one vertex and by adding at most two is called largest. FACT 5 [HMP2]. Removing a largest clique from a bithreshold graph generates a bipartite bithreshold graph, that is completely characterized as one of the five classes o f graphs BBI . . . . . BB5 shown in Figure 2 or their induced subgraphs, plus isolated vertices. The circled vertices denote supervertices that may have cardinality greater than 1, while the other vertices have cardinality 1. The vertices of a cobithreshold graph G can be partitioned into three classes: a largest independent set I, a complete set K, and the subgraph H, induced by G - K - / , that is the complement of a bipartite bithreshold graph [HMP2]. H and K are completely connected, while the connections between I and H + K still have not been characterized. In the next section we give a "canonical coloring" of the vertices and the edges based on this characterization that will lead us to the O(n 3) recognition algorithm. We denote by /-} the supergraph obtained from the graph H. The supergraph H is one of the graphs in Figure 3. They are obtained from the classes in Figure 2 and from 1413.2 141], 14B:~ 14135 B14~ Fig. 2. The five subclasses of bipartite bithreshold graphs. 419 An O (n3) Recognition Algorithm for Bithreshold Graphs A a H ca. C D Ca E C F a &l d de / N d~Df d f d- -f F i g . ;3. T h e / t - - graphs. their induced subgraphs by replacing every supervertex with a simple vertex and by complementing the result. Since removing a vertex in a supervertex simply lowers its cardinality, the only interesting case is when we delete the whole supervertex from the graph. Notice that two other supervertices might become twins from this deletion. Then, in Figure 3, A corresponds to the class BB1, B to the classes BB2, BB3, BB4, C either to the class BB5 or to an induced subgraph of class BB1 (BBI - b or BBI - e), D to an induced subgraph of the two classes BBI, BB5 (BBI - b - e and BB5 - b) and E, F to several induced subgraphs of the five classes. 3. The Canonical Coloring. We say that a subgraph has uniform color when all its edges are colored in the same way (red, black, red/black), i.e., when the subgraph belongs to the same threshold components. LEMMA 1. Every supervertex and every superedge in t?I must be completely contained in at least one o f the two threshold components o f H. PROOF. As stated before, a supervertex is a clique in H. Therefore, if a supervertex were not completely contained in a threshold component, a mixed clique would exist. Since a superedge together with its extremal supervertices is a clique in H, the same holds for superedges. [] We call an edge red, black or red~black if it belongs to Tl, T2, or both, respectively. We say that a threshold graph G = (V, E) dominates a threshold graph G' = (V, E') if, for any x ~ V such that G' U x is threshold, the graph G U x is threshold. LEMMA 2. Let G be a threshold graph with boxes BI . . . . . Bk. Let G' be a threshold graph obtained from G by adding or deleting edges in such a way that two consecutive boxes o f G are joined in G'. Then G' dominates G. PROOF. It follows from Fact 1. [] Given a cobithreshold graph G, we say that a cobithreshold cover (Ti, T2) of G dominates a cobithreshold cover (T(, T~) of G if, for any vertex x connected to G, the 420 S. De Agostino,R. Petreschi, and A. Sterbini BI B21 a, B31 B32 B33 (5 ! ( B22 x x /J x/ e| ' t xx / | Fig. 4. The cobithresholdcovers of class B ( o a red vertex, and 9 a black vertex). I x xx / it 'o' J x x ~' / ' x "~x ~' 9 ' ,. / x i \s | shows a black edge, - . . . . a red edge, [] a bicolored vertex, existence of a cobithreshold cover of G Ux inducing (/'1', T~) on G implies the existence of a cobithreshold cover inducing (T1, T2). Up to isomorphisms, the uniform cobithreshoM covers of the complements of BB2, BB3, BB4 corresponding to the covers B1, B21, B22, B31, B32, B33 in Figure 4, dominate all nonuniform covers. LEMMA 3. PROOE The superedges ab, bc, ac and de, ef, d f must be differently colored, otherwise forbidden configurations would be introduced. Similarly, this holds for the supervertices a, b and d, e. In order not to introduce mixed cliques, the superedge cf must be bicolored and the superedges af and dc must be colored black and red, respectively. Moreover, the supervertex f must be bicolored if af contains at least a single-colored edge, while it might be red when af is uniformly bicolored. The same holds for supervertex c with respect to dc. af and dc are the only superedges that might not be uniformly colored. Ifaf is not uniformly colored, the supervertex f comprises two boxes of the red threshold component T1. From Lemma 2, the red component TI', obtained by coloring a f uniformly, dominates T1. In fact, the two boxes of T1 in f become a single box of T(. Such a uniform coloring does not affect the black component. Then the resulting coloring is dominating. With similar reasoning for the superedge dc, the statement of the lemma follows. [] LEMMA 4. Up to isomorphisms, the only cobithreshold covers of the complement of BBI, BBs, and BB5 - {b} of Figure 2 are the uniform ones corresponding to the covers of A, C, and D in Figure 5. PROOE As in Lemma 3. [] Up to isomorphisms, the uniform cobithreshold covers of the complement of the induced subgraphs of BB1, BB5 corresponding to the covers Ell, El2, E13, Ez, F in Figure 6 dominate all nonuniform covers. LEMMA 5. PROOF. As in Lemma 3. [] An O (n3) RecognitionAlgorithmfor Bithreshold Graphs A C 421 D Fig. 5. The cobithresholdcovers of classes A, C, and D. THEOREM !. Let G be a cobithreshold graph. There exists a cobithreshold cover (TI, 1"2) such that the cover induced by (Tl, T2) on H has supervertices and superedges uniformly colored. PROOE [] It follows from Lemmas 3, 4, and 5. Let (/~l, 7~2) be the cobithreshold cover o f / ~ , with associated colors red and black, respectively. We define a coloring scheme for the vertices o f / 1 , under the assumption that the clique in a threshold graph has maximum size, and therefore the base is a proper subset of it. RULE I. A supervertex must be red (black) either if it belongs to the base o f Tl (T2) or if it is connected to all the vertices o f the base ofT1 (T2). RULE 2. l f a supervertex is red (black)from Rule 1 and no neighbor is the endpoint of a black (red) edge, then the vertex must be bicolored. Rule 1 corresponds to coloring with red (black) all the vertices of the base F1 (F2), all the remaining vertices in the clique KI (K2), plus the maximum degree vertices of the independent set Ii (/2). If a vertex is connected to both bases, it is bicolored. These rules reproduce the coloring defined by the previous theorem for classes A, Bt, B21, B31, C, D, Ell, E2, F. Notice that the edges incident to a red (black) vertex are red (black). In the following we are under the assumption t h a t / t belongs to one of the nine classes A, B i, B21, B31, C, D, El1, E2, F and is colored as in Rules 1 and 2. In the next theorem we show how to color the edges between vertices in K and supervertices in H. l','li E~2 Eta E2 Fig. 6. The cobithresholdcovers of class E. F 422 s. De Agostino,R. Petreschi. and A. Sterbini THEOREM 2. Let 121UK be a cobithreshold graph, where lgl and K are totally connected. Given a cobithreshold cover (7~1, T2) o f I21, the following coloring technique o f the edges xvi, vi E I?t, x E K, gives a "canonical coloring" of H U K that is cobithreshold and dominates all the other cobithreshold covers of H U K inducing (Tl, T2) on 171: 1. All the edges xvi, with vi E I?t have the same color of vi. 2. All the vertices and edges of K are bicolored. PROOF. Since K is totally connected to/~, the coloring is 2-threshold. Now we prove that no mixed cliques are introduced. First. the canonical coloring cannot introduce a mixed triangle because the only way is to add a black xvi edge to a black ui vertex and a red xvj edge to a red vj vertex. This is impossible since black vertices are not connected to red ones. Similarly, the canonical coloring cannot introduce mixed cliques of size four. Moreover, every other cobithreshold cover o f / ~ U K can be obtained from the canonical one by adding colors to some edges connecting K to/-). Notice that every red vertex in H is an isolated vertex in the black threshold component. Then, the addition of the black color to some red edge would split the biggest box of the black threshold component. From Lemma 2, the resulting black threshold component is dominated by the one produced by the canonical coloring. Therefore, the canonical coloring of H U K dominates all the others. [] In the next theorem we show how to color the edges between vertices in I and supervertices in/-) U K. THEOREM 3. Let 121 U K U x be a cobithreshold graph. The following coloring technique of the edges xvi, vi c I~I U K, gives a "canonical coloring" ofi21 U K U x that is cobithreshold: 1. lf vi is only red (black), then xvi must have the red color (black). 2. lf vi is bicolored, then xvi must be colored as the threshold component to which x is connected in the way explained in Fact I. PROOF. First we show that we do not introduce any mixed clique of four vertices with this coloring. In fact, such a clique would have two disjoint edges colored black and red, respectively. The coloring technique would introduce such a clique only if the two differently colored edges are disjoint, by connecting a vertex to a triangle with colored edges as in Figure 7. However, the triangle does not exist in classes A, Bl, B21, B31, C, D, Eli, E2, F and cannot be introduced in / t U K by the coloring of Theorem 2. The rest of the proof differs for cases 1 and 2 of the statement of the theorem. Case 1. Let vi be a red vertex. Since/-) U K Ux is cobithreshold, 1)i is in the independent set of the black component. Suppose we color the edge xvi only black. Then, to satisfy the thresholdness of the black component T2, x must be connected to all the vertices with greater degree in 7~, as explained in Fact 1. Observe that all the red vertices belong to the independent set of the black component, and, moreover, that they are neighbors of some vertex with degree greater than zero in the black component. Then the black edge An O (n3) Recognition Algorithm for Bithreshold Graphs 423 . . . . . . . . . = + -dh x , Fig. 7. Obtaining a mixed Ka by adding a node in l. x vi creates some mixed triangle x vi vj. Therefore, x i)i must have the red color. The same holds switching the two colors. Case 2. It follows from Fact 1 that the 2-thresholdness is guaranteed. It is easy to see that, when x is connected to both bases, mixed triangles are always avoided by bicoloring xvi. [] The following two theorems guarantee that the coloring is cobithreshold. THEOREM 4. The assumption that 171 belongs to classes A, Bt, B21, B31, C, D, E l l , E2, F does not cause any loss o f generality. PROOF. We restrict ourselves to proving the theorem in the case o f classes B22 and B21. The other cases (032, B33, El2, El3) follow in a similar way. B22 and B21 differ only in the color of vertex c. Therefore, every cobithreshold cover of B21 U x is a cobithreshold cover of 022 Ux. It follows that B21 and B22 are equivalent with respect to the dominance relation. By contrast, if we apply the canonical coloring to 022 U x, we might introduce mixed triangles including vertex c. This rules out Some canonical covers that are accepted in the case of B211.3x.On the other hand, all the canonical covers of B22 Ux are canonical covers of B21 U X. Therefore, the algorithm need not consider cover 022. [] Now we show that the coloring of the edges connecting a vertex x 6 I to the rest of the graph can be computed independently from the coloring of the edges connecting any other vertex y ~ I. THEOREM 5. Let G = I2I U K U x U y be a cobithreshold graph with x, y not adjacent. Then the canonical colorings o f 17t U K U x and 17t U K t3 y provide a cobithreshold coloring of G. PROOF. We assume that there exists a cobithreshold cover such that the canonical coloring is not cobithreshold. F r o m the fact that the canonical coloring ensures the absence of mixed triangles, it follows that the canonical coloring fails because of a forbidden configuration. Then suppose edge yb is only red as shown in Figure 8(a). Let/)i 1)j be a bicolored edge in H U K. I f x is connected to both ui, 1)j, then the edges xvi, xvj must share a color, otherwise we obtain a mixed triangle. If vivj has a single color, then edges xvi, xvj must share the same color of vivj. The same holds for y. It follows that edges ya and ab must have the same color of edge yb; therefore, they must be bicolored. According to the canonical coloring, the vertices a and b are bicolored 424 S. De Agostino, R. Petreschi, and A. Sterbini . b a h a b U I j/ Y 3" Y i x (a.) JJr J Y x (c) Fig. 8. The canonical coloring avoids the forbidden configuration. as in Figure 8(b). Moreover, when a node y is connected to two bicolored nodes, both edges are colored in the same way. Therefore, it is impossible that edge yb is only red (Figure 8(c)). [] 4. T h e A l g o r i t h m . We show below an O(n3)-time algorithm to recognize and decompose a cobithreshold graph that is based on the canonical coloring of the previous section. Input: A graph G = (V, E). Output: Ti and 7"2 if G is cobithreshold. Algorithm: a. Find a largest independent set I in G. b. Test if the graph (7 - i is bipartite bithreshold. If the test fails, G is not cobithreshold. c. Generate the supergraph/-). d. Construct one of the possible cobithreshold decompositions Tl (red graph) a n d / ' 2 (black graph) of H among A, BI, B21, B31, C, D, E l l , E2, F. If everyone has been used already, G is not cobithreshold. e. Add to/-) the clique K with its canonical coloring. f. For each vertex x in 1, determine the canonical coloring of the superedges incident in x. g. Verify the thresholdness of the two resulting graphs 7"1, T2. If the test succeeds, graph G is cobithreshoid, otherwise go to step d to construct one of the other possible decompositions. The upper bound of the complexity of the algorithm is due to step a that requires O (n 3) time. The correctness follows from Section 3. References [CH] V. Chv~italand P. L. Hammer. Aggregationof inequalities in integer programming.Ann. Discrete Math., 1:145-162. 1977. [CLI M.B. Cozzens and R. Leibowitz. Threshold dimension of graphs. SIAM J. Algebraic Discrete Methods. 4:579-595, 1984. An O(n 3) Recognition Algorithm for Bithreshold Graphs [DP] [G] IHM] [HMPII [HMP2] [HZ] [IP] [MI [Ordl [Orll [PS] ITI [Y] View publication stats 425 S. De Agostino and R. Petreschi. On PVchunk operations and matrogenic graphs. Internat. J. Found. Comput. Sci., 3(1):11-20, 1992. M. C. Golumbic. Algorithmic Graph Theol. and Perfect Graphs. Academic Press, New York, 1980. P. L. Hammer and N. V. R. Mahadev. Bithreshold graphs. SlAM J. Algebraic Discrete Methods, 6(3):497-506, 1985. P. L. Hammer, N. V. R. Mahadev, and U. N. Peled. Some properties of 2-threshold graphs. Networks, 19:17-23, 1989. P. L. Hammer, N. V. R. Mahadev, and U. N. Peled. Bipartite bithreshold graphs. Discrete Appl. Math., 119:79-96, 1993. P. B. Henderson and Y. Zalkstein. A graph-theoretic characterization of the PVchunk class of synchronising primitives. SIAM J. Comput., 6(1):88-108, 1977. T. Ibaraki and U. N. Peled. Sufficient conditions for graphs to have threshold number 2. In P. Hansen, editor, Studies on Graphs and Discrete Programming, pages 241-268. North-Holland, Amsterdam, 1981. S. Muroga. Threshold Logic and Its Applications. Wiley-Interscience, New York, 1971. E. T. Ordman. Minimal threshold separators and memory requirements for synchronization. SIAM J. Comput., 18(1):152-165, 1989. J. Orlin. The minimal integral separator of a threshold graph. Ann. Discrete Math., 1:415--419, 1977. R. Petreschi and A. Sterbini. Recognizing strict 2-threshold graphs in O(m) time. Inform. Process. Lett., (54): 193-198, 1995. G. Tinhofer. Bin-packing and matchings in threshold graphs. To appear in Discrete Appl. Math. M. Yannakakis. The complexity of the partial order dimension problem. SlAM J. Algebraic Discrete Methods, 3(3):351-358, 1982.