Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

1 Introduction

In several applications there is the need to represent graphs that are globally sparse but contain dense subgraphs. As an example, a social network is often composed of communities, whose members are closely interlinked, connected by a network of relationships that are much less dense. The visualization of such networks poses challenges that are attracting the study of several researchers (see, e.g., [6, 11]). One frequent approach is to rely on clustering techniques to collapse dense subgraphs and then represent only the links between clusters. However, this has the drawback of hiding part of the graph structure. Another approach that has been explored is the use of hybrid drawing standards, where different conventions are used to represent the dense and the sparse portions of the graph: In the drawing standard introduced in [4, 12] each dense part is represented by an adjacency matrix while two adjacent dense parts are connected by a curve.

In this paper we study intersection-link representations, which are hybrid representations where in the dense parts of the graph the edges are represented by the intersection of geometric objects (intersection representation) and in the sparse parts the edges are represented by curves (link representation). More formally and more specifically, we introduce the following problem. Suppose that a pair (GS) is given where G is a graph and S is a set of cliques that partition the vertex set of G. In an intersection-link representation, vertices are geometric objects that are translates of the same rectangle. Consider an edge (uv) and let R(u) and R(v) be the rectangles representing u and v, respectively. If (uv) is part of a clique (intersection-edge) we represent it by drawing R(u) and R(v) so that they intersect, else (link-edge) we represent it by a curve connecting R(u) and R(v); see Fig. 1.

Fig. 1.
figure 1

Intersection-link representation of a graph with five cliques.

We study the Clique Planarity problem that asks to test whether a pair (GS) has an intersection-link representation such that link-edges do not cross each other and do not traverse any rectangle. The main challenge of the problem lies in the interplay between the geometric constraints imposed by the rectangle arrangements and the topological constraints imposed by the link edges.

Several problems are related to Clique Planarity; here we mention two notable ones. The problem of recognizing intersection graphs of translates of the same rectangle is \(\mathcal {NP}\)-complete  [7]. Note that this does not imply \(\mathcal {NP}\)-hardness for our problem, since cliques always have such a representation. Map graphs allow to represent graphs containing large cliques in a readable way; they are contact graphs of internally-disjoint connected regions of the plane, where the contact can be even a single point. The recognition of map graphs has been studied in [8, 15]. One can argue that there are graphs that admit a clique-planar representation, while not admitting any representation as a map graph, and vice versa.

We now describe our contribution. Our study encountered several interesting and at a first glance unrelated theoretical problems. In more detail, our results are as follows.

  • In Sect. 3 we show that Clique Planarity is \(\mathcal {NP}\)-complete even if S contains just one clique with more than one vertex. This result is established by observing a relationship between Clique Planarity and a natural constrained version of the Clustered Planarity problem, in which we ask whether a path (rather than a tree as in the usual Clustered Planarity problem) can be added to each cluster to make it connected while preserving clustered planarity; we prove this problem to be \(\mathcal {NP}\)-complete, a result which might be interesting in its own right.

  • In Sect. 4, we show how to decide Clique Planarity in linear time in the case in which each clique has a prescribed geometric representation, via a reduction to the problem of testing planarity for a graph with a given partial representation.

  • In Sect. 5, we concentrate on instances of Clique Planarity composed of two cliques. While we are unable to settle the complexity of this case, we show that the problem becomes equivalent to an interesting variant of the 2-Page Book Embedding problem, in which the graph is bipartite and the vertex ordering in the book embedding has to respect the vertex partition of the graph. This problem is in our opinion worthy of future research efforts. For now, we use this equivalence to establish a polynomial-time algorithm for the case in which the link-edges are assigned to the pages of the book embedding.

  • In Sect. 6, we study a Sugiyama-style problem where the cliques are arranged on levels according to a hierarchy. In this practical setting we show that Clique Planarity is solvable in polynomial time. This is achieved via a reduction to the T -level planarity problem [3].

Conclusions and open problems are presented in Sect. 7. Because of space limitations, complete proofs are deferred to the full version of the paper [2].

2 Intersection-Link Model

Let G be a graph and S be a set of cliques inducing a partition of the vertex set of G. In an intersection-link representation of (GS): (i) each vertex u is a translate R(u) of an axis-aligned rectangle \(\mathcal R\); (ii) R(u) and R(v) intersect if and only if edge (uv) is an intersection-edge; and (iii) each link-edge (uv) is a curve connecting the boundaries of R(u) and R(v). To avoid degenerate intersections we assume that no two rectangles have their sides on the same line. The Clique Planarity problem asks whether an intersection-link representation of a pair (GS) exists such that no two curves intersect and no curve intersects the interior of a rectangle. Such a representation is called clique-planar. A pair (GS) is clique-planar if it admits a clique-planar representation. Let \(\varGamma \) be an intersection-link representation of \((K_n,\{K_n\})\). We have the following.

Lemma 1

Traversing the outer boundary B of \(\varGamma \) clockwise, the sequence of encountered rectangles is a subset of \(R(u_1),R(u_2),\) \(\dots ,R(u_n),R(u_{n-1}),\dots ,\) \(R(u_2)\), for some permutation \(u_1,\dots ,u_n\) of the vertices of \(K_n\).

Proof sketch: The statement follows from the following claims: (a) the sequence of encountered rectangles is not of the form \(\dots ,R(u),\dots ,R(v), \dots , R(u), \dots , R(v)\), for any \(u,v\in K_n\); (b) every maximal portion of B belonging to a single rectangle R(u) contains (at least) one corner of R(u); (c) if two adjacent corners of the same rectangle R(u) both belong to B, then the entire side of R(u) between them belongs to B; and (d) any rectangle R(u) does not define three distinct maximal portions of B.    \(\square \)

The following lemma allows us to focus, without loss of generality, on special clique-planar representations, which we call canonical.

Lemma 2

Let (GS) admit a clique-planar representation \(\varGamma \). There exists a clique-planar representation \(\varGamma '\) of (GS) such that: (i) each vertex is represented by an axis-aligned unit square and (ii) for each clique \(s \in S\), all the squares representing vertices in s have their upper-left corners along a common line with slope 1.

Proof sketch: Initialize \(\varGamma '=\varGamma \). Scale \(\varGamma '\) so that each rectangle has both sides of length larger than 2. For any clique \(s \in S\), traverse the boundary of the rectangle arrangement representing s in \(\varGamma \) clockwise. By Lemma 1, the circular sequence of encountered rectangles is of the form \(R(u_1),\dots ,R(u_{|s|}),R(u_{|s|-1}),\dots ,R(u_2)\), for some permutation \(u_1,\dots ,u_{|s|}\) of the vertices of s. Place pairwise-intersecting unit squares \(Q(u_1),\dots , Q(u_{|s|})\) representing \(u_1,\dots ,u_{|s|}\) in the interior of \(R(u_1)\), as required by the lemma. Remove \(R(u_1),\dots ,R(u_{|s|})\) and reroute the curves representing link-edges from the border of the rectangle arrangement to the suitable ending squares. This can be done without introducing any crossings, because the circular sequence of the squares encountered when traversing the boundary of the square arrangement clockwise is \(Q(u_1),\dots ,Q(u_{|s|}),Q(u_{|s|-1}),\dots ,Q(u_2)\).    \(\square \)

3 Hardness Results on Clique Planarity

In this section we prove that the Clique Planarity problem is not solvable in polynomial time, unless \(\mathcal{P}\)=\(\mathcal {NP}\). In fact, we have the following.

Theorem 1

It is \(\mathcal {NP}\)-complete to decide whether a pair (GS) is clique-planar, even if S contains just one clique with more than one vertex.

We prove Theorem 1 by showing a reduction from a constrained clustered planarity problem, which we prove to be \(\mathcal {NP}\)-complete, to the Clique Planarity problem.

A clustered graph (GT) is a pair where G is a graph and T is a rooted tree whose leaves are the vertices of G; the internal nodes of T distinct from the root correspond to subsets of vertices of G, called clusters. A clustered graph is flat if every cluster is a child of the root. A c-planar drawing of (GT) is a planar drawing of G, together with a representation of each cluster \(\mu \) as a simple region \(R_\mu \) of the plane such that: (i) every region \(R_\mu \) contains all and only the vertices in \(\mu \); (ii) every two regions \(R_\mu \) and \(R_\nu \) are either disjoint or one contains the other; and (iii) every edge intersects the boundary of each region \(R_\mu \) at most once. A graph is c-planar if it admits a c-planar drawing. The clustered planarity problem asks whether a given clustered graph is c-planar. Polynomial-time algorithms for testing c-planarity are known only in special cases, most notably, for c-connected clustered graphs, in which each cluster induces a connected graph [9, 10]. A clustered graph is c-planar if and only if a set of edges can be added to it so that the resulting graph is c-planar and c-connected [10]. Any such set of edges is a saturator, and the subset of a saturator composed of the edges between vertices of the same cluster \(\mu \) defines a saturator for \(\mu \). A saturator is linear if the saturator for each cluster is a path. The Clustered Planarity with Linear Saturators (cpls) problem asks whether a flat clustered graph such that each cluster induces an independent set of vertices admits a linear saturator.

Lemma 3

Let (GT) be an instance of cpls with \(G=(V,E)\) and let \(E^\star \subseteq \left( {\begin{array}{c}V\\ 2\end{array}}\right) \setminus E\) be such that in \(G^\star = (V,E \cup E^\star )\) every cluster induces a path. Then \(E^\star \) is a linear saturator for (GT) if and only if \(G^\star \) is planar.

The following lemma connects the problem Clique Planarity with cpls.

Lemma 4

Given an instance (GT) of the cpls problem, an equivalent instance \((G',S)\) of the Clique Planarity problem can be constructed in linear time.

Proof sketch: Initialize \(G'=G\). Then, for each cluster \(\mu \) of (GT), add a clique \(s_{\mu }\) on the vertex set of \(\mu \) to \((G',S)\). Clearly, \((G',S)\) can be constructed in linear time. We now prove the equivalence between (GT) and \((G',S)\).

If (GT) admits a linear saturator \(E^*\), then there exists a c-planar drawing \(\varGamma ^\star \) of \((G^\star ,T)\), where \(G^\star \) is obtained by adding \(E^*\) to G. We construct a clique-planar representation of \((G',S)\) as follows. For each cluster \(\mu \), replace the interior of the region representing \(\mu \) in \(\varGamma ^\star \) with a set of \(|s_{\mu }|\) pairwise-intersecting axis-aligned unit squares, where the order of such squares is the same as the one of the corresponding vertices in the linear saturator for \(\mu \); complete the drawing of each link-edge (uv) of \(G'\) with curves from the squares representing u and v to the boundaries of the regions representing the clusters containing u and v. The correspondence between the order of the squares and the order of the vertices in \(E^*\) guarantees the absence of crossings.

If \((G',S)\) has a clique-planar representation \(\varGamma \), which we can assume to be canonical by Lemma 2, then we define a set \(E^\star \) as follows. For each \(s\in S\), we add to \(E^\star \) the edges of path \((u_1,\dots ,u_k)\) on the vertex set of s, where the unit squares \(R(u_1),\dots ,R(u_k)\) are in this order in their arrangement in \(\varGamma \). We claim that \(E^\star \) is a linear saturator for (GT). By Lemma 3, it suffices to show that \(G+E^\star \) admits a planar drawing: Starting from \(\varGamma \), we place each vertex v at the center of R(v), replace R(v) with straight-line segments from v to the endpoints of its incident link-edges, and draw the edges of \(E^\star \) as straight-line segments. This does not produce crossings. In particular, any two straight-line segments not in \(E^\star \) incident to vertices u and v in the same clique are separated by the line through the intersection points of the boundaries of R(u) and R(v), as in Fig. 2(a). Further, any segment (uv) in \(E^\star \) and any segment not in \(E^\star \) incident to a vertex w in the same clique as u and v are separated by the line through the intersection points of the boundaries of R(u) and R(w) or of R(v) and R(w), as in Fig. 2(b).    \(\square \)

Fig. 2.
figure 2

(a)–(b) Construction of a linear saturator from a clique-planar representation. (c) A biconnected planar graph G with a Hamiltonian path P. (d) The clustered graph \((G',T)\) obtained from G and the linear saturator for \((G',T)\) corresponding to P.

Next, we prove that the cpls problem is \(\mathcal {NP}\)-complete.

Theorem 2

The cpls problem is \(\mathcal {NP}\)-complete, even for instances in which just one cluster contains more than one vertex.

Proof sketch: The problem clearly lies in \(\mathcal {NP}\). We give a polynomial-time reduction from the Hamiltonian Path problem in biconnected planar graphs [14]. Given an instance G of Hamiltonian Path, we construct an instance \((G',T)\) of cpls as follows. Assume G has an associated planar embedding. Initialize \(G'=G\), as in Fig. 2(c). Add a vertex \(v_f\) inside each face f and connect it to all the vertices incident to f (this results in a triangulated planar graph \(G'\)); then subdivide with a vertex each edge of \(G'\) which is also in G, as in Fig. 2(d). Finally, add a cluster \(\mu \) to T containing all the vertices of \(G'\) which are also in G and, for each of the remaining vertices, add to T a cluster containing only that vertex. Now, any Hamiltonian path \(P=(v_1,\dots ,v_n)\) in G can be drawn in \(G'\)without crossings by letting each edge \((v_i,v_{i+1})\) lie in one of the two faces of \(G'\) incident to the dummy vertex for edge \((v_i,v_{i+1})\). It follows from Lemma 3 that the edge set of P is a linear saturator for \((G',T)\). Conversely, any linear saturator for \((G',T)\) defines a path on the vertex set of \(\mu \), which is a Hamiltonian path in G.    \(\square \)

4 Clique-Planarity with Given Vertex Representations

In this section we show how to test Clique Planarity in linear time for instances (GS) with given vertex representations. That is, a clique-planar representation \(\varGamma '\) of \((G',S)\) is given, where \(G'\) is obtained from G by removing its link-edges, and the goal is to test whether the link-edges of (GS) can be drawn in \(\varGamma '\) to obtain a clique-planar representation of (GS). We start with a linear-time preprocessing in which we verify that every vertex of G incident to a link-edge is represented in \(\varGamma '\) by a rectangle incident to the outer boundary of the clique it belongs to. If the test fails, the instance is negative. Otherwise, we proceed as follows.

Fig. 3.
figure 3

(a) An intersection-link representation \(\varGamma \) of \((K_7,\{s=K_7\})\). (b) A simple cycle with a vertex for each maximal portion of the boundary of \(\varGamma \) belonging to a single rectangle. (c) Planar drawing \(\mathcal{H}'_s\) of graph \(H'_s\) corresponding to \(\varGamma \).

We show a reduction to the Partial Embedding Planarity problem [1], which asks whether a planar drawing of a graph H exists extending a given drawing \(\mathcal{H}'\) of a subgraph \(H'\) of H. First, we define a connected component \(H'_s\) of \(H'\) corresponding to a clique \(s\in S\) and its drawing \(\mathcal{H}'_s\). We remark that \(H'_s\) is a cactus graph, that is a connected graph that admits a planar embedding in which all the edges are incident to the outer face. Denote by B the boundary of the representation of s in \(\varGamma '\) (see Fig. 3(a)). If s has one or two vertices, then \(H'_s\) is a vertex or an edge, respectively (and \(\mathcal{H}'_s\) is any drawing of \(H'_s\)). Otherwise, initialize \(H'_s\) to a simple cycle containing a vertex for each maximal portion of B belonging to a single rectangle (see Fig. 3(b)). Let \(\mathcal{H}'_s\) be any planar drawing of \(H'_s\) with a suitable orientation. Each rectangle in \(\varGamma '\) may correspond to two vertices of \(H'_s\), but no more than two by Lemma 1. Insert an edge in \(H'_s\) between every two vertices representing the same rectangle and draw it in the interior of \(\mathcal{H}'_s\). By Lemma 1, these edges do not alter the planarity of \(\mathcal{H}'_s\). Contract the inserted edges in \(H'_s\) and \(\mathcal{H}'_s\) (see Fig. 3(c)). This completes the construction of \(H'_s\), together with its planar drawing \(\mathcal{H}'_s\). Graph \(H'\) is the union of graphs \(H'_s\), over all the cliques \(s\in S\); the drawings \(\mathcal{H}'_s\) of \(H'_s\) are in the outer face of each other in \(\mathcal{H}'\). Note that, because of the preprocessing, the endvertices of each link-edge of G are vertices of \(H'\); then we define H as the graph obtained from \(H'\) by adding, for each link-edge (uv) of G, an edge between the vertices of \(H'\) corresponding to u and v. We have the following:

Lemma 5

There exists a planar drawing of H extending \(\mathcal{H}'\) if and only if there exists a clique-planar representation of (GS) coinciding with \(\varGamma '\) when restricted to \((G',S)\).

Proof sketch: Let \(\mathcal H\) be a planar drawing of H extending \(\mathcal{H}'\). We construct a clique-planar representation of (GS) as follows: (i) for each \(s \in S\), enclose \(\mathcal{H}'_s\) with a closed polyline \(P_s\); (ii) scale \(\mathcal H\) so that the bounding box of the representation of s in \(\varGamma '\) fits inside \(P_s\); (iii) replace the interior of \(P_s\) with a copy of the representation of s in \(\varGamma '\); and (iv) reroute the link-edges from \(P_s\) to the suitable rectangles; this creates no crossing, because vertices along the outer face of \(\mathcal{H}'_s\) are in the same order as the corresponding rectangles along the boundary of the representation of s in \(\varGamma '\).

Let \(\varGamma \) be a clique-planar representation of (GS). We construct a planar drawing of H extending \(\mathcal{H}'\) as follows: (i) for each \(s \in S\), enclose the representation of s in \(\varGamma \) by a closed polyline \(P_s\); (ii) replace the interior of \(P_s\) with a scaled copy of \(\mathcal{H}'_s\); and (iii) reroute the curves representing link-edges from \(P_s\) to the suitable endvertices (as in the previous direction, this can be done without introducing crossings).    \(\square \)

We get the main theorem of this section.

Theorem 3

Clique Planarity can be decided in linear time for a pair (GS) if the rectangle representing each vertex of G is given as part of the input.

Proof

First, we check whether, for each \(s\in S\), all the rectangles representing vertices in s are pairwise intersecting. This can be done in O(|s|) time by computing the maximum x- and y-coordinates \(x_M\) and \(y_M\) among all bottom-left corners, the minimum x- and y-coordinates \(x_m\) and \(y_m\) among all top-right corners, and by checking whether \(x_M\) \(<\) \(x_m\) and \(y_M\) \(<\) \(y_m\). The described reduction to Partial Embedding Planarity can be performed in linear time by traversing the boundary B of each clique \(s\in S\); namely, as a consequence of Lemma 1, B has linear complexity. Contracting an edge requires merging the adjacency lists of its endvertices; this can be done in constant time since these vertices have constant degree, again by Lemma 1. Finally, the Partial Embedding Planarity problem can be solved in linear time [1].   \(\Box \)

5 Testing Clique Planarity for Graphs Composed of Two Cliques

In this section we study the Clique Planarity problem for pairs (GS) such that \(|S|=2\). Observe that, if \(|S|=1\), then the Clique Planarity problem is trivial, since in this case G is a clique with no link-edge, hence a clique-planar representation of (GS) can be easily constructed. The case in which \(|S|=2\) is already surprisingly non-trivial. Indeed, we could not determine the computational complexity of Clique Planarity in this case. However, we establish the equivalence between our problem and a book embedding problem whose study might be interesting in its own; by means of this equivalence we show a polynomial-time algorithm for a special version of the Clique Planarity problem. This book embedding problem is defined as follows.

A 2-page book embedding is a plane drawing of a graph where the vertices are cyclically arranged along a closed curve \(\ell \), called the spine, and each edge is drawn in one of the two regions of the plane delimited by \(\ell \). The 2-Page Book Embedding problem asks whether a 2-page book embedding exists for a given graph. This problem is \(\mathcal {NP}\)-complete  [16]. Now consider a bipartite graph \(G(V_1\cup V_2,E)\). A bipartite 2-page book embedding of G is a 2-page book embedding such that all vertices in \({{V_1}}\) occur consecutively along the spine (and all vertices in \({{V_2}}\) occur consecutively, as well). Finally, we define a bipartite 2-page book embedding with spine crossings (b2pbesc), as a bipartite 2-page book embedding in which edges are not restricted to lie in one of the two regions delimited by \(\ell \), but each of them might cross \(\ell \) once; these crossings are only allowed to happen in the two portions of \(\ell \) delimited by a vertex of \(V_1\) and a vertex of \(V_2\). We call the corresponding embedding problem Bipartite 2-Page Book Embedding with Spine Crossings (b2pbesc).

We now prove that b2pbesc is equivalent to Clique Planarity for instances (GS) such that \(|S|=2\). Consider any instance \((G',\{s_1,s_2\})\) of Clique Planarity. We define an instance \(G^{}({V_1^{}} \cup {V_2^{}}, E^{})\) of b2pbesc so that \(V_i\) is the vertex set of \(s_i\), for \(i=1,2\), and E is the set of link-edges of \(G'\). Conversely, given an instance \(G^{}({V_1^{}} \cup {V_2^{}}, E^{})\) of b2pbesc, an instance \((G',\{s_1,s_2\})\) of Clique Planarity can be constructed in which \(s_i\) is a clique on \(V_i\), for \(i=1,2\), and the set of link-edges of \(G'\) coincides with E. Since link-edges only connect vertices of different cliques and since each edge of E only connects a vertex of \(V_1\) to one of \(V_2\), each mapping generates a valid instance for the other problem. Also, these mappings define a bijection, hence the following lemma establishes the equivalence between the two problems.

Lemma 6

\((G',\{s_1,s_2\})\) is clique-planar if and only if \(G^{}({V_1^{}} \cup {V_2^{}}, E^{})\) admits a b2pbesc.

Proof sketch: Starting from a b2pbesc \(\mathcal B\) of G, draw disjoint closed curves \(\lambda _1\) and \(\lambda _2\) respectively containing the vertices in \(V_1\) and \(V_2\). Scale \(\mathcal B\) so that a square of size \(2 \times 2\) fits in the interiors of \(\lambda _1\) and \(\lambda _2\). Replace such interiors with canonical representations of \(s_1\) and \(s_2\) in which the order of the unit squares corresponds to the order of the vertices along \(\ell \). Each link-edge of \((G',S)\) is then composed of three curves: one is the portion of the corresponding edge of G outside \(\lambda _1\) and \(\lambda _2\), and two are curves from the boundaries of \(\lambda _1\) and \(\lambda _2\) to the suitable ending squares. This can be done without crossings as the unit squares are in the same order as the vertices along \(\ell \).

Fig. 4.
figure 4

Constructing a b2pbesc from a clique-planar representation.

Starting from a clique-planar representation of \((G',\{s_1,s_2\})\), construct a b2pbesc \(\mathcal B\) of G as follows. Refer to Fig. 4. By Lemma 1, the rectangles representing vertices \(u_1, \dots , u_k\in V_1\) appear along the boundary \(B_1\) of \(s_1\) in an order which is a subsequence of \(R(u_1), \dots , R(u_k), \dots , R(u_2)\). Draw a curve \(\ell _1\) between two points \(p_1^a\in R(u_1) \cap B_1\) and \(p_1^b\in R(u_k) \cap B_1\) entering \(R(u_1), \dots , R(u_k)\) in this order. Place \(u_i\) at the point where \(\ell _1\) enters \(R(u_i)\). Define \(\ell _2\), \(B_2\), \(p_2^a\) and \(p_2^b\), and draw the vertices of \(V_2\) analogously. Add to \(\mathcal B\) curves \(\ell _{12}\) and \(\ell _{21}\), not intersecting each other, not intersecting the same link-edge, each intersecting any link edge at most once, and connecting \(p_1^a\) to \(p_2^b\), and \(p_2^a\) to \(p_1^b\), respectively. Let \(\ell =\ell _1\cup \ell _2 \cup \ell _{12}\cup \ell _{21}\). The correspondence between the vertex ordering along \(\ell \) and the order of the rectangles along \(B_1\) and \(B_2\) allows us to extend the link-edges from \(B_1\) and \(B_2\) to the suitable vertices of G inside them. The vertices of \(V_1\) (of \(V_2\)) are consecutive along \(\ell \), since they lie on \(\ell _1\) (on \(\ell _2\)); also, each edge \(e \in E\) crosses \(\ell \) at most once, either on \(\ell _{12}\) or on \(\ell _{21}\). Hence, \(\mathcal B\) is a b2pbesc of G.    \(\square \)

We now consider a variant of the Clique Planarity problem for two cliques in which each clique is associated with a 2-partition of the link-edges incident to it, and the goal is to construct a clique-planar representation in which the link-edges in different sets of the partition exit the clique on “different sides”. This constraint corresponds to the variant of the 2-page book embedding problem, called Partitioned 2-page book embedding problem, in which the vertices are allowed to be arbitrarily permuted along the spine, while the edges are pre-assigned to the pages of the book [13].

Let \((G,S=\{s_1,s_2\})\) be an instance of Clique Planarity and let \(\{E^a_i, E^b_i\}\) be a partition of the link-edges incident to \(s_i\), with \(i \in \{1,2\}\). Consider an intersection-link representation \(\varGamma _i\) of \(s_i\) with outer boundary \(B_i\), let \(p_i\) be the bottom-left corner of the leftmost rectangle in \(\varGamma _i\), and let \(q_i\) be the upper-right corner of the rightmost rectangle in \(\varGamma _i\). Let \(B^a_i\) (\(B^b_i\)) be the part of \(B_i\) from \(p_i\) to \(q_i\) (from \(q_i\) to \(p_i\)) in clockwise direction; this is the top side (the bottom side) of \(\varGamma _i\). We aim to construct a clique-planar representation of (GS) in which all the link-edges in \(E^a_i\) (resp. in \(E^b_i\)) intersect the arrangement of rectangles representing \(s_i\) on its top side (resp. bottom side). We call the problem of determining whether such a representation exists 2-Partitioned Clique Planarity. We prove that 2-Partitioned Clique Planarity can be solved in quadratic time. The algorithm is based on a reduction to equivalent instances of Simultaneous Embedding with Fixed Edges (sefe) that can be decided in quadratic time. Given two graphs \({{G^{}_1}}\) and \({{G^{}_2}}\) on the same vertex set V, the sefe problem asks to find planar drawings of \(G_1\) and \(G_2\) that coincide on V and on the common edges of \({{G^{}_1}}\) and \({{G^{}_2}}\).

Lemma 7

Let \((G,\{s_1,s_2\})\) and \(\{E^a_1, E^b_1,E^a_2, E^b_2\}\) be an instance of 2-Partitioned Clique Planarity. An equivalent instance \(\langle {{G^{}_1}},{{G^{}_2}}\rangle \) of sefe such that \({{G_1}}=(V,{{E_1}})\) and \({{G_2}}=(V,{{E_2}})\) are 2-connected and such that the common graph \(G_\cap = (V,{{E_1}}\cap {{E_2}})\) is connected can be constructed in linear time.

Proof sketch: By Lemma 6, we can describe \((G,\{s_1,s_2\})\) by its equivalent instance \(G^{}({V_1^{}} \cup {V_2^{}}, E^{})\) of b2pbesc, where \(V_i\) is the vertex set of \(s_i\), for \(i=1,2\), and E is the set of link-edges of \((G,\{s_1,s_2\})\); partition \(\{E^a_i, E^b_i\}\) translates to constraints on the side of the spine \(\ell \) each of these edges has to be incident to. Namely, for each \(u_i \in V_1\), all the edges in \(E^a_1\) (in \(E^b_1\)) incident to \(u_i\) have to exit \(u_i\) from the internal (resp. external) side of \(\ell \); and analogously for the edges of \(E^a_2\) and \(E^b_2\). Hence, the edges in \(E^a_1 \cap E^a_2\) (in \(E^b_1 \cap E^b_2\)) lie in the internal (resp. external) side of \(\ell \), while the other edges cross \(\ell \).

Fig. 5.
figure 5

The SEFE \(\langle {{\varGamma _1}},{{\varGamma _2}}\rangle \) of \(\langle {{G^{}_1}},{{G^{}_2}}\rangle \) corresponding to \(\varGamma \) from Fig. 4.

We sketch the construction of \(\langle {{G^{}_1}},{{G^{}_2}}\rangle \). Refer to Fig. 5. The common graph \(G_{\cap }\) contains a cycle \(\mathcal {C} = (t_1, r_1, t_2, t_3, r_2, t_4, q_2, q_1)\) and trees \(Q_1\), \(Q_2\), \(R_1\), \(R_2\), \(T_1,\dots ,T_4\) rooted at \(q_1\), \(q_2\), \(r_1\), \(r_2\), \(t_1,\dots ,t_4\), respectively. The leaves of these trees are associated to the vertices of G and to the edges crossing \(\ell \), as described in Fig. 5. Thus, the circular order of the leaves of these trees corresponds to the order in which the vertices of G and the spine-crossings of the edges of \(E^a_2 \cap E^b_1\) and \(E^a_1 \cap E^b_2\) appear along \(\ell \). In particular, \(w_1,\dots ,w_4\) enforce the consecutivity of the vertices of \(V_1\) (of \(V_2\)) along \(\ell \).

Some edges of \({{G^{}_1}}\) and \({{G^{}_2}}\) are used to enforce the coherence of such ordering in all stars and trees. Some other edges of \({{G^{}_1}}\) and \({{G^{}_2}}\) represent the edges of G, possibly subdivided if they cross \(\ell \); in particular, (portions of) edges of G that have to lie on the internal side of \(\ell \) are edges in \({{G^{}_1}}\) between the leaves of \(T_2\) and \(T_3\), while (portions of) edges of G that have to lie on the external side of \(\ell \) are edges in \({{G^{}_2}}\) between the leaves of \(R_2\) and \(T_4\). Thus, (portion of) edges on the same side of \(\ell \) are represented by edges in the same graph, either \({{G^{}_1}}\) or \({{G^{}_2}}\), so that they are not allowed to cross in the sefe as well as in the b2pbesc. This realizes the equivalence between the sefe and the b2pbesc and completes the sketch of the proof.    \(\square \)

Theorem 4

2-Partitioned Clique Planarity can be solved in quadratic time for instances (GS) in which \(|S|=2\).

Proof

Apply Lemma 7 to construct in linear time an instance \(\langle {{G^{}_1}},{{G^{}_2}}\rangle \) of sefe that is equivalent to (GS) such that \({{G^{}_1}}\) and \({{G^{}_2}}\) are biconnected and their intersection graph \(G_{\cap }\) is connected. The statement follows from the fact that instances of sefe with this property can be solved in quadratic time [5].   \(\square \)

6 Clique Planarity with Given Hierarchy

In this section we study a version of the Clique Planarity problem in which the cliques are given together with a hierarchical relationship among them. Namely, let (GS) be an instance of Clique Planarity and let \(\psi : S \rightarrow \{1,\dots ,k\}\), with \(k \le |S|\), be an assignment of the cliques in S to k levels such that, for each link-edge (uv) of G connecting a vertex u of a clique \(s'\) to a vertex v of a clique \(s''\), we have \(\psi (s') \ne \psi (s'')\); an instance is proper if \(\psi (s') = \psi (s'') \pm 1\) for each link-edge.

We aim to construct canonical clique-planar representations of (GS) such that (Property 1) for each clique \(s \in S\), the top side of the bounding box of the representation of s lies on line \(y=2\psi (s)\), while the bottom side lies above line \(y=2\psi (s)-2\), and (Property 2) each link-edge (uv), with \(u \in s'\), \(v \in s''\), \(\psi (s') < \psi (s'')\), is drawn as a y-monotone curve from the top side of R(u) to the bottom side of R(v). We call the problem of testing whether such a representation exists Level Clique Planarity.

We show how to test level clique planarity in quadratic time for proper instances via a linear-time reduction to equivalent proper instances of T-level Planarity [3].

A \(\mathcal {T}\) -level graph \((V,E,\gamma ,\mathcal {T})\) consists of (i) a graph \(G =(V,E)\), (ii) a function \(\gamma : V \rightarrow \{1,...,k\}\) such that \(\gamma (u) \ne \gamma (v)\) for each \((u,v) \in E\), where the set \(V_i = \{v \mid \gamma (v)=i\}\) is the i-th level of G, and (iii) a set \(\mathcal {T}=\{T_1,\dots ,T_k\}\) of rooted trees such that the leaves of \(T_i\) are the vertices in \(V_i\). A \(\mathcal {T}\) -level planar drawing of \((V,E,\gamma ,\mathcal {T})\) is a planar drawing of G where the edges are y-monotone curves and the vertices in \(V_i\) are placed along line \(y = i\), denoted by \(\ell _i\), according to an order compatible with \(T_i\), that is, for each internal node \(\mu \) of \(T_i\), the leaves of the subtree of \(T_i\) rooted at \(\mu \) are consecutive along \(\ell _i\). \(T\) -Level Planarity asks to test whether a \(\mathcal {T}\)-level graph is \(\mathcal {T}\)-level planar.

Lemma 8

Given a proper instance of Level Clique Planarity, an equivalent proper instance of T-level Planarity can be constructed in linear time.

Proof sketch: Given an instance \((G(V,E),S,\psi )\), an instance \((V,E',\gamma ,\mathcal {T})\) of T-level Planarity can be constructed as follows. Their vertex sets coincide and \(E'\) coincides with the set of link-edges in E. For each vertex v in a clique \(s \in S\) we have \(\gamma (v)=\psi (s)\). Finally, for \(i=1,\dots ,k\), where k is the number of levels in \((G,S,\psi )\), tree \(T_i \in \mathcal {T}\) has root \(r_i\), a child \(w_s\) of \(r_i\) for each \(s\in S\), and the vertices of s as children of \(w_s\).

Suppose that \((V,E',\gamma ,\mathcal {T})\) admits a T-level planar drawing \(\varGamma \). Construct a clique-planar representation satisfying Properties 1 and 2 as follows. Construct a canonical representation of each clique \(s\in S\) with the top side of the bounding box on \(y=2\psi (s)\); cliques on the same level are side-by-side. The order along \(y=2i\) of the cliques \(s\in S\) with \(\psi (s)=i\) and the order of the rectangles in each of these cliques is dictated by the order of the vertices in \(V_i\) along \(\ell _i\). Finally, each edge \((u,v)\in E'\) consists of three straight-line segments: two segments connect rectangles R(u) and R(v) to points \(p_u\) and \(p_v\) on the bounding boxes of their cliques and a segment connects \(p_u\) and \(p_v\).

Suppose that \((G(V,E),S,\psi )\) admits a clique-planar representations satisfying Properties 1 and 2. We construct a T-level planar drawing of \((V,E',\gamma ,\mathcal {T})\) as follows. Place each vertex \(v \in V_i\) at the intersection between the left side of R(v) and the line \(\ell _i:y\) \(=\) \(2i-1\). Each edge (uv) is a curve composed of three parts: The middle part coincides with the drawing of the link-edge (uv) outside R(u) and R(v), while the other parts connect points on their boundaries to u and v. The ordering of the vertices of \(V_i\) along \(\ell _i\) is compatible with \(T_i\) since \(\ell _i\) intersects all the rectangles of each clique s with \(\psi (s)=i\), and since rectangles in different cliques are disjoint. Thus, vertices in the same clique, and hence children of the same node of \(T_i\), are consecutive along \(\ell _i\).

The construction can be performed in linear time, thus proving the lemma.    \(\square \)

Theorem 5

Level Clique Planarity is solvable in quadratic time for proper instances and in quartic time for general instances.

Proof

Any instance \((G,S,\psi )\) of Level Clique Planarity can be made proper by introducing dummy cliques composed of single vertices to split link-edges spanning more than one level. This does not alter the level clique planarity of the instance and might introduce a quadratic number of vertices. Lemma 8 constructs in linear time an equivalent proper instance of T-level Planarity. The statement follows since T-level Planarity can be solved in quadratic time [3] for proper instances.   \(\Box \)

7 Conclusions and Open Problems

We initiated the study of hybrid representations of graphs in which vertices are geometric objects and edges are either represented by intersections (if part of dense subgraphs) or by curves (otherwise). Several intriguing questions arise from our research. (1) How about considering families of dense graphs richer than cliques? Other natural families of dense graphs could be considered, say interval graphs, complete bipartite graphs, or triangle-free graphs. (2) How about using different geometric objects for representing vertices? Even simple objects like equilateral triangles or unit circles seem to pose great challenges, as they give rise to arrangements with a complex combinatorial structure. For example, we have no counterpart of Lemma 1 in those cases. (3) What is the complexity of the bipartite 2-page book embedding problem? We remark that, in the version in which spine crossings are allowed, this problem is equivalent to the clique planarity problem for instances with two cliques.