A clustered graph (or c-graph) is a pair with underlying graph and inclusion tree , i.e., a rooted tree whose leaves are the vertices of . Each internal node of represents a cluster of vertices of (its leaf descendants) which induces a subgraph . A c-planar drawing of (Fig. 1) consists of a drawing of and of a representation of each cluster as a simple closed region , i.e., a region homeomorphic to a closed disc, such that: (1) Each region contains the drawing of . (2) For every two clusters , if and only if is a descendant of in . (3) No two edges cross. (4) No edge crosses any region boundary more than once. (5) No two region boundaries intersect.
An interesting and challenging line of research in graph drawing concerns the computational complexity of the C-Planarity problem, which asks to test the existence of a c-planar drawing of a c-graph. This problem is notoriously difficult, particularly when (as in Fig. 1) clusters may be disconnected, faces may have unbounded size, and the cluster hierarchy may have multiple nested levels. No known subexponential-time algorithm solves the (general) C-Planarity problem, and it is unknown whether it is NP-complete, although the related problem of splitting as few clusters as possible to make a c-graph c-planar was proved NP-hard . Thus, there is considerable interest in subexponential-time, slice-wise polynomial, and fixed-parameter tractable algorithms, besides polynomial-time algorithms for special cases of C-Planarity.
C-Planarity was introduced by Feng, Cohen, and Eades , who solved it in quadratic time for the c-connected case when every cluster induces a connected subgraph. Similar results were given by Lengauer  using different terminology. Dahlhaus  claimed a linear-time algorithm for c-connected C-Planarity (with some details later provided by Cortese et al. ). Goodrich et al.  gave a cubic-time algorithm for disconnected clusters that satisfy an “extroverted” property, and Gutwenger et al.  provided a polynomial-time algorithm for “almost” c-connected inputs. Cornelsen and Wagner showed polynomiality for completely connected c-graphs, i.e., c-graphs for which not only every cluster but also the complement of each cluster is connected . FPT algorithms have also been investigated [10, 15]. For additional special cases, see, e.g., [2, 3, 4, 7, 14, 23].
A c-graph is flat when no non-trivial cluster is a subset of another, so has only three levels: the root, the clusters, and the leaves. Flat C-Planarity can be solved in polynomial time for embedded c-graphs with at most vertices per face [22, 26] or at most two vertices of each cluster per face , for embedded c-graphs in which each cluster induces a subgraph with at most two connected components , and for c-graphs with two clusters [9, 26, 29] or three clusters . At the other end of the size spectrum, Jelínková et al.  provide efficient algorithms for -connected flat c-graphs when each cluster has at most vertices. Fulek  speculates that C-Planarity could be solvable in subexponential time for more general embedded flat c-graphs.
In this paper, we provide subexponential-time and fixed-parameter tractable algorithms for broad classes of c-graphs. We show the following results:
Our first result uses divide-and-conquer with a large but subexponential branching factor. It exploits cycle separators in planar graphs and a concise representation of the connectivity of each cluster in a c-planar drawing. This method also leads to an algorithm for generalized -simply nested graphs, which extend simply-nested graphs with bounded face size (Section 3.1). Recall that, (short for slice-wise polynomial) is the class of parameterized problems with input size and parameter than can be solved in time, where is a computable function.
We obtain our second result by expressing c-planarity in extended monadic second-order logic for embedded flat c-graphs and applying Courcelle’s Theorem. The graphs to which this result applies, with bounded treewidth and bounded face size, include the nested triangles graphs, a standard family of examples that are hard for many graph drawing tasks, the dual graphs of bounded-treewidth bounded-degree plane graphs , and the buckytubes, graphs formed from a planar hexagonal lattice wrapped to form a cylinder of bounded diameter.
2 Definitions and Preliminaries
The graphs considered in this paper are finite, simple, and connected. A graph is planar if it admits a drawing in the plane without edge crossings. A combinatorial embedding is an equivalence class of planar drawings, where two drawings of a graph are equivalent if they determine the same rotation at each vertex, i.e, the same circular orderings for the edges around each vertex. A planar drawing partitions the plane into topologically connected regions, called faces. The bounded faces are the inner faces, while the unbounded face is the outer face. A combinatorial embedding together with a choice for the outer face defines a planar embedding. An embedded graph (plane graph) is a planar graph with a fixed combinatorial embedding (fixed planar embedding). The length of a face is the number of occurrences of edges encountered in a traversal of . The maximum face size of an embedded graph is the length of its largest face.
A graph is connected if it contains a path between any two vertices. A cut-vertex is a vertex whose removal disconnects the graph. A separation pair is a pair of vertices whose removal disconnects the graph. A connected graph is -connected if it contains at least vertices and does not have a cut-vertex, and a -connected graph is -connected if it contains at least vertices and does not have a separation pair. The blocks of a graph are its maximal -connected subgraphs. Any (subdivision of a) -connected planar graph admits a unique combinatorial embedding (up to a flip) .
Tree-width and Embedded-width.
A tree decomposition of a graph is a tree whose nodes, called bags, are labeled by subsets of vertices of . For each vertex the bags containing must form a nonempty contiguous subtree of , and for each edge at least one bag must contain both and . The width of the decomposition is one less than the maximum cardinality of any bag, and the treewidth of is the minimum width of any of its tree decompositions.
Recently, Borradaile et al.  developed a variant of treewidth, specialized for plane graphs, called embedded-width. According to their definitions, a tree decomposition respects an embedding of a plane graph if, for every inner face of , at least one bag contains all the vertices of . They define the embedded-width of to be the minimum width of a tree decomposition that respects the embedding of . We will use the following result .
Theorem 2.1 (, Theorem 2).
If is a plane graph where every inner face has length at most , then .
Borradaile et al. do not require the vertices of the outer face to be contained in a same bag. In our applications, we modify this concept so that the tree decomposition also includes a bag containing the outer face, and we denote the minimum width of such a tree decomposition as . We have the following.
If is a plane graph whose maximum face size (including the size of the outer face) is , then .
Proof. To prove the statement, we can proceed as follows.
We augment to a graph , by embedding in the interior of a triangle and by identifying one of the vertices of the outer face of with a vertex of . Clearly, and has maximum face size . Also, we have that , since and since all the vertices incident to the same face in are also incident to the same face in . Thus, the statement follows from the fact that, by Theorem 2.1, .
Recall that, in a c-graph , each internal node of corresponds to the set of vertices of at leaves of the subtree of rooted at . Set induces the subgraph of . We call the internal nodes other than the root clusters. A cluster is connected if is connected and disconnected otherwise. A c-graph is c-connected if every cluster is connected.
A c-graph is c-planar if it admits a c-planar drawing. Two c-graphs and are equivalent if both are c-planar or neither is. If the root of has leaf children, enclosing each leaf in a new singleton cluster produces an equivalent c-graph. Therefore, we can safely assume that each vertex belongs to a cluster. A c-graph is flat if each leaf-to-root path in has exactly three nodes. The clusters of a flat c-graph form a partition of the vertex set.
An embedded c-graph is a c-graph whose underlying graph has a fixed combinatorial embedding. It is c-planar if it admits a c-planar drawing that preserves the embedding of . In what follows, we only deal with embedded flat c-graphs. Therefore, we will refer to such graphs simply as c-graphs.
We define the candidate saturating edges of a c-graph as follows. For each face of , let be the closed walk composed of the vertices and edges of . For each cluster , consider the set of connected components of induced by the vertices of and, for each component , assign a vertex of belonging to as a reference vertex of . We add an edge inside between the reference vertices of any two components in if and only if such vertices belong to different connected components of ; see Figs. (a)a and (b)b.
A c-graph obtained from by adding to a subset of its candidate saturating edges is a super c-graph of .
Di Battista and Frati  gave the following characterization.
Theorem 2.2 (, Theorem 1).
A c-graph is c-planar if and only if:
there exists a face in such that when is chosen as the outer face for no cycle composed of vertices of the same cluster encloses a vertex of a different cluster in its interior; and
there exists a super c-graph of such that is planar and is c-connected (see Fig. (c)c).
Conditions (i) and (ii) of Theorem 2.2 can be easily verified in linear time. Therefore, we can assume that any c-graph satisfies these conditions. Following  we thus view the problem of testing c-planarity as one of testing Condition (iii).
A cluster-separator in a c-graph is a cycle in for which some cluster has vertices both in the interior and in the exterior of but with . Condition (iii) immediately yields the following observation.
A c-graph that has a cluster-separator is not c-planar.
In the next sections, it will be useful to only consider c-graphs which are at least -connected (Section 3) and -connected (Section 4). The next lemma, conveniently stated in a stronger form111In Section 4, we exploit all the properties of the lemma. In Section 3, we only exploit the existence of an equivalent -connected c-graph with maximum face size ., shows that this is not a loss of generality.
Lemma 2 ().
Let be an -vertex c-graph with maximum face size . There exists an -time algorithm that constructs an equivalent c-graph with such that: 1. is -connected, 2. the maximum face size of is , and 3. the c-graph obtained by augmenting with all its candidate saturating edges is such that .
To prove the statement, we can proceed as follows.
First, we transform c-graph into an equivalent c-graph , by applying the transformation in Fig. (a)a to every edge, such that , every vertex of has degree at least , the maximum face size of is , , and each vertex of is incident to at least three edges in each block belongs to.
Second, we transform c-graph into an equivalent c-graph , by applying the transformation in Fig. (b)b to every vertex, such that , is -connected, the maximum face size of is , and the c-graph obtained by augmenting with all its candidate saturating edges is such that , which implies that , since by Lemma 1.
We now describe each of the transformations in detail.
First, initialize . For every vertex of , let be any edge incident to . Add to vertices and and embed paths and in the interior of each of the two faces of edge is incident to; also, subdivide edge with a vertex , add edges and , and assign vertices , , and to the same cluster of () vertex belongs to. Refer to Fig. (a)a. By construction, all the newly added vertices have degree at least . In particular, observe that each cut-vertex of is incident to at least three edges in each of the blocks such a cut-vertex belongs to. It is easy to see that and are equivalent. Also, the maximum face size of is . Further, , as the transformation replaces edges with subgraphs of treewidth .
Second, initialize . For every vertex of , we subdivide each edge incident to with a dummy vertex . Denote such a graph by . Also, add an edge between any two vertices and such that edges and are consecutive around in the unique face shared by and in . Finally, assign each vertex to the same cluster of () vertex belongs to. Refer to Fig. (b)b. The equivalence between and is again straightforward. Clearly, and . Also, by the observation that the cut-vertices of are incident to at least three edges in each of the blocks such cut-vertices belong to, the applied transformation fixes the rotation at all the vertices of . Since each vertex of has minimum degree and has a fixed combinatorial embedding (up to a flip), by the result of Whitney , we have that is -connected. Furthermore, , since is obtained by subdividing each edge of twice, thus obtaining a graph with the same tree-width as and maximum face-size in , and by adding edges between some of the vertices incident to the faces of . Since is the graph obtained by adding all the candidate saturating-edges of (recall that such edges only connect vertices in the same face of ), we have that . Since, by Lemma 1, and since and , we have that . This concludes the proof of the lemma.
3 A Subexponential-Time Algorithm for C-Planarity
In this section, we describe a divide-and-conquer algorithm for testing the c-planarity of -connected c-graphs exploiting cycle separators in planar graphs.
The “conquer” part of our divide-and-conquer uses the following operation on pairs of c-graphs. Let and be plane graphs on overlapping vertex sets such that the outer face of and an inner face of are bounded by the same cycle . Merging and constructs a new plane graph from as follows. We remove multi-edges (belonging to cycle ) and assign each vertex a rotation whose restriction to the edges of (of ) is the same as the rotation at in (in ). This is possible as cycle bounds the outer face of and an inner face of . We say that is a merge of and . Now consider two c-graphs and such that (i) is a cycle, (ii) for each vertex , vertex belongs to the same cluster both in and in , and (iii) cycle bounds the outer face of and an inner face of (when a choice for their outer faces that satisfies Condition (ii) of Theorem 2.2 has been made). Merging and is the operation that constructs a c-graph as follows. Graph is obtained by merging and . Tree is obtained as follows. Initialize to . First, for each cluster , we add the leaves of in as children of cluster in , removing duplicate leaves. Second, for each cluster , we add the subtree of rooted at as a child of the root of . We say that is a merge of and .
In the “divide” part of the divide-and-conquer, we replace subgraphs of the input by smaller planar components called cycle-stars that preserve their c-planarity properties. Let be a connected plane graph that contains a face whose boundary is a cycle . We say that is a cycle-star if removing all the edges of makes a forest of stars; refer to Fig. (c)c. Also, we say that cycle is universal for and we say that a vertex of is a star vertex of if it does not belong to . Clearly, the size of is .
For a c-planar c-graph and a cycle separator , we denote by (by ) the c-graph obtained from by removing all the vertices and the edges of that lie in the interior of (in the exterior of ). Consider a super c-graph of satisfying Condition (iii) of Theorem 2.2, which exists since is c-planar. We now give a procedure, which will be useful throughout the paper, to construct two special c-planar c-graphs and associated with whose properties are described in the following lemma.
Lemma 3 ().
C-graphs and are such that:
graph () is a cycle-star whose universal cycle is ,
cycle bounds the outer face of (an inner face of ),
each star vertex of () and all its neighbours belong to the same cluster in (), and
the c-graph () obtained by merging and (by merging and ) is c-planar.
We describe how to construct from ; refer to Fig. 13. The construction of is symmetric.
First, for each cluster such that , we remove all the vertices in lying in the interior of together with their incident edges. By Observation 1, the resulting c-graph is still c-planar and c-connected. Also, we remove edges in the interior of whose endpoints belong to different clusters. Clearly, this simplification preserve c-connectedness. We still denote the resulting c-graph as .
Second, consider the c-graph consisting of the vertices and of the edges of lying in the interior and along the boundary of . For each cluster and for each connected component of in , we replace all the vertices and edges of lying in the interior of in with a single vertex , assigning it to the same cluster and making it adjacent to all the vertices in . Let be the resulting c-graph. It is easy to see that such a transformation preserves c-connectedness and planarity, therefore is a c-connected c-planar c-graph. By construction, each vertex is adjacent to a single vertex , where is the cluster vertex belongs to; thus, the vertices and the edges in the interior and along the boundary of in form c-graph whose underlying graph is a cycle-star satisfying Properties (1), (2) and (3) of Lemma 3. Further, since the subgraph of consisting of the vertices and of the edges lying in the exterior and along the boundary of coincides with , we have that is a c-planar c-connected super c-graph of . Thus, by Condition (iii) of Theorem 2.2, Property (4) of Lemma 3 is also satisfied.
Let () be a c-graph obtained by augmenting the c-graph () of Lemma 3 by introducing new vertices, each belonging to a distinct cluster, and by adding edges only between the vertices in () and the newly introduced vertices in such a way that cycle bounds a face of () and all the other faces of () are triangles. From the construction of Lemma 3, we also have the following useful technical remark.
The c-graph obtained by merging and (by merging and ) is c-planar.
We now describe a divide-and-conquer algorithm based on Lemma 3, called TestCP, that tests the c-planarity of a -connected c-graph and returns a super c-graph of satisfying Condition (iii) of Theorem 2.2, if is c-planar. See Fig. 23 for illustrations of the c-graphs constructed during the execution of the algorithm.
We first give an intuition on the role of cycle-stars in Algorithm TestCP.
Let be a c-planar c-graph and let be a cycle separator of . By Lemma 3, for each c-connected c-planar super c-graph of , we can injectively map the super c-graph of , composed of the vertices of and of the edges in the interior and along the boundary of in , with a cycle-star whose universal cycle is . This is due to the fact that there exists a one-to-one correspondence between the connected components of induced by the vertices of each cluster in and the star vertices of . Similar considerations hold for the super c-graph of . Although the c-planarity of and is necessary for the c-planarity of , it is not a sufficient condition, as the connectivity of clusters inside in (internal cluster-connectivity) and the connectivity of clusters outside in (external cluster-connectivity) must also together determine the c-connectedness of . The role of cycle-stars and in the algorithm presented in this section is exactly that of concisely representing the internal cluster-connectivity of and the external cluster-connectivity of , respectively, to devise a divide-and-conquer approach to test the c-planarity of .
Outline of the algorithm
. We overview the main steps of our algorithm below.
If , we test -planarity directly, as a base case for the divide-and-conquer recursion. Otherwise, we construct a cycle-separator of and test whether is a cluster-separator. If so, cannot be c-planar (Observation 1), and we halt the search.
We generate all cycle-stars with universal cycle . A cycle-star represents a potential connection pattern of clusters inside . For each cycle-star we apply Procedure OuterCheck to test whether this pattern could be augmented by additional connections outside to complete the desired cluster-connectivity. That is, we test whether admits a c-connected c-planar super c-graph whose internal cluster-connectivity is represented by . To test this, we replace the subgraph of in with an internally-triangulated supergraph of to obtain a c-graph and recursively test for c-planarity. It is important to observe that, the triangulation step prevents from having saturating edges inside , thus enforcing exactly the same internal-cluster connectivity represented by (Remark 1). If is c-planar, the procedure returns a c-connected c-planar super c-graph of . If no cycle-star passes the test, is not c-planar by Lemma 3. We call all the cycle-stars that passed this test admissible.
We then apply Procedure InnerCheck to verify whether the internal-cluster connectivity represented by some admissible cycle-star can actually be realized by a c-connected c-planar super c-graph of . For each admissible cycle-star , the procedure applies the construction of Lemma 3 to obtain a cycle-star representing the external cluster-connectivity of . Then, it tests whether admits a c-connected c-planar super c-graph whose external cluster-connectivity is represented by . This is done similarly to Procedure OuterCheck, by triangulating the exterior of and recursively testing -planarity of a smaller graph. If Procedure InnerCheck succeeds for any admissible cycle-star , then we can merge the subgraphs of and of induced by the vertices inside and outside , respectively, to obtain a c-connected c-planar super c-graph of , and we halt the search with a successful outcome. It might be the case that has a different internal-cluster connectivity than that represented by , but this is not a problem, because the different cluster connectivity (which necessarily corresponds to a different admissible cycle-star) still provides a c-planar drawing of the whole graph.
If no admissible cycle-star passes Procedure InnerCheck, is not c-planar.
It is crucial in this algorithm that be a cycle-separator. Because it is a cycle, no candidate saturating edges can connect vertices in the interior of to vertices in the exterior of , as such vertices do not share any face. That is, the interaction between and only happens through vertices of . This allows us to split the instance into smaller instances recursively along and model the interaction via cycle-stars (by Lemma 3 and Remark 1) whose universal cycle is .
The complete listing of Algorithm TestCP is provided in the next page.
Base Case of the algorithm.
The base case occurs when and are no longer smaller than .
Observe that, we obtained () by merging () and () along cycle , which has size . The size of and is bounded by , while the size of and is bounded by . Therefore, since cycle is shared by all the mentioned graphs by construction, we have that the size of and is at most . Thus, with , we can set the base case of Algorithm TestCP when , that is, .
Correctness of the algorithm.
We show that, given a -connected c-graph , Algorithm TestCP returns YES, which happens when both procedures OuterCheck and InnerCheck succeed, if and only if is c-planar.
() Suppose that OuterCheck and InnerCheck succeed for a cycle-star constructed at step 2a. We show that is c-planar. Consider the c-graph constructed at step 3(a)v from and . The proof of this direction follows by the next claim about and from Theorem 2.2.
C-graph is a c-planar c-connected super c-graph of .
Proof. Graphs and are planar, as they are subgraphs of and , respectively (step 3(a)v). By construction, cycle bounds an inner face of and the outer face of . Therefore , obtained by merging and , is planar. Also, observe that, and are supergraphs of and , respectively, therefore graph is a super graph of .
We now show that is c-connected, that is, for each cluster , graph is connected.
First, let be a cluster in such that lies in the interior of in . Since is c-connected, we have that is connected. Also, lie in the interior of in . By construction, contains all the vertices and the edges in the interior of , therefore we also have that is connected. Hence, is connected. The proof that graph is connected, for each cluster in such that lies in the exterior of in , is analogous.
Then, let be a cluster such that . Clearly, if , then is connected since both and are connected. Otherwise, the following three cases are possible: either is disconnected, or is disconnected, or both and are disconnected.
We show that all the vertices in and in are connected in .
We first prove that all the vertices in are connected in .
Consider two connected components and of . Observe that, by construction, c-graph (step 3(a)v) is a merge of and of . Since is c-connected and since is an augmentation of cycle-star such that edges in do not have endpoints in the same cluster, the c-graph obtained by merging and is also c-connected. Since is c-connected, the vertices of and are connected via star vertices of and vertices of belonging to cluster in . Observe that, by construction, c-graph is a merge of and of . Further, has been obtained by applying the construction of Lemma 3 to c-graph (step 3(a)i) and cycle . Therefore, each connected component of in corresponds to a star vertex of . Hence, we have that the vertices of and are also connected in via vertices of and belonging to cluster .
Now, we prove that all the vertices in are connected in .
Consider two connected components and of . Observe that, as shown above, each connected component of in corresponds to a star vertex of . Recall that is c-connected. Therefore, the star vertices of corresponding to and are connected via other star vertices of and vertices of belonging to cluster in . Hence, the vertices of and are also connected in via vertices of belonging to connected components of corresponding to star vertices of and vertices of belonging to cluster in .
() Suppose that is c-planar. We show that Procedure OuterCheck and InnerCheck succeed. Since is c-planar, there exists a super c-graph of such that is planar and is c-connected, by Theorem 2.2. By using the construction of Lemma 3 on c-graph , we can obtain a cycle-star whose universal cycle is that represents the connectivity of clusters inside in . The proof of this direction follows from the next claim.
Procedures OuterCheck and InnerCheck succeed for .
Proof. Procedure OuterCheck succeeds if, for a cycle separator of selected at step 1 of the algorithm, there exists a cycle-star whose universal cycle is such that the corresponding c-graph , constructed at steps 2(b)i, 2(b)ii, and 2(b)iii of the algorithm, is c-planar. Recall that, cycle-star has the following properties: 1. Cycle is the universal cycle of and bounds the outer face of , and 2. for each star vertex of , the neighbours of belong to the same cluster vertex belongs to. Since, steps 2a and 2(b)i construct all c-graphs with the above properties, when we are guaranteed to compute c-graph . First, observe that the c-graph obtained by merging c-graphs and is c-planar, since has been obtained by applying the construction of Lemma 3 to a super c-connected c-planar c-graph of . This together with Remark 1 imply that c-graph is c-planar. Thus, the invocation of TestCP on at step 2(b)iv will return YES. Hence, Procedure OuterCheck succeeds.
Procedure InnerCheck succeeds if, there exists a c-graph , constructed at steps 3(a)i, 3(a)ii, and 3(a)iii of the algorithm, that is c-planar. By Theorem 2.2, a c-graph is c-planar if and only if there exists a super c-graph of such that is planar and is c-connected. As Procedure OuterCheck succeeds, the c-graph corresponding to is c-planar. Therefore, Procedure OuterCheck provides us with a c-planar c-connected c-graph (see steps 2(b)iv and 3(a)i) that is a super c-graph of . Consider the c-graph constructed at step 3(a)i by applying the construction of Lemma 3 to . Observe that, the c-graph obtained by merging and is a c-connected c-planar c-graph. This is due to the fact that, since is internally triangulated, there exists no edge in the interior of in that belongs to and does not belong to , that is, no candidate saturating edges connect two vertices in the interior of