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

Let \(R=(V_R,E_R)\) and \(B=(V_B,E_B)\) be two planar graphs sharing a common graph \(C=(V_R\cap V_B, E_R\cap E_B)\). The vertices and edges of C are common, while the other vertices and edges are exclusive. We refer to the edges of R, B, and C as the red, blue, and black edges, respectively. A simultaneous embedding of R and B is a pair of plane drawings of R and B, respectively, that agree on the common vertices (see Fig. 1a–b).

Simultaneous graph embeddings have been a central topic of investigation for the graph drawing community in the last decade, because of their applicability to the visualization of dynamic graphs and of multiple graphs on the same vertex set [6, 11], and because of the depth and breadth of the theory they have been found to be related to.

Fig. 1.
figure 1

(a-b) R and B with \(V_C=\{a,b,c,d,e\}\) and \(E_C=\{(a,b),(b,c),(a,c),(c,d)\}\). (c) Simultaneous embedding of R and B. (d) Sge of R and B. (e) Sefe of R and B.

Brass et al. [6] initiated the research on this topic by investigating simultaneous geometric embeddings (or Sges), which are simultaneous embeddings where all edges are represented by straight-line segments (see Fig. 1d). This setting proved to be fairly restrictive: there exist two trees [16] and even a tree and a path [2] with no Sge. Furthermore, the problem of deciding whether two graphs admit an Sge is NP-hard [12].

Two relaxations of Sge have been considered in the literature in which edges are not forced to be straight-line segments. In the first setting, we look for a simultaneous embedding of two given planar graphs R and B in which every edge is drawn as a polygonal curve with few bends. Di Giacomo and Liotta [9] proved that two bends per edge always suffice. If R and B are trees, then one bend per edge is sufficient [10]. Note that black edges may be represented by different curves in each drawing. The variant in which the edges of R and B might only cross at right angles has also been considered [3]. In the second setting, we look for a simultaneous embedding with fixed edges (or Sefe) of R and B: a simultaneous embedding in which every common edge is represented by the same simple curve in the plane (see Fig. 1e). In other words, a Sefe is a drawing of the union graph \((V_R\cup V_B,E_R\cup E_B)\) that determines a plane drawing of R (of B) when restricted to the vertices and edges of R (resp. of B). While not every two planar graphs admit a Sefe, this setting is less restrictive than Sge: for example, every tree and every planar graph admit a Sefe [13]. Determining the complexity of deciding whether two given graphs admit a Sefe is a major open problem in the field of graph drawing. Polynomial-time testing algorithms are known in many restricted cases, such as when the common graph C is biconnected [1] or when C is a set of disjoint cycles [5]. We refer to an excellent survey by Bläsius et al. [4] for many other results.

In this paper we present algorithms to construct Sefes in which edges are represented by polygonal curves. For the purpose of guaranteeing the readability of the representation, we aim at minimizing two natural aesthetic criteria: the number of bends per edge and the number of crossings per edge pair. Both criteria have been recently considered in relation to the construction of a Sefe. Namely, Grilli et al. [17] proved that every combinatorial Sefe can be realized as a Sefe with at most nine bends per edge, a bound which improves to three bends per edge when the common graph is biconnected. Further, Chan et al. [7] proved that if R and B admit a Sefe, then they admit a Sefe in which every red-blue edge pair crosses at most twenty-four times.

Contribution. We improve on the results of Grilli et al. [17] and of Chan et al. [7] by proving the following results. (1) Any two trees admit a Sefe with one bend per edge; thus, every two edges cross at most four times. The number of bends is the best possible, since two trees exist with no Sge [16]. (2) Any planar graph and any tree admit a Sefe with six bends per edge in which every two edges cross at most eight times. (3) Any two planar graphs that admit a Sefe also admit a Sefe with six bends per edge in which every two edges cross at most sixteen times. In all cases, the common edges are straight-line segments. Because of space limits, we present the result for trees and we just sketch the ideas for the other results. For the full version of the paper see [14].

2 Preliminaries

A plane drawing of a (multi)graph G determines a circular ordering of the edges incident to each vertex of G; the set of these orderings is called a rotation system. Two plane drawings of G are equivalent if they have the same rotation system, the same containment relationship between cycles, and the same outer face (the second condition is redundant if G is connected). A planar embedding is an equivalence class of plane drawings. Analogously, a Sefe of two planar graphs R and B determines a circular ordering of the edges incident to each vertex (comprising edges incident to both R and B); the set of these orderings is the rotation system of the Sefe. Two Sefes of R and B are equivalent if they have the same rotation system and if their restriction to the vertices and edges of R (of B) determines two equivalent plane drawings of R (resp. of B). Finally, a combinatorial Sefe \(\mathcal {E}\) for two planar graphs R and B is an equivalence class of Sefes; we denote by \(\mathcal {E}\vert _R\) (by \(\mathcal {E}\vert _B\)) the planar embedding of R (resp. of B) obtained by restricting \(\mathcal {E}\) to the vertices and edges of R (resp. of B).

A subdivision of a multigraph G is a graph \(G'\) obtained by replacing edges of G with paths, whose internal vertices are called subdivision vertices. If \(G'\) is a subdivision of G, the operation of flattening subdivision vertices in \(G'\) returns G. The contraction of an edge (uv) in a multigraph G leads to a multigraph \(G'\) by replacing (uv) with a vertex w incident to all the edges u and v are incident to in G; k parallel edges (uv) in G lead to \(k-1\) self-loops incident to w in \(G'\) (the contracted edge is not in \(G'\)). If G has a planar embedding \(\mathcal{E}_G\), then \(G'\) inherits a planar embedding \(\mathcal{E}_{G'}\) as follows. Let \(a_1,\dots ,a_k,v\) and \(b_1,\dots ,b_\ell ,u\) be the clockwise orders of the neighbors of u and v in \(\mathcal{E}_G\), respectively. Then the clockwise order of the neighbors of w is \(a_1,\dots ,a_k,b_1,\dots ,b_\ell \). The contraction of a connected graph is the contraction of all its edges.

The straight-line segment between points p and q is denoted by \(\overline{pq}\). The angle of \(\overline{pq}\) is the angle between the ray from p in positive x-direction and the ray from p through \(\overline{pq}\). A polygon P is strictly-convex if at every vertex the interior angle is \(<\pi \) ; also, P is star-shaped if there exists a point \(p^*\) such that \(\overline{pp^*}\subset P\), for every vertex p of P; the kernel of P is the set of all such points \(p^*\).

A 1-page book embedding (1PBE) is a plane drawing where all vertices are placed on an oriented line \(\ell \) called spine and all edges are curves in the halfplane to the left of \(\ell \). A 2-page book embedding (2PBE) is a plane drawing where all vertices are placed on a spine \(\ell \) and each edge is a curve in one of the two halfplanes delimited by \(\ell \).

3 Two Trees

In this section we describe an algorithm that computes a Sefe of any two trees R and B with one bend per edge. Let C be the common graph of R and B.

We outline our algorithm. In Step 1, we compute a combinatorial Sefe of R and B for every vertex the incident black edges are consecutive in the circular order of incident edges. In Step 2, we contract each component of C, obtaining trees \(R'\) from R and \(B'\) from B. In Step 3, we independently augment \(R'\) and \(B'\) to Hamiltonian planar graphs, so as to satisfy topological constraints that are necessary for the subsequent drawing algorithms. In Step 4, we use the Hamiltonian augmentations to construct a simultaneous embedding of \(R'\) and \(B'\) with one bend per edge, similarly to an algorithm of Erten and Kobourov [10]. Finally, in Step 5, we expand the components of C by modifying the simultaneous embedding of \(R'\) and \(B'\) in a neighborhood of each vertex to make room for the components of C. We now describe these steps in detail.

Step 1: Combinatorial Sefe . Fix the clockwise order of edges incident to each vertex as follows: all black edges in any order, then all red edges in any order, and then all blue edges in any order (each sequence might be empty). As any rotation system for a tree determines a planar embedding, this results in a combinatorial Sefe \(\mathcal {E}\) of R and B (Fig. 2a). We may assume that every component S of C is incident to at least one red and one blue edge: If S is not incident to any, say, blue edge, then \(B=S=C\), since B is connected, and any plane straight-line drawing of R is a Sefe of R and B.

Fig. 2.
figure 2

(a) A connected component S of C, together with its incident exclusive edges. (b) Vertex v resulting from the contraction of S.

For every component S of C we pick two incident edges r(S) and b(S) as follows. In any Sefe equivalent to \(\mathcal {E}\) let \(\gamma \) be a simple closed curve surrounding S and close enough to it so that \(\gamma \) has no crossing in its interior. Note that \(\gamma \) intersects all the exclusive edges incident to S in some clockwise order in which all the exclusive edges incident to a single vertex of S appear consecutively. Let r(S) be any red edge not preceded by a red edge in this order and let b(S) be the first blue edge after r(S). We define a total ordering \(\varrho _S\) of the vertices of S, as the order in which their exclusive edges intersect \(\gamma \) (a curve is added incident to every vertex of S with no incident exclusive edge for this purpose), where the first vertex of \(\varrho _S\) is the endvertex of r(S).

Lemma 1

The straight-line drawing of S obtained by placing its vertices on a strictly-convex curve \(\lambda \) in the order defined by \(\varrho _S\) is plane.

Proof

For every vertex v of S, shrink \(\gamma \) along an exclusive edge incident to v so that \(\gamma \) passes through v and still every edge of S lies in its interior. Eventually \(\gamma \) passes through all the vertices of S in the order \(\varrho _S\). The planarity of the drawing of S implies that there are no two edges whose endvertices alternate along \(\gamma \). Then placing the vertices of S on \(\lambda \) in the order \(\varrho _S\) leads to a plane straight-line drawing of S.    \(\Box \)

Step 2: Contractions. Contract each component S of C to a single vertex v. The resulting trees \(R'=(V'_R,E'_R)\) and \(B'=(V'_B,E'_B)\) have planar embeddings \(\mathcal {E}_{R'}\) and \(\mathcal {E}_{B'}\) inherited from \(\mathcal {E}_R\) and \(\mathcal {E}_B\), respectively. Vertex v is common to \(R'\) and \(B'\); let r(v) and b(v) be the edges corresponding to r(S) and b(S) after the contraction. See Fig. 2b.

Step 3: Hamiltonian Augmentations. We describe this step for \(R'\) only; the treatment of \(B'\) is analogous and independent. The goal is to find a vertex order corresponding to a 1PBE of \(R'\). All edges between consecutive vertices along the spine \(\ell \), as well as the edge between the first and last vertex along \(\ell \), can be added to a 1PBE while maintaining planarity: hence the 1PBE is essentially a Hamiltonian augmentation of \(R'\). For Step 5 we need to place r(v), for each common vertex v, as in the following.

Lemma 2

There is a 1PBE for \(R'\) equivalent to \(\mathcal {E}_{R'}\) such that, for every common vertex v, the spine passes through v right before r(v) in clockwise order around v.

Proof

We construct the embedding recursively. For each exclusive vertex v, let r(v) be an arbitrary edge incident to v. Arbitrarily choose a vertex s as the root of \(R'\) and place s on \(\ell \). Place the other endpoint of r(s) after s on \(\ell \) and all remaining neighbors of s, if any, in between in the order given by \(\mathcal {E}_{R'}\). Then process every child v of s (and the subtree below v) recursively as follows (and ensure that all subtrees stay in pairwise disjoint parts of the spine, for instance, by assigning a specific region to each).

Fig. 3.
figure 3

Embedding the children of v if (a) \(p\ne v'\) or (b) \(p= v'\). Parts of the embedding already constructed are in the shaded regions.

Note that both v and the parent p of v are already embedded. By symmetry we can assume that p lies before v on the spine. Let \(v'\) be the endvertex of r(v) different from v. If \(p\ne v'\), we place the other endvertex of r(v) right before v. Both if \(p\ne v'\) (see Fig. 3a) and if \(p=v'\) (see Fig. 3b), we place the other children of v, if any, according to \(\mathcal {E}_{R'}\), in the parts of the spine between p and \(v'\), and after v. If v is not a leaf, then all its children are processed recursively in the same fashion. It is easily checked that the resulting embedding is a 1PBE that satisfies the stated properties.    \(\Box \)

Step 4: Simultaneous Embedding. We now construct a simultaneous embedding of \(R'\) and \(B'\). Let \(\sigma _v\) be the order of the edges around a vertex v obtained by sweeping a ray clockwise around v, starting in direction of the negative x-axis.

Lemma 3

For every \(\varepsilon >0\), \(R'\) and \(B'\) admit a simultaneous embedding with one bend per edge in which:

  • all edges of \(E_{R'}\) (\(E_{B'}\)) incident to each vertex v in \(V_R'\) (resp. \(V_B'\)) leave v within an angle of \([-\varepsilon ;+\varepsilon ]\) with respect to the positive y-direction (resp. x-direction);

  • the drawing restricted to \(R'\) (to \(B'\)) is equivalent to \(\mathcal {E}_{R'}\) (resp. to \(\mathcal {E}_{B'}\)); and

  • for every common vertex v, the first red (blue) edge in \(\sigma _v\) is r(v) (resp. b(v)).

Proof

Our algorithm is very similar to algorithms due to Brass et al. [6] and Erten and Kobourov [10]. These algorithms, however, do not guarantee the construction of a simultaneous embedding in which the order of the edges incident to each vertex is as stated in the lemma. This order is essential for the upcoming expansion step.

We assign x-coordinates \(1,\dots ,|V_{R'}|\) (y-coordinates \(|V_{B'}|,\dots ,1\)) to the vertices of \(R'\) (resp. of \(B'\)) according to the order in which they occur on the spine in the 1PBE of \(R'\) (resp. of \(B'\)) computed in Lemma 2. This determines the placement of every common vertex. Set any not-yet-assigned coordinate to 0.

We now draw the edges of \(R'\) (the construction for \(B'\) is symmetric). The idea is to realize the 1PBE of \(R'\) with its vertices placed as above and its edges drawn as x-monotone polygonal curves with one bend. We proceed as follows. The 1PBE of \(R'\) defines a partial order of the edges corresponding to the way they nest. For example, denoting the vertices by their order along the spine, edge (3, 4) preceeds (3, 5) and (2, 5), while (1, 2) and (6, 7) are incomparable. We draw the edges of \(R'\) in any linearization of this partial order. Suppose we have drawn some edges and let (uv) be the next edge to be drawn. Assume w.l.o.g. that the x-coordinate of u is smaller than the one of v. For some \(\varepsilon _{uv}>0\), consider the ray \(\varrho _u\) emanating from u with an angle of \(\pi /2-\varepsilon _{uv}\) (with respect to the positive x-axis). Similarly, let \(\varrho _v\) be the ray emanating from v with an angle of \(\pi /2+\varepsilon _{uv}\). We choose \(\varepsilon _{uv}<\varepsilon \) sufficiently small so that:

  1. (1)

    no vertex in \(V_{R'}\setminus \{u\}\) lies in the region to the left of the underlying (oriented) line of \(\varrho _u\) and to the right of the vertical line through u;

  2. (2)

    no vertex in \(V_{R'}\setminus \{v\}\) lies in the region to the right of the underlying (oriented) line of \(\varrho _v\) and to the left of the vertical line through v; and

  3. (3)

    neither \(\varrho _u\) nor \(\varrho _v\) intersects any previously drawn edge.

As no two vertices of \(R'\) have the same x-coordinate, we can choose \(\varepsilon _{uv}\) as claimed. The corresponding rays \(\varrho _u\) and \(\varrho _v\) intersect in some point: this is where we place the bend-point of (uv). The resulting drawing is equivalent to the 1PBE of \(R'\) and therefore to \(\mathcal {E}_{R'}\). The remaining claimed properties are preserved from the 1PBE.    \(\Box \)

Step 5: Expansion. We now expand the components of C in the drawing produced by Lemma 3 one by one in any order. Let \(\varGamma \) be the current drawing, v be a vertex corresponding to a not-yet-expanded component S of C, and p be the point on which v is placed in \(\varGamma \). Note that the red and blue edges incident to v may be incident to different vertices in S. Let \(\sigma _v=(e_1,\dots ,e_\ell )\), where \(e_1,\dots ,e_k\) are red and \(e_{k+1},\dots ,e_\ell \) are blue. By Lemma 3, \(r(v)=e_1\) and \(b(v)=e_{k+1}\). Each edge incident to v is drawn as a polygonal curve with one bend. Let \(b_i\) be the bend-point of \(e_i\). The plan is to delete p and segments \(\overline{pb_i}\) in \(\varGamma \) to obtain \(\varGamma '\). Then draw S in \(\varGamma '\) inside a small disk around p and draw segments from S to \(b_1,\dots ,b_\ell \). See Fig. 4. For an \(\varepsilon \ge 0\), let \(D_\varepsilon \) be the disk with radius \(\varepsilon \) centered at p. Let \(\varGamma _R\) (\(\varGamma _R'\)) be the restriction of \(\varGamma \) (resp. \(\varGamma '\)) to the red and black edges. We state the following propositions only for the red graph; the propositions for the blue graph are analogous. By continuity, v can be moved around slightly in \(\varGamma _R\) while maintaining a plane drawing for the red graph. This implies the following.

Fig. 4.
figure 4

Expanding a component S in a small disk \(D_\varepsilon \) around p.

Proposition 1

There exists a \(\delta _R>0\) with the following property. For every drawing \(\varGamma _R^*\) obtained from \(\varGamma _R'\) by drawing S in \(D_{\delta _R}\), the red segments from S to \(b_1,\dots ,b_k\) do not cross any segment already present in \(\varGamma _R'\).

Proposition 2

There exists an \(\varepsilon _R>0\) with the following property. Let \(q_1,\dots ,q_k\) be any k (not necessarily distinct) points in this clockwise order on the upper semicircle of \(D_{\varepsilon _R}\). Then the segments \(\overline{q_1b_1},\dots ,\overline{q_kb_k}\) do not intersect except at common endpoints.

Proof

The angles of \(\overline{pb_1},\dots ,\overline{pb_k}\) are distinct and strictly decreasing, by Lemma 3 and by the way \(e_1,\dots ,e_k\) are labeled. We claim that \(\varepsilon _R\) can be chosen sufficiently small so that the angles of \(\overline{q_1b_1},\dots ,\overline{q_kb_k}\) are also distinct and strictly decreasing. For a certain \(\varepsilon \), let \(I_i(\varepsilon )\) be the interval of all angles \(\alpha \) such that the ray with angle \(\alpha \) from \(b_i\) intersects \(D_{\varepsilon }\). Since the angles of \(\overline{pb_1},\dots ,\overline{pb_k}\) are distinct, it follows that the intervals \(I_1(0),\dots ,I_k(0)\) are disjoint. By continuity, there exists an \(\varepsilon _R>0\) for which \(I_1(\varepsilon _R),\dots ,I_k(\varepsilon _R)\) are also disjoint, and the claim follows for this \(\varepsilon _R\). Finally, two segments \(\overline{q_ib_i}\) and \(\overline{q_jb_j}\) with \(i<j\) and \(q_i\ne q_j\) can intersect only if the angle of \(\overline{q_ib_i}\) is smaller than the angle of \(\overline{q_jb_j}\), which does not happen by the claim.    \(\Box \)

Lemma 4

There exists an \(\varepsilon >0\) with the following property. We can expand S to obtain a simultaneous embedding \(\varGamma ^*\) from \(\varGamma '\) by drawing the vertices of S on the boundary of \(D_\varepsilon \), the edges of S as straight-line segments, and by connecting S to \(b_1,\dots ,b_\ell \) with straight-line segments.

Proof

Let \(\delta _R\), \(\delta _B\), \(\varepsilon _R\), and \(\varepsilon _B\) be the constants given by Propositions 1 and 2 and their analogous formulations for B. Let \(\varepsilon :=\min \{\delta _R,\delta _B,\varepsilon _R,\varepsilon _B\}\). Place the vertices of S as distinct points on the boundary of the upper-right quadrant of \(D_\varepsilon \) in the order \(\varrho _S\). By Lemma 1, this placement determines a straight-line plane drawing of S. Draw straight-line segments from the vertices of S to \(b_1,\dots ,b_\ell \), thus completing the drawing of the exclusive edges incident to S. We prove that the red segments incident to S do not cross any red or black edge; the proof for the blue segments is analogous. By Proposition 1, the red segments incident to S do not cross the red and black segments not incident to S. Also, they do not cross the edges of S, which are internal to \(D_\varepsilon \). Further, Proposition 2 ensures that these segments do not cross each other. Namely, the linear order of the vertices of S defined by the sequence of red edges \(e_1,\dots ,e_k\) is a subsequence of \(\varrho _S\), given that the embedding \(\mathcal {E}_{R'}\) of \(R'\) is the one inherited from \(\mathcal {E}_{R}\), given that Lemma 3 produces a drawing of \(R'\) respecting \(\mathcal {E}_{R'}\) and in which \(e_1=r(v)\), and given that the endvertex of r(S) in S is the first vertex of \(\varrho _S\).    \(\Box \)

Theorem 1

Let R and B be two trees. There exists a Sefe of R and B in which every exclusive edge is a polygonal curve with one bend, every common edge is a straight-line segment, and every two exclusive edges cross at most four times.

Proof

By Lemma 3, \(R'\) and \(B'\) admit a simultaneous embedding with one bend per edge. By repeated applications of Lemma 4, the simultaneous embedding of \(R'\) and \(B'\) can be turned into a Sefe of R and B in which every exclusive edge has one bend and every common edge is a straight-line segment. Finally, any two exclusive edges cross at most four times, given that each of them consists of two straight-line segments.    \(\Box \)

4 A Planar Graph and a Tree (sketch)

In this section we sketch an algorithm that computes a Sefe of any planar graph R and any tree B in which every edge of R has at most six bends and every edge of B has one bend. The common graph C of R and B is a forest, as it is a subgraph of B. The algorithm is similar to the one for trees (Sect. 3), however, it encounters some of the complications one needs to handle when dealing with pairs of planar graphs (Sect. 5). A detailed description of the algorithm and a proof of its correctness can be found in [14]. The algorithm consists of several steps.

Step 1: Antennas. We modify R and B as follows. Each red edge (uv), with u and v in C, is replaced by a path \((u,u_e,v_e,v)\), whose first and third edge are black, and whose second edge is red; also, each red edge (uv), with u in C and v not in C, is replaced by a path \((u,u_e,v)\), with \((u,u_e)\) black and with \((u_e,v)\) red. Denote by \(R'\) and \(B'\) the resulting planar graph and tree. While this modification costs two extra bends per edge of R in the final Sefe of R and B (which will be obtained from a Sefe of \(R'\) and \(B'\) by removing vertices and edges not in R and B), it establishes the property that, for every exclusive edge e of \(R'\), every common endvertex of e is incident to e, to a common edge, and to no other edge.

Step 2: Combinatorial Sefe . We construct a combinatorial Sefe \(\mathcal {E}'\) of \(R'\) and \(B'\) such that at each vertex v of the common graph \(C'\) of \(R'\) and \(B'\), all the edges of \(C'\) are consecutive in the circular order of the edges incident to v. While this is done similarly to the case of tree-tree pairs, the existence of this combinatorial Sefe here is possible only because of the antennas introduced in Step 1. Edges r(S) and b(S), ordering \(\varrho _S\), and planar embeddings \(\mathcal {E}_{R'}\) and \(\mathcal {E}_{B'}\) are defined as in Sect. 3.

Step 3: Contractions. We contract each component of \(C'\) to a vertex in \(R'\) and in \(B'\), determining a planar multigraph \(R''\) (with loops) and a tree \(B''\), respectively. Graphs \(R''\) and \(B''\) inherit planar embeddings \(\mathcal {E}_{R''}\) and \(\mathcal {E}_{B''}\) from \(\mathcal {E}_{R'}\) and \(\mathcal {E}_{B'}\), respectively. Let r(v) and b(v) be the edges corresponding to r(S) and b(S).

Step 4: Hamiltonian Augmentations. A Hamiltonian augmentation of \(B''\) is computed by Lemma 2. A Hamiltonian augmentation of \(R''\) might not exist, thus we subdivide some edges of \(R''\) and then augment the subdivided \(R''\) into a graph \(R'''\) containing a Hamiltonian cycle \(\mathcal C\) (which we assume to be oriented counter-clockwise), none of whose edges is part of an original edge of \(R''\).

The augmentation does not alter the embedding of \(R''\), that is, it produces a planar embedding \(\mathcal{E}_{R'''}\) that contains a subdivision of \(\mathcal {E}_{R''}\); also, for each common vertex v of \(R''\) and \(B''\), the edge of \(\mathcal{C}\) entering v is right before r(v) in the clockwise order of edges incident to v in \(\mathcal {E}_{R'''}\). Each edge e of \(R''\) either is also an edge of \(R'''\) (as it has not been subdivided) or corresponds to a path with three edges in \(R'''\) (as it has been subdivided twice). In the former case, e is to the left of \(\mathcal C\); in the latter case, the path corresponding to e starts to the left of \(\mathcal C\), then moves to its right, and then ends again to its left.

The augmentation can be computed as follows: let T be a spanning tree of \(R''\); draw a closed curve \(\gamma \) in \(\mathcal {E}_{R''}\) around T crossing twice every edge of \(R''\) not in T; replace such crossings with subdivision vertices for the edges of \(R''\) and insert dummy vertices on \(\gamma \); modify \(\gamma \) in a neighborhood of each vertex v of \(R''\), so that \(\gamma \) passes through v.

Step 5: Simultaneous Embedding. In order to construct a simultaneous embedding of \(R''\) and \(B''\), we would like to use known algorithms that embed planar graph pairs simultaneously with two bends per edge [8, 9, 19]. However, the existence of self-loops in \(R''\) prevents us from doing that. Thus, we modify those algorithms to prove that a simultaneous embedding of \(R''\) and \(B''\) exists in which every edge of \(R''\) (of \(B''\)) is a polygonal curve with at most four bends (resp. with one bend) and every two edges cross at most eight times. Further, the planar embeddings \(\mathcal {E}_{R''}\) and \(\mathcal {E}_{B''}\) of \(R''\) and \(B''\) are respected, the first red (blue) edge in \(\sigma _v\) is r(v) (resp. b(v)), where \(\sigma _v\) is defined as in Sect. 3, and all the edges of \(R''\) leave their incident vertices within an angle of \([-\varepsilon ;+\varepsilon ]\) with respect to the positive y-direction (resp. x-direction).

The embedding algorithm is similar to the one in Lemma 3. First, the vertices of \(R'''\) (of \(B''\)) are assigned increasing x-coordinates (decreasing y-coordinates), according to their order along the Hamiltonian cycle in \(R'''\) (in \(B''\)). The edges of \(B''\) and the not subdivided edges of \(R''\) are drawn as steep 1-bend curves. Every other edge e of \(R''\) is a path with three edges in \(R'''\); drawing each of these edges as a steep 1-bend curve would result in e having five bends (one per edge of \(R'''\) composing e, plus two corresponding to the subdivision vertices for e); one bend is saved by placing all the subdivision vertices for the edges of \(R''\) on a strictly-convex curve, so that the edges of \(R'''\) between them can be drawn as straight-line segments rather than as 1-bend curves.

Step 6: Expansion. Expand the components of \(C'\) in the simultaneous embedding of \(R''\) and \(B''\), as in Sect. 3; this results in a Sefe of \(R'\) and \(B'\). Remove vertices and edges not in R and B, obtaining a Sefe of R and B. We get the following.

Theorem 2

Let R be a planar graph and let B be a tree. There exists a Sefe of R and B in which every exclusive edge of R is a polygonal curve with at most six bends, every exclusive edge of B is a polygonal curve with one bend, every common edge is a straight-line segment, and every two exclusive edges cross at most eight times.

5 Two Planar Graphs (sketch)

In this section we sketch an algorithm that computes a Sefe of any two planar graphs R and B in which every edge has at most six bends. A detailed description of the algorithm and a proof of its correctness can be found in [14].

We assume that a combinatorial Sefe \(\mathcal E\) of R and B is given, that no exclusive vertex or edge lies in the outer face of C in \(\mathcal E\), and that R and B are connected. We make the first assumption since determining the existence of such a Sefe is a problem of unknown complexity [4]; the last two assumptions can be met after an initial augmentation. We introduce antennas, as in Sect. 4, turning R and B into planar graphs \(R'\) and \(B'\) with a common graph \(C'\); however, here the modification is performed for both graphs. This costs two extra bends per edge in the final Sefe of R and B; however, it establishes the property that, for every exclusive edge e, every common endvertex of e is incident to e, to a common edge, and to no other edge. A combinatorial Sefe \(\mathcal {E}'\) of \(R'\) and \(B'\) is derived from \(\mathcal {E}\) by drawing the antennas as “very small” curves on top of the edges they partially replace. Let \(\mathcal {E}_{C'}\) be the restriction of \(\mathcal {E}'\) to \(C'\).

We now construct a Sefe of \(R'\) and \(B'\). Similarly to Sects. 3 and 4, we would like to contract each component S of \(C'\), construct a simultaneous embedding of the resulting graphs, and finally expand the components of \(C'\). However, S is not a tree here, but rather a planar graph containing other components of \(C'\) in its internal faces. Hence, the contraction – simultaneous embedding – expansion process does not happen just once, but rather we proceed from the outside to the inside of \(C'\) iteratively, each time applying that process to draw certain subgraphs of \(R'\) and \(B'\), until \(R'\) and \(B'\) have been entirely drawn. We now sketch how this is done.

We start by representing the cycle \(\delta ^*\) delimiting the outer face of \(C'\) in \(\mathcal {E}'\) as a strictly-convex polygon \(\varDelta ^*\). Next, assume that a Sefe \(\varGamma ''\) of two subgraphs \(R''\) of \(R'\) and \(B''\) of \(B'\) has been constructed. Let \(C''\) be the common graph of \(R''\) and \(B''\) and let \(\mathcal {E}_{R''}\), \(\mathcal {E}_{B''}\), and \(\mathcal {E}_{C''}\) be the planar embeddings of \(R''\), \(B''\), and \(C''\) in \(\mathcal {E}'\), respectively. Assume that the following properties hold for \(\varGamma ''\).

  • (Bends and crossings): every edge is a polygonal curve with at most four bends, every common edge is a straight-line segment, and every two exclusive edges cross at most sixteen times;

  • (Embedding): the restrictions of \(\varGamma ''\) to \(R''\), \(B''\), and \(C''\) are equivalent to \(\mathcal {E}_{R''}\), \(\mathcal {E}_{B''}\), and \(\mathcal {E}_{C''}\), respectively; and

  • (Polygons): each not-yet-drawn vertex or edge of \(R'\) or \(B'\) lies in \(\mathcal {E}'\) inside a simple cycle \(\delta _f\) in \(C''\) which is represented in \(\varGamma ''\) by a star-shaped empty polygon \(\varDelta _f\); further, if an edge exists in \(C'\) that lies inside \(\delta _f\) in \(\mathcal {E}'\) and that belongs to the same 2-connected component of \(C'\) as \(\delta _f\), then \(\varDelta _f\) is a strictly-convex polygon.

These properties are initially met with \(R''=B''=C''=\delta ^*\) and with \(\varGamma ''=\varDelta ^*\). It remains to describe how to insert in \(\varGamma ''\) vertices and edges of \(R'\) and \(B'\) that are not yet in \(\varGamma ''\), while maintaining these properties. Since \(R'\) and \(B'\) are finite graphs, this will eventually lead to a sefe of \(R'\) and \(B'\). We distinguish two cases.

In Case 1, a 2-connected component \(S_f\) of \(C'\) exists such that: (i) the outer face of \(S_f\) in \(\mathcal {E}_{C'}\) is delimited by a simple cycle \(\delta _f\) belonging to \(C''\) and containing no vertex or edge of \(C''\) in its interior in \(\mathcal {E}_{C'}\); and (ii) \(S_f\) contains edges inside \(\delta _f\) in \(\mathcal {E}_{C'}\), hence by property Polygons, \(\delta _f\) is a strictly-convex polygon \(\varDelta _f\) in \(\varGamma ''\). As observed in [18], a straight-line plane drawing \(\varGamma _f\) of \(S_f\) exists in which the outer face of \(S_f\) is delimited by \(\varDelta _f\) and every internal face is delimited by a star-shaped polygon. Plugging \(\varGamma _f\) in \(\varGamma ''\) maintains properties Bends and crossings, Embedding, and Polygons.

In Case 2, let \(\delta _f\) be a simple cycle belonging to \(C''\), containing no vertex or edge of \(C''\) in its interior in \(\mathcal {E}_{C'}\), and containing a not-yet-drawn vertex or edge in its interior in \(\mathcal {E}'\). By property Polygons, \(\delta _f\) is a star-shaped polygon \(\varDelta _f\) in \(\varGamma ''\). Since Case 1 does not apply, \(\delta _f\) delimits a face f of \(\mathcal {E}_{C'}\) in its interior (possibly with other cycles of \(C'\)). Let \(C'(f)\) be the subgraph of \(C'\) composed of the vertices and edges incident to f in \(\mathcal {E}_{C'}\). Also, let \(R'(f)\) (\(B'(f)\)) be the subgraph of \(R'\) (of \(B'\)) composed of \(C'(f)\) and of the red (blue) vertices and edges lying in f in \(\mathcal {E}'\); these are the graphs we draw while maintaining properties Bends and crossings, Embedding, and Polygons. This proof is the most involved part of the paper.

We give an algorithm that draws \(R'(f)\) and \(B'(f)\) in four steps, with the approach of Sects. 3 and 4: (Step 1) contract each component of \(C'(f)\), obtaining planar multigraphs \(R''(f)\) and \(B''(f)\); (Step 2) independently compute Hamiltonian augmentations of \(R''(f)\) and \(B''(f)\); (Step 3) construct a simultaneous embedding \(\varGamma ''(f)\) of \(R''(f)\) and \(B''(f)\), relying on their Hamiltonian augmentations; and (Step 4) expand each component of \(C'(f)\) in \(\varGamma ''(f)\), obtaining a Sefe \(\varGamma '(f)\) of \(R'(f)\) and \(B'(f)\).

Differently from the previous sections, a simultaneous embedding has to be constructed for two planar multigraphs; this is not a big issue though, other than for the number of bends of \(B'(f)\) in \(\varGamma '(f)\). What is a major complication is that, in order to extend the Sefe \(\varGamma ''\) of \(R''\) and \(B''\) by plugging \(\varGamma '(f)\) into it, we need to ensure that \(\varGamma ''\) and \(\varGamma '(f)\) coincide along the part they share, which is polygon \(\varDelta _f\). That is, the Sefe \(\varGamma '(f)\) of \(R'(f)\) and \(B'(f)\) we construct has to coincide with \(\varDelta _f\) when restricted to \(\delta _f\).

The impact of this constraint on the contraction – simultaneous embedding – expansion process is as follows. The contraction and Hamiltonian augmentation steps stay unchanged. Denote by \(u^*\) the vertex of \(R''(f)\) and \(B''(f)\) to which the 2-connected component \(S^*\) of \(C'(f)\) containing \(\delta _f\) has been contracted. The simultaneous embedding step is also very similar to the one in Sect. 4, except that it ensures that \(u^*\) and its adjacent bends are in certain geometric positions. The expansion step changes heavily. Namely: (i) we expand the components \(S\ne S^*\) of \(C'(f)\) in \(\varGamma ''_f\) in the usual way; (ii) we define a region \(\mathcal{H}^*\) inside the kernel of \(\varDelta _f\); (iii) we construct a drawing \(\varGamma ^*\) of \(S^*\) such that \(\delta _f\) is represented as \(\varDelta _f\) and all the other vertices and edges of \(S^*\) are inside \(\varDelta _f\) but outside \(\mathcal{H}^*\); we rotate and scale \(\varGamma ''_f\) and place it in \(\mathcal{H}^*\); and we finally connect \(\varGamma ^*\) with \(\varGamma ''_f\) via straight-line segments, thus obtaining \(\varGamma '_f\). We then plug \(\varGamma '_f\) in \(\varGamma ''\), so that they coincide along \(\varDelta _f\), obtaining a drawing satisfying Properties Bends and crossings, Embedding, and Polygons. We get the following.

Theorem 3

Let R and B be two planar graphs. If there exists a Sefe of R and B, then there also exists a Sefe of R and B in which every edge is a polygonal curve with at most six bends, every common edge is a straight-line segment, and every two exclusive edges cross at most sixteen times.

6 Conclusions

In this paper we proved upper bounds for the number of bends per edge and the number of crossings per edge pair required to realize a Sefe with polygonal curves as edges.

While the bound on the number of bends per edge we presented for tree-tree pairs is tight, there is room for improvement for pairs of planar graphs, as the best known lower bound [6] only states that one bend per edge might be needed. We suspect that our upper bound could be improved by designing an algorithm that constructs a simultaneous embedding of two planar multigraphs with less than four bends per edge. A related interesting problem is to determine how many bends per edge are needed to construct a simultaneous embedding of pairs of (simple) planar graphs. The best known upper bound is two [8, 9, 19] and the best known lower bound is one [15].

As a final research direction, we mention the problem of constructing Sefes of pairs of planar graphs in polynomial area, while matching our bounds for the number of bends per edge and crossings per pair of edges.