1 Introduction
A straightline drawing of a graph G is a mapping of each vertex to a distinct point on the plane and of each edge to a straightline segment between the vertices. A path is monotone if there exists a line such that the projections of the vertices of on appear on in the same order as on . A straightline drawing of a graph G is monotone, if a monotone path connects every pair of vertices.
Monotone graph drawing has gained the recent attention of researchers and several interesting results have appeared. Given a planar fixed embedding of a planar graph , a planar monotone drawing of can be constructed, but at the cost of some bends on some edges (thus no longer a straightline drawing) [2]. In the variable embedding setting, there exists a planar monotone drawing of any planar graph without any bends [8].
One way to find a monotone drawing of a graph is to simply find a monotone drawing of one of its spanning trees. For that reason, the problem of finding monotone drawings of trees has been the subject of several recent papers, starting from the work by Angelini et al. [1] which introduced monotone graph drawings.
Angelini et al. [1] provided two algorithms that used ideas from number theory and more specifically SternBrocot trees [11, 3], [4, Sect. 4.5].
The first algorithm used a grid of size (BFSbased algorithm) while the second one used a grid of size (DFSbased algorithm).
Later, Kindermann et al. [9] provided an algorithm based on Farey sequence (see [4, Sect. 4.5]) that used a grid of size .
He and He [7] gave an algorithm based on Farey sequence and reduced the required grid size to , which was the first result that used less than area.
Recently, He and He [5] firstly reduced the grid size for a monotone tree drawing to and, in a sequel paper, to [6]. Their monotone tree drawing uses a grid of size at most which turns out to be asymptotically optimal as there exist trees which require at least area [6].
Our Contribution:
All monotone tree drawing algorithms that have appeared in the literature consider rooted ordered trees and they draw them so that (i) the root of the tree is drawn at the origin of the drawing, (ii) the drawing is confined in the first quadrant, and (iii) the embedding of the tree is respected. In this paper, we provide a simple algorithm that has the exact same characteristics and, given an vertex rooted tree , it outputs a monotone drawing of that fits on a grid. Despite its simplicity, our algorithm improves the result of He and He [6].
By relaxing the drawing restrictions we can achieve smaller drawing area. More specifically, by carefully selecting a new root for the tree, which we draw it at the origin, we can produce a “twoquadrants” drawing that fits in an grid. We note that the produced drawing respects the given embedding of the tree. By further relaxing this requirement, i.e., by allowing to change the order of the neighbors of a tree vertex around it, we can achieve a drawing of better aspect ratio and smaller area (compared to our algorithm). More specifically, we describe a “fourquandrants” algorithm that draws an vertex tree on a grid of size at most .
The paper is organized as follows: Section 2 provides definitions and preliminary results. In Sections 3, 4 and 5 we present our one, two and fourquadrants algorithms, respectively. We conclude in Section 6. A preliminary version of this paper which included the onequadrant algorithm for monotone tree drawings was presented in [10].
2 Definitions and Preliminaries
Let be a drawing of a graph and be an edge from vertex to vertex in . The slope of edge , denoted by , is the angle spanned by a counterclockwise rotation that brings a horizontal halfline starting at and directed towards increasing coordinates to coincide with the halfline starting at and passing through . We consider slopes that are equivalent modulo as the same slope. Observe that . We only deal with planar monotone drawings of trees, as it was proved by Angelini et al. that every monotone drawing of tree is planar [1].
Let be a tree rooted at a vertex . Denote by the subtree of rooted at a vertex . By we denote the number of vertices of . Let be a child of . By we denote the tree that consists of edge and . In the rest of the paper, we assume that all tree edges are directed away from the root. A rooted tree is said to be ordered if there is an order imposed on the children of each vertex. A drawing is said to respect the ordering of the tree (or the embedding) if the children of a vertex are drawn around it in the specified order.
When producing a grid drawing, it is common to refer to the sidelength of the required grid and to its dimensions. We emphasize that we measure length (width/height) in units of distance, but when we denote the dimensions of a grid we use the number of grid points in each dimension. So, a grid of width and height fits in a grid.
2.1 Slopedisjoint Tree Drawings
Angelini et al. [1] defined the notion of slopedisjoint tree drawings. Let be a drawing of a rooted tree . is called a slopedisjoint drawing of if the following properties are satisfied:

For every vertex , there exist two angles and , with such that for every edge that is either in or that enters from its parent, it holds that .

For every two vertices such that is a child of , it holds that .

For every two vertices having the same parent, it holds that either or .
The idea behind the definition of slopedisjoint tree drawings is that all edges in the subtree as well as the edge entering from its parent have slopes that strictly fall within the anglerange defined for vertex . is called the anglerange of with and being its boundaries. The convex angle formed between two halflines with slopes and is denoted by and is called anglerange length of .
Angelini et al. [1] proved the following theorems:
Theorem 1 (Angelini et al.[1])
Every monotone drawing of a tree is planar.
Theorem 2 (Angelini et al.[1])
Every slopedisjoint drawing of a tree is monotone.
In order to simplify the description of our algorithm, we extend the definition of slopedisjoint tree drawings to allow for angleranges of adjacent vertices (parentchild relationship) or sibling vertices (children of the same parent) to share anglerange boundaries.
Definition 1
A tree drawing of a rooted tree is called a nonstrictly slopedisjoint drawing if the following properties are satisfied:

For every vertex , there exist two angles and , with such that for every edge that is either in or enters from its parent, it holds that .

For every two vertices such that is a child of , it holds that .

For every two vertices with the same parent, it holds that either or .
In our extended definition, we allow for angleranges of adjacent vertices (parentchild relationship) or sibling vertices (children of the same parent) to share anglerange boundaries. Note that replacing the “” symbols in our definition by the “” symbol gives us the original definition of Angelini et al. [1] for the slope disjoint tree drawings.
Lemma 1
Every nonstrictly slopedisjoint drawing of a tree is also a slopedisjoint drawing.
Proof
Intuitively, the theorem holds since we can always adjust (by a tiny amount) the angleranges of vertices that share an anglerange boundary so that, after the adjustment no two tree vertices share an anglerange boundary. Note that the actual drawing of the tree does not change. Only the angleranges are adjusted.
More formally, let be a nonstrictly slopedisjoint drawing of a tree rooted at . We show how to compute for every vertex a new anglerange such that the current drawing of with the new anglerange is slopedisjoint.
Let be the edge that connects the parent of to in , for .
We make use of the following definitions:
For any vertex it holds that:
(1)  
(2) 
By Property1 of the nonstrictly slopedisjoint drawing, we have that and, therefore, . By adding the two previous inequalities we get that,
(3) 
For any descendant of the root of , by inductive use of Property2 of the nonstrictly slopedisjoint drawings, it holds that:
(4)  
(5) 
Let the root of be at level0, let be a vertex in level and let be the height of tree . Define the slopedisjoint angleranges for each vertex as follows:
Firstly, we show that the new anglerange boundaries satisfy Property2 of slopedisjoint drawings. Let be a level vertex and be its child. By the nonstrictly slopedisjoint Property2, it holds that:
Similarly, we have that . We also have,
The last inequality holds since vertex has a child and, thus, is at a level such that . Thus, Property2 holds.
Secondly, we show that the new anglerange boundaries satisfy Property3 of slopedisjoint drawings. Let and be two level vertices having the same parent. Then, by Property3 of the nonstrictly slope disjoint drawings we have that or . The two cases are symmetric, so we only prove that when . As proved for the case of Property2, and and thus, it remains to prove that . But we have that,
Finally, we turn our attention to Property1 of slopedisjoint drawings. Anglerange boundaries and satisfy Property1 of nonstrictly slopedisjoint drawings and thus, for every vertex at level and for every edge that belongs in or that enters from its parent inequality Eq. 1 holds. By definition, we have that which implies
(7) 
The last inequality holds since and . The later is true since is a level vertex where .
In a similar way, we show that and we conclude that . Thus, Property1 of slopedisjoint drawing is also satisfied.
Theorem 3
Every nonstrictly slopedisjoint drawing of a tree is monotone and planar.
2.2 Locating Points on the Grid
Based on geometry, we now prove that it is always possible to identify points on a grid that satisfy several properties with respect to their location.
Lemma 2
Consider two angles , with and let . Then, edge connecting the origin to point satisfies .
Proof
Let and be the halflines from origin with slopes and , respectively. Let and be the intersection points of and with line , respectively. We prove that , so a point of the grid must lie between and , since the coordinate is integer and line segment is parallel to axis as seen in Figure 2.
From trigonometry, we know identities :
(8) 
and
(9) 
By Eq. 8, it holds that and thus, for it holds:
(10) 
The coordinates of point are while the coordinates of point are . Therefore,
Given that , the grid point falls within the angular sector defined by halflines and and satisfies the lemma.
Lemma 3
Consider angles , with and let . Then, a grid point such that the edge that connects the origin to satisfies , can be identified as follows:
Moreover, if is the identified point, it also holds that:
Proof
See Figure 2 for points, slopes and angular sectors relevant to Lemma 3. For each case, we show that the identified points in the statement of the lemma satisfy the “slope” (“”) and the “length” (“”) conditions.
 Case1: .

Point is the identified point. In this case, the edge from the origin to has slope . For the “slope” condition, given that and , it is enough to show that which implies that . If we have that,
A clear contradiction. So, . In a similar way we can show that .
For the “length” condition, we have to show that,
This is true since,
 Case2: .

We first establish the “slope” condition.
For the case where the identified point is . We note that the slope of the edge from the origin to is . Then, by the assumption we have:
It follows that .
For the case where the identified point is . We note that the slope of the edge from the origin to is . By the assumption, and by taking into account that , we have:
It follows that .
For the case where the identified point is . We note that the slope of the edge from the origin to is . We want to establish that . This can be easily proved by taking into account that as well as that .
For the “length” condition, it is enough to show that:
This is true since,
 Case3: .

We first establish the “slope” condition. In the case where , by Lemma 2 the identified point immediately satisfies the “slope” condition. The same holds for the symmetric case where . Finally, in the case where the slope condition trivially holds since the edge from the origin to has slope .
For the “length” condition, we note that in all three cases we have that,
But it also holds:
(11) And since we get that,
The lemma is now proved.
3 OneQuadrant “Traditional” Monotone Drawing of Rooted Ordered Trees
In this Section, we describe an algorithm that builds a monotone drawing of an vertex tree on a grid of size at most . We refer to this algorithm as “traditional” since it satisfies all drawing conventions followed by all algorithms that have appeared in the literature, that is, it take as input a rooted ordered tree and produces a monotone drawing of where (i) the root of is drawn at the origin of the drawing, (ii) the drawing of is confined in the first quadrant, and (iii) the order of the children of each node of is respected. The algorithm produces a nonstrictly slopedisjoint tree drawing which, by Theorem 3, is monotone and planar.
***
In order to describe a nonstrictly slopedisjoint tree drawing, we need to identify for each vertex of the tree a grid point to draw as well as to assign to it two angles , , with . For every tree node, the identified grid point and the two angles should be such that the three properties of the nonstrictly slopedisjoint drawings are satisfied.
The basic idea behind our algorithm is to split in a balanced way the anglerange of vertex to its children based on the size of the subtrees rooted at them. The following strategy formalizes this idea.
Strategy
Let be a nonleaf vertex of an vertex rooted tree such that we already have assigned values for and , with . Let , be the children of . We assign anglerange for the children of in the following way:
The following lemma proves that Strategy 3 satisfies Property2 and Property3 of the nonstrictly slopedisjoint drawings.
Lemma 4
Let be a vertex of the rooted tree such that we already have assigned values for and , with . Let , be the children of in . If we assign values for angleranges of the children of according to Strategy 3, then Property2 and Property3 of the nonstrictly slopedisjoint drawings are satisfied.
Proof
For Property3, we have to show that for every , , it holds: . For any , we have that,
The last inequality holds since, by assumption, and because the size of a rooted tree is always positive. Therefore,
So, for any , , it holds that and, thus, Property3 holds.
For Property2, since we proved that , it is sufficient to show that and . The first part trivially holds since by definition. For the second part, by using repeatedly the assignment for and provided in the statement of the lemma we get that,
Since the subtree rooted at , consists of the root vertex and the subtrees rooted at ’s children, it holds that . It follows that and Property2 is satisfied.
Observation
If a vertex has only one child, say , then the angle assignment Strategy 3 assigns and , which means that the child “inherits” the anglerange of its parent.
Algorithm 1 describes our monotone tree drawing algorithm. It consists of three steps: Procedure AssignAngles which assigns angleranges to the vertices of the tree according to Strategy 3, Procedure DrawVertices which assigns each tree vertex to a grid point according to Lemma 3 and Procedure BalancedTreeMonotoneDraw which assigns the root to point with anglerange and initiates the drawing of the tree.
Lemma 5
The drawing produced by Algorithm 1 is monotone and planar.
Proof
The anglerange assignment of Strategy 3 satisfies Property2 and Property3 of the nonstrictly slope disjoint drawing as proved in Lemma 4. In addition, the assignment of the vertices to grid points satisfies Property1 of the nonstrictly slope disjoint drawing as proved in Lemma 3. Thus, the produced drawing by Algorithm 1 is nonstrictly slope disjoint and, by Theorem 3, it is monotone and planar.
It remains to establish a bound on the grid size required by Algorithm 1. Our proof uses induction on the number of tree vertices having more than one child.
Lemma 6
Proof
We use induction on the number of vertices having at least two children. Let be the number of vertices of with at least two children.
 Base Case (i=0):

In that case, is just a path and by Observation 3, Algorithm 1 assigns to every vertex the same anglerange. From this observation, for any vertex , it holds that , therefore by Lemma 3 we have that each edge expands our grid at most by:
Since the tree has vertices, we expand the grid times, therefore the sidelength of the grid required for the drawing of tree is:
The base case is now settled.
 Induction Step:

We assume that for any rooted subtree which contains at most vertices with at least two children each, the statement holds. We prove that for any subtree rooted at vertex with vertices in having at least two children each, the statement also holds.
At first we prove that the only case of interest is when the subtree is rooted at a vertex with at least two children. Let’s assume is the union of a path starting from and ending at where each vertex has exactly one child except and the subtree rooted at . The number of vertices in having at least two children is by assumption since the vertices in the path between and have exactly one child. If the statement holds for we have, by Observation 3, and , and thus,
(12) The sidelength of the required grid for is,
Comments
There are no comments yet.