1 Introduction
A clustered graph (cgraph) is a planar graph with a recursive hierarchy defined on its vertices. A clustered planar (cplanar) drawing of a cgraph is a planar drawing of the underlying graph where: (i) each cluster is represented by a simple closed region of the plane containing only the vertices of the corresponding cluster, (ii) cluster borders never intersect, and (iii) any edge and any cluster border intersect at most once (more formal definitions are given in Section 2). The complexity of deciding whether a cgraph admits a cplanar drawing is still an open problem after more than 20 years of intense research [12, 14, 17, 18, 19, 25, 31, 33, 34, 35, 37, 41, 42, 43, 44, 49, 48, 52].
If we had an efficient cplanarity testing and embedding algorithm we could produce straightline drawings of clustered trees [27] and straightline drawings [11, 32] and orthogonal drawings [26] of cplanar cgraphs with rectangular regions for the clusters.
In order to shed light on the complexity of Clustered Planarity, this problem has been compared with other problems whose complexity is likewise challenging. This line of investigation was opened by Marcus Schaefer’s polynomialtime reduction of Clustered Planarity to SEFE [52]. Simultaneous Embedding with Fixed Edges (SEFE) takes as input two planar graphs and and asks whether a planar drawing and a planar drawing exist such that: (i) each vertex is mapped to the same point in and in and (ii) every edge is mapped to the same Jordan curve in and in .
However, the polynomialtime equivalence of the two problems is open and the reverse reduction of SEFE to Clustered Planarity is known only for the case when the intersection graph of the instance of SEFE is connected [4]. Also in this special case, the complexity of the problem is unknown, with the exception of the case when is a star, which produces a cgraph with only two clusters, a known polynomial case for Clustered Planarity [10, 46].
Since the general Clustered Planarity problem appears to be elusive, several authors focused on a restricted version of it where the hierarchy of the clusters is ‘flat’, i.e., only the root cluster contains other clusters and it does not directly contain vertices of the underlying graph [2, 3, 5, 6, 7, 9, 16, 20, 21, 24, 28, 36, 38, 39, 40, 46, 50]. This restricted problem, that we call Flat Clustered Planarity, is expressive enough to be useful in several applicative domains, as for example in computer networks where routers are grouped into Autonomous Systems [15], or social networks where people are grouped into communities [13, 29], or software diagrams where classes are grouped into packages [51]. Also, several hybrid representations have been proposed for the visual analysis of (not necessarily planar) flat clustered graphs, such as mixed matrix and nodelink representations [13, 22, 23, 30, 45], mixed intersection and nodelink representations [8], and mixed spacefilling and nodelink representations [1, 47, 53].
Unfortunately, the complexity of Flat Clustered Planarity is open as the complexity of the general problem. The authors of [14], after recasting Flat Clustered Planarity as an embedding problem on planar multigraphs, conclude that we are still far away from solving it. The authors of [4] wonder whether Flat Clustered Planarity retains the same complexity of Clustered Planarity. In this paper we answer this question in the affirmative. Obviously, a reduction of Flat Clustered Planarity to Clustered Planarity is trivial, since the instances of Flat Clustered Planarity are simply a subset of those of Clustered Planarity. The reverse reduction is the subject of Section 3, that proves the following theorem.
Theorem 1.1
There exists a quadratictime transformation that maps an instance of Clustered Planarity to an equivalent instance of Flat Clustered Planarity.
With very similar techniques we are able to prove also a stronger result.
Theorem 1.2
There exists a lineartime transformation that maps an instance of Flat Clustered Planarity to an equivalent instance of Independent Flat Clustered Planarity.
Here, by Independent Flat Clustered Planarity we mean the restriction of Flat Clustered Planarity to instances where each nonroot cluster induces an independent set.
The paper is structured as follows. Section 2 contains basic definitions. Section 3 contains the proof of Theorem 1.1 under some simplifying hypotheses (which are removed in Appendix B). Some immediate consequences of Theorem 1.1 are discussed in Section 4. The proof of Theorem 1.2 and some remarks about it are in Sections 5 and 6, respectively. Conclusions and open problems are in Section 7. For space reasons some proofs are moved to the appendix.
2 Preliminaries
Let be a rooted tree. We denote by the root of and by the subtree of rooted at one of its nodes . The depth of a node of is the length (number of edges) of the path from to . The height of a tree is the maximum depth of its nodes.
The nodes of a tree can be partitioned into leaves, that do not have children, and internal nodes. In turn, the internal nodes can be partitioned into two sets: lower nodes, whose children are all leaves, and higher nodes, that have at least one internalnode child. We say that a node is homogeneous if its children are either all leaves or all internal nodes. A tree is homogeneous if all its nodes are homogeneous. We say that a tree is flat if all its leaves have depth . A flat tree is homogeneous. Figure 1 shows a nonhomogeneous tree (Fig. 1), a homogeneous tree (Fig. 1), and a flat tree (Fig. 1).
We also need a special notion of size: the size of a tree , denoted by , is the number of higher nodes of different from the root of . Observe that a homogeneous tree is flat if and only if . For example, the sizes of the trees represented in Figs. 1, 1, and 1 are , , and , respectively (filled gray nodes in Fig. 1). The proof of the following lemma can be found in Appendix A.
Lemma 1
A homogeneous tree of height and size contains at least one node such that is flat.
A graph is a set of vertices and a set of edges, where each edge is an unordered pair of vertices. A drawing of is a mapping of its vertices to distinct points on the plane and of its edges to Jordan curves joining the incident vertices. Drawing is planar if no two edges intersect except at common endvertices. A graph is planar if it admits a planar drawing.
A clustered graph (or cgraph) is a pair where is a planar graph, called the underlying graph of , and , called the inclusion tree of , is a rooted tree such that the set of leaves of coincides with . A cluster is an internal node of . When it is not ambiguous we also identify a cluster with the respective subset of the vertex set. An intercluster edge of a cluster of is an edge of that has one endvertex inside and the other endvertex outside . An independent set of vertices is a set of pairwise nonadjacent vertices. A cluster of is independent if its vertices form an independent set. A cgraph is independent if all its clusters, with the exception of the root, are independent clusters. A cluster of is a lower cluster (higher cluster) of if is a lower node (higher node) of .
A cgraph is flat if its inclusion tree is flat. The clusters of a flat cgraph are all lower clusters with the exception of the root cluster. A cluster is called singleton if it contains a single cluster or a single vertex.
A drawing of a cgraph is a mapping of vertices and edges of to points and to Jordan curves joining their incident vertices, respectively, and of each internal node of to a simple closed region containing exactly the vertices of . Drawing is cplanar if: (i) curves representing edges of do not intersect except at common endpoints; (ii) the boundaries of the regions representing clusters do not intersect; and (iii) each edge intersects the boundary of a region at most one time. A cgraph is cplanar if it admits a cplanar drawing.
Problem Clustered Planarity is the problem of deciding whether a cgraph is cplanar. Problem Flat Clustered Planarity is the restriction of Clustered Planarity to flat cgraphs. Problem Independent Flat Clustered Planarity is the restriction of Clustered Planarity to independent flat cgraphs.
The proof of the following lemmas can be found in Appendix A.
Lemma 2
An instance of Clustered Planarity with vertices and clusters can be reduced in time to an equivalent instance such that: (1) is homogeneous, (2) has at least two children, and (3) .
3 Proof of Theorem 1.1
We describe a polynomialtime reduction of Clustered Planarity to Flat Clustered Planarity. Let be a clustered graph, let be the number of vertices of , and let be the number of clusters of . Due to Lemma 2 we can achieve in time that is homogeneous and . We reduce to an equivalent instance where is flat. The reduction consists of a sequence of transformations of into , , …, , where each , , has an homogeneous inclusion tree and each transformation takes time.
Consider any , with , where is a homogeneous, nonflat tree of height (refer to Fig. 2). By Lemma 1, has at least one node such that is flat. Since , node has a parent . Also, denote by the children of and by the siblings of in . We construct as follows (refer to Fig. 2). Graph is obtained from by introducing, for each intercluster edge of , two new vertices and and by replacing with a path . Tree is obtained from by removing node , attaching its children directly to and adding to two new children and , where cluster (cluster , respectively) contains all vertices (, respectively) introduced when replacing each intercluster edge of with a path. The proof of the following lemmas can be found in Appendix B.
Lemma 3
If is homogeneous then is homogeneous.
Lemma 4
We have that .
Lemma 5
The cgraph is flat.
The proof of the following lemma is given here under two simplifying hypotheses (the proof of the general case can be found in Appendix B):
The underlying graph is connected
Cluster is not the root of
Observe that Hypothesis conn implies that also is connected. Observe, also, that Hypothesis notroot and Property 2 of Lemma 2 imply that there is at least one vertex of that is not part of (this hypothesis is not satisfied, for example, by the cgraph depicted in Fig. 2).
Lemma 6
is cplanar if and only if is cplanar.
Proof sketch
The first direction of the proof is straightforward. Let be a cplanar drawing of (refer to Fig. 3). We show how to construct a cplanar drawing of (refer to Fig. 3). Consider the region that contains , with . The boundary of is crossed exactly once by each intercluster edge of . Identify outside the boundary of two arbitrarily thin regions and that turn around and that intersect exactly once all and only the intercluster edges of . Insert into each intercluster edge of two vertices and , placing inside and inside . By ignoring you have a cplanar drawing of .
Suppose now to have a cplanar drawing of . We show how to construct a cplanar drawing of under the Hypotheses conn and notroot. Consider the regions and inside (refer to Fig. 4). Regions and are joined by the intercluster edges introduced when replacing each intercluster edge of , where , with a path (red edges of Fig. 4). Such intercluster edges of and partition into regions that have to host the remaining children of and the intercluster edges among them. In particular, of these regions are bounded by two intercluster edges and two portions of the boundaries of and . One of such regions, instead, is also externally bounded by the boundary of .
Now consider the regions corresponding to the children of , with , that were originally children of . These regions (filled white in Fig. 4) may have intercluster edges among them and may be connected to , but by construction cannot have intercluster edges connecting them to , or connecting them to the original children of , or exiting the border of . In particular, due to Hypothesis conn, these regions must be directly or indirectly connected to . Finally, consider the regions corresponding to the original children of (filled gray in Fig. 4). These regions may have intercluster edges among them, connecting them to , or connecting them to the rest of the graph outside . In particular, due to Hypotheses conn and notroot, each (and also ) must be directly or indirectly connected to the border of . It follows that the drawing in of the subgraph composed by the regions of and their intercluster edges cannot contain in one of its internal faces any other cluster of . Hence, the subregion of that is the union of and the region enclosed by is a closed and simple region that only contains the regions , … plus the region and all the intercluster edges among them (see Fig. 5). By ignoring and and by removing vertices and and joining their incident edges we obtain a cplanar drawing .
4 Remarks about Theorem 1.1
In this section we discuss some consequences of Theorem 1.1 that descend from the properties of the reduction described in Section 3. Such properties are summarized in the following lemma.
Lemma 7
Let be an vertex clustered graph with clusters. The flat clustered graph equivalent to built as described in the proof of Theorem 1.1 has the following properties:

Graph is a subdivision of

Each edge of is replaced by a path of length at most

The number of vertices of is

The number of clusters of is
Proof
Regarding Property 1, observe that, for , each is obtained from by replacing edges with paths. Hence is a subdivision of . To prove Property 2 observe that each time an edge is subdivided, a pair of vertices and is inserted and that edges are subdivided when the boundary of a higher cluster is removed. Edges that traverse more boundaries are those that link two vertices whose lowest common ancestor is the root of . These edges traverse highercluster boundaries in . Hence, the number of vertices inserted into these edges is . Property 3 can be proved by considering that has edges and each edge, by Property 2, is replaced by a path of length at most . Finally, Property 4 descends from the fact that at each step has exactly one cluster more than , since new clusters and are inserted but cluster is removed.
An immediate consequence of Property 1 of Lemma 7 is that the number of faces of is equal to the number of faces of . Also, if is connected, biconnected, or a subdivision of a triconnected graph, is also connected, biconnected, or a subdivision of a triconnected graph, respectively. If is a cycle or a tree, is also a cycle or a tree, respectively. Hence, the complexity of Clustered Planarity restricted to these kinds of graphs can be related to the complexity of Flat Clustered Planarity restricted to the same kinds of graphs. Further, since a subdivision preserves the embedding of the original graph, the problem of deciding whether a cgraph admits a cplanar drawing where has a fixed embedding is polynomially equivalent to deciding whether a flat cgraph admits a cplanar drawing where has a fixed embedding.
By the above observations some results on flat clustered graphs can be immediately exported to general cgraphs. Consider for example the following.
Theorem 4.1
([16, Theorem 1]). There exists an time algorithm to test the cplanarity of an nvertex embedded flat cgraph with at most two vertices per cluster on each face.
We generalize Theorem 4.1 to nonflat cgraphs.
Theorem 4.2
Let be an nvertex cgraph where has a fixed embedding. There exists an time algorithm to test the cplanarity of if each lower cluster has at most two vertices on the same face of and each higher cluster has at most two intercluster edges on the same face of .
Proof sketch
The proof is based on showing that, starting from a cgraph that satisfies the hypotheses of the statement, the equivalent flat cgraph built as described in the proof of Theorem 1.1 satisfies the hypotheses of Theorem 4.1. Hence, we first transform into in time and then apply Theorem 4.1 to , which gives an answer to the cplanarity test in time, which is, by Property 3 of Lemma 7, time.
In [24] it has been proven that Flat Clustered Planarity admits a subexponentialtime algorithm when the underlying graph has a fixed embedding and its maximum face size belongs to .
Theorem 4.3
([24, Theorem 3]). Flat Clustered Planarity can be solved in time for nvertex embedded flat cgraphs with maximum face size .
The authors of [24] ask whether their results can be generalized to nonflat cgraphs. We give an affirmative answer with the following theorem.
Theorem 4.4
Clustered Planarity can be solved in time for nvertex embedded cgraphs with maximum face size and height of the inclusion tree.
Proof sketch
5 Proof of Theorem 1.2
In this section we reduce Flat Clustered Planarity to Independent Flat Clustered Planarity by applying a transformation very similar to the one described in Section 3 to each nonindependent cluster.
Let be a flat cgraph. Let be the number of lower clusters of that are not independent. The reduction consists of a sequence of transformations of into where each , , is a flat cgraph with nonindependent lower clusters.
Consider a flat cgraph , with , such that has nonindependent clusters and let be a nonindependent cluster of . We show how to construct an flat cgraph equivalent to and such that has nonindependent clusters (refer to Fig. 6). Denote by , with , those children of such that . Suppose that has children , which are vertices of .
The underlying graph of is obtained from by introducing, for each intercluster edge of , two new vertices and and replacing with a path . The inclusion tree of is obtained from by removing cluster and introducing, for each , a lower cluster child of containing only . We also introduce two lower clusters and as children of that contain all the vertices and , respectively, introduced when replacing each intercluster edge of with a path. It is easy to see that is a flat clustered graph and that it has one nonindependent cluster less than .
We prove the following lemma assuming that Hypothesis conn holds. The complete proof is in Appendix D.
Lemma 8
is cplanar if and only if is cplanar.
Proof sketch
The proof is very similar to the proof of Lemma 6. First, we show that, given a cplanar drawing of the flat cgraph it is easy to construct a cplanar drawing of (see, as an example, Fig. 7). Second we show that, given a cplanar drawing of the flat cgraph it is possible to construct a cplanar drawing of . This second part of the proof is complicated by the fact that, since in this case Hypothesis notroot does not apply, we may have that in the region is embraced by intercluster edges and region boundaries of , , …, and (see Fig. 10 in Appendix D). Hence, before identifying the region the drawing needs to be modified so that the external face touches . This can be easily done by rerouting edges (see the example in Fig. 10).
The proof of Theorem 1.2 is concluded by showing that each can be obtained from in time proportional to the number of vertices and intercluster edges of , which gives an overall time for the reduction.
6 Remarks about Theorem 1.2
Starting from a flat cgraph, the reduction described in Section 5 allows us to find an equivalent independent flat cgraph with the properties stated in the following lemma (the proof is in Appendix E).
Lemma 9
Let be an vertex flat clustered graph with clusters. The independent flat clustered graph equivalent to built as described in the proof of Theorem 1.2 has the following properties:

Graph is a subdivision of

Each intercluster edge of is replaced by a path of length at most .

The number of vertices of is

The number of clusters of (including the root) is
Also, a further property can be pursued.
Observation 1
. At the same asymptotic cost of the reduction described in the proof of Theorem 1.2 it can be achieved that nonroot clusters are of two types: (Type 1) clusters containing a single vertex of arbitrary degree or (Type 2) clusters containing multiple vertices of degree two.
All observations of Section 4 regarding the consequences of Property 1 of Lemma 7 apply here to of Property 1 of Lemma 9. Further, the two reductions can be concatenated yielding the following.
Lemma 10
Let be an vertex clustered graph with clusters. The independent flat clustered graph equivalent to built by concatenating the reduction of Theorem 1.1 and the reduction of Theorem 1.2, as modified by Observation 1, has the following properties:

Graph is a subdivision of

Each intercluster edge of is replaced by a path of length at most

The number of vertices of is

The number of clusters of is

Nonroot clusters are of two types: (Type 1) clusters containing a single vertex of arbitrary degree or (Type 2) clusters containing multiple vertices of degree two
Lemma 10 describes the most constrained version of Clustered Planarity that is known to be polynomially equivalent to the general problem. Observe that if all nonroot clusters of a cgraph are of Type 1 then Independent Flat Clustered Planarity is linear, since is cplanar if and only if is planar. Conversely, if all clusters are of Type 2 then the underlying graph is a collection of cycles, and the problem has unknown complexity [20, 21].
7 Conclusions and Open Problems
We showed that Clustered Planarity can be reduced to Flat Clustered Planarity and that this problem, in turn, can be reduced to Independent Flat Clustered Planarity. The consequences of these results are twofold: on one side the investigations about the complexity of Clustered Planarity could legitimately be restricted to (independent) flat clustered graphs, neglecting more complex hierarchies of the inclusion tree; on the other side some polynomialtime results on flat clustered graphs could be easily exported to general cgraphs (we gave some examples in Section 4).
We remark that while Theorems 1.1 and 1.2 are formulated in terms of decision problems, their proofs offer a solution of the corresponding search problems, meaning that they actually describe a polynomialtime algorithm to compute a cplanar drawing of a cgraph, provided to have a cplanar drawing of the corresponding flat cgraph or a cplanar drawing of the corresponding independent flat cgraph.
Several interesting questions are left open:

Can the reduction presented in this paper be used to generalize some other polynomialtime testing algorithm for Flat Clustered Planarity to plain Clustered Planarity?

What is the complexity of Independent Flat Clustered Planarity when the number of Type 2 clusters is bounded?
References
 [1] Abello, J., Kobourov, S.G., Yusufov, R.: Visualizing large graphs with compoundfisheye views and treemaps. In: Pach, J. (ed.) GD 2004. LNCS, vol. 3383, pp. 431–441. Springer (2004), doi:10.1007/9783540318439_44
 [2] Akitaya, H.A., Fulek, R., Tóth, C.D.: Recognizing weak embeddings of graphs. In: Czumaj, A. (ed.) SODA 2018. pp. 274–292 (2018), doi:10.1137/1.9781611975031.20
 [3] Angelini, P., Da Lozzo, G.: Clustered planarity with pipes. In: Hong, S.H., Eades, P., Meidiana, A. (eds.) ISAAC 2016. LIPIcs, vol. 64, pp. 13:1–13:13 (2016), doi:10.4230/LIPIcs.ISAAC.2016.13
 [4] Angelini, P., Da Lozzo, G.: SEFE = Cplanarity? The Computer Journal 59(12), 1831–1838 (2016), doi:10.1093/comjnl/bxw035
 [5] Angelini, P., Da Lozzo, G., Di Battista, G., Frati, F.: Strip planarity testing. In: Wismath, S., Wolff, A. (eds.) GD 2013. LNCS, vol. 8242, pp. 37–48 (2013)
 [6] Angelini, P., Da Lozzo, G., Di Battista, G., Frati, F.: Strip planarity testing for embedded planar graphs. Algorithmica 77(4), 1022–1059 (2017), doi:10.1007/s0045301601289
 [7] Angelini, P., Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M., Roselli, V.: Relaxing the constraints of clustered planarity. Comput. Geom. Theory Appl. 48(2), 42–75 (2015), doi:10.1016/j.comgeo.2014.08.001
 [8] Angelini, P., Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M., Rutter, I.: Intersectionlink representations of graphs. J. Graph Algorithms Appl. 21(4), 731–755 (2017), doi:10.7155/jgaa.00437
 [9] Angelini, P., Da Lozzo, G., Di Battista, G., Frati, F., Roselli, V.: The importance of being proper (in clusteredlevel planarity and Tlevel planarity). Theoretical Computer Science 571, 1–9 (2015), doi:10.1016/j.tcs.2014.12.019
 [10] Angelini, P., Di Battista, G., Frati, F., Patrignani, M., Rutter, I.: Testing the simultaneous embeddability of two graphs whose intersection is a biconnected or a connected graph. J. Discrete Algorithms 14, 150–172 (2012), doi:10.1016/j.jda.2011.12.015
 [11] Angelini, P., Frati, F., Kaufmann, M.: Straightline rectangular drawings of clustered graphs. Discrete Comput. Geom. 45(1), 88–140 (2011), doi:10.1007/s004540109302z
 [12] Angelini, P., Frati, F., Patrignani, M.: Splitting clusters to get cplanarity. In: Eppstein, D., Gansner, E.R. (eds.) GD 2009. LNCS, vol. 5849, pp. 57–68 (2010), doi:10.1007/9783642118050_8
 [13] Batagelj, V., Brandenburg, F.J., Didimo, W., Liotta, G., Palladino, P., Patrignani, M.: Visual analysis of large graphs using (X,Y)clustering and hybrid visualizations. IEEE Trans. Visual. Comput. Graphics 17(11), 1587–1598 (2011), doi:10.1109/TVCG.2010.265
 [14] Bläsius, T., Rutter, I.: A new perspective on clustered planarity as a combinatorial embedding problem. Theor. Comput. Sci. 609, 306–315 (2016), 10.1016/j.tcs.2015.10.011
 [15] Candela, M., Di Bartolomeo, M., Di Battista, G., Squarcella, C.: Radian: Visual exploration of traceroutes. IEEE Trans. Visual. Comput. Graphics 24, 2194–2208 (2018), doi:10.1109/TVCG.2017.2716937
 [16] Chimani, M., Di Battista, G., Frati, F., Klein, K.: Advances on testing cplanarity of embedded flat clustered graphs. In: Duncan, C., Symvonis, A. (eds.) GD 2014. Lecture Notes in Computer Science, vol. 8871, pp. 416–427 (2014)
 [17] Cornelsen, S., Wagner, D.: Completely connected clustered graphs. J. Discrete Algorithms 4(2), 313–323 (2006), doi:10.1016/j.jda.2005.06.002
 [18] Cortese, P.F., Di Battista, G.: Clustered planarity (invited lecture). In: SoCG 05. pp. 30–32. ACM (2005)
 [19] Cortese, P.F., Di Battista, G., Frati, F., Patrignani, M., Pizzonia, M.: Cplanarity of cconnected clustered graphs. J. Graph Algorithms Appl. 12(2), 225–262 (2008)
 [20] Cortese, P.F., Di Battista, G., Patrignani, M., Pizzonia, M.: Clustering cycles into cycles of clusters. J. Graph Algorithms Appl. 9(3), 391–413 (2005)
 [21] Cortese, P.F., Di Battista, G., Patrignani, M., Pizzonia, M.: On embedding a cycle in a plane graph. Discrete Mathematics 309(7), 1856–1869 (2009), doi:10.1016/j.disc.2007.12.090
 [22] Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M.: Computing NodeTrix representations of clustered graphs. In: Nöllenburg, M., Hu, Y. (eds.) GD 2016. LNCS, vol. 9801, pp. 107–120 (2016), doi:10.1007/9783319501062_9
 [23] Da Lozzo, G., Di Battista, G., Frati, F., Patrignani, M.: Computing NodeTrix representations of clustered graphs. J. Graph Algorithms Appl. 22(2), 139–176 (2018)
 [24] Da Lozzo, G., Eppstein, D., Goodrich, M.T., Gupta, S.: Subexponentialtime and FPT algorithms for embedded flat clustered planarity. In: WG 2018 (2018), to appear
 [25] Dahlhaus, E.: A linear time algorithm to recognize clustered graphs and its parallelization. In: Lucchesi, C.L., Moura, A.V. (eds.) LATIN 1998. LNCS, vol. 1380, pp. 239–248. Springer (1998)
 [26] Di Battista, G., Didimo, W., Marcandalli, A.: Planarization of clustered graphs. In: Mutzel, P., Juenger, M., Leipert, S. (eds.) GD 2001. LNCS, vol. 2265, pp. 60–74 (2002)
 [27] Di Battista, G., Drovandi, G., Frati, F.: How to draw a clustered tree. J. Discrete Algorithms 7(4), 479–499 (Dec 2009), doi:10.1016/j.jda.2008.09.015
 [28] Di Battista, G., Frati, F.: Efficient cplanarity testing for embedded flat clustered graphs with small faces. J. Graph Algorithms Appl. 13(3), 349–378 (2009)
 [29] Di Giacomo, E., Didimo, W., Liotta, G., Palladino, P.: Visual analysis of onetomany matched graphs. J. Graph Algorithms Appl. 14(1), 97–119 (2010)
 [30] Di Giacomo, E., Liotta, G., Patrignani, M., Tappini, A.: NodeTrix planarity testing with small clusters. In: Frati, F., Ma, K. (eds.) GD 2017. pp. 479–491. LNCS (2017), doi:10.1007/9783319739151_37
 [31] Eades, P., Feng, Q.: Multilevel visualization of clustered graphs. In: North, S.C. (ed.) GD 1996. LNCS, vol. 1190, pp. 101–112. Springer (1996), doi:10.1007/3540624953_41
 [32] Eades, P., Feng, Q., Lin, X., Nagamochi, H.: Straightline drawing algorithms for hierarchical graphs and clustered graphs. Algorithmica 44(1), 1–32 (2006), doi:10.1007/s0045300411448
 [33] Eades, P., Feng, Q., Nagamochi, H.: Drawing clustered graphs on an orthogonal grid. J. Graph Algorithms Appl. 3(4), 3–29 (1999), doi:10.7155/jgaa.00016
 [34] Eades, P., Huang, M.L.: Navigating clustered graphs using forcedirected methods. J. Graph Algorithms Appl. 4(3), 157–181 (2000), doi:10.7155/jgaa.00029
 [35] Feng, Q., Cohen, R.F., Eades, P.: Planarity for clustered graphs. In: Spirakis, P.G. (ed.) ESA 1995. LNCS, vol. 979, pp. 213–226. Springer (1995), doi:10.1007/3540603131_145
 [36] Frati, F.: Multilayer drawings of clustered graphs. J. Graph Algorithms Appl. 18(5), 633–675 (2014), doi:10.7155/jgaa.00340
 [37] Frati, F.: Clustered graph drawing. In: Kao, M.Y. (ed.) Encyclopedia of Algorithms, 2nd Edition, pp. 1–6. Springer Science+Business Media New York (2015), doi:10.1007/9783642278488_6551
 [38] Fulek, R.: Cplanarity of embedded cyclic cgraphs. Comput. Geom. 66, 1–13 (2017), doi:10.1016/j.comgeo.2017.06.016
 [39] Fulek, R.: Embedding graphs into embedded graphs. In: Okamoto, Y., Tokuyama, T. (eds.) ISAAC 2017. LIPIcs, vol. 92, pp. 34:1–34:12 (2017), doi:10.4230/LIPIcs.ISAAC.2017.34
 [40] Fulek, R., Kynčl, J.: Hanani–Tutte for approximating maps of graphs. In: Speckmann, B., Tóth, C.D. (eds.) SoCG 18. pp. 39:1–39:15. LIPIcs (2018), doi:10.4230/LIPIcs.SoCG.2018.39
 [41] Fulek, R., Kynčl, J., Malinović, I., Pálvölgyi, D.: Clustered planarity testing revisited. Electr. J. Comb. 22(4) (2015), http://www.combinatorics.org/ojs/index.php/eljc/article/view/v22i4p24, paper P4.24
 [42] Goodrich, M.T., Lueker, G.S., Sun, J.Z.: Cplanarity of extrovert clustered graphs. In: Healy, P., Nikolov, N.S. (eds.) GD 2005. LNCS, vol. 3843, pp. 211–222. Springer (2006), doi:10.1007/11618058_20
 [43] Gutwenger, C., Jünger, M., Leipert, S., Mutzel, P., Percan, M., Weiskircher, R.: Advances in cplanarity testing of clustered graphs. In: Kobourov, S.G., Goodrich, M.T. (eds.) GD 2002. LNCS, vol. 2528, pp. 220–235. Springer (2002), doi:10.1007/3540361510_21
 [44] Gutwenger, C., Mutzel, P., Schaefer, M.: Practical experience with HananiTutte for testing cplanarity. In: McGeoch, C.C., Meyer, U. (eds.) ALENEX 2014. pp. 86–97. SIAM (2014), doi:10.1137/1.9781611973198.9
 [45] Henry, N., Fekete, J., McGuffin, M.J.: NodeTrix: a hybrid visualization of social networks. IEEE Trans. Vis. Comput. Graph. 13(6), 1302–1309 (2007)
 [46] Hong, S.H., Nagamochi, H.: Twopage book embedding and clustered graph planarity. Tech. Report 2009004, Department of Applied Mathematics & Physics, University of Kyoto, Japan (2009)
 [47] Itoh, T., Muelder, C., Ma, K., Sese, J.: A hybrid spacefilling and forcedirected layout method for visualizing multiplecategory graphs. In: Eades, P., Ertl, T., Shen, H. (eds.) IEEE PacificVis 2009. pp. 121–128 (2009)
 [48] Jelínek, V., Jelínková, E., Kratochvíl, J., Lidický, B.: Clustered planarity: Embedded clustered graphs with twocomponent clusters. In: Tollis, I.G., Patrignani, M. (eds.) GD 2008. LNCS, vol. 5417, pp. 121–132. Springer (2008), doi:10.1007/9783642002199_13
 [49] Jelínek, V., Suchý, O., Tesar, M., Vyskocil, T.: Clustered planarity: Clusters with few outgoing edges. In: Tollis, I.G., Patrignani, M. (eds.) GD 2008. LNCS, vol. 5417, pp. 102–113 (2009)
 [50] Jelínková, E., Kára, J., Kratochvíl, J., Pergel, M., Suchý, O., Vyskocil, T.: Clustered planarity: Small clusters in cycles and eulerian graphs. J. Graph Algorithms Appl. 13(3), 379–422 (2009), doi:10.7155/jgaa.00192
 [51] Sander, G.: Visualisierungstechniken für den compilerbau. PhD Thesis, Universität Saarbrücken, Germany (1996)
 [52] Schaefer, M.: Toward a theory of planarity: HananiTutte and planarity variants. J. Graph Algorithms Appl. 17(4), 367–440 (2013), doi:10.7155/jgaa.00298
 [53] Zhao, S., McGuffin, M.J., Chignell, M.H.: Elastic hierarchies: Combining treemaps and nodelink diagrams. In: Stasko, J.T., Ward, M.O. (eds.) IEEE InfoVis 2005. p. 8 (2005), doi:10.1109/INFOVIS.2005.12
Appendix Appendix A – Proof of Lemmas 1 and 2 of Section 2.
Lemma 1. A homogeneous tree of height and size contains at least one node such that is flat.
Proof
Let be a leaf of whose depth is . Since , is not flat and . Consider the parent of the parent of . The subtree of has . Since is homogeneous and has a nonleaf child , all the children of are internal nodes. Hence, is flat.
Lemma 2. An instance of Clustered Planarity with vertices and clusters can be reduced in time to an equivalent instance such that:

is homogeneous,

has at least two children, and

.
Proof
First we prove Property (1). Suppose that the inclusion tree of a cgraph is not homogeneous. We transform into an equivalent cgraph such that is homogeneous. Consider a node that has both internal node children and leaf children , , …, . For each such and for each child of , we insert between and a lower node that is child of and parent of . The obtained cgraph is homogeneous and may be constructed in time . Also, given a cplanar drawing of one can immediately obtain a cplanar drawing of simply by ignoring the boundaries of the regions , where is a cluster introduced by the above described transformation. Conversely, given a cplanar drawing of one can obtain a cplanar drawing of by inserting a small boundary around the vertices that changed their parent in the above transformation. Hence, is cplanar if and only if is cplanar.
Finally, we prove Properties (2) and (3). Suppose to have an instance with or such that has a single child. We traverse and recursively replace each cluster that has a single child with its child. The obtained instance is equivalent to original one since from a cplanar drawing of one can obtain a cplanar drawing of simply by ignoring the boundaries of the removed clusters and from a cplanar drawing of one can obtain a cplanar drawing of by suitably adding the boundary of each removed parent cluster around the boundary of its child cluster (or around the child vertex leaf). Since all clusters of have at least two children Property (2) is satisfied. We claim that . In fact, since all the internal nodes of have degree at least two, we have that the number of leaves of is at least . Hence, . This proves Property (3).
Appendix Appendix B – Proofs of Lemmas 3–6 of Section 3.
Let be a flat cplanar cgraph and let be a node of such that is flat. Denote by the children of and by , , …, the siblings of in . Let be the flat cgraph constructed as described in Section 3. We prove the following lemmas.
Lemma 3. If is homogeneous then is homogeneous.
Proof
Suppose is homogeneous. The only part of that is changed in is the subtree . In particular, has all cluster children, while the newly introduced clusters and have all vertex children. Hence is homogeneous.
Lemma 4. We have that .
Proof
Consider a node of for which . Since the transformation of into only reduces the height of some subtree of , such a node was also the root of a subtree of height greater than in . Conversely, consider a node of for which . If then is not present in , otherwise it is still the root of a subtree of height greater than one in . Hence, the number of nodes that are root of subtrees of height greater than one of is reduced by one with respect to the same number in .
Lemma 5. The cgraph is flat.
Proof
Now, we provide the proof of Lemma 6 in the general case, i.e., without leveraging on Hypotheses conn and notroot.
Lemma 6. is cplanar if and only if is cplanar.
Proof
The first direction of the proof is straightforward. Let be a cplanar drawing of . We show how to construct a cplanar drawing of . Consider the region that contains , with (refer to Fig. 3). The boundary of is crossed exactly once by each intercluster edge of . Identify outside the boundary of two arbitrarily thin regions and that follow the boundary of and that intersect all and only the intercluster edges of exactly once (see Fig. 3). Insert into each intercluster edge of two vertices and , placing inside and inside . By ignoring you have a cplanar drawing of .
Conversely, suppose to have a cplanar drawing of . We show how to construct a cplanar drawing of . Consider the regions and inside (refer to Fig. 8). Regions and are joined by the intercluster edges (drawn red in Fig. 8) introduced when replacing each intercluster edge of , where , with a path. Such intercluster edges of and partition into regions that have to host the remaining children of and the intercluster edges among them. In particular, of these regions are simple and bounded by two intercluster edges and two portions of the boundaries of and . One of such regions, instead, is also externally bounded by the boundary of .
Now, consider the regions corresponding to the children of , with , that were originally children of . These regions (filled white in Fig. 8) may be without any intercluster edge (as, for example, in Fig. 8); may have intercluster edges among themselves (as, for example, , , , , , , and in Fig. 8); and may be connected to (as, for example, , , , , , , , , and in Fig. 8). However, by construction these regions cannot have intercluster edges connecting them to , or connecting them to the regions of the original children of , or exiting the border of . Hence, the regions corresponding to , …,
can be classified into two sets, denoted
and , of ‘anchored regions’ and ‘floating regions’ of , respectively, where an anchored region of is a region whose cluster contains at least one vertex of that is connected (via a path) to a vertex in and a floating region of is a region whose cluster contains all vertices not connected to vertices in . For example, in Fig. 8, contains , , and , while contains all the other whitefilled regions.Analogously, consider the regions , with , corresponding to the original children of (filled gray in Fig. 8). These regions may be without any intercluster edge (as, for example, , , and in Fig. 8); may have intercluster edges among themselves (as, for example, , , , , , , and in Fig. 8); may have intercluster edges connecting them to (as, for example, , , , , , , and in Fig. 8); or may have intercluster edges connecting them the rest of the graph outside (as, for example, in Fig. 8). However, by construction these regions cannot have intercluster edges connecting them to , or connecting them to the the regions in or . Hence, we can classify the regions corresponding to , …, into two sets, denoted and , of ‘anchored regions’ and ‘floating regions’ of , where an anchored region of is a region whose cluster contains at least one vertex of that is connected to a vertex in or to a vertex outside and a floating region of is a region whose cluster contains all vertices not connected to vertices in nor outside . For example, in Fig. 8, set contains , , , , and , while contains all the other grayfilled regions.
Our strategy will be that of removing altogether from the drawings of the floating regions (and all their content), possibly modifying the drawing of the remaining graph, and then suitably reinserting the drawing of the floating regions.
Suppose now to have temporarily removed from the drawings of the floating regions in and (see, for example, Fig. 8).
We define an auxiliary multigraph that has one vertex representing and one vertex for each child of such that . For each intercluster edge between two clusters and corresponding to the vertices and of , respectively, we add an edge to . Observe that , by the definition of the anchored regions in , is connected.
Drawing induces a drawing of the multigraph , where each vertex of is represented by the region of the cluster corresponding to and each edge of is represented as the corresponding intercluster edge of and restricted to the portion that is drawn outside the boundaries of and .
There are two cases: either does not contain in one of its internal faces (Case 1, depicted in Fig. 8) or it contains (Case 2, depicted in Fig. 9).
In Case 1 no change has to be done to . In Case 2 we modify and, consequently, so to fall again into Case 1. Namely, we identify a minimal set of edges of that, if removed, would bring on the external face of (for example in Fig 9 this set contains only edge ). Starting from edge , that is incident to the external face of , we redraw each , with , as follows. Suppose that the curve for in starts from a point on the boundary of and ends with a point on the boundary of . We arbitrarily choose two distinct points and , encountered in this order when traversing from to . We remove the portion of between and and we redraw it by returning back from towards on the external face of and then moving along the external face of until we reach (see, for example, Fig. 9). Observe that this corresponds to moving the external face of to a face that was previously an internal face of enclosed by . We carry on doing the same operation for each , with , until the external face of is incident on the boundary of . At this point we are in Case 1.
Observe that since does not contain in one of its internal faces , then it cannot contain any region in either, as, by definition, these regions are either connected to or to the boundary of . Hence, the internal faces of only contain vertices and edges that in belong to .
Now we reinsert the drawings of the floating regions. We identify an arbitrarily small empty disk inside and move inside the (suitably scaled down) drawings of the floating regions in . Analogously, we identify an arbitrarily small empty disk inside and move inside the (suitably scaled down) drawings of the floating regions in . Consider the region that is the region covered by . Such a region is connected, is simple, contains only vertices and nodes of , and its boundary is a simple curve (see Fig. 9). Therefore, by neglecting the boundaries of and and by removing their internal vertices and joining their incident edges we obtain a cplanar drawing of .
Appendix Appendix C – Proof of Theorems 4.2 and 4.4 of Section 4.
Theorem 4.2. Let be an nvertex cgraph where has a fixed embedding. There exists an time algorithm to test the cplanarity of if each lower cluster has at most two vertices on the same face of and each higher cluster has at most two intercluster edges on the same face of .
Proof
The proof is based on showing that, starting from a cgraph that satisfies the hypotheses of the statement, the equivalent flat cgraph built as described in the proof of Theorem 1.1 satisfies the hypotheses of Theorem 4.1. By Property 1 of Lemma 2 we can assume that is homogeneous. Observe that the transformation of into an homogeneous tree described in the proof of Lemma 2 only introduces lower clusters that contain a single vertex and, hence, preserves the property that each higher cluster has at most two intercluster edges incident to the same face.
The transformation of into described in the proof of Theorem 1.1 removes one higher cluster and introduces two lower clusters and . Each intercluster edge of is subdivided into three edges , , and , where and . Since at most two intercluster edges of belong to the same face of we have that the lower clusters and have at most two vertices on the same face of . Any other higher or lower cluster of is not modified by the transformation. It follows that , which, with the exception of the root cluster, has only lower clusters, satisfies the conditions of Theorem 4.1.
Theorem 4.4. Clustered Planarity can be solved in time for nvertex embedded cgraphs with maximum face size and height of the inclusion tree.
Proof
The proof is based on applying Theorem 4.3 to the flat cgraph built as described in the proof of Theorem 1.1 and equivalent to . By Property 2 of Lemma 7 each edge of is replaced by a path of length at most . Hence, each face of has a maximum size . Also, by Property 3 of Lemma 7 we have that the number of vertices of is . Theorem 4.3 guarantees that we can test for cplanarity in time, which gives the statement.
Appendix Appendix D – Proof of Lemma 8 of Section 5.
In this section, we provide the proof of Lemma 8 in the general case, i.e., without leveraging on Hypothesis conn. Let be a flat cplanar cgraph and let be a nonindependent cluster of containing vertices , , …, of . Also, denote by , with , those children of such that . Let be the flat cgraph constructed as described in Section 5. We have the following.
Lemma 8. is cplanar if and only if is cplanar.
Proof
The proof is similar to the proof of Lemma 6. Given a cplanar drawing of the flat cgraph , we show how to construct a cplanar drawing of (refer to Fig. 7). The construction is based on identifying two arbitrary thin regions and outside the border of such that and intersect exactly once all and only the intercluster edges of . By ignoring , by inserting for each intercluster edge of vertices and in and , respectively, and by adding a boundary to each vertex , …, , we obtain .