2-Layer Fan-Planarity: From Caterpillar to Stegosaurus

  • Carla Binucci
  • Markus Chimani
  • Walter Didimo
  • Martin Gronemann
  • Karsten Klein
  • Jan Kratochvíl
  • Fabrizio MontecchianiEmail author
  • Ioannis G. Tollis
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9411)


In a fan-planar drawing of a graph there is no edge that crosses two other independent edges. We study 2-layer fan-planar drawings, i.e., fan-planar drawings such that the vertices are assigned to two distinct horizontal layers and edges are straight-line segments that connect vertices of different layers. We characterize 2-layer fan-planar drawable graphs and describe a linear-time testing and embedding algorithm for biconnected graphs. We also study the relationship between 2-layer fan-planar graphs and 2-layer right-angle crossing graphs.

1 Introduction

In a 2-layer drawing of a graph, each vertex is drawn as a point of one of two distinct horizontal layers and each edge is drawn as a straight-line segment that connects vertices of different layers. Clearly, a graph admits such a drawing if and only if it is bipartite. The study of 2-layer drawings has a long tradition in Graph Drawing for two main reasons: (i) 2-layer drawings are a natural way to visually convey bipartite graphs; (ii) algorithms that compute such drawings represent a building block for the popular Sugiyama’s framework [17, 18], used to draw graphs on multiple horizontal layers.

Since it is commonly accepted that edge crossings negatively affect the readability of a diagram, the study of 2-layer drawings has focused for a long time on the minimization of edge crossings. Eades et al. proved that a connected bipartite graph admits a crossing-free 2-layer drawing if and only if it is a caterpillar [9], i.e., a tree for which the removal of all vertices of degree one produces a path. Eades and Whitesides proved that the problem of minimizing edge crossings in a 2-layer drawing is NP-hard [11] and, as a consequence, many papers focused on efficient heuristics or exact exponential techniques for computing 2-layer drawings with minimum number of edge crossings; a very limited list of these papers includes [10, 12, 14, 16, 19].

More recently, a growing attention has been devoted to the study of graph drawings where edge crossings are allowed under some specific restrictions, which still guarantee a good readability of the layout. In particular, motivated by cognitive experiments of Huang et al. [13], several papers investigated right angle crossing drawings (RAC drawings for short) [7], in which the edges can cross only at right angles (see [8] for a survey on the subject). Di Giacomo et al. characterized the class of bipartite graphs that admit a RAC drawing on two layers, and described a linear-time testing and embedding algorithm for 2-layer RAC drawable graphs [5]. Heuristics for computing the maximum 2-layer RAC subgraph of a given graph are also described [6].

In this paper we concentrate on 2-layer fan-planar drawings, i.e., 2-layer drawings that are also fan-planar. In a fan-planar drawing an edge can only cross edges having a common end-vertex, thus an edge cannot cross two independent edges (see Fig. 1). Fan-planar drawings were introduced by Kaufmann and Ueckerdt [15], who showed that fan-planar graphs with n vertices have at most \(5n-10\) edges, which is a tight bound. Subsequent papers proved that recognizing fan-planar graphs is NP-hard and studied restricted classes of fan-planar graphs in terms of density and recognition algorithms [1, 2]. In particular, it is shown that 2-layer fan-planar drawings have at most \(2n-4\) edges (still a tight bound) [2]. From an application perspective, it has been observed that fan-planar drawings may be used to create confluent drawings with few edge crossings per edge [2]. Our contribution is as follows:
  1. (i)

    We first study biconnected graphs (Sect. 3). We prove that a biconnected graph is 2-layer fan-planar if and only if it is a spanning subgraph of a snake graph (Sect. 3.1), which is a chain of complete bipartite graphs \(K_{2,h}\) (see Definition 1). We also describe a linear-time algorithm that tests whether a biconnected graph admits a 2-layer fan-planar drawing, and that computes such a drawing if it exists (Sect. 3.2).

  2. (ii)

    We then give a characterization of the class of graphs that admit a 2-layer fan-planar drawing (Sect. 4). We prove that a connected graph is 2-layer fan-planar if and only if it is a subgraph of a stegosaurus graph, a further generalization of a snake (see Definition 2). Since every 2-layer crossing-free drawing is also fan-planar, but not vice versa, caterpillars are a proper subclass of stegosauruses.

  3. (iii)

    We explore the relationship between 2-layer fan-planar and 2-layer RAC drawable graphs (Sect. 5). We prove that, for biconnected graphs the first class is properly included in the second one, while there is no inclusion relationships for general graphs.


2 Preliminaries

We assume familiarity with basic concepts of graph drawing and planarity [4]. Throughout the paper, a graph with a fixed planar (outerplanar) embedding is also called a plane (outerplane) graph. Let G be a graph. For each vertex v of G, the set of edges incident to v is called the fan of v. Each edge (uv) of G belongs to the fan of u and to the fan of v at the same time. Two edges that do not share a vertex are called independent edges, and always belong to distinct fans. A fan-planar drawing \(\varGamma \) of G is a drawing such that: (a) no edge is crossed by two independent edges (the forbidden configuration of Fig. 1(a)); (b) there are not two adjacent edges (uv), (uw) that cross an edge e from different “sides” while moving from u to v and from u to w (the forbidden configuration of Fig. 1(b)). Two allowed configurations of a fan-planar drawing are in Fig. 1(c) and (d). A fan-planar graph is a graph that admits a fan-planar drawing. Observe that in a straight-line drawing, the forbidden case (b) cannot happen. By definition, a fan-planar drawing does not contain 3 mutually crossing edges.
Fig. 1.

(a)-(b) Forbidden and (c)-(d) allowed configurations of fan-planar drawings.

In a 2-layer drawing of a graph each vertex is drawn as a point on one of two distinct horizontal lines, called layers, and each edge is drawn as a straight-line segment that connects vertices of different layers. A 2-layer fan-planar drawing is a 2-layer drawing that is also fan-planar. A 2-layer fan-planar graph is a graph that admits a 2-layer fan planar drawing. Clearly, every graph that has a 2-layer drawing is bipartite. For a given 2-layer drawing of a bipartite graph \(G=(V_1, V_2, E)\), denote by \(\ell _i\) the horizontal line on which the vertices of \(V_i\) are drawn \((i = 1, 2)\). We always assume that \(\ell _1\) is above \(\ell _2\). Two 2-layer drawings of G are equivalent if they have the same left-to-right order \(\pi _i\) of the vertices of \(V_i\) along \(\ell _i\) \((i = 1, 2)\). A 2-layer embedding is an equivalence class of 2-layer drawings and it is described by a pair of linear orderings (i.e., permutations) \(\gamma = (\pi _1,\pi _2)\) of the vertices in \(V_1\) and \(V_2\), respectively. Let u and v be two vertices of \(V_i\), we write \(u \prec v\) if \(\pi _i(u) < \pi _i(v)\) \((i = 1, 2)\). Also, the first (last) vertex of \(\pi _1\) and the first (last) vertex of \(\pi _2\) are the leftmost vertices (rightmost vertices) of \(\gamma \). The edge between the leftmost (rightmost) vertices of \(\gamma \) (if it exists) is called the leftmost edge (the rightmost edge) of \(\gamma \). If \(\varGamma \) is a drawing within class \(\gamma \), we say that \(\gamma \) is the embedding of \(\varGamma \). If \(\varGamma \) is a 2-layer fan-planar drawing, we also say that \(\gamma \) is a 2-layer fan-planar embedding.

Since any geometric position of the vertices that respects the two linear orderings defined by \(\gamma \) yields a 2-layer fan-planar drawing in linear time, we will concentrate on embeddings in the following. We say that \(\gamma \) is maximal if for any two vertices u and v that are not adjacent in G, the embedding obtained from \(\gamma \) by adding the edge (uv) is no longer 2-layer fan-planar.

3 Biconnected 2-Layer Fan-Planar Graphs

Let \(G_1\) and \(G_2\) be two graphs. The operation of merging \(G_1\) and \(G_2\) by identifying an edge \(e_1\) of \(G_1\) with an edge \(e_2\) of \(G_2\) (in one of the two possible ways) is called an edge merging; the resulting graph G is called a merger of \(G_1\) and \(G_2\) with respect to \(e_1,e_2\). The end-vertices of the edge obtained by identifying \(e_1\) with \(e_2\) are merged vertices of G. In Fig. 2(a), the white vertices in the merger graph are the merged vertices.

Definition 1

A snake is a graph recursively defined as follows: (i) A complete bipartite graph \(K_{2,h}\) (\(h\ge 2\)) is a snake; (ii) A merger of two snakes \(G_1\) and \(G_2\) with respect to edges \(e_1\) of \(G_1\) and \(e_2\) of \(G_2\), with the property that none of the end-vertices of \(e_i\) is a merged vertex of \(G_i\) \((i = 1, 2)\), is a snake.

Intuitively, a snake is a bipartite planar graph consisting of a chain of complete bipartite graphs \(K_{2,h}\) (see Fig. 2(b)). An alternative definition of a snake can be derived from the definition of ladder, i.e., a maximal bipartite outerplanar graph consisting of two paths of the same length \(\langle u_1, u_2, \dots , u_{\frac{n}{2}} \rangle \) and \(\langle v_1, v_2, \dots , v_{\frac{n}{2}} \rangle \) plus the edges \((u_i,v_i)\) \((i = 1,2, \dots \frac{n}{2})\) (see also [5]); the edges \((u_1,v_1)\) and \((u_{\frac{n}{2}},v_{\frac{n}{2}})\) are called the extremal edges of the ladder. A snake is a planar graph obtained from an outerplane ladder, by adding, inside each internal face, an arbitrary number (possibly none) of paths of length two connecting a pair of non-adjacent vertices of the face.
Fig. 2.

(a) Edge merging of two graphs. (b) A snake.

3.1 Characterization

The characterization of the biconnected graphs that admit a 2-layer fan-planar embedding is given by Theorem 3. The proof is based on the next two lemmas.

Lemma 1

Let G be biconnected graph. If G admits a maximal 2-layer fan-planar embedding \(\gamma \) then G is a snake.

Proof Sketch

Due to maximality, the leftmost and the rightmost edges of \(\gamma \) always exist, and do not cross any other edge. Therefore, \(\gamma \) contains at least two uncrossed edges. We prove the statement by induction on the number \(l\ge 2\) of uncrossed edges in \(\gamma \). Recall that, since G is biconnected, it has vertex degree at least two.

Base Case: \(l=2\). In this case, we prove that G is a \(K_{2,r}\) for some \(r \ge 2\), which implies that G is a snake. Note that G cannot be a \(K_{1,r}\), since it has vertex degree at least two. If G contains only four vertices, then G is a \(K_{2,2}\), as there are exactly two uncrossed edges. Suppose now that G has more than four vertices.

Claim 1

Let (uv) and (wx) be a pair of crossing edges in \(\gamma \), such that \(u \prec w\) on \(\ell _1\) and \(x \prec v\) on \(\ell _2\). Then the edges (ux) and (wv) exist.

Claim 2

If \(G'\) is a subgraph of G such that \(G'\) is a \(K_{2,r'}\) (for some \(r' > 2\)) and \(G'\) contains the leftmost and the rightmost edges of \(\gamma \), then G is a \(K_{2,r}\) (for some \(r > r'\)).

Using Claims 1 and 2, we now prove that G is a \(K_{2,r}\), for some \(r > 2\). Consider the rightmost vertex w on \(\ell _1\) and the rightmost vertex v on \(\ell _2\) in \(\gamma \). Due to maximality, edge (wv) exists and is uncrossed. Also, since w and v have degree at least two, they both have one more incident edge, which we denote by (wx) and (uv). Since w and v are the rightmost vertices, (wx) and (uv) cross each other, and thus, by Claim 1, edge (ux) exists. Let H be the \(K_{2,2}\) subgraph of G induced by u, v, x, and w. Since we are assuming that G has more than four vertices, there exists a vertex z other than the vertices of H. Without loss of generality, assume that z is on layer \(\ell _2\).

If (ux) is the leftmost edge of \(\gamma \), then \(x \prec z \prec v\), and this implies that z can be adjacent to u and w only, as otherwise (wx), (uv), and an edge incident to z would form three mutually crossing edges. Also, since z has degree at least two, z is adjacent to both u and w. Thus subgraph \(G'\) of G induced by \(\{u,v,w,x,z\}\) is a \(K_{2,3}\) containing the left- and rightmost edges of \(\gamma \). By Claim 2, G is a \(K_{2,r}\), with \(r > 2\).

If (ux) is not the leftmost edge of \(\gamma \), then (ux) is crossed in \(\gamma \), and, as observed in the proof of Claim 1, it is crossed by an edge having either w or v as an end-vertex. Without loss of generality, suppose that (ux) crosses an edge (wz). By applying Claim 1 to (ux) and (wz), edge (uz) exists. Hence, again, the subgraph \(G'\) induced by the vertices of H plus z is a \(K_{2,3}\) graph. If (uz) is the leftmost edge of \(\gamma \), then by Claim 2, G is a \(K_{2,r}\), with \(r > 2\). If (uz) is not the leftmost edge, then again it is crossed by an edge having either w or v as an end-vertex. However, since (ux) is already crossed by (wz), (uz) can only be crossed by edges having w as an end-vertex. Denoted by (wy) one of the edges that cross (uz), we have that edge (uy) exists by Claim 1, and therefore the subgraph induced by the vertices of H plus vertices z and y is a \(K_{2,4}\) that contains the rightmost edge of \(\gamma \). By iterating this argument, we eventually obtain a subgraph \(K_{2,r'}\) \((r' > 2)\) of G that contains the rightmost and also the leftmost edge of \(\gamma \), which by Claim 2 implies that G is a \(K_{2,r}\), with \(r > 2\).

Inductive Case: \(l>2\). Consider an uncrossed edge (uv) different from the leftmost and the rightmost edge of \(\gamma \). Let \(\gamma _1\) (resp., \(\gamma _2\)) be the embedding induced by the vertices to the left (resp., right) of (uv) plus u and v. Clearly, \(\gamma _1\) and \(\gamma _2\) are 2-layer fan-planar. Let \(G_i\) be the subgraph of G consisting of the vertices and edges of \(\gamma _i\) \((i=1,2)\). Since (uv) is uncrossed in \(\gamma \), \(G_1\) and \(G_2\) are biconnected. Also, each of the two \(\gamma _i\) contains a number \(l_i < l\) of uncrossed edges, and thus \(G_i\) is a snake by induction. Since G is a merger of \(G_1\) and \(G_2\) with respect to (uv), G is a snake. \(\square \)

Lemma 2

Every n-vertex snake admits a 2-layer fan-planar embedding, which can be computed in O(n) time.

Proof Sketch

Let G be a snake. By definition, G is a chain of graphs \(G_1, \dots , G_k\), such that each \(G_i\) is a complete bipartite graph \(K_{2,h_i}\) that shares a pair of merged vertices with \(G_{i+1}\) \((i = 1, \dots , k-1)\). The idea to construct a 2-layer fan-planar embedding is to put the vertices of each partite set on the corresponding layer, such that those of \(G_i\) precede those of \(G_{i+1}\). See Fig. 3 for an illustration. \(\square \)

Fig. 3.

Illustration for the proof of Lemma 2. (a) A snake G; the vertices of each partite set are ordered (i.e., numbered) according to the rules given in the proof. (b) A 2-layer fan-planar drawing of G whose embedding reflects the vertex ordering; the uncrossed edges are in bold.

Theorem 3

A biconnected graph G is 2-layer fan-planar if and only if G is a spanning subgraph of a snake.


Suppose first that G has a 2-layer fan-planar embedding \(\gamma \). If \(\gamma \) is maximal, then G is a snake by Lemma 1. Else, there is a maximal 2-layer fan-planar embedding \(\gamma '\) of a graph \(G'\) such that: (i) \(G \subset G'\), (ii) \(G'\) has the same vertex set of G, and (iii) the restriction of \(\gamma '\) to G coincides with \(\gamma \). Hence, by Lemma 1, G is a spanning subgraph of a snake. Conversely, let G be a spanning subgraph of a snake. Since any spanning subgraph of a 2-layer fan-planar graph is also 2-layer fan-planar, G is 2-layer fan-planar by Lemma 2.\(\square \)

3.2 Testing and Embedding Algorithm

We now describe an algorithm to test whether a given biconnected bipartite graph G is 2-layer fan-planar. Since every biconnected 2-layer fan-planar graph is a spanning subgraph of a snake (Theorem 3), the algorithm must check whether G can be augmented to a snake by only adding a suitable set of edges. In what follows we assume that the input graph G is not a simple cycle, as otherwise it is clearly 2-layer fan-planar.

A chain \(P = \langle u, v_1, v_2, \dots , v_k, v \rangle \) of G is a maximal path of G such that all its internal vertices \(v_i\) have degree 2 in G \((i=1, \dots , k)\). Contracting P is to transform G into a new graph \(G'\) obtained from G by replacing P with a single edge \(e_P=(u,v)\) of weight \(w(e_P)=k\). Reversely, we can say that G is obtained from \(G'\) by expanding \(e_P\) (P is the expansion of \(e_P\)). Note that \(G'\) may have multiple edges that connect u and v. If G is a plane graph, we assume that the contraction of P preserves the embedding of G. The weighted contraction of G is the edge-weighted multi-graph \(\mathcal C(G)\) obtained from G by contracting all inclusion-wise maximal chains of G; all edges of \(\mathcal C(G)\) that are also in G are assigned weight 0. Figure 4(c) shows the weighted contraction of the graph in Fig. 4(b). Based on weighted contractions, we can reinterpret the characterization of 2-layer fan-planar graphs as follows (cf. Fig. 4):
Fig. 4.

Illustration for Lemma 4. (a) A plane snake \(\overline{G}\) consisting of an outerplane ladder (black vertices) with arbitrary paths of length two inside each internal face. (b) A (plane) biconnected spanning subgraph G of \(\overline{G}\). (c) The (plane) weighted contraction \(\mathcal C(G)\); only edge weights greater than 0 are shown. (d) The plane multi-graph \(G^*\) of property (c) in the statement of Lemma 4.

Lemma 4

Let G be a bipartite biconnected graph that is not a simple cycle. G is a spanning subgraph of a snake if and only if its weighted contraction \(\mathcal C(G)\) has a planar embedding such that: (a) All vertices of \(\mathcal C(G)\) are on the external face; (b) All edges \(e_P\) of \(\mathcal C(G)\) with \(w(e_P) \ge 2\) are on the external face; (c) Let \(G^*\) be the plane multi-graph obtained from \(\mathcal C(G)\) by expanding all edges \(e_P\) of the external face. It is possible to add to \(G^*\) internal edges of weight 0, such that the resulting graph \(H^*\) is outerplane and the removal of the internal edges of weight 1 from \(H^*\) produces a ladder.

We now give a linear-time algorithm, called Bic2LFPTest, that tests whether a bipartite biconnected graph G has a 2-layer fan-planar embedding, and that constructs such an embedding in the positive case. The algorithm checks whether \(\mathcal C(G)\) admits a planar embedding with the properties (a), (b), and (c) of Lemma 4. If such an embedding exists, a snake for which G is a spanning subgraph is obtained by expanding the edges of weight 1 in the multi-graph \(H^*\) of property (c); a 2-layer fan-planar embedding of this snake (and hence of G) is obtained using the construction in the proof of Lemma 2.

Algorithm Bic2LFPTest (G)

Step 1. Compute the weighted contraction \(\mathcal C(G)\) of G, and compute, if any, an outerplanar embedding of \(\mathcal C(G)\) (i.e. property (a) of Lemma 4). This can be done in linear time: temporarily add to \(\mathcal C(G)\) a dummy vertex u and a dummy edge (uv) for every vertex v of \(\mathcal C(G)\); then run a linear-time planarity testing and embedding algorithm (e.g. [3]) on it. Note that, since \(\mathcal C(G)\) is still biconnected, the outerplanar embedding of \(\mathcal C(G)\) is unique (if it exists), except for the permutation of multi-edges. If \(\mathcal C(G)\) is not outerplanar, the whole test is negative and the algorithm stops, otherwise an outerplanar embedding is found and the algorithm goes to the next step.

Step 2. Check whether the outerplanar embedding can be modified (if needed) so that all edges with weight greater than 1 can be put on the external face (property (b) of Lemma 4), keeping all vertices on the external face. This is possible if and only if: (i) for every pair of consecutive vertices \(\{u,v\}\) on the boundary of the external face there is at most one edge \(e=(u,v)\) with \(w(e) \ge 2\) (which can be then put on the external face), and (ii) there is no chord with weight greater than 1. Both conditions (i) and (ii) can be checked in linear time. If this checking fails, then the whole test is negative, otherwise the new outerplanar embedding with the heaviest edges on the external face is computed and the algorithm goes to the next step.

Step 3. Expand the external edges with weight greater than 0 to get the multi-graph \(G^*\) in property (c) of Lemma 4; this can be done in linear time if we suitably store the chain P associated with each edge \(e_P\) when \(\mathcal C(G)\) is computed in Step 1. Then, check whether it is possible to add to \(G^*\) a suitable set of internal edges (chords) connecting vertices of the external face such that the resulting multi-graph \(H^*\) is still outerplane and becomes a ladder if we subsequently remove the internal edges of weight 1 (property (c)). This can be done with the following procedure. If \(H^*\) already contains a chord of weight 0, then: (i) temporarily remove the edges with weight 1; (ii) verify whether the resulting graph can be augmented with extra chords to an outerplane ladder, using the linear-time algorithm described by Di Giacomo et al. [5]. We remark that, if such an augmentation exists it is unique under the assumption that \(H^*\) already contains a chord of weight 0; (iii) check whether the removed edges with weight 1 can be reinserted inside the outerplane ladder without violating the planarity (which can be done in linear time). If \(H^*\) does not contain a chord with weight 0, then \(H^*\) contains at least one chord \(e=(u,v)\) with weight 1 (we assumed that G is not a simple cycle, hence \(H^*\) contains at least one chord). In this case, consider the two vertices \(u_1, u_2\) that are adjacent to u on the boundary of the external face, and the two vertices \(v_1, v_2\) that are adjacent to v on the boundary of the external face (some of these vertices may coincide). It can be seen that any edge augmentation of \(H^*\) that leads to an outerplane ladder with the edges of weight 1 inside its internal faces, must include at least one chord \(e' \in C = \{(u,v_1), (u,v_2), (v,u_1), (v,u_2)\}\) (in particular, in the outerplane ladder either two edges of C are chords or one is a chord and one is an extremal edge of the ladder). Hence, for each of these (at most four) chords \(e'\), try to add \(e'\) to \(H^*\) and then repeat the substeps \((i)-(iii)\) described above. If the augmentation fails for all possible choices of \(e'\), the whole test is negative, otherwise it is positive and a snake that contains G as a spanning subgraph is obtained. A 2-layer fan-planar embedding of this snake coincides with that of G, and is computed using the construction of Lemma 2.

Theorem 5

Let G be a bipartite biconnected graph with n vertices. There exists an O(n)-time algorithm that tests whether G is 2-layer fan-planar, and that computes a 2-layer fan-planar embedding of G in the positive case.

4 Simply Connected 2-Layer Fan-Planar Graphs

We saw that a biconnected graph is \(2\)-layer fan-planar if and only if it is a subgraph of a snake. We now show that a (simply) connected graph is \(2\)-layer fan-planar if and only if it is a subgraph of a stegosaurus. Clearly, a non-connected graph is 2-layer fan-planar if and only if every connected component is a 2-layer fan-planar graph.

Recall that snakes are obtained by merging edges of a sequence of several \(K_{2,h}\) (\(h\ge 2\)). We may denote the partite set with more than 2 vertices (if any) the large side of a \(K_{2,h}\). Given a snake G, a vertex in G is mergeable if it is an end-vertex of a mergeable edge and belongs to the large side of an original \(K_{2,h}\). Note that a snake always has at most two mergeable vertices; by definition, a \(K_{2,2}\) on either end of the snake prohibits a mergable vertex. The graph resulting from merging two graphs \(G_1\) and \(G_2\) by identifying a mergeable vertex of \(G_1\) with a mergeable vertex of \(G_2\) is a vertex merger.

Definition 2

A stegosaurus is either a fan (a trivial stegosaurus) or a graph recursively defined as follows (Fig. 5(a)): (i) A snake is a stegosaurus, whose mergeable vertices are the mergeable vertices of the snake. (ii) The vertex merger of two stegosaurs \(G_1,G_2\) is a stegosaurus. Its mergeable vertices are those (at most one per \(G_1,G_2\)) not used in this merging. (iii) Let v be a mergeable vertex of a stegosaurus \(G_1\). Adding a new vertex \(v'\) and an edge \((v,v')\) gives a stegosaurus with the same mergeable vertices as \(G_1\).

Fig. 5.

(a) A stegosaurus composed of three snakes \(G_1, G_2\), \(G_3\) that have been merged at \(v_2,v_3\) and several edges have been attached to \(v_1, \ldots , v_4\). (b) The result of merging snakes \(G_1, G_2\) using a non-mergeable vertex can be augmented into one snake by adding the dashed edge.

Observation 6

Consider merging two snakes \(G_1,G_2\) at vertices \(v_1,v_2\). Assume that \(v_1\) is an end-vertex of a mergeable edge but not from a large side; \(v_2\) may be chosen as \(v_1\) or be a mergeable vertex. Then, the merged graph would be a subgraph of a snake (Fig. 5(b)). Thus, only vertices from the large side have to be considered in Definition 2.

In the following, a block of a graph (i.e., a biconnected component) is called trivial if it consists of a single edge. Let an edge e be a trivial block. If e has an end-vertex of degree 1, e is a stump, otherwise, it is a bridge. A graph is called maximal 2-layer fan-planar, if it cannot be augmented by an edge without losing 2-layer fan-planarity. Observe that, in contrast to the biconnected case, we have the situation that an embedding (or drawing) of G is maximal 2-layer fan-planar (i.e., we cannot add an edge within this embedding), but the graph is not maximal 2-layer fan-planar; it “simply” requires a different \(2\)-layer fan-planar embedding into which we can add another edge. Figure 6(a),(b) show an example. By definition and Theorem 3, a biconnected graph is \(2\)-layer fan-planar if and only if it is the subgraph of a snake, and thus, of a stegosaurus. Also, a simply connected graph that is a subgraph of a snake is \(2\)-layer fan-planar. We will first show that stegosaurs are \(2\)-layer fan-planar. Then, we will show that every \(2\)-layer fan-planar graph is a subgraph of a stegosaurus.
Fig. 6.

(a) A maximal \(2\)-layer fan-planar drawing and (b) a different embedding to which one may add the edge (xy). (c) A \(2\)-layer fan-planar drawing of the stegosaurus from Fig. 5(a).

Lemma 7

Every stegosaurus has a \(2\)-layer fan-planar embedding.


Figure 6(c) outlines the idea. We already know that snakes are \(2\)-layer fan-planar and how to draw them, and, by definition, that the non-trivial blocks of a stegosaurus are snakes. Drawing a stegosaurus hence means drawing the individual snakes and realizing that we can draw additional trivial blocks (arising from (iii) in the definition) at the left and right “ends” of the stegosaurus, as well as at its cut vertices. \(\square \)

It should be understood that a trivial stegosaurus is a maximal 2-layer fan-planar graph. In the following, we only have to consider non-trivial stegosaurs. We start with proving a property that holds for all \(2\)-layer fan-planar drawings, not only for maximal ones:

Lemma 8

Let B be a non-trivial block of a \(2\)-layer fan-planar graph G, and e an independent edge, i.e., none of its end-vertices belongs to B. No edge of B can be crossed by e in any \(2\)-layer fan-planar embedding of G.


Assume there is an embedding where some edge \(b\in E(B)\) is crossed by e. Since B is a non-trivial block, b is part of a cycle \(C\subseteq E(B)\) with \(|C|\ge 4\). Hence, by the properties of 2-layer embeddings, e needs to cross another edge \(c\in C\) as well. The edges bc need to be adjacent, as otherwise we would get pairwise crossings between three independent edges. Embedding a cycle, in our case C, on two layers, requires a crossing of every edge except for two non-adjacent edges. Hence either b or c will have a crossing with another edge of C and the independent edge e, a contradiction.\(\square \)

From the above lemma, we obtain a simple but useful observation:

Corollary 9

In a \(2\)-layer fan-planar embedding, two non-trivial blocks cannot cross.

Hence we know that in a \(2\)-layer fan-planar drawing, non-trivial blocks are “nicely” placed next to each other from left to right without crossings between them. We now show several properties of maximal \(2\)-layer fan-planar graphs. Clearly, a maximal \(2\)-layer fan-planar graph will be connected.

Lemma 10

Let G be a maximal \(2\)-layer fan-planar graph. There exists an embedding \(\gamma \) of G in which no stump is crossed.

Proof Sketch

One may assume that a vertex is incident to at most one stump. Choosing an embedding \(\gamma \) with the least crossing count between stumps, yields the result. \(\square \)

Lemma 11

A maximal \(2\)-layer fan-planar graph G does not contain bridges.

Proof Sketch

Using the embedding from Lemma 10, one can show that if a bridge exists, it is not crossed, and one may insert an edge, contradicting maximality of G. \(\square \)

Corollary 12

Let G be a maximal \(2\)-layer fan-planar graph. There exists an embedding in which no two blocks cross. Any cut vertex is either contained in two non-trivial blocks, or is a left- or rightmost vertex in this embedding.

Hence we have that a maximal \(2\)-layer fan-planar graph allows a drawing where non-trivial blocks are neither crossed by other non-trivial nor by trivial blocks. Furthermore, in contrast to the non-biconnected case, if an embedding of a biconnected graph G is maximal \(2\)-layer fan-planar, then G is maximal \(2\)-layer fan-planar. We can deduce:

Corollary 13

Let G be a maximal \(2\)-layer fan-planar graph. Its non-trivial blocks are maximal \(2\)-layer fan-planar biconnected graphs, i.e., snakes.

Lemma 7 and Corollary 13 imply the following.

Theorem 14

A graph is \(2\)-layer fan-planar if and only if it is a subgraph of a stegosaurus.

Fig. 7.

(a) The tree \(T_3\); it is 2-layer RAC but not 2-layer fan-planar. (b) A 2-layer RAC embedding (not drawing) of \(T_3\) In both figures the path connecting u to v has bold edges.

5 Relationship with 2-Layer RAC Drawings

It is natural to ask for the relationship between 2-layer fan-planarity and 2-layer RAC. Di Giacomo et al. proved that a 2-layer embedding \(\gamma \) is RAC (i.e., there exists a 2-layer RAC drawing w.r.t. \(\gamma \)) if and only if \(\gamma \) has neither 3 mutually crossing edges nor two adjacent edges crossed by a third one [5]. For example, the embedding in Fig. 7(b) is 2-layer RAC. They also showed that a biconnected graph has a 2-layer RAC embedding if and only if it is a subgraph of a ladder. Since a ladder is a special snake (but not vice versa), we deduce from Theorem 3:

Corollary 15

The biconnected 2-layer RAC graphs are a proper subclass of the biconnected 2-layer fan-planar graphs.

For general graphs, however, there is no inclusion relationship between those two concepts. In particular, we exhibit infinitely many trees \(T_k\) \((k \ge 3)\) that are 2-layer RAC but not 2-layer fan-planar. \(T_k\) consists of two vertices u and v connected by a path of length \(k \ge 3\), and such that each u and v have further (disjoint) three paths of length \(k+1\) attached to them. Figure 7(a) depicts \(T_3\). Using the characterization of 2-layer RAC trees [5], one can verify that \(T_k\) has a 2-layer RAC embedding, see Fig. 7(b).

By Theorem 14, we can show that \(T_k\) is not \(2\)-layer fan-planar by observing that it cannot be a subgraph of a stegosaurus. Indeed, suppose that G is some stegosaurus that contains \(T_k\), and suppose that \(\varGamma \) is a planar drawing of G as in Fig. 5(a), where all vertices of degree greater than two lie on the external face and are suitably placed on two distinct horizontal lines. Since u and v have degree 4 in \(T_k\), they are external vertices of \(\varGamma \). Denote by \(P_{uv}\) the path from u to v in \(\varGamma \) that corresponds to the path from u to v in \(T_k\). Consider the three paths of length \(k+1\) attached to u in \(T_k\). Since they only share vertex u, and also share only vertex u with \(P_{uv}\), one of them, call it \(P_u\), is necessarily “routed towards” v in \(\varGamma \), while the other two can be routed away from v. Analogously, one of the three paths of length \(k+1\) attached to v, call it \(P_v\), must be routed towards u in \(\varGamma \), while the other two can be routed away from u. Since \(P_{uv}\) has length k, it is not difficult to verify that either \(P_u\) and \(P_v\) must share a vertex or at least one of them share a vertex with \(P_{uv}\); a contradiction. Thus, G cannot exist.

6 Open Problems

The main open problem of our study is to provide, if any, an efficient 2-layer fan-planarity testing algorithm for general (i.e., not necessarily biconnected) graphs, which exploits Theorem 14. Another interesting research line is designing algorithms that compute 2-layer drawings that are “as fan-planar as possible”, i.e., whose number of forbidden configurations (two independent edges crossed by a third one) is minimized.


  1. 1.
    Bekos, M.A., Cornelsen, S., Grilli, L., Hong, S.-H., Kaufmann, M.: On the recognition of fan-planar and maximal outer-fan-planar graphs. In: Duncan, C., Symvonis, A. (eds.) GD 2014. LNCS, vol. 8871, pp. 198–209. Springer, Heidelberg (2014) Google Scholar
  2. 2.
    Binucci, C., Di Giacomo, E., Didimo, W., Montecchiani, F., Patrignani, M., Symvonis, A., Tollis, I.G.: Fan-planarity: properties and complexity. Theor. Comput. Sci. 589, 76–86 (2015)CrossRefGoogle Scholar
  3. 3.
    Booth, K., Lueker, G.: Testing for the consecutive ones property, interval graphs and graph planarity using PQ-trees. J. Comput. Syst. Sci. 13, 335–379 (1976)MathSciNetCrossRefzbMATHGoogle Scholar
  4. 4.
    Di Battista, G., Eades, P., Tamassia, R., Tollis, I.G.: Graph Drawing. Prentice Hall, Upper Saddle River (1999) zbMATHGoogle Scholar
  5. 5.
    Di Giacomo, E., Didimo, W., Eades, P., Liotta, G.: 2-layer right angle crossing drawings. Algorithmica 68(4), 954–997 (2014)MathSciNetCrossRefzbMATHGoogle Scholar
  6. 6.
    Di Giacomo, E., Didimo, W., Grilli, L., Liotta, G., Romeo, S.A.: Heuristics for the maximum 2-layer RAC subgraph problem. Comput. J. 58(5), 1085–1098 (2015)CrossRefGoogle Scholar
  7. 7.
    Didimo, W., Eades, P., Liotta, G.: Drawing graphs with right angle crossings. Theor. Comput. Sci. 412(39), 5156–5166 (2011)MathSciNetCrossRefzbMATHGoogle Scholar
  8. 8.
    Didimo, W., Liotta, G.: The crossing angle resolution in graph drawing. In: Pach, J. (ed.) Thirty Essays on Geometric Graph Theory, pp. 167–184. Springer, New York (2012)Google Scholar
  9. 9.
    Eades, P., McKay, B., Wormald, N.: On an edge crossing problem. In: ACSC 1986, pp. 327–334 (1986)Google Scholar
  10. 10.
    Eades, P., Kelly, D.: Heuristics for drawing 2-layered networks. Ars Comb. 21, 89–98 (1986)MathSciNetGoogle Scholar
  11. 11.
    Eades, P., Whitesides, S.: Drawing graphs in two layers. Theor. Comput. Sci. 131(2), 361–374 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Eades, P., Wormald, N.C.: Edge crossings in drawings of bipartite graphs. Algorithmica 11(4), 379–403 (1994)MathSciNetCrossRefzbMATHGoogle Scholar
  13. 13.
    Huang, W., Eades, P., Hong, S.: Larger crossing angles make graphs easier to read. J. Vis. Lang. Comput. 25(4), 452–465 (2014)CrossRefGoogle Scholar
  14. 14.
    Jünger, M., Mutzel, P.: 2-layer straightline crossing minimization: performance of exact and heuristic algorithms. J. Graph Algorithms Appl. 1, 1–25 (1997)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Kaufmann, M., Ueckerdt, T.: The density of fan-planar graphs. CoRR abs/1403.6184 (2014).
  16. 16.
    Mutzel, P.: An alternative method to crossing minimization on hierarchical graphs. SIAM J. Optim. 11(4), 1065–1080 (2001)MathSciNetCrossRefzbMATHGoogle Scholar
  17. 17.
    Sugiyama, K.: Graph Drawing and Applications for Software and Knowledge Engineers. World Scientific, Singapore (2002)CrossRefzbMATHGoogle Scholar
  18. 18.
    Sugiyama, K., Tagawa, S., Toda, M.: Methods for visual understanding of hierarchical system structures. IEEE Trans. Syst. Man Cybern. 11(2), 109–125 (1981)MathSciNetCrossRefGoogle Scholar
  19. 19.
    Valls, V., Martí, R., Lino, P.: A branch and bound algorithm for minimizing the number of crossing arcs in bipartite graphs. Eur. J. Oper. Res. 90(2), 303–319 (1996)CrossRefzbMATHGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Carla Binucci
    • 1
  • Markus Chimani
    • 2
  • Walter Didimo
    • 1
  • Martin Gronemann
    • 3
  • Karsten Klein
    • 4
  • Jan Kratochvíl
    • 5
  • Fabrizio Montecchiani
    • 1
    Email author
  • Ioannis G. Tollis
    • 6
  1. 1.Università Degli Studi di PerugiaPerugiaItaly
  2. 2.Osnabrück UniversityOsnabrückGermany
  3. 3.University of CologneCologneGermany
  4. 4.Monash UniversityMelbourneAustralia
  5. 5.Charles UniversityPragueCzech Republic
  6. 6.University of Crete and Institute of Computer Science-FORTHCreteGreece

Personalised recommendations