A straight-line drawing of a graph G is a mapping of each vertex to a distinct point on the plane and of each edge to a straight-line 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 straight-line 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 straight-line drawing) . In the variable embedding setting, there exists a planar monotone drawing of any planar graph without any bends .
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.  which introduced monotone graph drawings.
Angelini et al.  provided two algorithms that used ideas from number theory and more specifically Stern-Brocot trees [11, 3], [4, Sect. 4.5].
The first algorithm used a grid of size (BFS-based algorithm) while the second one used a grid of size (DFS-based algorithm).
Later, Kindermann et al.  provided an algorithm based on Farey sequence (see [4, Sect. 4.5]) that used a grid of size .
He and He  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  firstly reduced the grid size for a monotone tree drawing to and, in a sequel paper, to . 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 .
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 .
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 “two-quadrants” 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 “four-quandrants” 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 four-quadrants algorithms, respectively. We conclude in Section 6. A preliminary version of this paper which included the one-quadrant algorithm for monotone tree drawings was presented in .
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 counter-clockwise rotation that brings a horizontal half-line starting at and directed towards increasing -coordinates to coincide with the half-line 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 .
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 side-length 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 Slope-disjoint Tree Drawings
Angelini et al.  defined the notion of slope-disjoint tree drawings. Let be a drawing of a rooted tree . is called a slope-disjoint 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 slope-disjoint 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 angle-range defined for vertex . is called the angle-range of with and being its boundaries. The convex angle formed between two half-lines with slopes and is denoted by and is called angle-range length of .
Angelini et al.  proved the following theorems:
Theorem 1 (Angelini et al.)
Every monotone drawing of a tree is planar.
Theorem 2 (Angelini et al.)
Every slope-disjoint drawing of a tree is monotone.
In order to simplify the description of our algorithm, we extend the definition of slope-disjoint tree drawings to allow for angle-ranges of adjacent vertices (parent-child relationship) or sibling vertices (children of the same parent) to share angle-range boundaries.
A tree drawing of a rooted tree is called a non-strictly slope-disjoint 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 angle-ranges of adjacent vertices (parent-child relationship) or sibling vertices (children of the same parent) to share angle-range boundaries. Note that replacing the “” symbols in our definition by the “” symbol gives us the original definition of Angelini et al.  for the slope disjoint tree drawings.
Every non-strictly slope-disjoint drawing of a tree is also a slope-disjoint drawing.
Intuitively, the theorem holds since we can always adjust (by a tiny amount) the angle-ranges of vertices that share an angle-range boundary so that, after the adjustment no two tree vertices share an angle-range boundary. Note that the actual drawing of the tree does not change. Only the angle-ranges are adjusted.
More formally, let be a non-strictly slope-disjoint drawing of a tree rooted at . We show how to compute for every vertex a new angle-range such that the current drawing of with the new angle-range is slope-disjoint.
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:
By Property-1 of the non-strictly slope-disjoint drawing, we have that and, therefore, . By adding the two previous inequalities we get that,
For any descendant of the root of , by inductive use of Property-2 of the non-strictly slope-disjoint drawings, it holds that:
Let the root of be at level-0, let be a vertex in level- and let be the height of tree . Define the slope-disjoint angle-ranges for each vertex as follows:
Firstly, we show that the new angle-range boundaries satisfy Property-2 of slope-disjoint drawings. Let be a level- vertex and be its child. By the non-strictly slope-disjoint Property-2, 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, Property-2 holds.
Secondly, we show that the new angle-range boundaries satisfy Property-3 of slope-disjoint drawings. Let and be two level- vertices having the same parent. Then, by Property-3 of the non-strictly slope disjoint drawings we have that or . The two cases are symmetric, so we only prove that when . As proved for the case of Property-2, and and thus, it remains to prove that . But we have that,
Finally, we turn our attention to Property-1 of slope-disjoint drawings. Angle-range boundaries and satisfy Property-1 of non-strictly slope-disjoint 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
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, Property-1 of slope-disjoint drawing is also satisfied.
Every non-strictly slope-disjoint 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.
Consider two angles , with and let . Then, edge connecting the origin to point satisfies .
Let and be the half-lines 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 :
By Eq. 8, it holds that and thus, for it holds:
The coordinates of point are while the coordinates of point are . Therefore,
Given that , the grid point falls within the angular sector defined by half-lines and and satisfies the lemma.
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:
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.
- Case-1: .
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,
- Case-2: .
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,
- Case-3: .
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:
And since we get that,
The lemma is now proved.
3 One-Quadrant “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 non-strictly slope-disjoint tree drawing which, by Theorem 3, is monotone and planar.
In order to describe a non-strictly slope-disjoint 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 non-strictly slope-disjoint drawings are satisfied.
The basic idea behind our algorithm is to split in a balanced way the angle-range of vertex to its children based on the size of the subtrees rooted at them. The following strategy formalizes this idea.
Let be a non-leaf vertex of an -vertex rooted tree such that we already have assigned values for and , with . Let , be the children of . We assign angle-range for the children of in the following way:
The following lemma proves that Strategy 3 satisfies Property-2 and Property-3 of the non-strictly slope-disjoint drawings.
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 angle-ranges of the children of according to Strategy 3, then Property-2 and Property-3 of the non-strictly slope-disjoint drawings are satisfied.
For Property-3, 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, Property-3 holds.
For Property-2, 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 Property-2 is satisfied.
If a vertex has only one child, say , then the angle assignment Strategy 3 assigns and , which means that the child “inherits” the angle-range of its parent.
Algorithm 1 describes our monotone tree drawing algorithm. It consists of three steps: Procedure AssignAngles which assigns angle-ranges 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 angle-range and initiates the drawing of the tree.
The drawing produced by Algorithm 1 is monotone and planar.
The angle-range assignment of Strategy 3 satisfies Property-2 and Property-3 of the non-strictly slope disjoint drawing as proved in Lemma 4. In addition, the assignment of the vertices to grid points satisfies Property-1 of the non-strictly slope disjoint drawing as proved in Lemma 3. Thus, the produced drawing by Algorithm 1 is non-strictly 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.
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 angle-range. 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 side-length 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,
The side-length of the required grid for is,