1 Introduction
Given an vertex graph , a morph between two drawings (i.e., embeddings in ) of
is a continuous transformation from one drawing to the other through a family of intermediate drawings. One is interested in wellbehaved morphs, i.e., those that preserve essential properties of the drawing at any moment. Usually this property is that the drawing is
crossingfree; such morphs are called crossingfree morphs. This concept finds applications in multiple domains: animation, modeling, and computer graphics, etc. [13, 14, 15, 12]. A drawing of is a straightline drawing if it maps each vertex of to a point in and each edge of to the line segment whose endpoints correspond to the endpoints of this edge. In this work, we focus on the case of drawings in the Euclidean plane () and drawings (); a noncrossing drawing of a graph in is called planar.The study of crossingfree graph morphs began in 1944 from a nonconstructive proof that such morphs for maximal planar graphs exist between two topologically equivalent drawings [11]; a matching algorithmic result appeared in 1983 [21]. Recently crossingfree morphs of straightline drawings are considered, where the vertex trajectories are simple. Of particular interest is linear morph transforming one straightline drawing of a graph to another such drawing through a sequence of straightline drawings. Morph is called a morphing step, or simply a step, for brevity. In each step of a linear morph each vertex of moves along a straightline segment at a constant speed. Results [2, 4, 7, 3] led up to a seminal paper by Alamdari et al. [1] showing that for any two topologically equivalent planar drawings of a graph , there is a linear morph that transforms one drawing to the other in steps. This bound is asymptotically optimal in the worst case even when the graph is a path. A natural further question is how the situation changes when we involve the third dimension. For general 3D graph drawings the problem seems challenging: it is tightly connected to unknot recognition problem, that is in [16, 18], and its containment in P is widely open. If the given graph is a tree, the worstcase tight bound of steps holds for crossingfree linear morph [5] (and the lowerbound example is again a path). If both the initial and the final drawing are planar, then steps suffice [5].
Both algorithmic results [1, 5] have a drawback crucial from the practical point of view. Their intermediate steps use infinitesimal or very small distances, as compared to distances in the input drawings. This may blow up the space requirements and affect the aesthetical aspect. This raises a demand for morphing algorithms that operate on a small grid, i.e., of size polynomial in the size of the graph and parameters of the input drawings. All the intermediate drawings are then restricted to be grid drawings, where vertices map to nodes of the grid. Two crucial parameters of a straightline grid drawing are: the area (or volume for the 3D case) of the required grid, and the resolution, that is the ratio between the maximum edge length and the minimum vertexedge distance. If the grid area (or volume) is polynomially bounded, then so is the resolution [6].
BarreraCruz et al. [8] gave an algorithm to morph between two straightline planar Schnyder drawings of a triangulated graph in steps; all the intermediate drawings of this morph lie in a grid of size . Very recently BarreraCruz et al. [6] gave an algorithm that linearly morphs between two planar straightline grid drawings and of an vertex rooted tree in steps while each intermediate drawing is also a planar straightline drawing in a bounded grid. In particular, the maximum grid length and width is respectively and , where , and , and are the length and the height of the drawing respectively. Note that is .
Here we study morphing one straightline grid drawing of a tree to another such drawing in sublinear number of steps using 3D for intermediate steps. Effectively we ask the same question as in [5], but now with additional restriction for all drawings throughout the algorithm to lie in a small grid. We give two algorithms that require steps and steps, respectively. All the intermediate drawings require a grid of length , width and height , where is the diameter of the drawing . At the expense of using an extra dimension we significantly decrease the number of morphing steps, and also the required (horizontal) area, as compared to the planar result [6]. Our algorithm is the first one to morph between planar drawings of a tree in steps on a grid of polynomial volume.
2 Preliminaries and Definitions
Tree drawings.
For a tree , let be its root, and be the subtree of rooted at a vertex . Let and be respectively the set of vertices end edges of , and let denote the number of vertices in .
In a straightline drawing of , each vertex is mapped to a point in and each edge is mapped a straightline segment connecting its endpoints. A  (respectively, a ) grid drawing of is a straightline drawing where each vertex is mapped to a point with integer coordinates in (respectively, ).A drawing of is said to be crossingfree if images of no two edges intersect except, possibly, at common endpoints. A crossingfree grid drawing is called a planar grid drawing. For a crossingfree drawing , let denote the open disc of radius in X0Y plane centered at the image of . Unless stated otherwise, by the projection, denoted by , we mean the vertical projection to plane. Let , and respectively denote the length, width and height of , i.e., the maximum absolute difference between the , and coordinates of vertices in . Let denote the diameter of , defined as the ceiling of the maximum pairwise distance between its vertices. Given a vertex and an edge of the tree , denotes the distance between and . Similarly, is the distance between and .
Observation 1
Lemma 1

[6] For any vertex and edge not incident to in a planar grid drawing of , .

For each , let be equal to where is an integral constant. The distance between any two distinct vertices in is at least .
Proof

Let fix vertex and . Denote by the height in the triangle from the vertex , is the distance from to the line that contains the edge by its definition. Let be the area of triangle .
The .
On the other hand from the Pick’s theorem we know, that the area of the triangle with vertices lying in the lattice points of the grid is at least .
Then .

For any pair of distinct vertices , either or is at least since all vertices has integer coordinates in . This implies that, for each pair of distinct vertices , either or is at least since each coordinate of each vertex in is multiplied by to obtain . ∎
Path decomposition
of a tree is a decomposition of its edges into a set of disjoint paths as follows. Choose a path in and store it in . Removal of this path may disconnected the tree; recurse on the remaining connected components. In the end, contains disjoint paths whose union is . The way of choosing path may differ. The depth of a vertex in , denoted by , is defined as the length of the path from to . Head of the path , denotes as , is the vertex with the minimum depth in tree . Let internal vertices of the path be all vertices except . Any path decomposition of induces a linear order of the paths: path succeeds , i.e., , if and only if is deleted before during the construction of . Note that the subtree of each internal vertex of a path is a subset of the union of the paths that precede .
In the longpath decomposition [9], the path chosen in every iteration is the longest roottoleaf path (ties are broken arbitrarily). Let be the ordered set of paths of a longpath decomposition of . For , .
Heavyrootedpathwidth decomposition [5]. The Strahler number or HortonStrahler number of a tree is a parameter which was introduced by Horton and Strahler [17, 19, 20]. The same parameter was recently rediscovered by Biedl [10] with the name of rooted pathwidth when addressing the problem of computing upward tree drawings with optimal width.
The rooted pathwidth of a tree , which we denote by , is defined as follows. If , then . Otherwise, let be the maximum rooted pathwidth of any subtree rooted at a child of . Then if exactly one subtree rooted at a child of has rooted pathwidth equal to , and if more than one subtree rooted at a child of has rooted pathwidth equal to ; see Figure (a)a. Clearly is an integer number.
The heavyrootedpathwidth decomposition of a tree is defined as follows refer to Figure (b)b. For each nonleaf vertex of , let be the child of in such that is maximum (ties are broken arbitrarily). Then is a heavy edge; further, each child of is a light child of , and the edge is a light edge. Connected components of heavy edges form set of paths , called heavy paths, which may have many incident light edges. The path tree of is a tree whose vertices correspond to heavy paths in ; see Fig. (c)c. The parent of a heavy path in the path tree is the heavy path that contains the parent of the vertex with minimum depth in . The root of the path tree is the heavy path containing .
For convenience, we will also consider the light edge immediately above a heavy path to be a part of the path. When it is clear from the context we will refer to simply as .
We denote by the root of the path tree of ; let be the ordered sequence of the vertices of , where . 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 . For a vertex , we denote by its parent; note that . It is known [10] that the height of the path tree of an vertex tree is at most .
Fig. (a)a shows the heavyrootedpathwidth decomposition of our running example where heavy paths are shown in different colors.
Canonical 3D drawing of a tree , introduced in [5], is the crossingfree straightline 3D drawing of that maps each vertex of to its canonical position defined from heavyrooted pathwidth decomposition.
The canonical drawing of a tree , denoted by , is defined as follows:

First, we set for the root of .

Second, for each , we set , where is the coordinate of .

Third, for each and for each , we determine as follows. If , then 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 , for each and each , we recursively construct the canonical 3D drawing of
, and translate all the vertices by the same vector so that
is sent to .
We use the fact that lies in the positive quarterplane, inside a bounding box of height and width such that the leftbottom point of the box represents the image of the root and is mapped to the origin. Since tree never changes throughout our algorithm, we refer as .
For any vertex of , the relative canonical drawing of is the drawing of obtained by cropping and translating the obtained drawing of so that is mapped to the origin.
Morph:
Let and be two planar straightline drawings of . Then a morph is a sequence of 3D straightline drawings of such that , and is a linear morph, for each .
3 Tools for morphing algorithms
Stretching with a constant .
Let the drawing be lying in the plane. During stretching morph each coordinate of each vertex in is multiplied by a common positive integer constant . Thereby, it is a linear morph that ”stretches” the vertices apart.
Lemma 2
Stretching morph is crossingfree.
Proof
For each the drawing , where the image of any vertex of is is the same drawing scaled by . Since the original drawing was crossingfree, so is the drawing . ∎
Lemma 3

For any pair of vertices disks and do not cross in plane.

For a vertex disk does not enclose any other vertices or any part of nonincident to edges in .

For every vertex and every edge in there is lattice point such that and .
Proof

As disk contains no other vertices , then does not contain other vertices too. The — disk with half that radius — does not intersect with any for .

Due to Lemma 1 no nonincident edges intersected the disk of radius around in . That means that in , where all distances are multiplied by no nonincident edges intersect the disk of radius around . Other vertices do not lie in as .

Every edge from has been stretched by . If and , then and . The integral point and is .∎
Mapping around a pole
Let the pole through be vertical line in through point . Let be vertical halfplanes containing the pole through a point with integer coordinates. Suppose and contain infinitely many points with integer coordinates. Mapping around the pole is a morphing step to obtain a drawing which lies in from which lies in . Each vertex moves along a horizontal vector between and . The direction of this vector is common for all vertices of and is defined by and . Let us fix a horizontal plane which passing through the point where is an integer. Let be points that lie on and , respectively; such that and be the minimum nonzero distances from the to the integer points lying in and . The vector of mapping is defined as . Mapping is a unidirectional morph since all vertices of move along the vectors parallel to the vector of mapping till they reach the halfplane . See Fig. (c)c.
Proposition 1
[1] Let be a unidirectional morph between two planar straightline drawings and of . Let be a vertex of , let be an edge of and, for any drawing of , let be the line through the edge oriented from to . Suppose that is to the left of both in and in . Then is to the left of throughout .
Lemma 4
For each the drawing lies in one halfplane. Moreover, for each this halfplane has the vertical borderline , which is a borderline of halfplanes and .
Proof
Recall that mapping is a unidirectional morph that transforms drawings between two halfplanes that share a common pole. Note that the length of the vector of movement of any vertex in is proportional to its distance to the pole. Let denote the point on the pole with the same coordinate as , once again for each we denote by the drawing, where the image of any vertex of is . For any two vertices from with the same height that are being mapped to the halfplane , from proportionality of distances, we can cay that at any moment for the intermediate drawing we have . If the angle between the edge and the plane is the same for all points at some height, then it is the same for all vertices in , because points with the same coordinates had the same vector of movement.
Lemma 5
Mapping is a crossingfree morph.
Proof
From Lemma 4 we know that at any moment the whole lies within one halfplane and as the mapping is a unidirectional morph, one can get that drawing is a result of projection from halfplane to intermediate halfplane . We restricted angle between and not to be equal to and . With this resctiction drawing is the rotated drawing stretched in horizontal direction by some constant. Then is crossingfree as was crossingfree.
The rotation is a mapping when are halfplanes of planes parallel to respectively and thus . Vector of mapping for rotation is lying in the set, see Fig. 10:
We denote by a halfplane parallel to with vertical borderline going through vertex in Xpositive direction from that pole. are defined analogously.
A horizontal pole is a line parallel to axis. Horizontal pole through the point, mapping around horizontal pole and horizontal rotation are defined analogously. Corresponding set of possible directions of movement for horizontal rotation are:
Shrinking lifted subtrees.
Let be a vertex of such that the image of subtree in is , i.e., it lies in . Let be the ordered set of the children of which are ordered according to their coordinates in . For a tuple , where , let us consider the ordered set such that the members of are ordered according to their coordinates in . Let us consider the new subtree which is obtained by deleting the vertices in and their subtrees. Consider the canonical drawing of with respect to . For each satisfying , lies inside a box of height and width on the plane such that the downleft corner of the box coincides with since they are in a canonical position with respect to their roots. We define the shrink subtree procedure on as follows. We move each vertex from to . Vertices of the subtree rooted at also move along the same vector. Let us denote the shrinked subtree by . The height of the shrinked subtree is equal to the number of vertices in .
Observation 2
The height of the shrinked subtree is equal to the number of vertices in .
Proof
Note that the subtree rooted at has a canonical drawing in . This implies that for the subtree rooted at also has a canonical drawing with respect to in . Each lies inside a box of height . Also, note that the zcoordinate of is equal to . This implies that in , lies inside a box of height and the downleft corner of the box coincide with Also note that .
Lemma 6
Shrinking is a crossingfree morph.
Proof
Note that the and coordinates of each vertex in and are the same and coordinate can only decrease, shrinking is obviously a unidirectional morph in vertical plane which passes through . Also, note that through out the morphing process all vertices in maintain the relative orders among themselves since they move along parallel vectors. Also note that shrinking satisfies the conditions of Proposition 1. This implies that shrinking is a crossing free morph. ∎
Turning in horizontal plane.
Let be the canonical drawing of a subtree on the horizontal plane , i.e. relative canonical drawing rotated around horizontal pole through in any direction to lie in or halfplane. We discuss the case when lies in , the other case is similar. Let be the drawings obtained from by rotating the horizontal plane around the point by the angles respectively. Using a lemma from [6, Lemma pinwheel], we show the following.
Lemma 7
(Pinwheel) [6] Let and be two canonical drawings of a rooted ordered tree , where is at the same point in and . If and are (i) upward and leftward, or (ii) leftward and downward, or (iii) downward and rightward, or (iv) rightward and upward, respectively, then the morph is planar and lies in the interior of the right, top, left, or bottom half of the box centered at , respectively. See Fig. 11.
Lemma 8
The drawing can be obtained from the drawing in one morphing step, , where by we mean .
4 Morphing through lifting paths
Let be an vertex tree with vertices and be a path decomposition of into paths. In this section, we describe an algorithm that morphs a plane drawing in plane of tree to the canonical 3D drawing of in steps. It lifts the paths of one by one applying procedure Lift. Note that the final positions for the vertices in are defined through heavyrootedpathwidth decomposition, and do not depend on . Also, a morph from to can be obtained by playing the morph from to backwards. At all times during the algorithm, the following invariant holds: a path is lifted only after all the children of the internal vertices of are lifted. After the execution of Lift, path moves to its canonical position with respect to . See Fig. 1217.
Step 0: Preprocessing. This step is a single stretching morph with , see Section 3, stretching is a crossingfree morph.
4.1 Procedure Lift
Let be the first path in that has not been processed yet and be the current drawing of . We lift the path . For any vertex let lifted subtree be the portion of subtree that has been lifted after execution of Lift for some . The following invariants hold after every iteration of Lift procedure.

the drawing of in is the canonical drawing of with respect to for any ,

vertices of paths lie within X0Y plane.
We prove that these conditions hold after lifting . Let the processing vertices be the internal vertices of along with the vertices of their lifted subtrees.
Lemma 9
The subtrees of all internal vertices in are already lifted.
Proof
All the paths that precede in are exactly the paths that are left after deleting from the forest of subtrees of (see paragraph Path decomposition in Section 2). From this fact it follows that all internal vertices of have become roots of some trees after deleting the edges of and edges of that trees were processed in Lift procedures for some . ∎
Lemma 10
The maximum height of vertices in the drawing is strictly less than .
Proof
As all vertices of the processed paths are part of lifted subtrees of their head vertices, and by (I) have height as in canonical drawing, their height is strictly less than the number of vertices in a corresponding subtree, which does not exceed number of vertices in . ∎
Lemma 11
For any vertex and its lifted subtree . The maximum horizontal distance in the lifted subtree of , i.e. the difference between coordinates between any pair of vertices in in , does not exceed .
Proof
Note that the drawing of in is the canonical drawing of with respect to . This implies that the maximum horizontal distance between any vertex in and in is at most . ∎
Step 1: Shrink. For every internal vertex of the path its lifted subtree morphs into shrinked lifted subtree, see Sec. 3. All subtrees are shrinked simultaneously in one morphing step.
Lemma 12
Step 1 is crossingfree.
Proof
For each lifted subtree this is a shrinking step and by Lemma 6 it is crossingfree.
All lifted subtrees were not overlapping in projection to X0Y plane due to Condition (I) and Lemmas 3 and 11 in the drawing . As all vectors of movement are vertical, projections of lifted subtrees can not overlap during this morphing step and can not cross with each other.
In shrinked drawing every vertex of except has strictly positive coordinate which means that remains strictly above X0Y plane and can not cross with the part of that is still lying in X0Y. Internal vertices of do not change their positions during this morph. ∎
Step 2: Move others. This step consists of two morphs .
For , if projection overlaps with , we rotate twice the drawing of around the vertical pole through . Since every lifted subtree lies in , after this step all lifted subtrees lie in or .
Lemma 13
Step 2 is crossingfree.
Proof
Two different lifted subtrees cannot cross as due to Lemma 11: and due to Lemma 3 disks around vertices with radius do not cross with each other.
No edges within rotating lifted subtree can intersect as rotating is a mapping and mapping is a crossingfree morph (Lemma 5). Due to condition (II), all edges that do not lie in lifted subtrees are lying in X0Y plane. No lifted subtree can intersect with any edges in X0Y by condition (I): is the canonical drawing with respect to and lies strictly above X0Y plane except for the point . Rotation morph does not change coordinate of points during the movement, so throughout the morph drawing of lies above X0Y plane, vertex does not move during the rotation as it lies on the pole.
No vertices move in X0Y plane during Step 2 and no crossing can happen within the plane X0Y. ∎
Step 3: Go up: This is one morphing step that moves each internal vertex of path vertically to the height defined recursively as follows: for : ; for : . Note that is an integer number equal to the height of shrinked lifted subtree .
Lemma 14
Step 3 is crossingfree
Proof
Every internal vertex in the path moves with its subtree along the vertical vector. In the beginning of this morphing step no intersections existed in projection to plane between different subtrees and the path edges. Nothing changes in projection to plane during this step, all movements happen strictly above plane. That means that there can be no crossings during this step of an algorithm. ∎
Lemma 15

After Step 3, all internal vertices of along with vertices of their subtrees are horizontally separated from the rest of the vertices of the tree by a horizontal plane.

The subtrees of internal vertices of are horizontally separated from each other.
Proof

Due to Lemma 10, coordinates of all vertices that do not lie on the path are strictly below , also they are integer. By height definition in internal vertices of and vertices in their lifted subtrees have coordinates at least .
So the plane is the horizontal plane of separation.

For every pair of internal vertices of , let us define the plane of separation as follows. From the definition of the height the horizontal plane separates lifted subtree of vertex from lifted subtree of vertex . ∎
Step 4: Rotate subtrees to horizontal plane. In this morphing step all lifted subtrees of internal vertices of path are rotated around a horizontal pole through to lie in a horizontal plane. The direction of rotation is chosen in such a way that does not cross with an edge throughout this morph. That is we rotate in the halfspace that does not contain edge .
Lemma 16
With the proper direction of rotation, Step 4 is crossingfree.
Proof
If the crossing happens it must include one of the moving edges, i.e., edges of lifted subtrees.
As subtrees are horizontally separated from each other after Step 3 by Lemma 15, edges of different lifted subtrees can not cross. Also by Lemma 15, subtrees can not cross with nonprocessing vertices or edges between them as they also are horizontally separated in the beginning and in the end of this step.
If for some the edge lied in the vertical plane through there was no crossings in and after the beginning of movement will no longer lie in that plane and no crossing can happen. If lied strictly within one of the halfplanes defined by , then by the choice of direction of rotation we rotate through the halfspace that does not contain and thus can not cross with this edge either. ∎
Step 5: Correct the path: In morph , each vertex () of the path moves together with its subtree along the vector , where denotes coordinate of vertex in drawing . At the end of this step, the and coordinates of each are same as their and coordinates in the canonical drawing with respect to .
Lemma 17
Step 5 is crossingfree
Proof
Step is crossingfree because all edges of the path and all subtrees of different vertices of the path (that lie in horizontal planes) are horizontally separated from each other. All moving edges are horizontally separated from already lifted subtrees with the plane by Lemma 15. ∎
Step 6: Go down: During the morphing step , every vertex of the path moves together with its subtree along the same vertical vector , where means coordinate of vertex in drawing . At the end of this step, the coordinate of is the same as the coordinate of it in canonical drawing with respect to .
Lemma 18
Step 6 is crossingfree
Proof
All moving edges are horizontally separated from already lifted subtrees with the plane . During the morph the vertical order of internal vertices of the path does not change as is a portion of a roottoleaf path. From that it follows that horizontal separation of remains for different . ∎
Step 7: Turn subtrees in horizontal planes: It consists of two morphing steps , and turns every lifted subtree of internal vertices of to lie in positive direction with respect to vertex . For every subtree that lies in negative direction in the drawing , we use the morphing step from Lemma 8 to obtain a planar point reflection of across the point in horizontal plane containing .
Lemma 19
Step 7 is crossingfree
Proof
The fact that point reflection of a tree across the point of its root can be performed as two steps and those steps are crossingfree follows from Lemma 8.
Vertices of different lifted subtrees are horizontally separated and separated from nonprocessing vertices and edges, which means no crossings can happen between them. ∎
Step 8: Stretch in direction: This morphing step transforms lifted subtrees of internal vertices of in horizontal planes from shrinked to canonical size.
Lemma 20
Step 8 is crossingfree.
Proof
Stretching here is a shrinking morph played backwards and is a crossingfree morph for every by Lemma 6.
As all are horizontally separated from each other and from unprocessed part of the tree and morph is horizontal no crossings can happen between different or and unprocessed part of the graph. ∎
Step 9: Rotate to canonical positions: In morph all lifted subtrees of the internal vertices of the path rotate around horizontal axes to lie in vertical plane in positive direction such that the subtree is in canonical position with respect to vertex .
Lemma 21
Step 9 is crossingfree.
Proof
Let be the vertical plane parallel to X0Z and containing .
Vertices in subtrees lie from one side of in parallel planes at any moment of this morphing step. The halfplanes that contain different are parallel because we can look at the rotation of the halfplane containing as at the rotation of the halfplane containing translated by the vector . Then at every moment angle which means that these halfplanes are parallel to each other. So the vertices of do not cross.
Comments
There are no comments yet.