Pole Dancing:††thanks: We here refer to pole dancing as a fitness and competitive sport. The authors hope that many of our readers try this activity themselves, and will in return introduce many pole dancers to Graph Drawing, thereby alleviating the gender imbalance in both communities. The authors do not condone any pole activity used for sexual exploitation or abuse of women or men. 3D Morphs for Tree Drawings††thanks: E. A. was partially supported by F.R.S.-FNRS and SNF grant P2TIP2-168563 under the SNF Early PostDoc Mobility program. P.C. was supported by CONACyT, projects MINECO MTM2015-63791-R and Gen. Cat. 2017SGR1640. P.B, A.D and V.D. were supported by NSERC. F.F. was partially supported by MIUR Project “MODE” under PRIN 20157EFM5C and by H2020-MSCA-RISE project 734922, “CONNECT”. S.L. is Directeur de Recherches du F.R.S.-FNRS. A.T. was partially supported by the project “Algoritmi e sistemi di analisi visuale di reti complesse e di grandi dimensioni” - Ric. di Base 2018, Dip. Ingegneria, Univ. Perugia.
We study the question whether a crossing-free 3D morph between two straight-line drawings of an -vertex tree can be constructed consisting of a small number of linear morphing steps. We look both at the case in which the two given drawings are two-dimensional and at the one in which they are three-dimensional. In the former setting we prove that a crossing-free 3D morph always exists with steps, while for the latter steps are always sufficient and sometimes necessary.
A morph between two drawings of the same graph is a continuous transformation from one drawing to the other. Thus, any time instant of the morph defines a different drawing of the graph. Ideally, the morph should preserve the properties of the initial and final drawings throughout. As the most notable example, a morph between two planar graph drawings should guarantee that every intermediate drawing is also planar; if this happens, then the morph is called planar.
Planar morphs have been studied for decades and find nowadays applications in animation, modeling, and computer graphics; see, e.g., [11, 12]. A planar morph between any two topologically-equivalent222Two planar drawings of a connected graph are topologically equivalent if they define the same clockwise order of the edges around each vertex and the same outer face. planar straight-line333A straight-line drawing of a graph maps vertices to points in a Euclidean space and edges to open straight-line segments between the images of their end-vertices. We denote by (by ) the image of a vertex (of a subgraph of , resp.). drawings of the same planar graph always exists; this was proved for maximal planar graphs by Cairns  back in 1944, and then for all planar graphs by Thomassen  almost forty years later. Note that a planar morph between two planar graph drawings that are not topologically equivalent does not exist.
It has lately been well investigated whether a planar morph between any two topologically-equivalent planar straight-line drawings of the same planar graph always exists such that the vertex trajectories have low complexity. This is usually formalized as follows. Let and be two topologically-equivalent planar straight-line drawings of the same planar graph . Then a morph is a sequence of planar straight-line drawings of such that , , and is a planar linear morph, for each . A linear morph is such that each vertex moves along a straight-line segment at uniform speed; that is, assuming that the morph happens between time and time , the position of a vertex at any time is . The complexity of a morph is then measured by the number of its steps, i.e., by the number of linear morphs it consists of.
A recent sequence of papers [3, 4, 5, 6] culminated in a proof  that a planar morph between any two topologically-equivalent planar straight-line drawings of the same -vertex planar graph can always be constructed consisting of steps. This bound is asymptotically optimal in the worst case, even for paths.
The question we study in this paper is whether morphs with sub-linear complexity can be constructed if a third dimension is allowed to be used. That is: Given two topologically-equivalent planar straight-line drawings and of the same -vertex planar graph does a morph exist such that: (i) for , the drawing is a crossing-free straight-line 3D drawing of , i.e., a straight-line drawing of in such that no two edges cross; (ii) for , the step is a crossing-free linear morph, i.e., no two edges cross throughout the transformation; and (iii) ? A morph satisfying properties (i) and (ii) is a crossing-free 3D morph.
Our main result is a positive answer to the above question for trees. Namely, we prove that, for any two planar straight-line drawings and of an -vertex tree , there is a crossing-free 3D morph with steps between and . More precisely the number of steps in the morph is linear in the pathwidth of . Notably, our morphing algorithm works even if and are not topologically equivalent, hence the use of a third dimension overcomes another important limitation of planar two-dimensional morphs. Our algorithm morphs both and to an intermediate suitably-defined canonical 3D drawing; in order to do that, a root-to-leaf path of is moved to a vertical line and then the subtrees of rooted at the children of the vertices in are moved around that vertical line, thus resembling a pole dance, from which the title of the paper comes.
We also look at whether our result can be generalized to morphs of crossing-free straight-line 3D drawings of trees. That is, the drawings and now live in , and the question is again whether a crossing-free 3D morph between and exists with steps. We prove that this is not the case: Two crossing-free straight-line 3D drawings of a path might require steps to be morphed one into the other. The matching upper bound can always be achieved: For any two crossing-free straight-line 3D drawings and of the same -vertex tree there is a crossing-free 3D morph between and with steps.
The rest of the paper is organized as follows. In Sect. 2 we deal with crossing-free 3D morphs of 3D tree drawings. In Sect. 3 we show how to construct -step crossing-free 3D morphs between planar straight-line drawings of a path. In Sect. 4 we present our main result about crossing-free 3D morphs of planar tree drawings. Finally, in Sect. 5 we conclude and present some open problems.
Because of space limitations, some proofs are omitted or just sketched; they can be found in the full version of the paper.
2 Morphs of 3D drawings of trees
In this section we give a tight bound on the number of steps in a crossing-free 3D morph between two crossing-free straight-line 3D tree drawings.
For any two crossing-free straight-line 3D drawings , of an -vertex tree , there exists a crossing-free 3D morph from to that consists of steps.
The proof is by induction on . The base case, in which , is trivial. If , then we remove a leaf and its incident edge from , , and . This results in an -vertex tree and two drawings and of it. By induction, there is a crossing-free 3D morph between and . We introduce in such a morph so that it is arbitrarily close to throughout the transformation; this significantly helps to avoid crossings in the morph. The number of steps is the one of the recursively constructed morph plus one initial step to bring close to , plus two final steps to bring to its final position.∎
There exist two crossing-free straight-line 3D drawings of an -vertex path such that any crossing-free 3D morph from to consists of steps.
Before proving Theorem 2.2, we review some definitions and facts from knot theory; refer, e.g., to the book by Adams . A knot is an embedding of a circle in . A link is a collection of knots which do not intersect, but which may be linked together. For links of two knots, the (absolute value of the) linking number is an invariant that classifies links with respect to ambient isotopies. Intuitively, the linking number is the number of times that each knot winds around the other. The linking number is known to be invariant with respect to different projections of the same link . Given a projection of the link, the linking number can be determined by orienting the two knots of the link, and for every crossing between the two knots in the projection adding or if rotating the understrand respectively clockwise or counterclockwise lines it up with the overstrand (taking into account the direction).
Proof (Theorem 2.2)
The drawing of is defined as follows. Embed the first edges of in 3D as a spiral of monotonically decreasing height. Embed the rest of as a same type of spiral affinely transformed so that it goes around one of the sides of the former spiral. See Figure 1a. The drawing places the vertices of in order along the unit parabola in the plane .
Cut the edge joining the two spirals (the bold edge in Figure 1a). Removing an edge makes morphing easier so any lower bound would still apply. Now close the two open curves using two invisible edges to obtain a link of two knots; see Figure 1b. It is easy to verify that the (absolute value of the) linking number of this link is : indeed, determining it by the above procedure for the projection given by Figure 1 results in the linking number being equal to the number of crossings between the two links in this projection. In the drawing , each of the two halves of (and their invisible edges) are separated by a plane and so their linking number is .
In a valid linear morph, the edges of cannot cross each other, but they can cross invisible edges. However, during a linear morph between two straight-line 3D drawings of a graph any two non-adjacent edges of intersect times. Thus each invisible edge can only be crossed times during a linear morph. A single crossing can only change the linking number by 1. Therefore the linking number can only decrease by in a single linear morph. ∎
3 Morphing two planar drawings of a path in 3D
In this section we show how to morph two planar straight-line drawings and of an -vertex path into each other in two steps.
The canonical 3D drawing of , denoted by , is the crossing-free straight-line 3D drawing of that maps each vertex to the point , as shown in Figure 2. We now prove the following.
For any two planar straight-line drawings and of an -vertex path , there exists a crossing-free 3D morph with 2 steps.
It suffices to prove that the linear morph is crossing-free, since the morph is just the morph played backwards.
Since is linear, the speed at which the vertices of move is uniform (though it might be different for different vertices). Thus the speed at which their projections on the -axis move is uniform as well. Since moves uniformly from to , at any time during the motion (except at the time ) we have . Therefore, in any intermediate drawing any edge is separated from any other edge by the horizontal plane through one of its end-points. Hence no crossing happens during . ∎
4 Morphing two planar drawings of a tree in 3D
Let be a tree with vertices, arbitrarily rooted at any vertex. In this section we show that any two planar straight-line drawings of can be morphed into one another by a crossing-free 3D morph with steps (Theorem 4.1). Similarly to Section 3, we first define a canonical 3D drawing of (see Section 4.1), and then show how to construct a crossing-free 3D morph from any planar straight-line drawing of to . We describe the morphing procedure in Section 4.2; then in Section 4.3 we present a procedure Space that carries out the computations required by the morphing procedure; finally, in Section 4.4 we analyze the correctness and efficiency of both procedures.
Before proceeding, we introduce some necessary definitions and notation. By a cone we mean a straight circular cone induced by a ray rotated around a fixed vertical line (the axis) while keeping its origin fixed at a point (the apex) on this line. The slope of a cone , is the slope of the generating ray as determined in the vertical plane containing the ray. By a cylinder we always mean a straight cylinder having a horizontal circle as a base. Such cones or cylinders are uniquely determined, up to translations, respectively by their apex and slope or by their height and radius.
For a tree , let denote the subtree of rooted at its vertex . Also let denote the number of vertices in . The heavy-path decomposition  of a tree is defined as follows. For each non-leaf vertex of , let be the child of in such that is maximum (in case of a tie, we choose the child arbitrarily). Then is a heavy edge; further, each child of different from is a light child of , and the edge is a light edge. Connected components of heavy edges form paths, called heavy paths, which may have many incident light edges. Each path has a vertex, called the head, that is the closest vertex to the root of . See Figure 3 for an example. A path tree of is a tree whose vertices correspond to heavy paths in . The parent of a heavy path in the path tree is the heavy path that contains the parent of the head of . The root of the path tree is the heavy path containing the root of . It is well-known  that the height of the path tree is . We denote by the root of the path tree of ; let be the ordered sequence of the vertices of , where is the root of . For , we let be the light children of in any order. Let be the sequence of the light children of ordered so that: (i) any light child of a vertex precedes any light child of a vertex , if ; and (ii) the light child of a vertex precedes the light child of . When there is no ambiguity we refer to and simply as and , respectively.
4.1 Canonical 3D drawing of a tree
We define the canonical 3D drawing of a tree as a straight-line 3D drawing of that maps each vertex of to its canonical position defined as follows (see Figure 3b). Note that our canonical drawing is equivalent to the “standard” straight-line upward drawing of a tree [7, 9, 10].
First, we set for the root of . Second, for each , we set , where is the -coordinate of . Third, for each and for each light child of , we determine as follows. If , we set , where is the -coordinate of ; otherwise, we set , where is the -coordinate of . Finally, in order to determine the canonical positions of the vertices in , we recursively construct the canonical 3D drawing of , and translate all the vertices by the same vector so that is sent to .
Notice that the canonical position of any vertex of is . Here is the depth, in the path tree of , of the node that corresponds to the heavy path of that contains ; and is the position of in a depth-first search on in which the children of any vertex are visited as follows: first visit the light children in reverse order with respect to , and then visit the child incident to the heavy edge.
The following lemma is a direct consequence of the construction of .
The canonical 3D drawing of lies on a rectangular grid in the plane , where the grid has height and width equal to the height of the path tree of . Moreover, is on or above the line .
In the above definition of the canonical 3D drawing , instead of the heavy-path decomposition of , we can use the decomposition based on the Strahler number of , see  where the Strahler number is used under the name rooted pathwidth of . With this change, the width of will be equal to the Strahler number of , which is the instance-optimal width of an upward drawing of a tree . Moreover, since the Strahler number is linear in the pathwidth of , so is the width of defined this way. This is clearly not worse, and, for some instances, much better than the width given by the heavy-path decomposition.
In the below description of the morph we use heavy paths, however we can use the paths given by Remark 2 instead, without any modification.
4.2 The procedure Canonize()
Let be a planar straight-line drawing of a tree . Below we give a recursive procedure Canonize that constructs a crossing-free 3D morph from to the canonical 3D drawing . We assume that is enclosed in a disk of diameter centered at in the plane , and that the root of is placed at in . This is not a loss of generality, up to a suitable modification of the reference system.
Step 1 (set the pole).
The first step of the procedure Canonize aims to construct a linear morph , where is such that the heavy path of lies on the vertical line through and the subtrees of rooted at the light children of each vertex lie on the horizontal plane through . More precisely, the vertices of are placed in as follows. For , place at the point . Every vertex that belongs to a subtree rooted at a light child of is placed at a point such that its trajectory in the morph defines the same vector as the trajectory of .111Since the morph is linear, the trajectory of any vertex is simply the line segment connecting the positions of in and in . To define a vector, we orient the segment towards the position of in . Below we refer to as the pole. The pole will remain still throughout the rest of the morph.
Step 2 (lift).
The aim of the second step of the procedure Canonize is to construct a linear morph , where is such that the drawings of any two subtrees and rooted at different light children and of vertices in are vertically and horizontally separated. The separation between and is set to be large enough so that the recursively computed morphs Canonize and Canonize do not interfere with each other.
We describe how to construct . As anticipated, , for each vertex in . In order to determine the placement of the vertices not in we use cones , …, and cones , …,, namely one cone and one cone per vertex in . We also use, for each , a cylinder Space that bounds the volume used by Canonize. We defer the computation of these cones and cylinders to Section 4.3, and for now assume that they are already available. For each and for each , assume that has been computed already – this is indeed the case when . Let be the horizontal plane , where is the height of the cylinder Space. The drawing maps the subtree to the plane , just outside the cone and just inside the cone . See Figure 4. We proceed with the formal definition of . Let be any vertex of and let be the coordinates of . Then is the point . Here is the height of the plane , is the radius of the section of by the plane , and is the distance from to its closest point of the drawing , where is the parent of . See Figure 4. Note that the latter closest point can be a point on an edge.
Step 3 (recurse).
For each , we make a recursive call Canonize. The resulting morphs are combined into a unique morph , whose number of steps is equal to the maximum number of steps in any of the recursively computed morphs. Indeed, the first step of consists of the first steps of all the recursively computed morphs that have at least one step; the second step of consists of the second steps of all the recursively computed morphs that have at least two steps; and so on.
Step 4 (rotate, rotate, rotate).
The next morph transforms into a drawing such that each vertex is mapped to the intersection of the cone , the planes , , and the half-space . Note that going from to in one linear crossing-free 3D morph is not always possible. Refer to Lemma 2 for the implementation of the morph from to in steps. After Step 4 the whole drawing lies on the plane .
Step 5 (go down).
This step consists of a single linear morph , where is defined as follows. For every vertex in , ; further, for every vertex , all the vertices of have the same - and -coordinates in as in , however their -coordinate is decreased by the same amount so that lies on the horizontal plane through .
Step 6 (go left).
The final part of our morphing procedure consists of a single linear morph , where is the canonical 3D drawing of . Note that this linear morph only moves the vertices horizontally.
4.3 The procedure Space()
In this section we give a procedure to compute the cylinders and the cones which are necessary for Steps 2 and 4 of the procedure Canonize.
We fix a constant with , which we consider global to the procedure Canonize and its recursive calls; below we refer to as the global constant. The global constant will help us to define the cones so that Step 4 of Canonize can be realized with linear morphs, see Lemma 2.
The procedure Space returns a cylinder that encloses all the intermediate drawings of the morph determined by Canonize. At the same time, Space
determines the cones and for every vertex .
We now describe Space. Let be the result of the application of Step 1 of Canonize. Figure 5 illustrates our description.
If is a path, i.e., , return the cylinder of height and radius . In particular, if is a single vertex, return the disk of radius 1. Otherwise, construct the cylinder and the cones in the following fashion:
Set the current cone to be an infinite cone of slope 1. The apex of is determined as follows: starting with the apex being at the highest point of the pole, slide vertically downwards until it touches the drawing . That is, the apex of is at the lowest possible position on the pole such that the whole drawing is outside of . See Figure 5a.
Set the current height to be .
Iterate through the light children of in the order as they appear in . For every in :
Set to be the current cone .
Add the height of Space to the current height .
Let be the cone with the same apex as and with a slope defined so that the drawing is in-between and , and is well-separated from with the global constant . That is, , where is the spread of the drawing with respect to the parent of in . Namely is the ratio between the outer and the inner radius of the minimum annulus centered at and enclosing the drawing . See Figure 5a.
Let be the cylinder Space translated so that the center of its lower base is at the point .
Decrease so that encloses the entire cylinder .
Set to be the cone .
If is not the last element of (i.e., ), then let and define an auxiliary cone as follows. The apex of is at where is the parent of ; note that iff . The slope of is the maximum slope that satisfies the following requirement: (i) the slope of is at most the slope of . In addition, only for the case when , we require: (ii) in the closed half space , the portion of encloses the portion of . See Figure 5b. Update the cone to be the lowest vertical translate of so that is still outside the cone.
Return the cylinder of height (the current height), and radius equal to the radius of the section of the current cone cut by the plane .
4.4 Correctness of the morphing procedure
Step 4 of the procedure Canonize can be realized as a crossing-free 3D morph whose number of steps is bounded from above by a constant that depends on the global constant .
Let be the annulus formed by the section of and cut by the plane . See Figure 6. The morph performed in Step 4 consists of a sequence of linear morphs; in each of these morphs all the vertices of are translated by the same vector. This is done so that stays in during the whole Step 4. Thus, the trajectory of during Step 4 defines a polygon inscribed in . Since the ratio between the outer and the inner radius of is at least the global constant , we can inscribe a regular -gon in , and the trajectory of can be defined so that it follows this -gon plus at most one extra line segment.
We now prove that since each stays in , all the steps of the above morph are crossing-free. Recall that at any moment during the morph, the drawing of is a translation of the canonical 3D drawing . By Lemma 1, the space below the line of slope 1 passing through in plane does not contain any point of . Since the slope of is at most 1, the drawing of is enclosed in as long as is in . By conditions () and () of Space, the cone encloses in the closed half-space above . Hence the edge connecting to the pole never touches above . ∎
For any two plane straight-line drawings of an -vertex tree , there exists a crossing-free 3D morph from to with steps.
A 3D morph from to can be constructed as the concatenation of Canonize with the reverse of Canonize. Hence, it suffices to prove that Canonize is a crossing-free 3D morph with steps.
It is easy to see that Steps 1, 5, and 6 of Canonize are crossing-free linear morphs. The proof that Step 2 is a crossing-free linear morph is more involved. In particular, for any two light children and with of the same vertex of , the occurrence of a crossing between the edge and an edge of during Step 2 can be ruled out by arguing that the same two edges would also cross in ; this argument exploits the uniformity of the speed in a linear morph and that the horizontal component of the morph of Step 2 is a uniform scaling. Lemma 2 ensures that Step 4 is a crossing-free 3D morph with steps. Thus, Steps 1, 2, 4, 5, and 6 require a total of steps. Since the number of morphing steps of Step 3 of Canonize is equal to the maximum number of steps of any recursively computed morph and since, by definition of heavy path, each tree for which a recursive call Canonize is made has at most vertices, it follows that Canonize requires steps. ∎
5 Conclusions and Open Problems
In this paper we studied crossing-free 3D morphs of tree drawings. We proved that, for any two planar straight-line drawings of the same -vertex tree, there is a crossing-free 3D morph between them which consists of steps.
This result gives rise to two natural questions. First, is it possible to bring our logarithmic upper bound down to constant? In this paper we gave a positive answer to this question for paths. In fact our algorithm to morph planar straight-line tree drawings has a number of steps which is linear in the pathwidth of the tree (see Remark 2), thus for example it is constant for caterpillars. Second, does a crossing-free 3D morph exist with steps for any two planar straight-line drawings of the same -vertex planar graph? The question is interesting to us even for subclasses of planar graphs, like outerplanar graphs and planar -trees.
We also proved that any two crossing-free straight-line 3D drawings of an -vertex tree can be morphed into each other in steps; such a bound is asymptotically optimal in the worst case. An easy extension of our results to graphs containing cycles seems unlikely. Indeed, the existence of a deterministic algorithm to construct a crossing-free 3D morph with a polynomial number of steps between two crossing-free straight-line 3D drawings of a cycle would imply that the unknot recognition problem is polynomial-time solvable. The unknot recognition problem asks whether a given knot is equivalent to a circle in the plane under an ambient isotopy. This problem has been the subject of investigation for decades; it is known to be in NP  and in co-NP , however determining whether it is in P has been an elusive goal so far.
We thank Therese Biedl for pointing out Remark 2.
The research for this paper started during the Intensive Research Program in Discrete, Combinatorial and Computational Geometry, which took place in Barcelona, April-June 2018. We thank Vera Sacristán and Rodrigo Silveira for a wonderful organization and all the participants for interesting discussions.
-  Colin Conrad Adams. The knot book: an elementary introduction to the mathematical theory of knots. American Mathematical Soc., 2004.
-  Soroush Alamdari, Patrizio Angelini, Fidel Barrera-Cruz, Timothy M Chan, Giordano Da Lozzo, Giuseppe Di Battista, Fabrizio Frati, Penny Haxell, Anna Lubiw, Maurizio Patrignani, et al. How to morph planar graph drawings. SIAM Journal on Computing, 46(2):824–852, 2017.
-  Soroush Alamdari, Patrizio Angelini, Timothy M Chan, Giuseppe Di Battista, Fabrizio Frati, Anna Lubiw, Maurizio Patrignani, Vincenzo Roselli, Sahil Singla, and Bryan T Wilkinson. Morphing planar graph drawings with a polynomial number of steps. In S. Khanna, editor, 24th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA ’13), pages 1656–1667. SIAM, 2013.
-  P. Angelini, G. Da Lozzo, G. Di Battista, F. Frati, M. Patrignani, and V. Roselli. Morphing planar graph drawings optimally. In J. Esparza, P. Fraigniaud, T. Husfeldt, and E. Koutsoupias, editors, 41st International Colloquium on Automata, Languages and Programming (ICALP ’14), volume 8572 of LNCS, pages 126–137. Springer, 2014.
-  Patrizio Angelini, Fabrizio Frati, Maurizio Patrignani, and Vincenzo Roselli. Morphing planar graph drawings efficiently. In S. Wismath and A. Wolff, editors, 21st International Symposium on Graph Drawing (GD ’13), volume 8242 of LNCS, pages 49–60. Springer, 2013.
-  Fidel Barrera-Cruz, Penny Haxell, and Anna Lubiw. Morphing planar graph drawings with unidirectional moves. In Mexican Conference on Discrete Mathematics and Computational Geometry, pages 57–65, 2013. also available at http://arxiv.org/abs/1411.6185.
-  Therese Biedl. Optimum-width upward drawings of trees. arXiv preprint arXiv:1506.02096, 2015.
-  S.S. Cairns. Deformations of plane rectilinear complexes. The American Mathematical Monthly, 51(5):247–252, 1944.
-  Timothy M Chan. Tree drawings revisited. arXiv preprint arXiv:1803.07185, 2018.
-  Pierluigi Crescenzi, Giuseppe Di Battista, and Adolfo Piperno. A note on optimal area algorithms for upward drawings of binary trees. Computational Geometry, 2(4):187–200, 1992.
-  Michael S. Floater and Craig Gotsman. How to morph tilings injectively. Journal of Computational and Applied Mathematics, 101(1-2):117–129, 1999.
-  Craig Gotsman and Vitaly Surazhsky. Guaranteed intersection-free polygon morphing. Computers & Graphics, 25(1):67–75, 2001.
-  Joel Hass, Jeffrey C. Lagarias, and Nicholas Pippenger. The computational complexity of knot and link problems. Journal of the ACM, 46(2):185–211, 1999.
-  Marc Lackenby. The efficient certification of knottedness and Thurston norm. CoRR, abs/1604.00290, 2016.
-  Daniel D Sleator and Robert Endre Tarjan. A data structure for dynamic trees. In Proceedings of the thirteenth annual ACM symposium on Theory of computing, pages 114–122. ACM, 1981.
-  Carsten Thomassen. Deformations of plane graphs. Journal of Combinatorial Theory, Series B, 34(3):244–257, 1983.