Journal of Graph Algorithms and Applications Drawing Unordered Trees on K-grids

We present almost linear area bounds for drawing trees on the octagonal grid. For complete 7-ary trees we establish an upper and lower bound of Θ(n 1.129) and for complete ternary trees the bounds of O(n 1.048) and Θ(n), where the latter needs edge bends. For arbitrary ternary trees we obtain an upper bound of O(n log log n) with bends and good aspect ratio by applying the recursive winding technique. We explore the unit edge length and area complexity of drawing unordered trees on k-grids with k ∈ {4, 6, 8} and generalize the N P-hardness results of the orthogonal grid to the octagonal and hexagonal grids.


Introduction
Trees are a fundamental data structure in computer science to represent hierarchies.Amongst others they are used as family trees in social networks or inheritance structures in UML-diagrams.Their visualization is an important field in graph drawing [8,9,11,15,16,24].Often trees are unordered, e. g., flow charts.Then, it is not necessary that a drawing reflects a given child order.For readable and comprehensible drawings in traditional hierarchical style the following aesthetics are established [19,23,25]: y-coordinates of the vertices correspond to their depth, centered parents over their children, minimal distance between vertices, integral coordinates, no (too) small angles between edges incident on a common vertex, maintaining the order, planarity, and identically drawn isomorphic subtrees up to reflection.These criteria exclude recursive winding techniques as they were studied by Chan et al. [8,9].Marriott and Stuckey [21] have shown that for unordered binary trees it is N P-hard to determine a hierarchical drawing with minimal width.The same was shown by Supowit and Reingold [25] for order-preserving drawings.The common drawing algorithm for binary trees was introduced by Reingold and Tilford [23] and generalized to d-ary trees by Walker [4,7,27], which all satisfy the above aesthetic criteria.
The hierarchical drawing methods enforce placing the vertices at grid points.All these approaches allow drawing trees of high degree, such that the angles between incident edges may be very small.Restricting the degree of trees allows to draw along a finite set of directions, e. g., four directions on the orthogonal grid.This grid was widely investigated in literature [3, 8-10, 13, 15, 16, 24, 26].The 6-and the 8-grid with additional axes are used to draw trees with higher degree [1,6,18].A motivation for such grids are discrete representations of radial drawings [11].In our companion paper [6] we showed that it is N Phard to determine the existence of an order-preserving tree drawing within a given area on the k-grid with k ∈ {4, 6, 8}.Now we translate the N P-hardness to the unordered case.Bhatt and Cosmadakis [3] showed that it is N P-hard to determine if a tree of degree up to four has an unit edge length drawing on the orthogonal grid.This result can also be proven by the logic engine approach [12].For binary trees this was shown by Gregori [17].N P-hardness results for minimum area were presented in [5,20].We already have claimed an equivalent result on the 6-grid for trees with degree up to six [1], however, in contrast to here without a formal proof.In the plane only two grid axes are linear independent.This shall cause some problems for compacting drawings on higher order grids containing more than 2 axes which do not occur on the 4-grid.Furthermore, the degree of difficulty increases with the number of additionally available discrete directions.
The remainder is organized as follows.After some definitions in Sect. 2 we present a tight area bound for drawing complete 7-ary trees in Sect.3. Afterwards, we show an almost linear upper area bound for straight-line drawings and bounds for drawings of ternary trees with bends on the 8-grid in Sect. 4. Table 1 summarizes known area bounds for unordered complete trees on k-grids.Finally, we show in Sect. 5 that it is N P-hard to decide whether or not there is a unit edge length drawing for arbitrary trees with degree k ∈ {6, 8} on the k-grid and whether or not there is a drawing within a given area.

Preliminaries
The orthogonal or 4-grid is the infinite planar undirected graph G = (V, E) whose vertices V have integral coordinates and whose edges E link vertex pairs with vertical or horizontal unit distance.Throughout the paper we use a Cartesian coordinate system with ascending y-coordinates downwards.We extend the 4-grid with its four directions to the hexagonal or 6-grid [1,6,18] with six directions by adding an edge {u, v} for each u ∈ V on coordinates (x, y) and v ∈ V on (x + 1, y + 1).The octagonal or 8-grid is a 6-grid with additional edges {u, v} between each u ∈ V on (x, y) and v ∈ V on (x + 1, y − 1).We call these grids k-grids with k ∈ {4, 6, 8}.The distance between vertices u, v ∈ V with coordinates (u x , u y ) and (v x , v y ) on a k-grid is defined by the maximum metric ) and i ∈ {1, . . ., n − 1}.A path is straight if the edges have the same direction.Let T = (V, E) be a (rooted) unordered tree.
If each vertex v ∈ V has an outdegree of at most d, we call T a d-ary tree.
An embedding Γ(T ) of a d-ary tree T = (V, E) on a k-grid with d < k is a mapping Γ which specifies distinct integer coordinates Γ(v) = (x, y) for each vertex v ∈ V .Γ maps an edge e ∈ E onto a (straight) path of grid edges Γ(e) between its endpoints.The length of an edge e ∈ E is the distance between its incident vertices and the length of a path is the sum of its edge lengths.We use the terms drawing and embedding synonymously.The area on a k-grid is the size of the smallest bounding rectangle and the aspect ratio is the quotient of its height and its width.
The following definitions of drawing styles are in accordance to [6], where we replace "O" for ordered by "U" for unordered.An U k -drawing is a drawing of an unordered d-ary tree on a k-grid with d < k.A tree drawing is locally uniform if Figure 1: Patterns on the k-grids for each vertex its outgoing edges have identical length.We call a locally uniform U k -drawing U L k -drawing.In a pattern drawing of a d-ary tree on the k-grid, the outgoing edges of each vertex are axially symmetric with respect to the incoming edge.All patterns are categorized by their outdegree.They are listed in Fig. 1 for the various k-grids.An U k -drawing using patterns is called U P k -drawing.
Combining these properties we obtain locally uniform pattern drawings, called U LP k -drawings.Here the children of a vertex are positioned symmetrically, which corresponds to placing the parent centered over its children.

Complete 7-ary Trees
In this section we investigate drawing complete 7-ary trees on the 8-grid.Similar to the results of [1], we establish an upper and lower bound for the area needed for complete trees.
Theorem 1 The upper and the lower bound for the area of drawings of complete 7-ary trees with n vertices on the 8-grid is Θ(n log 7 9 ).
Proof: We construct the drawing of the tree recursively.In the initial case the tree has height h = 0.In the construction step h → h + 1 the side length (in grid points) of the planar drawing grows by a factor of three, see Fig. 2. Thus, the area is in O(9 h ).Since h = log 7 n, the area is O(9 Let Γ(T (h)) be an U k -drawing of a complete 7-ary tree of height h with root r on the 8-grid.W. l.o. g. we assume that r is placed at the origin.We proof by induction on h that at least seven of the four corner extreme points (± 3 h −1 2 , ± 3 h −1 2 ) and four center extreme points (± 3 h −1 2 , 0) and (0, ± 3 h −1 2 ) are occupied by a vertex or an edge of T (h).Note that one of the corner extreme points may be used for the incoming edge of the root of T (h).Clearly, the Figure 2: Complete 7-ary tree statement holds for the induction bases h = 0 and h = 1.Let T 1 , . . ., T 7 be the seven (complete) subtrees of r with height h − 1 and roots r 1 , . . ., r 7 .W. l.o. g. let the outgoing edges of r (r, r 1 ), . . ., (r, r 7 ) point to any of the eight possible edge directions except to the north-west.This allows us to assume that the numbering of the T i s is counter-clockwise starting with the west.
Assume for contradiction that the grid point p = ( 3 h −1 2 , 0) is not occupied by Γ(T (h)).Hence, the subtree T 5 with incoming edge (r, r 5 ) pointing to the east does not occupy p.By induction, the side lengths of the drawing of T 5 are at least 3 h−1 − 1.Then, one corner extreme point of T 5 overlaps the diagonal axis from r to the north-east.Therefore, it is not possible to use this diagonal direction for T 6 .By symmetric arguments, the same holds for T 1 , T 3 , and T 7 .
It remains to show that the corner extreme points are occupied.Assume for contradiction that the grid point q = ( 3 h −1 2 , 3 h −1 2 ) is not occupied by Γ(T (h)).Hence, the subtree T 4 with incoming edge (r, r 4 ) pointing to the south-east does not occupy q.As a consequence, its extreme points are placed at least one unit to the north and/or to the west.W. l.o. g. we assume that it is displaced one unit to the north (both other directions are symmetric).As the side lengths of T 4 and T 5 are at least 3 h−1 − 1 and T 4 and T 5 do not overlap, T 5 overlaps the diagonal axis from r to the north-east.Therefore, it is not possible to use this diagonal direction for T 6 .The same can be shown for T 2 and T 6 by symmetric arguments.
Corollary 1 There is a linear time algorithm to draw a complete 7-ary rooted tree with n vertices on the 8-grid in O(n 1.129 ) area and with aspect ratio 1.

Ternary Trees
First we consider complete ternary trees and afterwards arbitrary ternary trees on the 8-grid.

Complete Ternary Trees
Each complete ternary tree can be drawn on the 4-grid within O(n 1.262 ) area [13].For strictly upward drawings on the 6-grid there is a tight bound of Θ(n 1.262 ) [1].In upward drawings the edges point piecewise monotonically in a common direction.We present an almost linear upper bound for complete ternary trees on the 8-grid using all 8 directions.
Theorem 2 There is a linear time algorithm to draw a complete ternary tree with n vertices on the 8-grid in O(n 1.048 ) area and with aspect ratio 1.
Proof: We construct the tree T (h) with height h recursively.Figure 3 shows one recursion step for i → i + 4 with i ≤ h.Initially, for i = h mod 4 ∈ {0, . . ., 3}, we draw the tree T (i) within a square of constant area with the root at a corner.In a recursion step i → i + 4 there are 81 complete trees with height i which we draw within a square with side length S(i).Let c = 8 be the number of additionally inserted columns (rows) which are used for wiring, i. e., connecting the subtrees with their parents.Then, the side length is S(i+4) = 10•S(i)+c ≤ 10 i/4 + (c • i/4 i=0 10 i ) < 10 i/4 + c • 10 i/4 +1 .Thus, S(h) ∈ O(10 h/4 ) and the area of T (h) is in O(100 h/4 ).The height of a complete ternary tree is h = log 3 n.Therefore, the needed area is in O(100 Theorem 3 There is a linear time algorithm to draw a complete ternary tree with at most one bend per edge on the 8-grid and the 6-grid within Θ(n)-area.The drawing is strictly upward, has constant aspect ratio, and less than n 9 bends.
Proof: We inductively define a drawing of a complete ternary tree T (h) with height h.For trees with height h = 0 and h = 1 the drawing is shown in Fig. 4. In the construction step h → h + 1 we compose the complete subtrees T 1 (h), T 2 (h), and T 3 (h) rooted at r 1 , r 2 , and r 3 to a tree T (h + 1) with root r and connecting edges (r, r 1 ), (r, r 2 ), and (r, r 3 ).This is done either vertically (Fig. 5(a)) or horizontally (Fig. 5(b)), alternating with odd and even h.Note that T 1 (h), T 2 (h), T 3 (h) are drawn identically and, thus, their drawings have identical dimensions.We denote the width and the height (number of occupied grid points) of the drawing of a tree with height h with W (h) and H(h), respectively.
In the vertical step the height H(h + 1) = 3H(h) and the width W (h + 1) = W (h) + 2. For the horizontal step symmetrically H(h + 1) = H(h) + 2 and W (h + 1) = 3W (h).The correctness of these recursions can be shown by induction.After eliminating the recursion we substitute h by log 3 (2n + 1) − 1, since n = Finally, we show that the overall number of edge bends b is smaller than n 9 .In the drawing of a tree T (h) with n = 3 h+1 −1 as each recursion step produces exactly one bend.Solving these equations results in b = n−4 9 .

Arbitrary Ternary Trees
We transfer the recursive winding approach of Chan et al. [8,9] for drawing binary trees on the 4-grid to ternary trees on the 8-grid introducing bends.On the 4-grid the algorithm constructs straight-line upward planar drawings respecting subtree separation with O( n A log A) height and O( A log n log A ) width with A ∈ {2, . . ., n}.Subtree separation means that in the drawing there are nonoverlapping rectangles for every pair of disjoint subtrees.Observe that each choice of 2 ≤ A ≤ n implies an O(n log n) drawing area.Now we consider the 8-grid.Due to the linear dependency among the different edge directions on the 8-grid, it is not possible to reach the result with straight-line edges.
Theorem 4 Let T be an arbitrary ternary tree with n vertices.There is a planar upward drawing on the 8-grid of T with O( n A log A) × O( A log n log A ) area, where A ∈ {2, . . ., n}, and in total with less than n − | leaves(T )| bends.
Proof: Let T 3 = (V 3 , E 3 ) be an arbitrary ternary tree with n vertices.First, we transform T 3 to a binary tree In the next step, we draw T 2 using the algorithm of Chan et al. [8,9] out of the box.We obtain a drawing Γ(T 2 ) on the 4-grid with a height in O( n A log A) and a width in O( A log n log A ), where A ∈ {2, . . ., n}.Each vertex v ∈ V 2 with two children has the following property.Either, in case (i), one outgoing edge of v has the same direction as the incoming edge e of v and the other is orthogonal to e, or, in case (ii), both outgoing edges of v are orthogonal to e. See Figs.6(a) and (b).Now, we transform the straight-line drawing Γ(T 2 ) on the 4-grid into a drawing Γ(T 3 ) on the 8-grid with bends.All non-dummy vertices are placed on identical coordinates in Γ(T 3 ).We replace each dummy vertex w ∈ V 2 and its incident edges (v, w), (w, v 1 ), and (w, v 2 ) by the original edges (v, v 1 ) and (v, v 2 ) and determine their bend coordinates.All other (straight-line) edges remain identical in Γ(T 3 ).First, consider case (i).Let (x u , y u ) be the coordinates of a vertex u in Γ(T 2 ).W. l.o. g. an edge (v, w) ∈ E 2 for each dummy vertex w is directed to the east in Γ(T 2 ), (w, v 1 ) has the same direction, and (w, v 2 ) points to the south, see Fig. 6(a).Then, y v = y w = y v1 and x w = x v2 .In Γ(T 3 ) we add (v, v 1 ) with two bends at (x v + 0.25, y v − 0.25) and (x v1 − 0.25, y v1 − 0.25).We add (v, v 2 ) with one bend at (x w , y w ) instead of the dummy vertex w.For an (b) Recursive winding on the 8-grid with less than n bends Figure 7: Transformation of the binary tree drawing with dummy vertices w 1 , w 2 , and w 3 to the corresponding drawing of the ternary input tree example see Fig. 6(c).It remains case (ii), where w. l. o. g. the edge (v, w) points to the south, (w, v 1 ) to the west, and (w, v 2 ) to the east.Here, we place the bends of the edge (v, v 1 ) at coordinates (x v −0.25, y v +0.25) and (x w −0.25, y w ).For (v, v 2 ) we introduce a bend at (x w , y w ) instead of w.For an example see Figs. 6

(b) and (d).
For all remaining directions of the incoming edge of w the construction is analogous.Note that the construction steps preserve planarity and subtree separation.Γ(T 3 ) is a drawing with vertices at integral coordinates and some bends at multiples of 0.25.Quadrupling all coordinates transforms bends onto the grid while the area grows by a factor of 16.Thus, the asymptotic area bounds of Chan et al. [8,9] hold.The number of introduced bends in total is less than 2 n 3 + n 3 = n since one third of the edges gets two bends and another third one.Further, as no edge incident to a leaf needs a bend, we have less than n − | leaves(T 3 )| bends.For a schematic example see Fig. 7.
The construction of the proof can also be used for planar non-upward drawings of ternary trees on the 8-grid [8,9].Then, all directions of the 8-grid are used for the edge routing.
Corollary 2 Let T be an arbitrary ternary tree with n vertices.There is a planar drawing on the 8-grid of T with O( n A log A) × O(A log n + A) area, where A ∈ {2, . . ., n}, and in total with less than n − | leaves(T )| bends.
Choosing A = log n delivers a drawing with height O( n log n log log n), width O(log n), and, hence, area in O(n log log n).

N P-hardness Results
In this section we present N P-hardness results for planar unordered tree drawings on k-grids.There is always an U LP k -drawing Γ(T ) of a d-ary tree T on JGAA, 17 (2)  the k-grid with d < k.A possible construction is similar to the drawing style of the complete 7-ary tree in Sect.3. We set the lengths of the outgoing edges of a vertex u to 3 height(T )−depth(u)−1 and then proceed top-down.For each vertex u we draw its j < k outgoing edges in an arbitrary order with these lengths and with arbitrary directions.Similar to [1,3], we first shall restrict ourselves to the problem of drawing with unit edge length.Table 2 summarizes that drawing trees with unit edge length on a grid is in all listed cases N P-hard.Afterwards, we consider the area complexity of these drawings without the unit edge length constraint.

Unit Edge Length
We consider the complexity of constructing U k -, U P k -, U L k -and U LP k -drawings with unit edge lengths.First we show an N P-hardness result for U k -drawings, where we extend the results of the 4-grid [3,12,17] to trees of degree 8 on the 8-grid.This result should be adaptable, such that it holds also for binary trees on the 8-grid similar to [17].3-satisfiability (3-SAT) is the classical N P-complete decision problem whether or not a given a Boolean expression E in 3-conjunctive normal (3-CNF) with n variables and c clauses has a satisfying assignment such that E evaluates to true [14].3-CNF demands that the clauses are logically and-conjuncted and that each clause contains exactly three literals which are conjuncted by logical ors.A literal is a Boolean variable which may be negated or not.We reduce the N P-hard NOT-ALL-EQUAL-3-SAT (NAE-3-SAT) [14] by constructing a tree of degree 8 in polynomial time for the given expression E. NAE-3-SAT is a specialized variant of 3-SAT where only Boolean variable assignments are accepted which additionally cause at least one true and at least one false literal in each clause.
For a simple description, we use a free undirected tree in the following constructions.We define a full tree consisting of a vertex q with eight neighbors r 1 , . . ., r 8 , see Fig. 8(a).In turn, these have incident edges (r 1 , s 1 ), . . ., (r 8 , s 8 ).The four vertices s 1 , . . ., s 4 in {s 1 , . . ., s 8 } additionally have seven adjacent vertices, called corner leaves.Each of the remaining four vertices s 5 , . . ., s 8 has only one additional neighbor, called center leaf.In Fig. 8(a) the leaves t 5 , . . ., t 8 are center leaves and all remaining leaves are corner leaves.We identify the position of a full tree by the coordinates of vertex q.Proof: As mentioned above let s 1 , . . ., s 4 be the neighbors of the corner leaves and let the remaining s 5 , . . ., s 8 be the neighbors of the center leaves.Assume for contradiction that an edge (q, r i ) with i ∈ {1, . . ., 4} is drawn horizontally with length 1.As required, the seven other incident edges of q are also drawn with length 1.Then, there remain three possible edge directions for (r i , s i ).
One is horizontal and two are diagonal.If (r i , s i ) is drawn horizontally, then the seven adjacent leaves of s i cannot be placed satisfying unit edge length without an overlap.The same is true if (r i , s i ) is drawn diagonally with unit edge length.Thus, (q, r i ) cannot be drawn horizontal.The same arguments hold for a vertical (q, r i ).Thus, (q, r i ) must be diagonal.There remain five possible directions for the edge (r i , s i ).Assume for contradiction that (r i , s i ) has a different slope as (q, r i ).Then, the seven neighbors of s i overlap with the neighbors of q.Therefore, the square containing s i and its neighbors must be drawn at a corner of the overall 7 × 7 square S of grid points.No vertex can be placed outside of S, as otherwise there is an edge which is longer than 1.Finally, for the paths from q to the center leaves only the horizontal and vertical directions remain.
Let an encode tree be a full tree omitting two center leaves, see Fig. 8(b) (without s and s ).We call the two new leaves, i. e., the former neighbors of the omitted center leaves, striker leaves.Later we shall extend certain encode trees by strikers which are paths of length two added at a striker leaf, e. g., (s, s , s ) in Fig. 8(b).Consider a drawing of an encode tree with a given position of s.Then, the position of s is predetermined.For s three possible grid points remain satisfying unit edge length.These lie outside the 7 × 7 square.
x 11 x 21 x 21 x 31 x 31 x 41 x 41 We connect two full and encode trees inserting either an edge between center leaves, called center connection, or an edge between corner leaves, called corner connection.Note that in the remainder these two connection types are the only connections used between these two tree types.When it is obvious, we coarsen our view and use the notions vertex, leaf and path identifying full and encode trees as (meta-)vertices.Let u and v be center connected full trees.By Lemma 1, there are four relative positions for them in a drawing, i. e., u is left of, right of, above or below v. Let v have an absolute grid position and u a relative position to v.For u there are three possible grid positions satisfying edge length 1, e. g., if u is left of v, their y-coordinates differ by at most 1.
For a Boolean expression E in 3-CNF with c clauses and n variables we construct a tree S(n, c + 1) of degree 8, see Fig. 10 ignoring the strikers.Initially, we introduce the basic tree S(n, 1) containing the basic spine of center connected full trees (u 0 , v 1 , . . ., v n , w 0 ), see Fig. 9.We add two center connected encode trees x i1 and x i1 as additional neighbors to each of the full trees v i with i ∈ {1, . . ., n}.Finally, we append three additional center connected full trees u 1 , u 1 , u 1 (w 1 , w 1 , w 1 ) and two corner connected full trees a 11 and d 11 (b 11 and c 11 ) to the full tree u 0 (w 0 ).We denote a corner connected full tree α 11 with α ∈ {a, b, c, d}.
In the inductive step j → j + 1 we expand S(n, j) to S(n, j + 1) by appending the full trees u j+1 , u j+1 , u j+1 , w j+1 , w j+1 , w j+1 to u j , u j , u j , w j , w j , w j via center connections.Again using center connections, we add the encode trees x i,j+1 and x i,j+1 to x ij and x ij , respectively.For each k ∈ {1, . . ., j} and α ∈ {a, b, c, d} we add the full tree α j+1,k (α k,j+1 ) to the leaf α jk (α kj ) using a center connection.Finally, we append the new full trees α j+1,j+1 to α jj by corner connections.
We apply one additional construction step to the so far obtained tree S(n, c) to frame it.This is done similarly to the inductive step from the previous paragraph, but using full trees instead of encode trees.We obtain the tree S(n, c+1).This ensures that the free positions of each encode tree are restricted to the same y-coordinate and, then, as we will see later, strikers can only be embedded on the left or the right side of the encode trees for the c-th clause and x 12 x 11 x 11 x 12 x 13 x 14 x 24 x 23 x 22 x 21 x 21 x 22 x 23 x 24 x 34 x 33 x 32 x 31 x 31 x 32 x 33 x 34 x 44 x 43 x 42 x 41 x 41 x 42 x 43 x and c = 3) and assignment x 1 = T, x 2 = x 3 = x 4 = F not to the north or to the south.In S(n, c+1) we call the path (x i,c+1 , . . ., x i,c+1 ) with i ∈ {1, . . ., n} the i-th column C i .
Lemma 2 Let S(n, c + 1) be drawn with unit edge length on the 8-grid and let its basic spine be (v 0 = u 0 , v 1 , . . ., v n , w 0 = v n+1 ).Then, all vertices v i with i ∈ {0, . . ., n} share the same relative position to their successor v i+1 , which is either left of, right of, above, or below.
Proof: Considering the basic spine, the vertex u 0 has four center connected neighbors u 1 , u 1 , u 1 , v 1 .W. l.o. g. v 1 is placed to the right of u 0 and u 1 , u 1 , u 1 may be positioned left of, above, and below u 0 , see Fig. 9. Assume for contradiction that the center connected neighbor v 2 is placed below (above) v 1 .Each of the two full trees v 1 and v 2 has four center connected neighbors.This leads to a contradiction because there is no space left to place the fourth neighbor of v 2 considering edge length 1.Hence, v 2 must be placed to the right of v 1 .The same can be shown by an inductive argument for the remaining full trees of the basic spine.As a consequence, all these full trees are placed side by side and the y-coordinates differ between neighbors at most by 1.The center connected neighbors w 1 , w 1 , w 1 of w 0 are placed symmetrically to the respective neighbors of u 0 .See Fig. 10 for an example.
The basic spine is horizontally embedded if all neighbors are positioned in a planar way relatively left and right of each other, else it is vertically embedded.Let Γ(S(n, c + 1)) be a drawing of S(n, c + 1) with a horizontally embedded basic spine.Then, the basic spine separates Γ(S(n, c + 1)) into two halfs, the top half and the bottom half.Due to the freedom to permute incident edges, either the path (x i1 , . . ., x i,c+1 ) is drawn in the top half and (x i1 , . . ., x i,c+1 ) in the bottom half of each column C i , or vice versa.We call the paths (u 0 , . . ., u c+1 ), (u 0 , . . ., u c+1 ), (u 0 , . . ., u c+1 ) the u-spines of S(n, c+1).Analogously, we define w-spines.
Lemma 3 Let S(n, c + 1) be drawn with unit edge length and let the basic spine be embedded horizontally on the 8-grid.Then, all other edges have determined slopes (directions).
Proof: Let Γ(S(n, 1)) be a drawing of the basic tree S(n, 1) where w. l. o. g. the basic spine (u 0 , v 1 , . . ., v n , w 0 ) is horizontally embedded and u 0 is placed left of v 1 .Let u be placed left of u 0 , u above u 0 , and u below u 0 (symmetrically for w).Each v i with i ∈ {1, . . ., n} has two center connected encode trees x i1 and x i1 , which must be drawn above and below, respectively (or vice versa).So far all center connected full and encode trees have relative positions.Due to unit edge length, the horizontal grid distance between the corner connected full trees α 11 with α ∈ {a, b, c, d} above (below) the basic spine is at most 7(n + 2) + 1, which corresponds to 7(n + 2) free grid points.As each full tree horizontally covers 7 grid points, the horizontal row of n encode trees cover in sum 7(n + 2) points.The positions of these encode trees and of the corner connected full trees are fix.Analogously, the positions of the full trees vertically between the corner connected trees α 11 are fix.Hence, all edges of the basic tree S(n, 1) despite the center connections of the basic spine have a fix slope.The same argumentation can be applied in the induction step j → j + 1. W. l.o. g. let the basic spine always be horizontally embedded to the right in the remainder.Then, in each column C i with i ∈ {1, . . ., n} the center connection edges of the path (x i,c+1 , . . ., x i,c+1 ) are drawn vertically.Each surrounding 7 × 7 square of an encode tree covers exactly two grid points which are not occupied by the encode tree and which have identical y-coordinates.We use these free grid points to encode the remaining information of the Boolean expression E into the tree S(n, c + 1).
Consider the i-th variable x i and the j-th clause with i ∈ {1, . . ., n} and j ∈ {1, . . ., c}.If x i does not appear in clause j, we append the striker (s ij , s ij , s ij ) to the encode tree x ij and the striker (s ij , s ij , s ij ) to x ij .If x i occurs not negated in clause j, we add the striker (s ij , s ij , s ij ) to the encode tree x ij .Finally, if the variable x i occurs negated in clause j, we add the striker (s ij , s ij , s ij ) to x ij .In the following, T (E) identifies this extension of S(n, c + 1).Note that in a unit edge length drawing Γ(T (E)) all edges despite edges connecting the basic spine and the rear striker edges (s ij , s ij ) or (s ij , s ij ) have determined slopes.
Consider the encode tree z ij with z ij ∈ {x ij , x ij } and its striker S = (s, s , s ) in Γ(T (E)).Since there is the freedom of vertically mirroring z ij , S can be drawn either on its left or on its right side.According to Lemma 2, the y-coordinates of the columns C i and C i−1 or C i+1 with i ∈ {2, . . ., n − 1} differ at most by 1.However, if there is a free grid point at the right side of z i−1,j or the left side of z i+1,j , respectively, the vertex s can be embedded on it.For an example see the encode tree x 22 in Fig. 10 with its striker S embedded to the right side.Note that a striker starting from an encode tree of C 1 (C n ) can only be embedded to the right side (left side).
Lemma 4 Let E be a Boolean expression in 3-CNF with c clauses and n variables.E is satisfiable with at least one true and one false literal per clause if and only if there is a drawing Γ(T (E)) with unit edge length on the 8-grid.
Proof: "⇒": Let τ (E) be a satisfying assignment for the Boolean expression E with n variables and c clauses.Compute the tree T (E) as described above.To obtain a planar drawing Γ(T (E)) with unit edge length we have to determine, whether a path (x i1 , . . ., x i,c+1 ) will be embedded in the top half and its companion path (x i1 , . . ., x i,c+1 ) in the bottom half, or vice versa.If the variable x i with i ∈ {1, . . ., n} is true, then embed the corresponding path (x i1 , . . ., x i,c+1 ) of column C i in the top half, and in the bottom half otherwise.This is always possible as τ (E) ensures that each clause has at least one true and at least one false literal.This fits exactly to the fact that in the j-th row in the top (bottom) half of the drawing for the j-th clause at most two strikers can be embedded in a planar way as each encode tree can be vertically flipped.All other n − 3 holes are occupied by strikers for variables not existing in clause j.
"⇐": Let Γ(T (E)) be a drawing with unit edge length of T (E).According to Lemma 3 all edges have a determined slope despite the edges connecting the basic spine and the rear striker edges.Without strikers there are n − 1 holes, i. e., two adjacent free grid points, in the j-th row with j ∈ {1, . . ., c} between neighbored encode trees in the top half and n − 1 holes in the bottom half.In each row j (top and bottom half) we added n − 3 strikers for the non existing variables in clause j.Therefore, in the top (bottom) half at most two more strikers can be placed in the j-th row.For negated and not negated literals in a clause we added in total three strikers.It is not possible to place all three strikers in the top (bottom) half.In a planar drawing with unit edge length there must be two strikers in the top half and the other in the bottom half, or vice versa.
A literal y k with k ∈ {1, . . ., n} is either the variable x k or its negation x k .Let y k be in clause j.If y k is not negated, then the literal is true if the corresponding striker (s kj , s kj , s kj ) is embedded in the top half of the drawing Γ(T (E)).Otherwise, if y k is negated, then the literal is false if the striker (s kj , s kj , s kj ) is embedded in the top half.Hence, we obtain a satisfying assignment τ (E) with respect to NAE-3-SAT with at least one literal true and at least one literal false in each clause.
We obtain directly from Lemma 4 the following.
Theorem 5 Let T be a 7-ary tree.Deciding whether or not there exists an U 8 -drawing Γ(T ) with unit edge length is N P-hard.
The proof idea of the analogous result on the 6-grid is essentially the same as the above for the 8-grid.However, as there are technical differences and traps in Figure 11: Full and encode trees on the 6-grid the constructions due to the one missing diagonal, w. l. o. g. from south-east to north-west on the grid, we nevertheless present the proof (where necessary) in the same detail to ensure correctness.The differences manifest especially in the north-west and south-east regions of the (drawings of) full trees, encode trees, and T (E).For example and in contrast to Fig. 10, for the latter there is no option in this regions to corner connect the full trees b jj and d jj , 1 ≤ j ≤ c + 1, to enforce the rigidness of a drawing of T (E).Note that the N P-hardness was already claimed in [1], however, the detailed proof is presented for the first time in the following.First, we extend the definition of a full tree for the 6-grid, see Fig. 11(a).The vertex q has six adjacent vertices r 1 , . . ., r 6 .These have additional neighbors: r 1 (r 2 ) is adjacent to three leaves of which one is t 1 (t 2 ).r 3 (r 4 ) is adjacent to leaf t 3 (t 4 ) and to the inner vertex s 1 (s 2 ).r 5 (r 6 ) is adjacent to one leaf t 5 (t 6 ).There are no further vertices or edges.Analogously to the 8-grid, we call the adjacent leaves of r 1 and r 2 corner leaves and t 3 , . . ., t 6 center leaves.
Lemma 5 Full trees have exactly one drawing on the 6-grid with unit edge length and center leaves on the boundary of a bounding 5 × 5 square (in grid points) up to swapping paths from q to the center leaves, translation, and labeling of the vertices.
Proof: Let the root vertex q of a full tree be placed in the center of a 5 × 5 bounding square S (in grid points), w. l. o. g. at (0, 0).Then, r 1 , . . ., r 6 are placed around q such that the edges (q, r 1 ), . . ., (q, r 6 ) have length 1.
Assume for contradiction that (q, r 1 ) is drawn to the east with edge length 1.Then, the adjacent leaves of r 1 occupy at least one of the grid positions (1, 1) and (1, −1) and the remaining adjacent vertices of q cannot be placed.With x 11 x 21 x 21 x 31 x 31 x 41 x 41 symmetric arguments (q, r 1 ) cannot be drawn to the west or vertically.The same holds for the edge (q, r 2 ).Thus, (q, r 1 ) and (q, r 2 ) can only lie on the sole diagonal through q.As the precondition demands that each center leaf is on the boundary of S, each of them has to be placed in the middle of one boundary side.Then, there is not enough room to embedd both subtrees T (r 3 ) and T (r 4 ) induced by r 3 and r 4 , respectively, together in the north-east or south-west quadrant.Thus, T (r 3 ) is in the north-east and T (r 4 ) in the south-west, or vice versa.Then, the positions of the remaining vertices are predetermined.
An encode tree on the 6-grid is a full tree omitting the leaves t 5 and t 6 , see Fig. 11(b) without s and s .Again, we call a path with length 2 starting at one of the two arising leaves a striker.In the example, the striker (s, s , s ) is appended to the striker leaf r 6 = s.
Consider a drawing of an encode tree with unit edge length and the two center leaves t 3 and t 4 placed at the boundary of the surrounding 5 × 5 square and a fixed position of s.Then, the position of s is predetermined.For the leaf s there remain two possible grid points, which are located outside of the 5 × 5 square.
In the following we connect full trees and encoding trees like on the 8-grid.For these connections it is necessary to place the center leaves on the boundary of the respective 5 × 5 squares as required by Lemma 5.As on the 8-grid, center connections enforce relative positions of the participating full or encoding trees.
The basic spine is defined analogously and the construction of the basic tree S(n, 1) is done similar to the 8-grid.The only difference is, that we omit the corner connected full trees b 11 and d 11 , see Fig. 12 in comparison to Fig. 9.The tree S(n, 2) is the extension of S(n, 1).The encoding trees, the u-and w-spines, and the full trees a 11 and c 11 are extended as on the 8-grid.The difference is, that we append the full trees b 11 to w 1 and d 11 to u 1 , see Fig. 13.We call the subtrees rooted at α 11 with α ∈ {a, c} α-trees and the subtrees rooted at β 11 with β ∈ {b, d} β-trees.
The inductive construction step j → j + 1 is also similar to the 8-grid.We append a corresponding new encoding tree to each existing encoding tree in S(n, j).The extension of the α-trees is identical, too.However, the extension x 11 x 11 x 12 x 22 x 21 x 21 x 22 x 32 x 31 x 31 x 32 x 42 x 41 x 41 x 42  of the β-trees by new full trees varies due to the missing grid diagonal, which we describe in detail now.We center connect a new full tree β j−γ+1,γ to each existing full tree β j−γ,γ for γ ∈ {1, . . ., j − 1} and a single new full tree β 1,j+1 to β 1,j .This construction step is repeated until j + 1 = c.Like on the 8-grid, we finally apply one additional construction step using full trees instead of encoding trees.Again, this ensures that the strikers later can only be embedded left or right of the encode trees of the c-th clause.Thus, for the tree construction on the 6-grid we obtain in analogy to Lemma 3 the following.
Lemma 6 Let S(n, c + 1) be drawn with unit edge length and let the basic spine be embedded horizontally on the 6-grid.Then, all other edges have determined slopes (directions).
Proof: The only difference to the 8-grid lies in the construction of the β-trees.
Let Γ(S(n, 1)) be a drawing of the basic tree S(n, 1) where w. l. o. g. the basic spine (u 0 , v 1 , . . ., v n , w 0 ) is horizontally embedded and u 0 is placed left of v 1 .Let u 1 be placed left of u 0 , u 1 above u 0 , and u 1 below u 0 (symmetrically for w).
Each v i with i ∈ {1, . . ., n} has two center connected encode trees x i1 and x i1 , which must be drawn above and below, respectively, or vice versa.So far, all center connected full and encode trees have relative positions.Now, the corner connected full tree a 11 (c 11 ) can only be drawn above (below) u 1 (w 1 ) and left of (right of) u 1 (w 1 ).Due to the unit edge length in Γ(S(n, 1)), the number of free grid points horizontally between u 1 and w 1 above the basic is at most 5n.The same holds below the basic spine between u 1 and w 1 .As each encode tree covers horizontally 5 grid points, the horizontal row of n encode trees covers in sum 5n grid points.Thus, the positions of these encode trees and of the corner connected full trees are fix.Hence, all edges of the basic tree S(n, 1) up to the center connections of the basic spine have a determined slope, see Fig. 12.
In the first inductive step 1 → 2 the basic tree S(n, 1) is extended to S(n, 2), see Fig. 13.b 11 is center connected to w 1 and d 11 to u 1 .The construction ensures that the position above w 1 is either occupied by b 11 or w 2 .The position below u 1 is analogously occupied by either d 11 or u 2 .Therefore, the full and encoding trees of each encode column C i with i ∈ {1, . . ., n} are embedded vertically above each other, i. e., their x-coordinates are fixed.For the general inductive step j → j + 1 let w. l. o. g. w 0 be placed at the origin (0, 0) on a coarsened coordinate system where one unit covers 5 grid points.In case (i), b 11 is then located at (1, 1).W. l.o. g. the w-spines (w 0 , . . ., w j ), (w 0 , . . ., w j ), and (w 0 , . . ., w j ) are embedded horizontally to the east, vertically to the north, and vertically to the south, respectively.Now, we inductively prove that the "diagonal" positions (j − γ, γ) and (1, j) with γ ∈ {1, . . ., j − 1} between w j and w j are occupied by full trees of the b-tree.For j = 1 the statement holds because in S(n, 1) there is no valid position between w 1 and w 1 .For j = 2 in S(n, 2) there is one position occupied in the north-eastern direction by b 11 or w 2 .By induction the j − 1 positions between w j and w j are occupied by the full trees b j−γ,γ with γ ∈ {1, . . ., j − 1}.In the construction step we append the new full trees w j+1 and w j+1 to the w-spines and center connect j new full trees b j+1−γ,γ with γ ∈ {1, . . ., j − 1} to the existing full trees b j−γ,γ and b 1,j to b 1,j−1 .By induction there are j − 1 occupied positions between w j and w j .After applying the induction step there are exactly j positions between w j+1 and w j+1 .In the remaining case (ii) b 11 is located at the coarse coordinates (2, 0).Then, the path (w 1 , . . ., w j ) is embedded vertically to the north and the b-tree is displaced one unit to the south-eastern direction.Then, the same argumentation as in case (i) shows that the diagonal positions are occupied.The proof for the d-tree is symmetric.Thus, together with the fix α-trees as shown in the proof of Lemma 3, the x-coordinates of the encoding trees in a drawing Γ(S(n, c + 1)) are determined.Hence, all slopes between full and/or encoding trees are determined up to the center connections of the basic spine.
With this in hands, we are now able to encode a Boolean expression E into the tree S(n, c + 1) to obtain T (E) exactly as done on the 8-grid.Thus, the following holds by the same reasoning as in the proof of Lemma 4. For an example see Fig. 14.
Lemma 7 Let E be a Boolean expression in 3-CNF with c clauses and n variables.E is satisfiable with at least one true and one false literal per clause if and only if there is a drawing Γ(T (E)) with unit edge length on the 6-grid.
Together with the N P-hardness results of Bhatt and Cosmadakis [3] on the 4-grid, the main result follows.
Theorem 6 Let T be a d-ary tree with d < k for k ∈ {4, 6, 8}.Deciding whether or not there exists an U k -drawing Γ(T ) with unit edge length is N P-hard.Now we restrict U k -drawings using the aesthetic criteria local uniformity and patterns to obtain U L k -, U P k -and U LP k -drawings.Remember, that these are JGAA, 17(2) 103-128 (2013) 123 x 14 x 13 x 12 x 11 x 11 x 12 x 13 x 14 x 24 x 23 x 22 x 21 x 21 x 22 x 23 x 24 x 34 x 33 x 32 x 31 x 31 x 32 x 33 x 34 x 44 x 43 x 42 x 41 x 41 x 42 x 43 x 44 a 11 a 12 a 13 a 14   Proof: When using uniform slopes for the edges connecting the basic spine, the construction in the proof of Lemma 4 generates an U LP k -drawing of T (E) with unit edge length and k ∈ {4, 8}.
For U P 6 -drawings it is not possible to show the N P-hardness with the presented approach because a full tree with its center leaves on the boundary is no valid pattern drawing.Nevertheless, we claim the following.
Conjecture 1 Let T be a d-ary tree with d < 6. Deciding whether or not there exists an U P 6 -drawing (U LP 6 -drawing) Γ(T ) with unit edge length is N P-hard.

Area
Now we are interested in the area occupied by U 8 -, U L 8 -, U P 8 -and U LP 8drawings.
Proposition 1 Let T be a tree with degree 8 and A > 1. Determining whether or not there exists an U 8 -drawing Γ(T ) within area A is N P-hard.
Proof: (Sketch) Again we reduce from NAE-3-SAT.Let E be a Boolean expression with c clauses and n variables and let tree T (E) of degree 8 be constructed as described in Sect.5.1 with some additional edges.Let j ∈ {1, . . ., c}.For each encode tree x 1j and x 1j in the first column C 1 we add new vertices b 1j and b 1j connected by the edges (s 1j , b 1j ) and (s 1j , b 1j ) to the striker leaf s 1j and s 1j , respectively.To the last column C n we add the edges (s nj , b nj ) and (s nj , b nj ) in the same way.Let A = W • H with W = 7(2(c + 1) + n + 2) and H = 7(2(c + 1) + 1).E is satisfiable with at least one true and one false literal per clause if and only if there is an U 8 -drawing of T (E) within area A.
"⇒": We argue similar to the if-part in the proof of Lemma 4. We draw the basic spine (u 0 , v 1 , . . ., v n , w 0 ) horizontally on identical y-coordinates.We align the edges added to the striker leaves to the left in the first column C 1 and to the right in the last column C n .Using the assignment τ (E) the strikers are aligned as described in Lemma 4.Then, Γ(T (E)) has total height H. Its total width corresponds to the sum of the lengths of a u-spine, the basic spine, and a w-spine which is W .
"⇐": Let Γ(T (E)) be a drawing of T (E) within area A. The number of available grid points of area A = W • H with W = 7(2(c + 1) + n + 2) and H = 7(2(c + 1) + 1).The number of vertices in T (E) is smaller by 2c than the number of available grid points in A. Therefore, for each clause j there are only two grid points left blank.This shall tighten the drawing in a row in the top or in the bottom half and therefore, the whole drawing, such that we can determine the assignment τ (E) analogously to the proof of Lemma 4.
Corollary 4 Let T be a 7-ary tree and A > 1. Determining whether or not there exists an U P 8 , U L 8 or U LP 8 -drawing Γ(T ) within area A is N P-hard.
Proof: First, consider U LP 8 -drawings.Let Γ(T (E)) be a locally uniform pattern drawing within area A = H • W , which is identical to the drawing in the proof of Proposition 1.Therefore, the remaining arguments can be applied analogously.The result also holds for U L 8 -and U P 8 -drawings because they are already U LP 8 -drawings.
The same statements for the k-grid with k ∈ {4, 6} except for U P 6 -and U LP 6 -drawings shall be proven similarly.In the case k = 6, Γ(T (E)) must be extended to completely fill the remaining space in the north-east and the south-west of the surrounding rectangle with full trees.

Conclusion
We have shown the N P-hardness for several problems of drawing trees with unit edge length on k-grids with k ∈ {4, 6, 8}.For the same types of drawings, we furthermore stated the N P-hardness of using minimal area.For complete 7-ary trees on the 8-grid we presented a tight area bound of Θ(n log 7 9 ) which is about Θ(n 1.129 ) and for complete ternary trees we gave an almost linear upper bound of O(n 1.048 ) for the needed area.Using bends allows drawing complete ternary trees in O(n) area.For arbitrary ternary trees we showed an upper area bound of O(n log log n).Each of the two latter algorithms generates in total less than n edge bends.
Future work is to complete the needed area bounds for arbitrary trees on the k-grid with or without allowing bends.We conjecture that ternary trees can be drawn upwards on the 8-grid with recursive winding using less than n 3 bends in O(n log n) area and in O(n log log n) area without a common direction.For that, further optimizations in the subtree placement within the transformation of the intermediate binary to the final ternary tree drawing of Sect.4.2 should be helpful.Formal N P-hardness proofs for the unit edge length and minimal area U P 6 -and U LP 6 -drawings are missing up to now.It would be nice to have similar but more general results on bounds and N P-hardness independent of a concrete k.

Figure 8 :Lemma 1
Figure 8: Full and encode trees on the 8-grid