Planar Packing of Binary Trees Markus Geyer1 , Michael Hoffmann2,? , Michael Kaufmann1 , Vincent Kusters2,∗ , and Csaba D. T´oth3 1
3
Wilhelm-Schickard-Institut f¨ ur Informatik, Universit¨ at T¨ ubingen, Germany. [geyer|mk]@informatik.uni-tuebingen.de 2 Institute of Theoretical Computer Science, ETH Z¨ urich, Switzerland. [hoffmann|vincent.kusters]@inf.ethz.ch California State University Northridge and University of Calgary.
[email protected] Abstract. In the graph packing problem we are given several graphs and have to map them into a single host graph G such that each edge of G is used at most once. Much research has been devoted to the packing of trees, especially to the case where the host graph must be planar. More formally, the problem is: Given any two trees T1 and T2 on n vertices, we want a simple planar graph G on n vertices such that the edges of G can be colored with two colors and the subgraph induced by the edges colored i is isomorphic to Ti , for i ∈ {1, 2}. A clear exception that must be made is the star tree which cannot be packed together with any other tree. But a popular hypothesis states that this is the only exception, and all other pairs of trees admit a planar packing. Previous proof attempts lead to very limited results only, which include a tree and a spider tree, a tree and a caterpillar, two trees of diameter four and two isomorphic trees. We make a step forward and prove the hypothesis for any two binary trees. The proof is algorithmic and yields a linear time algorithm to compute a plane packing, that is, a suitable two-edge-colored host graph along with a planar embedding for it. In addition we can also guarantee several nice geometric properties for the embedding: vertices are embedded equidistantly on the x-axis and edges are embedded as semi-circles.
a0
a b d
c e
?
f
g
+ h i
b
0
e0
=
d0
c0
g0
f0 h0
a c e f d i h g b c0 e0 f 0 g 0 h0 i0 d0 b0 a0
i0
Partially supported by the ESF EUROCORES programme EuroGIGA, CRP GraDR and the Swiss National Science Foundation, SNF Project 20GG21-134306.
2
1
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
Introduction
Finding subgraphs with specific properties within a given graph or more generally determining relationships between a graph and its subgraphs is one of the most studied topics in graph theory. The subgraph isomorphism problem [21,11,5] asks to find a subgraph H in a graph G. The graph thickness problem [16] asks for the minimum number of planar subgraphs which the edges of a graph can be partitioned into. The arboricity problem [4] asks to determine the minimum number of forests which a graph can be partitioned into. Another related classical combinatorial problem is the k edge-disjoint spanning trees problem which dates back at least to Tutte [20] and Nash-Williams [17], who gave necessary and sufficient conditions for the existence of k edge-disjoint spanning trees in a graph. Every (maximal) planar graph can be partitioned into at most three edge-disjoint trees or into three forests, respectively, also known as Schnyder woods [19]. Finally, Gon¸calves [13] proved that every planar graph can be partitioned in two edge-disjoint outerplanar graphs. Of course, the study of relationships between a graph and its subgraphs can also be done the other way round. Instead of asking for specific types of subgraphs of a given graph, one can ask for a graph G that encompasses a given set of graphs G1 , . . . , Gk and satisfies certain properties in addition. This topic occurs with different flavors in the computational geometry and graph drawing literature. It is motivated by visualization aims, such as the display of networks evolving over time and the simultaneous visualization of relationships involving the same S entities. In the simultaneous embedding problem [2,12,7] the graph G = Gi is given and the goal is to draw it so that the drawing of each Gi is plane. The simultaneous embedding without mapping problem [2] is to find a graph G on n vertices such that: (i) G contains all the Gi as subgraphs, and (ii) G can be drawn with straight-line edges so that the drawing of each Gi is plane. The packing problem is to find a graph G on n vertices that contains a given collection G1 , . . . , Gk of graphs on n vertices each as edge-disjoint subgraphs. This problem has been studied in a wide variety of scenarios (see, e.g., [1], [6], [3]). Much attention has been devoted to the packing of trees. Hedetniemi [14] showed that any two non-star trees can be packed into a subgraph of Kn . A star is a tree with exactly one vertex of degree greater than one. Maheo et al. [15] gave a characterization of the triples of trees that can be packed into Kn . In the planar packing problem the graph G is required to be planar. Garc´ıa et al. [10] conjectured that there exists a planar packing for any two non-star trees, that is, for any two trees with diameter greater than two. Notice that the hypothesis that none of the trees is a star is necessary, since a star uses all edges incident to one vertex and so there is no edge left to connect that vertex in the other tree. Garc´ıa et al. proved their conjecture for the cases that the trees are isomorphic and that one of the trees is a path. Oda and Ota [18] addressed the case that one of the trees is a caterpillar or that one of the trees is a spider of diameter at most four. A caterpillar is a tree that becomes a path when all leaves are deleted and a spider is a tree with at most one vertex of degree greater than two. Frati et al. [9] gave an algorithm to construct a planar packing of any
Planar Packing of Binary Trees
3
spider with any tree. Finally, Frati [8] proved the conjecture for the case that both trees have diameter at most four. In this paper we will prove the following: Theorem 1. Any two non-star binary trees admit a planar packing. Binary trees are a major step in the study of planar tree packing, because they offer far more variety than the path-like sub-structures in spiders or the subtrees of constant depth in caterpillars and—more generally—trees of bounded diameter. We believe that the techniques used here shed some new light on the structure and complexity of the problem that might also help to attack the general case.
2
Definitions and Overview
A binary tree is a tree in which no vertex has more than three neighbors. All trees considered in the following are binary. A rooted tree is a directed tree with exactly one sink (vertex of out-degree zero). In a rooted tree, every vertex v other than the root has exactly one outgoing edge vp. The target p(v) = p is the parent of v, and conversely v is a child of p. In figures we denote the root of a tree by an outgoing vertical arrow. For a vertex v of a rooted tree T , denote by t(v) the subtree rooted at v, that is, the subtree of T induced by the vertices from which v can be reached on a directed path. Furthermore, denote by |v| the size (number of vertices) of t(v). The path on n vertices is denoted by Pn . A tree in which all vertices—except for at most one that is called the center —have degree one is called a star and the star on n vertices is denoted by Sn . A two page book embedding (2PBE) of a graph G = (V, E) is a plane embedding of G, such that the vertices of G are aligned on a horizontal line and the set of edges can be partitioned into two sets, one of which is embedded in the closed halfplane above the line and the other is embedded in the closed halfplane below the line. Similarly, a one page book embedding (1PBE) uses only one of the closed halfplanes. We embed vertices equidistantly along the positive x-axis and refer to them by their x-coordinate, that is, P = {1, . . . , n}. An interval [i, j] in P is a sequence of the form i, i + 1, . . . , j, for 1 ≤ i ≤ j ≤ n, or i, i − 1, . . . , j, for 1 ≤ j ≤ i ≤ n. Observe that we consider an interval [i, j] as oriented and so we can have i > j. Denote the length of an interval [i, j] by |[i, j]| = |i − j| + 1. Overview. We explicitly construct a plane drawing of two trees T1 = (V1 , E1 ) and T2 = (V2 , E2 ) on the point set P = {(i, 0) : 1 ≤ i ≤ n}. For the most part we will actually work with a 2PBE where the trees give the partition of the edges. In certain situations, however, we will also embed an edge of a tree “on the other side” of the x-axis. So while the final embedding is a 2PBE, in general the partition of the edges is not just according to the trees T1 and T2 . Every edge {p, q} ∈ P2 is embedded as an upper or lower semicircle with diameter pq. A joint embedding for T1 and T2 is then determined by a map π that assigns to each vertex in V = V1 ∪V2 a distinct point from P and determines
4
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
for each edge e ∈ E = E1 ∪ E2 whether e is embedded above or below the xaxis. If π is a 2PBE, then it is plane, if the following holds: for any two edges {u, v}, {w, x} that are embedded on the same page, π(u) < π(w) < π(v) implies π(u) ≤ π(x) ≤ π(v). As a first step we construct an embedding π1 for T1 onto P , using only the halfplane above P to route the edges. The embedding is guided by specific rules which are discussed in Section 3. Next we recursively construct an embedding for T2 to pair up with π1 (T1 ). In principle we follow the same strategy as for T1 , except for the first step, which introduces a “shift”. Also, we sometimes have to deviate from this strategy and in some cases even π1 has to be adjusted locally in order to obtain the final embedding π. Although neither of the two trees T1 and T2 we start with is a star, it is possible—in fact, unavoidable—that stars appear as subtrees during the recursion. Given that we deal with binary trees, these stars can have at most four vertices, though. We have to deal with these stars explicitly whenever they arise, because the general recursive step works for non-stars only. Mostly this can be done simply by gathering all the information on the embedding of T1 and then computing the proper intervals into which to embed, but at some points subtle changes of the general plan are required. For instance, we occasionally “flip” the embedding of some subtree of T1 : when flipping a subtree A of π(T1 ) that is embedded on an interval [i, j], we reflect the embedded tree at the vertical line x = i+j 2 through the midpoint of [i, j]. The recursion ends with explicit constructions for subtrees of size at most four. Each step of the algorithm fixes the embedding for at least one vertex and looks at and works with a constant number of vertices and edges only. As the vertex degree in our graphs is constant, it is straightforward to represent the trees and the host graph so that we can test for the presence of an edge and add or remove an edge in constant time. The sizes of the subtrees in the rooted trees T1 and T2 can be precomputed in linear time. Therefore we obtain a linear time algorithm overall.
3
Embedding of T1
We begin by defining a preliminary 1PBE π1 for T1 . Throughout the paper, whenever we embed a tree T on an interval [i, j], we assume w.l.o.g. that i < j. Since we are free to choose a root r1 for T1 , let r1 be any leaf of T1 . We start the recursive procedure by embedding T1 rooted at r1 onto [1, n]. In every recursive step, we are given a tree T rooted at a vertex r and an interval [i, j] of length |r|. We place r at position i and embed its one or two children according to two rules. The larger-subtree-first rule dictates that in the embedding of T on [i, j], the larger subtree of r is embedded on an interval bordering the position of r. The one-side rule dictates that all neighbors of a vertex v mapped to k ∈ [i, j] are mapped to either [i, k − 1] or to [k + 1, j]. Note that these rules imply that every subtree T ⊆ T1 is embedded onto an interval
Planar Packing of Binary Trees
5
[i, j] ⊆ [1, n], using the edge {i, j}. Together with the placement of the root of T1 at position 1, these two rules completely define the embedding algorithm below. For an example see Fig. 1. a b d
c e
f
g
h a c e f d i h g b
i
Fig. 1: Example for the embedding of T1 .
Algorithm 1: Embed (T, I). Input: A rooted binary tree T = (V, E) and a directed interval I with I ⊆ [1, n]. Output: A map π1 : V → I. Let r be the root of T and let [i, j] = I (w.l.o.g. i < j). π1 (r) ← i if r has degree one in T then Let r0 be the child of r in t. Embed (t(r0 ), [j, i + 1]) else if r has degree two in T then Let r1 , r2 be the two children of r, such that |r1 | ≥ |r2 |. Embed (t(r1 ), [i + |r1 |, i + 1]) Embed (t(r2 ), [j, i + |r1 | + 1]) Observe that π1 (T1 ) satisfies the following property: Proposition 1. The edge {n − 1, n} is not used by π1 , for n ≥ 5. This edge will be used to start the embedding of T2 . Consider the embedding π1 of a tree T1 onto [1, n]. When restricting the focus to some subinterval [i, j] ⊆ [1, n], we see the embedding π1 (F ) of a forest F := π1−1 ([i, j]) ⊆ T1 . Given that a specific embedding is used for T1 , we should also be able to derive some properties of π1 (F ). The following lemma describes some embeddings that cannot be produced by Algorithm 1. We will use this during the embedding of T2 . Lemma 1. Consider a tree T ⊆ T1 such that T = π1−1 ([i, j]), for some interval [i, j] ⊆ [1, n], and suppose that π1 (T ) uses the edges {i, k} and {`, j}, for some i < k < ` < j. Then at least one of the following two conditions holds: a>b+c
∧
c>b
(1)
c>a+b
∧
a > b,
(2)
where a = |[i, k]|, b = |[k + 1, ` − 1]|, and c = |[`, j]|.
6
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
Proof. Note that the second equation is obtained from the first by exchanging the roles of a and c. Hence, we may assume w.l.o.g. that p(j) = i. Suppose that b = 0. Since i has children k and j, vertex i has no incoming edges besides {i, k} and {i, j}. The larger-subtree-first rule for i implies a − 1 ≥ b + c, which together with the trivial c > 0 yields (1). It remains to consider the case b > 0. Since i already has indegree two and j already has one child in `, the vertices at [k + 1, ` − 1] must form a tree B with root rB and p(rB ) = j. The larger-subtree-first rule for j implies c − 1 ≥ b and the one for i implies a − 1 ≥ b + c, which together gives (1). t u Corollary 1. Consider a tree T ⊆ T1 such that T = π1−1 ([i, j]), for some interval [i, j] ⊆ [1, n], and suppose that π1 (T ) uses the edges {i, k} and {`, j}, for some i < k < ` < j. Then k − i 6= j − `. Proof. If k − i = j − `, then we have a = c in Lemma 1. At least one of the two conditions must hold, but both imply a > b + a, which is impossible for a, b ≥ 0. t u
4
Embedding of T2
In this section we describe how to obtain an embedding for T2 that is compatible with the already constructed embedding of T1 . We will do this in a recursive way similar to the embedding of T1 . The difference is that we have to take the edges used by T1 into account and adapt our strategy accordingly. Sometimes it is also necessary to change the embedding of T1 . When doing so, we have to be very careful in order to not destroy the properties of the embedding that were discussed in the preceding section and that play a crucial role in driving the embedding algorithm for T2 . Small subtrees of size at most four may be stars and so lead to unsolvable subproblems in the recursion. We resolve this by giving explicit solutions for these cases. These therefore serve as base cases for the recursive embedding of T2 . In the recursion we will keep as an invariant—we call it the placement invariant— that whenever the recursive embedding for a subtree t(v) on an interval I = [i, j] is invoked, the placement of v on i is valid in the sense that the edge from i to the point where p(v) is embedded is not used by T1 (and so it is available for T2 ). Sometimes this invariant does not only apply to the parent of v but also to another child that has already been embedded. Generally speaking, whenever we call the algorithm recursively for some tree T to be embedded on some interval I, we have to ensure that placing the root r of T on i does not induce any edge with the already embedded neighbors of r outside of I that is already used by T1 . This invariant allows us to work with the current interval locally, without having to care about where vertices are placed outside of this interval. Whenever we would like to map r to a position different from i, we have to be careful, because there may be edges that we do not see when only considering the situation on I locally: A vertex a of T1 mapped into I may have edges to vertices outside of I, in particular, to a vertex that is mapped to the same position as the
Planar Packing of Binary Trees
7
parent of r in T2 . In such a case, we say that r and a are in conflict. Obviously we must not map two vertices that are in conflict to the same position. Note that vertices of T other than r do not have conflicts and hence can be placed safely, as long as we ensure that no edge on I is used on both sides. Stars occur not only in the base cases of the recursion, but they may also occur as subtrees of a large tree. So whenever we are at a subtree T ⊂ T2 with root r in the recursion and one of the subtrees of r has strictly fewer than five vertices, we cannot use the recursive procedure for that subtree but have to handle that situation explicitly. The remainder of this section details our recursive embedding algorithm. We start by handling the base cases of the recursion, which consist of certain trees on at most nine vertices (“A small tree.”). It follows a description of the general step, which consists of two parts: “the first step” of the recursive procedure selects the starting vertex (root) for the recursion and then the general case handles “a large tree”, in which at least one subtree of the root has five or more vertices. Due to space limitations many proofs have to be omitted in this extended abstract. A small tree. We begin with the case where |b| ≤ 4. Let w.l.o.g. I = [1, |b|]. Note that there are stars of size at most four, so it will not always be possible to find an embedding. We will describe precisely when an embedding is possible. For |b| = 1 an embedding is trivially possible. For |b| = 2 an embedding is possible if and only if {1, 2} is not used (in which case we are embedding against a star). For |b| = 3 there are two rooted versions of P3 that we denote by P31 (rooted at a leaf) and P32 (rooted at the interior vertex of degree two). Lemma 2. Given a forest A ⊆ T1 embedded on an interval I = [i, i + 2] ⊆ [1, n] using π1 , we can pack any rooted tree B of size 3 together with A onto I, assuming the placement invariant holds (the root b of B can be placed at i), unless: – A = P3 ; or – B = P32 , π1 (A) uses the edge {i, i + 1}, and b has a conflict at i + 2. Proof. Suppose that A 6= P3 . Then π1 (A) uses at most one edge on I, which is either {i, i + 1} or {i + 1, i + 2}. If π1 (A) uses {i, i + 1}, then B = P31 can be embedded by placing b on i and using the edges {i, i + 2} and {i + 1, i + 2}. Using the same edges also B = P32 can be embedded by placing b on i + 2, unless it has a conflict there. If π1 (A) uses {i + 1, i + 2}, then B = P32 can be embedded by placing b on i and using the edges {i, i + 1} and {i, i + 2}. Using the same edges also B = P31 can be embedded by placing b on i + 2. If b has a conflict at i + 2, flip the edge {i + 1, i + 2} in π(A) to match b with the leaf i + 1 of T1 . t u For |b| = 4, there are three possible trees that we want to embed. We will give explicit embeddings for each of these. We distinguish the following cases in Fig. 2, from left to right. If edge {1, 4} is used, then we are embedding against one of the three possible trees of size 4. The star never works, which leaves us with two options (case 1 and 2). If {1, 4} is not used, then {1, 3} might be used.
8
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
In this case, {3, 4} is certainly not used, and [1, 3] may contain an embedding of P32 (case 3) or P31 (case 4). The case where {2, 4} is used instead of {1, 3} is symmetric (we can use symmetry here since in this particular case, we never use the placement invariant). If none of the edges {1, 4} or {1, 3} or {2, 4} are used, then the only remaining possible edges are between consecutive vertices (cases 5 to 8). Finally, if no edges are used, then any embedding will work. Observe that, in particular, all cases where we embed a non-star tree with a tree work, which settles the theorem for n ≤ 4.
not possible
not possible
not possible
Fig. 2: The embeddings of all trees of size 4 with all possible embeddings of π1 , except the case where a star of size 4 was embedded by π1 .
The implications of this table are summarized in the following lemma: Lemma 3. Given a forest A ⊆ T1 embedded on an interval I = [i, i + 3] ⊆ [1, n] using π1 , we can pack any rooted tree B of size 4 together with A onto I, assuming the placement invariant holds (the root b of B can be placed at i), unless: – a star is embedded at [i, i + 3]; or – B is a star, and either a non-star tree is embedded at [i, i + 3], or {i, i + 1} and {i + 2, i + 3} are both used. The situation changes for n ≥ 5, because there is no binary star on more than four vertices. The following lemma—whose proof is omitted due to space limitations—shows that an embedding is always possible for certain small trees, in particular, for all trees on five vertices. Lemma 4. Consider a forest A ⊆ T1 embedded on an interval I = [i, i + k] ⊆ [1, n] using π1 , for some k ≥ 4, and a tree B on k + 1 vertices rooted at a vertex b with degB (b) ≤ 2 and such that |c| ≤ 4, for every child c of b. Then we can pack B together with A onto I, assuming the placement invariant holds (b can be placed at i).
Planar Packing of Binary Trees
9
The general step. We have to embed a non-star subtree B ⊂ T2 with root b, |b| ≥ 6, onto I = [i, j] with |I| = |b|. W.l.o.g. assume that i < j. On the other side, there is a forest A ⊂ T1 that consists of trees A1 , . . . , Ak that have been embedded in this order onto I using π1 . Each Ai has a single vertex, its root, that is connected to vertices outside of I. We have to be careful when pairing b with a root of some Ai because there are edges that we do not see when only considering the situation on I locally. More precisely, we must not map two vertices that are in conflict to the same position. Recall that non-root vertices do not have conflicts and hence can be placed safely, as long as we ensure that no edge on I is used on both sides. From the placement invariant we know that b can be safely mapped to i, that is, b is not in conflict with whichever vertex of A is mapped to i. Whenever we want to map b to a point different from i, it has to be ensured that there is no conflict with the corresponding vertex of A. Moreover, knowing that b is connected to some vertex outside of I, we have to ensure that such edges can be drawn without crossing any of the edges used for the embedding of B. As long as b is mapped to i, which is an endpoint of I, this is clearly true. But when mapping b to a point y ∈ I \ {i}, there must not be any edge {x, z} in B for which y ∈ [π(x), π(z)]. A similar care has to be taken for the roots of A. In fact, to ensure this invariant, we argue locally only: In the algorithm we map b to a point different from i only if then b is paired with a vertex of A on the other side that does not have any edge to a vertex outside of the current interval. Also, sometimes we have to change the embedding of T1 , which in principle might destroy the carefully derived properties of the embdding π1 . Indeed, in the final embedding these properties do not necessarily hold. However, we ensure that they do hold for any interval that we invoke the recursive algorithm on. That is, whenever the recursive procedure is invoked on some interval, then the subforest of T1 embedded on it looks “as-if” it came from an embedding of type π1 (in particular, it satisfies the one-side rule and the larger-subtree-first rule). The first step. This paragraph describes the first step of the recursive procedure that serves only to select a suitable starting vertex. Choose a leaf b of T2 as a root and let b0 denote the child of b in T2 . Map b to n and recursively embed t(b0 ) onto [n − 1, 1]. For n = 6 this can be done by Lemma 4. For n ≥ 7, we apply the general recursive step, as described in the remainder. Observe that the placement invariant for the recursive step is guaranteed by Proposition 1. A large tree. The root b may have degree one or two in B. We consider these two cases separately. A large tree with a degree one root. So suppose that degB (b) = 1. Let b1 denote the child of b in B and let B1 = t(b1 ). Note that |b1 | ≥ 5 and so, in particular, B1 is not a star and we can embed it recursively. We would like to embed b on i and B1 recursively onto [j, i + 1] (Fig. 3a). In case the edge {i, j} is used by π1 (A) already, we change this plan and embed B1 onto [i+1, j] instead (Fig. 3b). If also the edge {i, i + 1} is used by π1 (A) already, we rearrange the embedding
10
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
for A by exchanging the mappings to i and i + 1 (Fig. 3c). (Note that by the one-side rule i + 1 is a leaf of π1 (A) and, therefore, such a rearrangement does not introduce a crossing.) After this change we can resort to the original plan and embed B1 onto [j, i + 1] (Fig. 3d).
i
...
j i
(a) Default.
...
(b) {i, j} used.
j i
...
...
j i
(c) Both {i, j} and {i, i + 1} used.
j
(d) Flipped.
Fig. 3: Cases for a large tree with a degree one root.
A large tree with a degree two root. Consider now the case degB (b) = 2. Denote the children of b by b1 and b2 so that w.l.o.g. |b1 | ≥ |b2 |, and let B1 = t(b1 ) and B2 = t(b2 ). By Lemma 4 we may assume that |b1 | ≥ 5. Let B1+ be B1 extended with b as a root of degree one. As B1+ has at least six vertices, it can be handled recursively. The general plan is the following: embed B2 onto [j, i + |b1 | + 1] and then embed B1+ onto [i, i + |b1 |]. We distinguish subcases depending on the size of B2 . Due to space limitations, we discuss the cases |b2 | ≥ 5 and |b2 | ≤ 2 only. Case L1: |b2 | ≥ 5. Then neither B1 nor B2 is a star. If π1 (A) does not use {i, j}, we can just follow the plan mentioned. Similarly, if π1 (A) does not use {i, i + |b1 | + 1}, then we can adjust the plan to embed B2 onto [i + |b1 | + 1, j] instead. So suppose that π1 (A) uses both {i, j} and {i, i + |b1 | + 1}. Due to the presence of {i, i+|b1 |+1} we know that there is no conflict for b at i+|b1 | and that {i+|b1 |, j} is not used by π1 (A). We first embed B2 onto [j, i+|b1 |+1] recursively, treating i + |b1 | + 1 as a conflict in case that π1 (A) uses {i + |b1 |, i + |b1 | + 1}. Then B1+ can be embedded onto [i + |b1 |, i] recursively. Note that b may have a conflict at i, if the embedding for B2 chose to map b2 to a neighbor of i in π(A) (which is no problem). Case L2: |b2 | = 1. Suppose that π1 (A) uses {i, j}. Then by Corollary 1 π1 (A) does not use both {i, i + 1} and {j − 1, j}. Since {i, j} is used, none of the vertices i + 1, . . . , j − 1 are in conflict with b. Therefore we can recursively embed B1+ onto [i + 1, j] (if {i, i + 1} is not used) or [j − 1, i] (if {j − 1, j} is not used) and then map b2 to i or j, respectively. Alternatively, suppose that π1 (A) does not use {i, j}. By the placement invariant, it is safe to embed b on i, so we can embed b2 on j and B1+ onto [i, j − 1]. Case L3: |b2 | = 2. If π1 (A) does not use either of {i, j} or {j − 1, j}, then we can embed B2 onto [j, j − 1] and B1+ onto [i, j − 2]. So we may suppose that π1 (A) uses one of these edges.
Planar Packing of Binary Trees
11
Case L3.1: π1 (A) uses {i, j}. Then by Corollary 1 π1 (A) does not use both {i, i + 1} and {j − 1, j}. If π1 (A) does not use {j − 1, j}, then we embed B2 onto [j − 1, j] and B1+ onto [i, j − 2]—unless π1 (A) uses {i, j − 1}. In that case we embed B2 onto [j, j − 1] and B1+ onto [j − 2, i] instead. Hence we may suppose that π1 (A) uses {j − 1, j} but does not use {i, i + 1}. By the larger-subtree-first rule j cannot be the root of π1 (A) (the leaf at j − 1 is right next to it), and so b does not have a conflict at j and π1 (A) does not use {i + 1, j}. Therefore we can embed B2 onto [i + 1, i] and B1+ onto [j, i + 2]. Case L3.2: π1 (A) does not use {i, j} but it uses {j − 1, j}. Our plan is to embed B2 onto [j − 2, j − 1], as this edge is not used by π1 (A) according to the one-side rule. For this we would like to map b 7→ j and B1 onto [i, j − 3]. This works fine, unless {j − 2, j} is used by π1 (A) or b has a conflict at j. Case L3.2.1 π1 (A) uses {j − 2, j}. Consider the subtree S of π1 (A) on [j − 2, j]. We will argue below that regardless of whether the parent of S is at j − 2 or at j, we can flip S by exchanging the mapping for j − 2 and j and then embed B2 onto [j − 1, j] and B1+ onto [i, j − 2]. Note that after the flip {j − 1, j} is not used by π(A) anymore and the neither before nor after the flip π(A) uses {i, j − 1}. It remains to argue about the validity of the flip. If the parent of S lies to the right, it is in a different interval and so it does not know about the details of S, anyway. If the parent lies to the left and within [i, j − 3], then the (already embedded) subtree B2 is outside of the interval [i, j − 2] for B1+ , effectively shrinking a subtree on three vertices to a subtree on one vertex. But as this subtree is certainly the one furthest from its parent in the current interval of interest, decreasing its size does not affect the larger-subtree-first rule. Case L3.2.2 π1 (A) does not use {j − 2, j} but b has a conflict at j. Due to the conflict, the root of {j − 1, j} is at j and so b does not have a conflict at j − 1. Just as in the previous case, we can flip the edge by exchanging the mapping for j − 1 and j and then embed B2 onto [j − 2, j − 1] (not used by π(A), because it corresponds to {j − 2, j} before the flip), map b on j (no conflict, because it corresponds to j − 1 before the flip), and finally embed B1 onto [i, j − 3] recursively ({i, j} is not used by π(A), because it corresponds to {i, j − 1} before the flip and j − 1 was a leaf connected to j in π1 (A)).
5
Conclusion
In this paper, we gave a proof of the well-known planar packing conjecture for the case of binary non-star trees. The major open problem is the proof of the hypothesis for general non-star trees. We strongly suspect this to be true and we hope that the techniques developed for the binary case here can also be used to attack the general problem. Of course, the inclusion of more than two trees should be considered. Since a tight packing into a planar graph of n vertices is not possible, the question there would be to minimize the size of the planar graph which comprises the union of the trees. For example a planar packing of three n-vertex paths on n + 1 vertices
12
M. Geyer, M. Hoffmann, M. Kaufmann, V. Kusters, and Cs. D. T´ oth
can be obtained, while appropriate generalizations to more general graph classes and/or a larger number of subgraphs have not been obtained as far as we know.
References 1. J. Akiyama and V. Chv´ atal. Packing paths perfectly. Discrete Mathematics, 85(3):247–255, 1990. 2. P. Braß, E. Cenek, C. A. Duncan, A. Efrat, C. Erten, D. Ismailescu, S. G. Kobourov, A. Lubiw, and J. S. B. Mitchell. On simultaneous planar graph embeddings. Comput. Geom., 36(2):117–130, 2007. 3. Y. Caro and R. Yuster. Packing graphs: The packing problem solved. Electr. J. Comb., 4(1), 1997. 4. D. Eppstein. Arboricity and bipartite subgraph listing algorithms. Information Processing Letters, 51(4):207–211, 1994. 5. D. Eppstein. Subgraph isomorphism in planar graphs and related problems. J. Graph Algorithms & Applications, 3(3):1–27, 1999. 6. A. Frank and Z. Szigeti. A note on packing paths in planar graphs. Math. Program., 70(2):201–209, 1995. 7. F. Frati. Embedding graphs simultaneously with fixed edges. In Graph Drawing, pages 108–113, 2006. 8. F. Frati. Planar packing of diameter-four trees. In 21st Canadian Conference on Computational Geometry (CCCG ’09), pages 95–98, 2009. 9. F. Frati, M. Geyer, and M. Kaufmann. Planar packings of trees and spider trees. Information Processing Letters, 109(6):301–307, Feb 2009. 10. A. Garc´ıa, C. Hernando, F. Hurtado, M. Noy, and J. Tejel. Packing trees into planar graphs. J. Graph Theory, pages 172–181, 2002. 11. M. R. Garey and D. S. Johnson. Computers and Intractability, A Guide to the Theory of NP-Completeness. W.H. Freeman and Company, New York, 1979. 12. M. Geyer, M. Kaufmann, and I. Vrt´ o. Two trees which are self-intersecting when drawn simultaneously. In Graph Drawing, pages 201–210, 2005. 13. D. Gon¸calves. Edge partition of planar graphs into two outerplanar graphs. In Proc. 37th Annu. ACM Sympos. Theory Comput., pages 504–512, 2005. 14. S. M. Hedetniemi, S. T. Hedetniemi, and P. J. Slater. A note on packing two trees into KN . Ars Combin., 11:149–153, 1981. 15. M. Maheo, J.-F. Sacl´e, and M. Wo´zniak. Edge-disjoint placement of three trees. European J. Combin., 17(6):543–563, 1996. 16. P. Mutzel, T. Odenthal, and M. Scharbrodt. The thickness of graphs: A survey. Graphs and Combinatorics, 14(1):59–73, 1998. 17. C. St. J. A. Nash-Williams. Edge-Disjoint Spanning Trees of Finite Graphs. Journal of The London Mathematical Society-second Series, s1-36:445–450, 1961. 18. Y. Oda and K. Ota. Tight planar packings of two trees. In European Workshop on Computational Geometry, pages 215–216, 2006. 19. W. Schnyder. Planar graphs and poset dimension. Order, 5:323–343, 1989. 20. W. T. Tutte. On the problem of decomposing a graph into n connected factors. Journal of the London Mathematical Society, s1-36(1):221–230, 1961. 21. J. R. Ullmann. An algorithm for subgraph isomorphism. J. ACM, 23(1):31–42, 1976.