Theory Comput Syst (2018) 62:1409–1426 https://doi.org/10.1007/s00224-017-9825-2 1 2 Petr A. Golovach · Dieter Kratsch · 3 3 Daniel ¨ Paulusma · Anthony Stewart Published online: 21 November 2017 © The Author(s) 2017. This article is an open access publication Abstract Agraph H is a square root of a graph G , or equivalently, G is the square of H,if G can be obtained from H by adding an edge between any two vertices in H that are of distance 2. The SQUARE ROOT problem is that of deciding whether a given graph admits a square root. The problem of testing whether a graph admits a square root which belongs to some specified graph class H is called the H-SQUARE ROOT problem. By showing boundedness of treewidth we prove that SQUARE ROOT is polynomial-time solvable on some classes of graphs with small clique number and that H-SQUARE ROOT is polynomial-time solvable when H is the class of cactuses. Keywords Square root · Cactus · Treewidth · Clique number This article is part of the Topical Collection on Special Issue on Combinatorial Algorithms Daniel Paulusma daniel.paulusma@durham.ac.uk Petr A. Golovach petr.golovach@ii.uib.no Dieter Kratsch dieter.kratsch@univ-lorraine.fr Anthony Stewart a.g.stewart@durham.ac.uk Department of Informatics, University of Bergen, PB 7803, 5020 Bergen, Norway Laboratoire d’Informatique Theorique ´ et Appliquee, ´ Universite ´ de Lorraine, 57045 Metz Cedex 01, France Department of Computer Science, Durham University, Durham DH1 3LE, UK 1410 Theory Comput Syst (2018) 62:1409–1426 1 Introduction Squares and square roots are well-known concepts in graph theory that have been studied first from a structural perspective [27, 30] and later also from an algorithmic perspective (as we will discuss). The square G = H of a graph H = (V , E ) is H H the graph with vertex set V = V , such that any two distinct vertices u,v ∈ V are G H H adjacent in G if and only if u and v are of distance at most 2 in H.Agraph H is a square root of G if G = H . It is a straightforward exercise to check that there exist graphs with no square root, graphs with a unique square root as well as graphs with many square roots. In this paper we consider square roots from an algorithmic point of view. The cor- responding recognition problem, which asks whether a given graph admits a square root, is called the SQUARE ROOT problem. Our research is motivated by the result of Motwani and Sudan [26] who proved in 1994 that SQUARE ROOT is NP-complete. Afterwards, SQUARE ROOT was shown to be polynomial-time solvable for vari- ous graph classes, such as planar graphs [23], or more generally, any non-trivial minor-closed graph class [28]; block graphs [21]; line graphs [24]; trivially perfect graphs [25]; threshold graphs [25]; graphs of maximum degree 6 [4] and graphs of maximum average degree smaller than [14]. It was also shown that SQUARE ROOT is NP-complete for chordal graphs [18]. We refer to [4, 5, 14] for a number of parameterized complexity results on SQUARE ROOT. The computational hardness of SQUARE ROOT also led to a variant, which asks whether a given graph has a square root that belongs to some specified graph class H. We denote this problem by H-SQUARE ROOT.The H-SQUARE ROOT prob- lem is known to be polynomial-time solvable if H is the class of trees [23], proper interval graphs [18], bipartite graphs [17], block graphs [21], strongly chordal split graphs [22], graphs with girth at least g for any fixed g ≥ 6[11], ptolemaic graphs [19], 3-sun-free split graphs [19](see[20] for an extension of the latter result to other subclasses of split graphs). In contrast, NP-completeness of this problem has been shown if H is the class of split graphs [18], chordal graphs [18], graphs of girth at least 4 [11] or graphs of girth at least 5 [10]. It follows from a result of Harary, Karp and Tutte [16] that every square root H of a planar square has maximum degree at most 3 and only contains blocks that are of size 4 or isomorphic to an even cycle. It follows from this that such graphs H have bounded treewidth. By “blowing up” each bag of a tree decomposition by adding all neighbours of every vertex u to every bag that contains u, we get a tree decom- position of H . Hence, planar squares have bounded treewidth. As such we may use Courcelle’s Theorem [6] to obtain an alternative (but comparable) proof for the polynomial-time result of Lin and Skiena [23]for SQUARE ROOT restricted to planar graphs. We note that the polynomial-time algorithms for solving SQUARE ROOT for graphs of maximum degree at most 6 [4] and graphs of maximum average degree less than [14] are also based on showing that the graphs which permit square roots also have bounded treewidth. Nestoridis and Thilikos [28] proved their result for minor- closed graph classes by showing boundedness of carving width. It is also possible, by using the graph minor decomposition of Robertson and Seymour [29], to show that squares of graphs from minor-closed classes have in fact bounded treewidth. Theory Comput Syst (2018) 62:1409–1426 1411 Hence, it is a natural question to ask whether the technique of showing boundedness of treewidth can be used for recognizing some other squares as well. This is the main focus of our paper. 1.1 Our Results Our results are twofold. First, in Section 3 we focus on the H-SQUARE ROOT prob- lemfor aspecificclass H of graphs, namely we let H be the class of cactuses. A connected graph is a cactus if every edge of it is contained in at most one cycle. We give an O(n )-time algorithm for solving H-SQUARE ROOT on n-vertex graphs where H is the class of cactuses. Our research is motivated by the nontrivial question as to whether H-SQUARE ROOT is polynomial-time solvable if H is the class of pla- nar graphs, that is, whether squares of planar graphs can be recognized in polynomial time. The known result that squares of trees, which form a subclass of the class of cactuses, can be recognized in polynomial time [23] can be seen as a first step towards solving this problem. As every cactus is planar, our result can be seen as a second step towards solving it. As a side note, cactuses are not a subclass of any of the other aforementioned classes of which the squares can be recognized in polynomial time. If a graph has a square root that is a cactus, we say that G has a cactus root. We observe that a general technique applied in several papers [1, 10, 11, 23] is not applicable for finding cactus roots. In these papers the aim is to find some type of sparse square root and it can be shown that such a square root (if it exists) is unique or unique up to isomorphism. This uniqueness can be exploited and as such is very helpful for finding the square root. However, this is not the case for cactus roots; Fig. 1 shows a graph that has two non-isomorphic cactus roots. Instead, we prove our result by showing boundedness of treewidth. We first analyze, in Section 3.1, the structure of squares of cactuses. This helps us to recognize vertices of the input graph G that are cut-vertices in any cactus root (if such a square root exists) and sets of compulsory and forbidden edges of any cactus root of G . In this way we can reduce, in Section 3.2, the graph G to a number of smaller instances such that G has a cactus root if and only if each of these smaller instances has a cactus root. Showing that each of the smaller instances has bounded treewidth, the aforementioned observation that we can solve the prob- lem in polynomial time on any graph class of bounded treewidth completes the proof. In Section 4 we focus on the SQUARE ROOT problem restricted to some classes of graphs that have a small clique number. Our motivation for doing so comes from the observation that SQUARE ROOT is readily seen to be polynomial-time solvable for graphs with clique number at most 3 (the only square roots a connected graph on n vertices with clique number 3 may have are the cycle or path on n vertices). Moreover, by identifying such classes of graphs, our results complement existing polynomial-time results for other classes of graphs with a small clique number, such as planar graphs [23] and graphs of maximum degree 6 [4]. We prove that SQUARE ROOT is polynomial-time solvable for the classes of 3-degenerate graphs and (K , P )-free graphs by showing that squares in these two graph classes have r t bounded treewidth. 1412 Theory Comput Syst (2018) 62:1409–1426 Fig. 1 A graph with non-isomorphic square cactus roots. The edges of the cactus roots are shown by solid lines, whereas the other edges are shown by dashed lines In Section 5 we present two tables that incorporate both new and old results and there we also discuss some directions for future work. 2 Preliminaries We consider only finite undirected graphs without loops and multiple edges. We refer to the textbook of Diestel [8] for any undefined graph terminology. We denote the vertex set of a graph G by V and the edge set by E . The subgraph G G of G induced by a subset U ⊆ V is denoted by G[U ]. The graph G − U is the graph obtained from G after removing the vertices of U.If U ={u}, we also write G − u. Similarly, we denote the graph obtained from G after deleting a set of edges S (an edge e)by G − S (G − e respectively). Let G be a graph. A connected component of G is a maximal connected subgraph. The distance dist (u,v) between a pair of vertices u and v of G is the number of edges of a shortest path between them. The diameter diam(G) of G is the maximum distance between two vertices of G . The open neighbourhood of a vertex u ∈ V is defined as N (u) ={v | uv ∈ G G E }, and its closed neighbourhood is defined as N [u]= N (u) ∪{u}.Two (adja- G G G cent) vertices u,v are said to be true twins if N [u]= N [v].Avertex v is simplicial G G if N [v] is a clique, that is, if there is an edge between any two vertices of N [v]. G G The clique number of G is the size of a largest clique of G . Theory Comput Syst (2018) 62:1409–1426 1413 Let G be a graph. The degree of a vertex u ∈ V is defined as d (u) =|N (u)|. G G G The maximum degree of G is (G) = max{d (v) | v ∈ V }. A vertex of degree 1 is G G said to be a pendant vertex. If v is a pendant vertex, then we say that the unique edge incident to u is a pendant edge. For a non-negative integer d , the graph G is said to be d-degenerate if every subgraph H of G has a vertex of degree at most d . Let {H ,..., H } be a family of graphs. Then a graph G is called (H ,..., H )- 1 p 1 p free if G contains no induced subgraph isomorphic to a graph in {H ,..., H }.We 1 p denote the complete graph and path on r vertices by K and P , respectively. r r Avertex u is a cut vertex of a connected graph G with at least two vertices if G −u is disconnected. An inclusion-maximal induced subgraph of G that has no cut vertex is called a block. Recall that a connected graph G is a cactus if each edge of G is contained in at most one cycle. This implies the following well-known property. Observation 1 Each block of a cactus with at least two vertices is either a K (an edge) or a cycle. A tree decomposition of a graph G is a pair (T , X ) where T is a tree and X = {X | i ∈ V } is a collection of subsets (called bags)of V such that the following i T G three conditions hold: i) X = V , i G i ∈V ii) for each edge xy ∈ E , x , y ∈ X for some i ∈ V ,and G i T iii) for each x ∈ V the set {i | x ∈ X } induces a connected subtree of T . G i The width of a tree decomposition ({X | i ∈ V }, T ) is max {|X |− 1}.The i T i ∈V i treewidth tw(G) of a graph G is the minimum width over all tree decompositions of G . We will make use of the following result of Bodlaender. Lemma 1 ([3]) For any fixed constant k, it is possible to decide in linear time whether the treewidth of a graph is at most k. 3 Cactus Roots Recall that a graph H is called a cactus root of a graph G if H is a cactus and a square root of G.If H is the class of cactuses, we may denote the H-SQUARE ROOT as the following problem: CACTUS ROOT Input: agraph G . Question: is there a cactus H with H = G ? We also need to define the following more general variant introduced in [4]for general square roots: CACTUS ROOT WITH LABELS Input: agraph G and sets of edges R, B ⊆ E . Question: is there a cactus H with H = G , R ⊆ E and B ∩ E =∅? H H 1414 Theory Comput Syst (2018) 62:1409–1426 By choosing R = B =∅ we see that CACTUS ROOT is indeed a special case of CACTUS ROOT WITH LABELS. In Section 3.1 we analyze the structure of squares of cactuses. We use the infor- mation obtained in this way for the design of our algorithm, which we describe in Section 3.2. 3.1 A Number of Structural Observations and Lemmas In this section we state three observations and prove seven lemmas. We will use these results, which are all structural, for the design of our O(n ) time algorithm for CACTUS ROOT presented in Section 3.2. The first observation is known and easily follows from the definition of the treewidth. Observation 2 For a cactus G, tw(G) ≤ 2. The second observation gives an upper bound for the treewidth of the square of a graph; it follows from the well-known fact that we can transform every tree decom- position (T , X ) of a graph G into a tree decomposition of G by adding, to each bag X of T , all the neighbours of every vertex from X . i i Observation 3 For a graph G, tw(G ) ≤ (tw(G) + 1)((G) + 1) − 1. Let H be a square root of a graph G . We say that H is a minimal square root of G if H = G but any proper subgraph of H is not a square root of G . Note that the two cactus roots displayed in Fig. 1 are both minimal. Since any connected subgraph of a cactus is a cactus, we can make the following observation. Observation 4 If a graph G has a cactus root, then G has a minimal cactus root. A block of a graph G is called a leaf block if it contains at most one cut vertex of G . This leads to our first lemma. Lemma 2 If a cactus H is a minimal square root of a graph G, then H has no leaf block that is a triangle. Proof Suppose that a cactus H is a minimal square root of G such that a triangle with vertices x , y, z is a leaf block of H . As a leaf block contains at most one cut vertex of H by definition, we may assume that y and z are not cut vertices of H . Let H = H − yz. It is straightforward to verify that H = G , contradicting the minimality of H . Suppose that u and v are pendant vertices of a square root H of G and that u and v are adjacent to the same vertex of H −{u,v}. Then, in G , u and v are simplicial vertices and true twins. We use this observation in the proof of the following lemma. Theory Comput Syst (2018) 62:1409–1426 1415 Lemma 3 Let H be a minimal cactus root of a graph G. If G contains at least six simplicial vertices that are pairwise true twins, then at least one of these vertices is a pendant vertex of H . Proof Let H be a minimal cactus root of a graph G that contains a set X of six simplicial vertices that are pairwise true twins. The vertices of X cannot all belong to the same block of H , because such a block would be a cycle with at least six vertices (by Observation 1) and any two vertices of this block could not be true twins of G . Hence, there is a cut vertex u of H such that there exist two vertices x , y ∈ X that are in distinct connected components of H − u.Let H be a connected component of H − u that contains x.If x is not a pendant vertex of H then, by the minimality of H and Lemma 2, there exists a vertex z ∈ V that is adjacent to x and that is at distance 2 from u in H . Then, as every path from y to z in H contains u,wefindthat yz ∈ / E . This is a contradiction since x and y are true twins of G and xz ∈ E .We G G conclude that x is a pendant vertex of H . The following definition plays a crucial role in our paper. Definition 1 Let u be a cut vertex of a connected graph H . We say that (i) u is important if H − u has three vertices that belong to three distinct connected components of H − u and that are each at distance at least 2 from u in H ; (ii) u is essential if H − u has two vertices that belong to two distinct connected components of H − u and that are both at distance at least 2 from u in H . Definition 1(i) immediately implies the following lemma. Lemma 4 If u is an important cut vertex of a cactus root H of a graph G, then there are three vertices x , y, z ∈ N (u) such that x , y and z are at distance at least 3 from each other in G − u. Although we have no implication in the opposite direction, we can show the following (which explains why we need the second and weaker part of Definition 1). Lemma 5 Let G be a graph with a cactus root H . If u ∈ V has three neighbours x , y and z in G that are at distance at least 3 from each other in G − u, then u is an essential cut vertex of H . Moreover, at least two vertices of {x , y, z} belong to distinct connected components of H − u. Proof Assume that G has a cactus root H.Let u ∈ V be such that u has three neighbours x , y and z in G that are at distance at least 3 from each other in G − u. Notice that because x , y and z are at distance at least 3 from each other in G − u, these vertices are all at distance 2 from u in H . For contradiction, assume that u is not a cut vertex of H.Then u has at most two adjacent vertices in H,since H is a cactus (see Observation 1). Then at least two vertices of {x , y, z} are adjacent to the same vertex of H (which is one of the two 1416 Theory Comput Syst (2018) 62:1409–1426 neighbours of u) implying that these two vertices of {x , y, z} are adjacent in G and thus in G − u; a contradiction. Hence u is a cut vertex of H . Now suppose that x , y and z are all in the same connected component H of H −u. Since H is a cactus, we find, by Observation 1, that H contains at most two vertices that are adjacent to u in H . Again, we obtain that at least two vertices of {x , y, z} are adjacent to the same vertex of H ; a contradiction. Hence, at least two vertices of {x , y, z} belong to distinct connected components of H − u.Since x , y and z are at distance 2 from u in H , this implies that u is an essential cut vertex of H . We now show that we can recognize edges of a cactus root that are incident to an essential cut vertex. Lemma 6 Let u be an essential cut vertex of a cactus root H of a graph G. Then for every x ∈ N (u), it holds that ux ∈ / E if and only if there exists a vertex y ∈ N (u) G H G such that x and y are at distance at least 3 in G − u. Proof Let u be an essential cut vertex of a cactus root H of a graph G.Let x ∈ N (u). First suppose that ux ∈ E .Let y ∈ N (u).If uy ∈ E ,then xy ∈ E .If G H G H G uy ∈ / E , then there exist a vertex z ∈ V and edges uz, zy ∈ E ,as y ∈ N (u). H H H G As zy ∈ E ,wefindthat zy ∈ E .As ux , uz ∈ E , we also deduce that xz ∈ E . H G H G In both cases x and y are at distance at most 2 in G − u. Now suppose that ux ∈ / E . Then, as x ∈ N (u),wefindthat x is at distance 2 H G from u in H.Let H be the connected component of H − u containing x.Since u is an essential cut vertex of H , H − u has another connected component H containing avertex y at distance 2 from u in H . It remains to observe that y ∈ N (u) and x and y are at distance 3 in G − u. The next lemma is used to recognize vertices adjacent to an essential cut vertex that belong to the same block of a minimal cactus root. Lemma 7 Let H be a minimal cactus root of a graph G. For any u ∈ V ,two distinct vertices x , y ∈ N (u) are in the same block of H if and only if x and y are in the same connected component of G = G − E − u. G[N (u)] Proof Let x , y ∈ N (u). First suppose that x and y are in distinct blocks of H . Then x and y are readily seen to be in distinct connected components of G .Now suppose that x and y are in the same block C of H.If xy ∈ E then x and y are in the same connected component of G . Suppose xy ∈ / E .Then C is a cycle by Observation 1. If C is not a triangle, then C has a unique (x , y)-path in H (avoiding u) of length at least 2. This path is an (x , y)-path in G as well. Hence x and y are in the same connected component of G . Suppose that C is a triangle.Then xy ∈ E . As H is a minimal cactus root, x or y has at least one neighbour z = u in H due to Lemma 2. Assume without loss of generality that z is a neighbour of x . Then the edges xy, xz ∈ E imply that zy ∈ E . We establish that xzy is an (x , y)-path in H G G , that is, also in this case x and y are in the same connected component of G . Theory Comput Syst (2018) 62:1409–1426 1417 Finally we show how to determine which neighbours in G of an essential cut vertex u of a cactus root H are in the same connected component of H − u. Lemma 8 Let H be a minimal cactus root of a graph G. For any u ∈ V and x ∈ N (u), a vertex y ∈ N (u) is in the same connected component of H − uas x H G if and only if either uy ∈ E and y in the same block of H as x , or uy ∈ / E and H H there is a vertex z ∈ N (u), such that z is in the same block of H as x and yz ∈ E . H G Proof Let y ∈ N (u). First suppose y is in the same connected component of H − u as x.If uy ∈ E ,then y is in the same block of H as x . Suppose uy ∈ / E .As H H uy ∈ E , there is a vertex z ∈ N (u) such that zy ∈ E .Then z is in the same G H H block of H as x,as x and y are in the same connected component of H − u. To prove the reverse implication, if uy ∈ E and x , y are in the same block of H , then x and y are in the same connected component of H − u. Suppose that uy ∈ / E and there is a vertex z ∈ N (u) such that z is in the same block of H as x and yz ∈ E .If yz ∈ E ,then y and z are in the same connected component of H − u.If G H yz ∈ / E , then there is a v ∈ V such that yv, vz ∈ E .Since uy ∈ / E , we obtain H G H H = u. Therefore, y and z are in the same connected component of H − u. Because y and z are in the same connected component of H − u and x , y are in the same block of H , we obtain that x , y are in the same connected component of H − u. 3.2 The Algorithm In this section we use the structural results from the previous section to obtain a polynomial-time algorithm for CACTUS ROOT. The main idea is to reduce a given instance of CACTUS ROOT to a set of smaller instances of CACTUS ROOT WITH LABELS, each having bounded treewidth. We therefore need the following lemma which show, together with Lemma 1 and Observations 2 and 3, that we are done if we manage to achieve this goal. Lemma 9 CACTUS ROOT WITH LABELS can be solved in time f (t ) · n for n-vertex graphs of treewidth at most t . Proof It is not difficult to construct a dynamic programming algorithm for the prob- lem (for details see [4] in which such an algorithm is sketched for the general SQUARE ROOT problem). For simplicity we give a non-constructive proof based on Courcelle’s theorem [6]. By this theorem, it suffices to show that the existence of a cactus root can be expressed in monadic second-order logic. Let (G, R, B) be an instance of CACTUS ROOT WITH LABELS. We observe that the existence of a cactus H such that G = H , R ⊆ E and B∩E =∅ is equivalent H H to the existence of a subset X ⊆ E such that the following four properties hold: (i) R ⊆ X and B ∩ X =∅; (ii) for every uv ∈ E , uv ∈ X or there exists a vertex w such that uw, wv ∈ X ; (iii) for every two distinct edges uw, vw ∈ X , uv ∈ E ; G 1418 Theory Comput Syst (2018) 62:1409–1426 (iv) for every uv ∈ X and for every two (u,v)-paths P and P in G such that 1 2 E , E ⊆ X \{uv}, it holds that P = P . P P 1 2 1 2 Each of these properties can be expressed in monadic second-order logic. In particu- lar, with respect to property (iv), expressing that a subgraph P of G is a (u,v)-path in G can be done in monadic second-order logic in a standard way (see, for example, [7]). Hence the lemma follows. Now we are ready to prove the main result. Theorem 1 CACTUS ROOT can be solved in time O(n ) for n-vertex graphs. Proof We first give an overview of our algorithm. As we can consider each connected component separately, we may assume without loss of generality that the input graph G is connected. First, we use Lemma 3 to recognize sets of pendant vertices in a (potential) cactus root adjacent to the same vertex that have size at least 7. For each of these sets, we show that it is safe to delete some vertices without changing the answer for the considered instance. After performing this step, we obtain a graph G such that in any cactus root of G each vertex is adjacent to at most six pendants. Further, we use Lemmas 4 and 5 to construct a set U of essential cut vertices in a (potential) cactus root such that U contains all important cut vertices. Next, we apply Lemma 6 to recognize which edges incident to the vertices of U are in any cactus root and which edges are not included in any cactus root. We label them red and blue respectively and obtain an instance of CACTUS ROOT WITH LABELS.Now we can use Lemmas 7 and 8 to determine for each u ∈ U , the partition of the set of vertices of G − u into the sets of vertices of the connected components of H − u, where H is a cactus root of G . This allows us to split G via the vertices of U as showninFig. 2. Due to the presence of labelled edges incident to the vertices of U , we obtain an equivalent instance. Finally, we observe that the obtained graph has bounded treewidth using Observations 2 and 3, so we can use Lemmas 1 and 9 to solve the problem, as we pointed out already. Now we formally explain the details of our algorithm. Let G be a connected graph. First, we preprocess G using Lemma 3 to reduce the number of pendant vertices adjacent to the same vertex in a (potential) cactus root of G . To do so, we exhaustively apply the following rule. Fig. 2 Splitting of a graph; the vertices of U are black, the edges of a square root are shown by solid lines and the other edges are shown by dashed lines Theory Comput Syst (2018) 62:1409–1426 1419 Pendants Reduction If G has a set X of simplicial true twins of size at least 7, then delete an arbitrary u ∈ X from G . The following claim shows that this rule is safe. Claim A If G = G − u is obtained from G by the application of Pendant reduction, then G has a cactus root if and only if G has a cactus root. We prove Claim A as follows. Suppose that H is a minimal cactus root of G.By Lemma 3, H has a pendant vertex u ∈ X . It is easy to verify that H = H − u is a cactus root of G . Assume now that H is a minimal cactus root of G . By Lemma 3, H has a pendant vertex w ∈ X \{u}, since the vertices of X \{u} are simplicial true twins of G and |X \{u}| ≥ 6. Let v be the unique neighbour of w in H .We construct H from H by adding u and making it adjacent to v. It is readily seen that H is a cactus root of G . This completes the proof of Claim A. For simplicity, we call the graph obtained by exhaustive application of the pendants rule G again. The following property is important for us. Claim B Every cactus root of G has at most six pendant vertices adjacent to the same vertex. Now we construct an instance of CACTUS ROOT WITH LABELS together with a set U of cut vertices of a (potential) cactus root. Labelling Set U =∅, R =∅ and B =∅. For each u ∈ V such that there are three distinct vertices x , y, z ∈ N (u) that are at distance at least 3 from each other in G − u do the following: (i) set U = U ∪{u}, (ii) set B ={uv ∈ E |∃w ∈ N (u) s.t. dist (v, w) ≥ 3}, G G G−u (iii) set R ={uv | v ∈ N (u)}\ B , (iv) set R = R ∪ R and B = B ∪ B , (v) if R ∩ B =∅, then return a no-answer and stop. Lemmas 4–6 immediately imply the following claim. Claim C If G has a cactus root, then Labelling does not stop in Step (v), and if H is a minimal cactus root of G, then R ⊆ E and B ∩ E =∅. Moreover, every vertex H H u ∈ U is an essential cut vertex of any cactus root of G, and any important cut vertex u of any cactus root of G is contained in U . For each u ∈ U,let R(u) ={v ∈ N (u) | uv ∈ R} and B(u) = N (u) \ R(u) G G and construct a partition P(u) ={S , S ,..., S } of N (u) as follows. 1 2 k(u) G Partition For each u ∈ U , (i) put x , y ∈ R(u) in the same set of P(u) if and only if x and y are in the same connected component of G = G − E − u, G[R(u)] 1420 Theory Comput Syst (2018) 62:1409–1426 (ii) for each x ∈ R(u), put y ∈ B(y) in the same set with x if xy ∈ E , (iii) if at least one of the following holds, then return a no-answer and stop: P(u) is not a partition of N (u), there is a set of P(u) with at least three vertices of R(u), there is a vertex of B(u) that is not in a set of P(u) with a vertex of R(u), there are distinct S, S ∈ P(u) such that for some x ∈ S and y ∈ S , xy ∈ R, there are distinct S, S ∈ P(u) such that for some x ∈ S and y ∈ S , xy ∈ E but ux ∈ / R or uy ∈ / R, there are distinct S, S ∈ P(u) such that for some x ∈ S and y ∈ S , xy ∈ / E but ux ∈ R and uy ∈ R, the graph G − E − u has a path connecting vertices of distinct sets G[R(u)] of P(u). By Lemmas 7, 8 and Claim C, we have the following. Claim D If G has a cactus root, then Partition does not stop in Step (iii), and if H is a minimal cactus root of G, then (i) R ⊆ E and B ∩ E =∅, H H (ii) every important cut vertex u of H is in U , (iii) for any u ∈ U, x , y ∈ N (u) are in the same connected component of H − u if and only if x and y are in the same set of P(u). Now we split the instance (G, R, B) of CACTUS ROOT WITH LABELS into several instances of the problem. Splitting For each u ∈ U,let P(u) ={S ,..., S } and do the following: 1 k (i) delete u and introduce k new vertices u ,..., u , 1 k (ii) for each i ∈{1,..., k},make u adjacent to all vertices of S , i i (iii) for each i ∈{1,..., k} and v ∈ S ,if uv ∈ R, then replace uv by u v in R, i i and if uv ∈ B , then replace uv by u v in B , (iv) for each i, j ∈{1,..., k}, i = j , delete the edges xy with x ∈ S and y ∈ S , i j (v) for each i ∈{1,..., k} and v ∈ S , update P(v) by replacing v by v in the i i sets and deleting the vertices of N (u) \ S from the sets. G i Let G ,..., G be the connected components of the obtained graph. For i ∈ 1 r {1,..., r },let R = R ∩ E and B = B ∩ E . By Claims B and D, we establish i G i G i i the following crucial claim. Claim E The input graph G has a cactus root if and only if (G , R , B ) is a yes- i i i instance of CACTUS ROOT WITH LABELS for each i ∈{1,..., r }. Moreover, if (G , R , B ) is a yes-instance, then G has a cactus root H with R ⊆ E and i i i i i H B ∩ E =∅ such that every cut vertex of H belongs to at most eight blocks and to i H at most two blocks not being a K . 2 Theory Comput Syst (2018) 62:1409–1426 1421 By Claim E, if G has a cactus root, then (G ) ≤ 10 for i ∈{1,..., k}.ByObser- vations 2 and 3, we obtain that tw(G ) ≤ 32 in this case. We use Lemma 1 to check whether this holds for each i ∈{1,..., r }. If the algorithm reports that tw(G ) ≥ 33 for some i ∈{1,..., r }, then we return a no-answer and stop. Otherwise, we solve CACTUS ROOT WITH LABELS for each instance (G , R , B ) using Lemma 9 for i i i i ∈{1,..., r }. It remains to evaluate the running time of our algorithm. We can find all simplicial vertices and sort them into the equivalence classes with the true twin relation in time O(n ). This implies that the exhaustive application of the Pendant reduction rule can be done in time O(n ). For each vertex u ∈ V , we can compute the distances between the vertices of G − u in time O(n ). Hence, the Labelling step can be done in time O(n ). For each u ∈ U the sets R(u) and B(u) can be constructed in time O(n ). For each u ∈ U , we can construct G = G − E and find the connected G[R(u)] components of G in time O(n ). It follows, that the Partition step can be done in 3 3 time O(n ). The Splitting step takes O(n ) time. The algorithm in Lemma 1 runs in O(n) time. We conclude that the total running time is O(n ). 4 Squares of Low Clique Number We first consider the class of 3-degenerate graphs. We will show that 3-degenerate squares have bounded treewidth. In order to do this we need the following two known lemmas. Lemma 10 ([4]) The SQUARE ROOT problem can be solved in time O( f (t )n) for n-vertex graphs of treewidth at most t . Lemma 11 ([14]) Let H be a square root of a graph G. Let T be the bipartite graph with V = C ∪ B, where partition classes C and B are the set of cut vertices and blocks of H , respectively, such that u ∈ C and Q ∈ B are adjacent if and only if Q contains u. For u ∈ C,let X consist of u and all neighbours of u in H . For Q ∈ B, let X = V .Then (T , X ) is a tree decomposition of G. Q Q We call the tree decomposition (T , X ) of Lemma 11 the H -tree decomposition of G and are now ready to prove the following lemma. Lemma 12 If G is a 3-degenerate graph with a square root, then tw(G) ≤ 3. Proof Without loss of generality we assume that G is connected and has at least one edge. Let H be a square root of G.Let C be the set of cut vertices of H,and let B be the set of blocks of H . We construct the H -tree decomposition (T , X ) of G (cf. Lemma 11). We will show that (T , X ) has width at most 3. We start with two useful observations. If v ∈ V ,then N [v] is a clique in G . H H Because G is 3-degenerate, this means that (H ) ≤ 3. For the same reason H 1422 Theory Comput Syst (2018) 62:1409–1426 contains no cycles of length at least 5 as a subgraph, because a square of a cycle of length at least 5 has minimum degree 4. We claim that X has size at most 4 for every Q ∈ B. In order to see this, let Q beablockof H,and let u ∈ V . Suppose that Q has a vertex v at distance at least 3 from u. Because Q is 2-connected, Q has two internally vertex disjoint paths that join u and v and, therefore, Q (and thus H ) contains a cycle of length at least 6 which, as we saw, is not possible. We find that each vertex v ∈ V is at distance at most 2 from u. Hence, u is adjacent to all other vertices of Q in G.Bythe same reasoning any two vertices in Q are of distance at most 2 of each other. Hence, Q is a clique in G.As G is 3-degenerate, this means that Q is a clique in G of size at most 4. Consequently, X , has size at most 4. As (H ) ≤ 3, we find that X has Q u size at most 4 for every cut vertex u of H . Lemma 12, combined with Lemmas 1 and 10, leads to the following result. Theorem 2 SQUARE ROOT can be solved in O(n) time for 3-degenerate graphs on n vertices. Proof Let G be an 3-degenerate graph on n vertices. By Lemma 1 we can check in O(n) time whether tw(G) ≤ 3. If tw(G)> 3, then G has no square root by Lemma 12. If not we solve SQUARE ROOT in O(n) time by using Lemma 10. Remark We cannot claim any upper bound for the treewidth of 4-degenerate graphs with a square root. In order to see this, take a wall (see Fig. 3) and subdivide each edge three times, that is, replace each edge uv by a path uabcv where a, b, c are three new vertices. This gives us a graph H , such that H is 4-degenerate. In order to see the latter, note that every “b-type” vertex has degree 4 in H and that after removing all degree-4 vertices, we obtain a disjoint number of copies of K , each of which is 4-degenerate. A wall of height h has treewidth (h) (see, for example, [8]). As subdividing an edge and adding edges does not decrease the treewidth of a graph, this means that the graph H can have arbitrarily large treewidth. We now consider (K , P )-free graphs (that is, graphs with no induced path P r t t and no complete subgraph K ). We let K denote the complete bipartite graph in r s,s which both partition classes have s vertices. We need a result of Atminas, Lozin and Razgon. Fig. 3 Walls of height 2, 3, and 4, respectively Theory Comput Syst (2018) 62:1409–1426 1423 Lemma 13 ([2]) For any two integers s and t , there exists an integer b(s, t ) such that any graph of treewidth at least b(s, t ) contains the path P as an induced subgraph or the complete bipartite graph K as a (not necessarily induced) subgraph. s,s Lemma 13, together with Ramsey’s Theorem, enables us to prove the following lemma. Lemma 14 For every two integers r, t ≥ 1, the class of (K , P )-free graphs with a r t square root has bounded treewidth. Proof Let r, t ≥ 1. For contradiction, assume that the class of (K , P )-free graphs r t with a square root has unbounded treewidth. Then there exists a (K , P )-free graph r t G with a square root such that G has treewidth at least b(s, t ),where b(s, t ) is the constant in Lemma 13 for a sufficiently large integer s. Then, by Lemma 13, we find that G contains a subgraph F isomorphic to K . As we have chosen the fixed integer s,s s to be large enough, Ramsey’s Theorem implies, together with the K -freeness of G,that F is in fact an induced subgraph of G . This means that no two vertices in the same bipartition class of F may have a common neighbour in H . In particular, this implies that for each u ∈ V , H contains at most one edge of F incident to u (as otherwise u would be a common neighbour of two vertices of F in H ). Let A and B be the bipartition classes of F.Let u ∈ A.As s is sufficiently large, there exist at least r vertices v ,...,v in B that are not adjacent to u in H . Then there 1 r must exist r distinct vertices w ,...,w with edges uw and w v for i = 1,..., r 1 r i i i (to enforce the edges uv in G for i = 1,..., r ). As the vertices w ,...,w all have i 1 q common neighbour u in H , they form a clique of size r in G , a contradiction with the K -freeness of G . Using a similar reasoning as before, we find that Lemma 14, combined with Lemmas 1 and 10, leads to the following result. Theorem 3 For every two integers r, t ≥ 1, SQUARE ROOT can be solved in time O(n) for (K , P )-free graphs on n vertices. r t 5 Conclusions We proved that the problem of testing whether a graph has a cactus root is O(n )-time solvable. In fact, our algorithm can be modified to find a cactus root in the same time (if it exists). Every cactus is outerplanar, and recently Golovach et al. [12] proved that squares of outerplanar graphs can be recognized in polynomial time. Determining the complexity of H-SQUARE ROOT when H is the class of planar graphs is still a wide open problem. Golovach et al. [12] also proved that squares of graphs of pathwidth at most 2 can be recognized in polynomial time. We recall that every cactus has treewidth at most 2. This leads to the open problem of determining the complexity of H-SQUARE ROOT when H is the class of graphs of treewidth at most 2. We also 1424 Theory Comput Syst (2018) 62:1409–1426 Table 1 A survey of the known results for H-SQUARE ROOT (the result marked with a ∗ isproveninthis paper) Graph class H complexity Trees [23] polynomial Proper interval graphs [18] polynomial Bipartite graphs [17] polynomial Block graphs [21] polynomial Strongly chordal split graphs [22] polynomial Ptolemaic graphs [19] polynomial 3-sun-free split graphs [19] polynomial Cactus graphs polynomial Cactus block graphs [9] polynomial Graphs of pathwidth at most 2 [12] polynomial Outerplanar graphs [12] polynomial Graphs with girth at least g for any fixed g ≥ 6[11] polynomial Graphs of girth at least 5 [10] NP-complete Graphs of girth at least 4 [11] NP-complete Split graphs [18] NP-complete Chordal graphs [18] NP-complete The result for 3-sun-free split graphs has been extended to a number of other subclasses of split graphs in [20] recall that a cactus is a connected graph, in which each block is either a cycle or an edge. This leads to the following (known) generalization: a cactus block graph is a connected graph, in which each block is a cycle or a complete graph. Recently, Table 2 A survey of the known results for SQUARE ROOT restricted to some special graph class G Graph class G complexity Planar graphs [23] linear Non-trivial and minor-closed [28] linear K -free graphs linear (K , P )-free graphs linear r t 3-degenerate graphs linear Graphs of maximum degree ≤ 5[4] linear Graphs of maximum degree ≤ 6[4] polynomial Graphs of maximum average degree < [14] polynomial Line graphs [24] polynomial Trivially perfect graphs [25] polynomial Threshold graphs [25] polynomial Chordal graphs [18] NP-complete Note that the row for planar graphs is absorbed by the row directly below it. Results marked with a ∗ are results shown in this paper Theory Comput Syst (2018) 62:1409–1426 1425 Ducoffe [9] gave a polynomial-time algorithm for the problem of recognizing squares of cactus block graphs. In Table 1 we summarize all known results on H-SQUARE ROOT. We observed that SQUARE ROOT is polynomial-time solvable for graphs with clique number 3 (or equivalently, K -free graphs) and proved the same result for 3- degenerate graphs and (K , P )-free graphs for every r, t ≥ 1. We summarize the r t known results for SQUARE ROOT in Table 2. As can be seen from this table, the com- putational complexity of SQUARE ROOT is unknown for several well-known graph classes. In particular, we recall the open problems of Milanic ˇ and Schaudt [25], who asked about the complexity of SQUARE ROOT restricted to split graphs and cographs. We also do not know the computational complexity of SQUARE ROOT for K -free graphs for r ≥ 5 and for graphs of maximum degree at most s for s ≥ 7. Acknowledgments This research was supported by EPSRC (EP/G043434/1), the Research Council of Norway (the project CLASSIS) and ANR project AGAPE. Extended abstracts containing results of this paper appeared in the proceedings of CTW 2016 [15] and IWOCA 2016 [13]. Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, dis- tribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. References 1. Adamaszek, A., Adamaszek, M.: Uniqueness of graph square roots of girth six. Electron. J. Comb. 18, #P139 (2011) 2. Atminas, A., Lozin, V.V., Razgon, I.: Linear time algorithm for computing a small biclique in graphs without long induced paths. Proc. SWAT LNCS 7357(2012), 142–152 (2012) 3. Bodlaender, H.L.: A linear-time algorithm for finding tree-decompositions of small treewidth. SIAM J. Comput. 25, 305–1317 (1996) 4. Cochefert, M., Couturier, J., Golovach, P.A., Kratsch, D., Paulusma, D., Stewart, A.: Computing square roots of graphs with low maximum degree. Discret. Appl. Math., to appear 5. Cochefert, M., Couturier, J., Golovach, P.A., Kratsch, D., Paulusma, D.: Parameterized algorithms for finding square roots. Algorithmica 74, 602–629 (2016) 6. Courcelle, B.: The monadic second-order logic of graphs III: Tree-decompositions, minor and complexity issues. Informatique The,orique ´ et Applications 26, 257–286 (1992) 7. Cygan, M., Fomin, F.V., Kowalik, L., Lokshtanov, D., Marx, D., Pilipczuk, M., Pilipczuk, M., Saurabh, S.: Parameterized Algorithms. Springer (2015) 8. Diestel, R.: Graph Theory, 4th edn. Graduate Texts in Mathematics, pp. 173. Springer (2012) 9. Ducoffe, G.: Finding cut-vertices in the square roots of a graph. In: Proc. WG 2017, LNCS, to appear 10. Farzad, B., Karimi, M.: Square-root finding problem in graphs, a complete dichotomy theorem. CoRR, arXiv:1210.7684 (2012) 11. Farzad, B., Lau, L.C., Le, V.B., Tuy, N.N.: Complexity of finding graph roots with girth conditions. Algorithmica 62, 38–53 (2012) 12. Golovach, P.A., Heggernes, P., Kratsch, D., Lima, P.T., Paulusma, D.: Algorithms for outerplanar graph roots and graph roots of pathwidth at most 2. In: Proc. WG 2017 LNCS, to appear 13. Golovach, P.A., Kratsch, D., Paulusma, D., Stewart, A.: Finding cactus roots in polynomial time. Proc. IWOCA LNCS 9843(2016), 253–265 (2016) 14. Golovach, P.A., Kratsch, D., Paulusma, D., Stewart, A.: A linear kernel for finding square roots of almost planar graphs. Theor. Comput. Sci. 689, 36–47 (2017) 15. Golovach, P.A., Kratsch, D., Paulusma, D., Stewart, A.: Squares of low clique number. Proc. CTW Electron. Notes Discret. Math. 55(2016), 195–198 (2016) 1426 Theory Comput Syst (2018) 62:1409–1426 16. Harary, F., Karp, R.M., Tutte, W.T.: A criterion for planarity of the square of a graph. J. Comb. Theory 2, 395–405 (1967) 17. Lau, L.C.: Bipartite roots of graphs. ACM Trans. Algor. 2, 178–208 (2006) 18. Lau, L.C., Corneil, D.G.: Recognizing powers of proper interval, split, and chordal graphs. SIAM J. Discret. Math. 18, 83–102 (2004) 19. Le, V.B., Oversberg, A., Schaudt, O.: Polynomial time recognition of squares of ptolemaic graphs and 3-sun-free split graphs. Theor. Comput. Sci. 602, 39–49 (2015) 20. Le, V.B., Oversberg, A., Schaudt, O.: A unified approach for recognizing squares of split graphs. Theor. Comput. Sci. 648, 26–33 (2016) 21. Le, V.B., Tuy, N.N.: The square of a block graph. Discret. Math. 310, 734–741 (2010) 22. Le, V.B., Tuy, N.N.: A good characterization of squares of strongly chordal split graphs. Inf. Process. Lett. 111, 120–123 (2011) 23. Lin, Y., Skiena, S.: Algorithms for square roots of graphs. SIAM J. Discret. Math. 8, 99–118 (1995) 24. Milanic, ˇ M., Oversberg, A., Schaudt, O.: A characterization of line graphs that are squares of graphs. Discret. Appl. Math. 173, 83–91 (2014) 25. Milanic, ˇ M., Schaudt, O.: Computing square roots of trivially perfect and threshold graphs. Discret. Appl. Math. 161, 1538–1545 (2013) 26. Motwani, R., Sudan, M.: Computing roots of graphs is hard. Discret. Appl. Math. 54, 81–88 (1994) 27. Mukhopadhyay, A.: The square root of a graph. J. Comb. Theory 2, 290–295 (1967) 28. Nestoridis, N.V., Thilikos, D.M.: Square roots of minor closed graph classes. Discret. Appl. Math. 168, 34–39 (2014) 29. Robertson, N., Seymour, P.D.: Graph minors. xvi. Excluding a non-planar graph. J. Comb. Theory Series B 89, 43–76 (2003) 30. Ross, I.C., Harary, F.: The square of a tree. Bell Syst. Tech. J. 39, 641–647 (1960)
Theory of Computing Systems – Springer Journals
Published: Nov 21, 2017
It’s your single place to instantly
discover and read the research
that matters to you.
Enjoy affordable access to
over 18 million articles from more than
15,000 peer-reviewed journals.
All for just $49/month
Query the DeepDyve database, plus search all of PubMed and Google Scholar seamlessly
Save any article or search result from DeepDyve, PubMed, and Google Scholar... all in one place.
Get unlimited, online access to over 18 million full-text articles from more than 15,000 scientific journals.
Read from thousands of the leading scholarly journals from SpringerNature, Elsevier, Wiley-Blackwell, Oxford University Press and more.
All the latest content is available, no embargo periods.
“Hi guys, I cannot tell you how much I love this resource. Incredible. I really believe you've hit the nail on the head with this site in regards to solving the research-purchase issue.”
Daniel C.
“Whoa! It’s like Spotify but for academic articles.”
@Phil_Robichaud
“I must say, @deepdyve is a fabulous solution to the independent researcher's problem of #access to #information.”
@deepthiw
“My last article couldn't be possible without the platform @deepdyve that makes journal papers cheaper.”
@JoseServera
DeepDyve Freelancer | DeepDyve Pro | |
---|---|---|
Price | FREE | $49/month |
Save searches from | ||
Create lists to | ||
Export lists, citations | ||
Read DeepDyve articles | Abstract access only | Unlimited access to over |
20 pages / month | ||
PDF Discount | 20% off | |
Read and print from thousands of top scholarly journals.
Already have an account? Log in
Bookmark this article. You can see your Bookmarks on your DeepDyve Library.
To save an article, log in first, or sign up for a DeepDyve account if you don’t already have one.
All DeepDyve websites use cookies to improve your online experience. They were placed on your computer when you launched this website. You can change your cookie settings through your browser.
ok to continue