10
MINIMUM N UMBER OF B ENDS OF PATHS OF T REES IN A G RID E MBEDDING APREPRINT Vitor T. F. de Luca Universidade do Estado do Rio de Janeiro Rio de Janeiro, Brazil [email protected] Fabiano S. Oliveira Universidade do Estado do Rio de Janeiro Rio de Janeiro, Brazil [email protected] Jayme L. Szwarcfiter Universidade Federal do Rio de Janeiro Universidade do Estado do Rio de Janeiro Rio de Janeiro, Brazil [email protected] September 8, 2021 ABSTRACT We are interested in embedding trees T with Δ(T ) 4 in a rectangular grid, such that the vertices of T correspond to grid points, while edges of T correspond to non-intersecting straight segments of the grid lines. Such embeddings are called straight models. While each edge is represented by a straight segment, a path of T is represented in the model by the union of the segments corresponding to its edges, which may consist of a path in the model having several bends. The aim is to determine a straight model of a given tree T minimizing the maximum number of bends over all paths of T . We provide a quadratic-time algorithm for this problem. We also show how to construct straight models that have k as its minimum number of bends and with the least number of vertices possible. As an application of our algorithm, we provide an upper bound on the number of bends of EPG models of VPT EPT graphs. Keywords Grid embedding · Number of bends · EPG models 1 Introduction The problem of grid embedding of a graph G is that of drawing G onto a rectangular two-dimensional grid (called simply grid) such that each vertex v V (G) corresponds to a grid point (an intersection of a horizontal and a vertical grid line) and the edges of G correspond to paths of the grid. Grid embedding of graphs has been considered with different perspectives [1, 2, 3, 4, 5, 6]. In [1], the authors described an algorithm for embedding planar graphs and showed that the resulting embedding has edges with at most 6 bends. The same authors later showed in [2] a simpler approach which provides an embedding in which each edge has at most 4 bends. Embeddings having edges with at most 4 bends were also considered in [6], where a linear-time algorithm is presented. In [4], linear-time algorithms were described for embedding planar graphs such that the resulting embedding is guaranteed to have edges with at most 2 bends, with the exception of the octahedron, for which at most two edges with 3 bends may be produced. In this same paper, the authors also provided an upper bound on the total number of bends of their embeddings. Note that, all of these results are related to the problem of finding embeddings of graphs in which the aim is to minimize the number of bends of the edges of the graph and/or the total number of bends. In this paper, we introduce a similar problem: given a planar graph G, find a grid embedding of G in which the edges of G correspond to pairwise non-intersecting paths of the grid, each one having no bends, such that the maximum number of bends, over all paths of G, is minimized. So, this new problem shifts the focus on the number of bends of edges of G to the number of bends of paths of G. This problem has not yet been considered in the literature so far. For instance, the arXiv:2109.02733v1 [math.CO] 6 Sep 2021

Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

MINIMUM NUMBER OF BENDS OF PATHS OF TREES IN A GRIDEMBEDDING

A PREPRINT

Vitor T. F. de LucaUniversidade do Estado do Rio de Janeiro

Rio de Janeiro, [email protected]

Fabiano S. OliveiraUniversidade do Estado do Rio de Janeiro

Rio de Janeiro, [email protected]

Jayme L. SzwarcfiterUniversidade Federal do Rio de Janeiro Universidade do Estado do Rio de Janeiro

Rio de Janeiro, [email protected]

September 8, 2021

ABSTRACT

We are interested in embedding trees T with ∆(T ) ≤ 4 in a rectangular grid, such that the verticesof T correspond to grid points, while edges of T correspond to non-intersecting straight segmentsof the grid lines. Such embeddings are called straight models. While each edge is represented by astraight segment, a path of T is represented in the model by the union of the segments correspondingto its edges, which may consist of a path in the model having several bends. The aim is to determinea straight model of a given tree T minimizing the maximum number of bends over all paths of T . Weprovide a quadratic-time algorithm for this problem. We also show how to construct straight modelsthat have k as its minimum number of bends and with the least number of vertices possible. As anapplication of our algorithm, we provide an upper bound on the number of bends of EPG models ofVPT ∩ EPT graphs.

Keywords Grid embedding · Number of bends · EPG models

1 Introduction

The problem of grid embedding of a graph G is that of drawing G onto a rectangular two-dimensional grid (calledsimply grid) such that each vertex v ∈ V (G) corresponds to a grid point (an intersection of a horizontal and a verticalgrid line) and the edges of G correspond to paths of the grid. Grid embedding of graphs has been considered withdifferent perspectives [1, 2, 3, 4, 5, 6]. In [1], the authors described an algorithm for embedding planar graphs andshowed that the resulting embedding has edges with at most 6 bends. The same authors later showed in [2] a simplerapproach which provides an embedding in which each edge has at most 4 bends. Embeddings having edges with atmost 4 bends were also considered in [6], where a linear-time algorithm is presented. In [4], linear-time algorithmswere described for embedding planar graphs such that the resulting embedding is guaranteed to have edges with at most2 bends, with the exception of the octahedron, for which at most two edges with 3 bends may be produced. In this samepaper, the authors also provided an upper bound on the total number of bends of their embeddings. Note that, all ofthese results are related to the problem of finding embeddings of graphs in which the aim is to minimize the number ofbends of the edges of the graph and/or the total number of bends.

In this paper, we introduce a similar problem: given a planar graph G, find a grid embedding of G in which the edges ofG correspond to pairwise non-intersecting paths of the grid, each one having no bends, such that the maximum numberof bends, over all paths of G, is minimized. So, this new problem shifts the focus on the number of bends of edges of Gto the number of bends of paths of G. This problem has not yet been considered in the literature so far. For instance, the

arX

iv:2

109.

0273

3v1

[m

ath.

CO

] 6

Sep

202

1

Page 2: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

tree in Figure 1(a) is drawn in such a way that there is a path having 5 bends (the path joining o and m), and 5 is themaximum number of bends in that drawing. However, this maximum number of bends can be decreased to 3 (pathjoining e and f ), as Figure 1(b) illustrates.

(a) (b)

Figure 1: Two possible modelsM1 (left) andM2 (right) of the same tree T .

This problem will find an application obtaining certain grid models of VPT ∩ EPT graphs We will define these classesof graphs next, and the application will be deferred to Section 3. Given a tree T , called host tree, and a set P of paths inT , the vertex (resp. edge) intersection graph of paths in a tree (VPT (resp. EPT)) of P is the graph denoted by VPT(P)(resp. EPT(P)) having P as vertex set and two vertices are adjacent if the corresponding paths have in common atleast one vertex (resp. edge). We say that 〈T,P〉 is a VPT (resp. EPT) model of G. Figure 2(a) shows a host tree andthe family of paths P = {A,B,C,D} in it, as well as the corresponding VPT(P) and EPT(P) graphs in Figures 2(b)and 2(c) respectively.

(a) (b) (c) (d) (e)

Figure 2: (a) Family of paths P = {A,B,C,D}; (b) The corresponding VPT(P) and (c) EPT(P) graphs; (d) A B2-EPGmodel Q and (e) its corresponding EPG graph.

Instead of host trees, the graphs we are interested have a grid G as the underlying structure from which a family of pathsP is taken. A graph G is an edge intersection graph of paths of a grid if there is a collection of paths P in a grid G suchthat each vertex in G corresponds to a member of P and two vertices are adjacent if, and only if, the correspondingpaths have in common at least one edge of the grid. We say that P is an EPG model of G. EPG graphs were firstintroduced by Golumbic, Lipshteyn and Stern in 2009 (c.f. [7]) motivated from circuit layout problems. The sameauthors showed that every graph is an EPG graph. Figure 2(e) illustrates the EPG graph corresponding to the family ofpaths presented in Figure 2(d).

A turn of a path at a grid point is called a bend and the grid point in which a bend occurs is called a bend point. An EPGmodel is a Bk-EPG model if each path has at most k bends. A graph that admits a Bk-EPG model is called Bk-EPG.Therefore, the graph G defined in Figure 2(e) is B2-EPG, as the model shows. However, it is possible to show that thereis a B1-EPG model of G and, thus, G is also B1-EPG. The problem of finding the least k such that a given graph isBk-EPG has been a question of great interest since EPG graphs were introduced. In particular, the B1-EPG graphshave been widely studied. On the other hand, there are fewer results for graphs that are Bk-EPG, for k ≥ 2. It wasproved that the recognition problem for B1-EPG is NP-complete and it was also proved that the recognition problem forB2-EPG is also NP-complete. It is the standing conjecture that determining the least k such that an arbitrary graph isBk-EPG is NP-complete for general k. References to all mentioned results can be found in [7].

In Section 2, we discuss the concept of straight model of trees. It is shown an algorithm that determines one such modelin which the maximum number of bends over all paths of a tree is minimized. In Section 3, we employ our algorithm toobtain straight models of host trees that are used to build EPG models of VPT ∩ EPT graphs. An upper bound on thenumber of bends of EPG models of VPT ∩ EPT graphs is then derived. Concluding remarks are presented in Section 4.

2

Page 3: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

2 Embedding trees in a grid

Let T be a tree such that ∆(T ) ≤ 4. Consider the problem of embedding such a tree in a grid G, such that the verticesmust be placed at grid points and the edges drawn as non-intersecting paths of G with no bends, which we will call astraight model of T , or simply an s-model of T . Figure 1 depicts two possible s-models corresponding to a same tree.Given a path Q = v1, v2, . . . , vk of T , and an s-modelM of T , the number of bends of Q is defined to be the numberof bends of the grid path consisting of the concatenation of the (straight) paths of the grid corresponding to the edges(v1, v2), (v2, v3), . . . , (vk−1, vk) inM. In Figure 1(a), the path o, h, d, c, g, i, j,m has 5 bends, whereas the same pathin Figure 1(b) has only 1 bend.

Among all possible s-models, consider the problem of finding one in which the maximum number of bends of a path ofT , over all of them, is minimum. Note that, since every path of a tree is contained in a leaf-to-leaf path, among the pathsthat bend the most in a given s-model is a leaf-to-leaf path, and therefore those are the only ones to be considered. Moreformally, letM(T ) be the set of all possible s-models of a given tree T and u, v ∈ V (T ) be leaves of T . The numberof bends of the path connecting u and v in an s-modelM∈M(T ) is denoted by bM(u, v). Therefore, bM1(o,m) = 5and bM2

(o,m) = 1. Letb(M) = max{bM(u, v) | u and v are leaves in T}

denote the number of bends of the path that bends the most inM, and

b(T ) = min{b(M) | M ∈M(T )}

the minimum number of bends of an s-model, over all of them. Figure 1(a) depicts an s-modelM1 of a tree T suchthat b(M1) = 5, and therefore b(T ) ≤ 5. Figure 1(b) shows another s-modelM2 of T for which b(M2) = 3 and,therefore, b(T ) ≤ 3. It is possible to show that no s-modelM of T has b(M) = 2 and, thus, b(T ) = 3.

We provide an algorithm that determines b(T ) and finds an s-modelM for which b(M) = b(T ). Before describing thealgorithm, some more terminology will be required.

GivenM ∈ M(T ), let b`M(p, v) denote the maximum number of bends found in a single path having as extremevertices p and a leaf of T , over all paths that contain v ∈ V (T ). That is,

b`M(p, v) = max{bM(p, f) | f is a leaf of T and the path connecting p and f contains v} .

Also, defineb`T (p, v) = min{b`M(p, v) | M ∈M(T )} .

As examples, in Figure 1, b`M2(i, l) = 0 = b`T (i, l), b`M2

(i, j) = 1 = b`T (i, j), b`M2(i, g) = 2 = b`T (i, g). Note that

b`M1(b, c) = 3, whereas b`M2

(b, c) = 2.

Let M ∈ M(T ) and v ∈ V (T ). Let {uiM(v) | 1 ≤ i ≤ d(v)} be N(v) and biM(v) = b`M(v, uiM(v)). Ford(v) < i ≤ 4, define “virtual” neighbors uiM(v) = ∅ for which biM(v) = −1. Assume that the neighbors (both realand virtual) are ordered so that biM(v) ≥ bi+1

M (v) for all 1 ≤ i < 4. As examples, u1M2(i) = g (and b1M2

(i) = 2),u2M2

(i) = j (and b2M2(i) = 1), u3M2

(i) = l (and b3M2(i) = 0), and u4M2

(i) = ∅ (and b4M2(i) = −1). Let

(p, v) ∈ E(T ). Let {uiM(p, v) | 1 ≤ i < d(v)} be N(v) \ {p} and biM(p, v) = b`M(v, uiM(p, v)). For d(v) ≤ i < 4,also define uiM(p, v) = ∅ for which biM(p, v) = −1. Again, assume that the neighbors uiM(p, v) are orderedaccording to their respective values of biM(p, v). As examples, u1M2

(g, i) = j (and b1M2(g, i) = 1), u2M2

(g, i) = l

(and b2M2(g, i) = 0), and u3M2

(g, i) = ∅ (and b3M2(g, i) = −1). Besides, u1M2

(i, g) = c (and b1M2(i, g) = 2), and

u2M2(i, g) = u3M2

(i, g) = ∅ (and b2M2(i, g) = b3M2

(i, g) = −1). The s-model may be omitted from these notationswhen it is unambiguous.

A tree T can be built from a single vertex v0 by a sequence v1, v2, . . . , vn−1 of vertex additions, each new vertexvi adjacent to exactly one vertex pi of T [{v0, v1, . . . , vi−1}] for all 1 ≤ i < n. We will call that T is incre-mentally built by (v0, ∅), (v1, p1), . . . , (vn−1, pn−1). For instance, the tree T of Figure 1 is incrementally built by(g, ∅), (i, g), (l, i), (c, g), (j, i), (k, j), (m, j), (d, c), (b, c), (f, b), (a, b), (e, d), (h, d), (n, h), (o, h).

Let v ∈ V (T ) andM∈M(T ). We say that v is balanced if u1(v) and u2(v) are mutually in the same horizontal orvertical grid line inM (and, therefore, so are u3(v) and u4(v)).

We are ready to present Algorithm 1, which consists of adding iteratively vertices to T and, for each new vertex v,traversing T in post-order taking v as the root. The operation to be carried out in each visited vertex is to balance v if itis not balanced. To illustrate its execution, Figure 3 presents the output of the algorithm having the tree T of Figure 1 asinput. Each s-model corresponds to a partial s-model of the tree, as it is at the end of each iteration. Regarding thetime complexity of the algorithm, it is possible to keep the values of uiM(v) stored for each v ∈ V (T ) and 1 ≤ i ≤ 4,

3

Page 4: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

and update them in constant time right after the balance step, based on which subtrees had their positions exchangedand on the respective values of uiM(w) from the neighbors w ∈ N(v). Since the algorithm performs n− 1 post-ordertraversals in T , the algorithm runs in O(n2) time. The remaining of the section is devoted to the correctness of thealgorithm, that is, to prove that ifM is the s-model produced by Algorithm 1 on input T , then b(M) = b(T ). We alsoprovide some numerical results concerning the number of bends of trees.

Algorithm 1 Determining b(T )

Input: a tree T such that ∆(T ) ≤ 4.Output: an s-modelM of T such that b(M) = b(T ).

Let S = (v0, ∅), (v1, p1), . . . , (vn−1, pn−1) be such that T is incrementally built by S.LetM be an s-model having a single grid point representing v0.for i← 1 to n− 1 do

Add toM the vertex vi attached to the grid point of pi, in any free horizontal or vertical grid line of piBALANCE(M, vi, pi)

procedure BALANCE(M, p, v)for u ∈ N(v) \ {p} do

BALANCE(M, v, u)If v is not balanced, then make it balanced by rearranging inM the drawing of the four subtrees of vrooted at ui(v) (for 1 ≤ i ≤ 4), potentially rotating and rescaling them to fit [balance step]

(a)

i:1−5−−−→(b)

−→(c)

BALANCE(M,j,i)−−−−−−−−−−→(d)

i:7−9−−−→(e)

−→(f)

BALANCE(M,b,c)−−−−−−−−−−→(g)

i:11−13−−−−−→(h)

−→

(i)

BALANCE(M,d,c)−−−−−−−−−−→(j)

BALANCE(M,h,d)−−−−−−−−−−→(k)

Figure 3: Execution of the Algorithm 1 with the tree T given as input and the sequence of vertex additions S =(g, ∅), (i, g), (l, i), (c, g), (j, i), (k, j), (m, j), (d, c), (b, c), (f, b), (a, b), (e, d), (h, d), (n, h), (o, h).

An ordered pair (p, v) is called critical in an s-modelM if

• v = ∅; or• (p, v) ∈ E(T ) and

– b`M(p, v) = b1M(p, v) and (v, u1M(p, v)) is critical; or– b`M(p, v) = b2M(p, v) + 1 and (v, u1M(p, v)), (v, u2M(p, v)) are critical.

In Figure 1(a), (a, ∅), (b, a), (c, b), and (i, j) are examples of critical pairs, while (f, b), (g, i), and (c, g) are not.

Let (p, v) ∈ E(T ) and T (p, v) be the connected component of T − (N(p) \ {v}) that contains p. Intuitively, T (p, v) iswhat remains of T when all neighbors of p, except v, are removed along with the vertices that become disconnectedfrom p.

4

Page 5: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

Lemma 1. Let T be a tree andM∈M(T ). If (p, v) ∈ E(T ) is a critical pair inM, then b`T (p, v) = b`M(p, v).

Proof. Let ui = ui(p, v) and bi = bi(p, v), for all 1 ≤ i ≤ 3. The proof is by induction on n = |V (T (p, v))|. If n = 2,then b`T (p, v) = b`M(p, v) = 0. Assume n > 2 and that the result holds for any such a tree T (p, v) with less than nvertices. As (p, v) ∈ E(T ) is critical, then

• if b`M(p, v) = b1 and (v, u1) is critical, then by induction hypothesis we have that b`T (p, v) ≥ b`T (v, u1) =b`M(v, u1) = b1. On the other hand, b`T (p, v) ≤ b`M(p, v) = b1. Thus, b`T (p, v) = b1 = b`M(p, v).

• if b`M(p, v) = b2 + 1 and (v, u1), (v, u2) are critical, then by induction hypothesis, b`T (v, u1) = b`M(v, u1) =b1 and b`T (v, u2) = b`M(v, u2) = b2. Since b1 ≥ b2 and u1 or u2 will bend with respect to the edge (p, v), thusb`T (p, v) ≥ b2 + 1. On the other hand, b`T (p, v) ≤ b`M(p, v) = b2 + 1. Thus, b`T (p, v) = b2 + 1 = b`M(p, v).

Corollary 1. Let T be a tree andM∈M(T ). If (p, v) is a critical pair inM, then b(T ) ≥ b`M(p, v).

Proof. By Lemma 1, we have that b(T ) ≥ b`T (p, v) = b`M(p, v).

Lemma 2. LetM′ be the s-model after the application of the balance step of Algorithm 1 on s-modelM in a vertex vwhich is not balanced. Then, b(M′) ≤ b(M).

Proof. Let bM(v) denote the maximum number of bends found in leaf-to-leaf paths inM that contain v ∈ V (T ). Letbi = biM(v) and ui = uiM(v) for all 1 ≤ i ≤ 4. Since v is not balanced inM, then u1 and u2 are not aligned inM.Therefore, bM(v) = b1 + b2 + 1. On the other hand, bM′(v) = max{b1 + b2, b1 + b3 + 1} ≤ b1 + b2 + 1 = bM(v).After the balance, only the paths that contain v have their number of bends changed. Thus, b(M′) ≤ b(M).

Lemma 3. LetM′ be the s-model after the call of BALANCE(M, p, v) of Algorithm 1, for some (p, v) ∈ E(T ) andM∈M(T ). If p = u1M(v), then (p, v) is critical inM′.

Proof. LetM′ be the s-model being transformed by the call of the procedure and its recursive calls, until its final statewhen the first procedure call returns. The proof is by induction on n = |V (T (p, v))|. If n = 2, then (p, v) is triviallycritical. Assume n > 2 and that the result holds for any such a tree T (p, v) with less than n vertices. The first part of theprocedure is to call it recursively for each (v, w), where w ∈ N(v) \ {p}. Note that, sinceM′ is equal toM initiallyand p = u1M(v), we have that p = u1M′(v), and therefore b`M′(w, v) ≥ b`M′(v, p) ≥ b`M′(v, w) ≥ b`M′(w,w′) for allw′ ∈ N(w) \ {v}. Thus, v = u1M′(w). Since T (v, w) has less vertices than T (p, v), we have by induction hypothesisthat (v, w) is critical inM′ after the call of BALANCE(M′, v, w). Let ui = uiM′(v) and bi = biM′(v), for all 1 ≤ i ≤ 4right before the balance step. Since b`M(v, p) = b`M′(v, p), while biM′(p, v) ≤ biM(p, v) for all 1 ≤ i ≤ 3, then p = u1.Thus, p is aligned with u1M′(p, v) and thus b`M′(p, v) = max{b1M′(p, v), b2M′(p, v) + 1}. As both (v, u1M′(p, v)) and(v, u2M′(p, v)) are critical, then (p, v) is critical.

Theorem 1. Given a tree T , let M be the s-model produced by the execution of Algorithm 1 on input T . Then,b(M) = b(T ).

Proof. The proof is by induction on the number of vertices n of T . If n = 1, thenM consists of just a vertex v0, andb(M) = b(T ) = 0. Suppose, the theorem holds for any input tree having less than n > 1 vertices. Let T ′ be the treebefore the addition of the last vertex vn−1 andM′ be the s-model of T ′ produced so far. By hypothesis induction,b(M′) = b(T ′). If b(M) = b(M′), then b(M) = b(T ′) ≤ b(T ) and, thus, b(M) = b(T ). If b(M) > b(M′), thenthe number of bends cannot have increased by more than 1 unit, since the addition of vn−1 could have increased themaximum number of bends, but by Lemma 2, the balance step cannot increase it. Thus, b(M) = b(M′) + 1 and allpaths that bend the most (say, k bends) have an extreme vertex on vn−1. Given a path P with k bends, walk throughthe vertices of P from vn−1 to the other extreme vertex of P and let w0, w1, w2, . . . , wk be the vertices such thatw0 = vn−1 and the others are those in which P bends, ordered according to such a walk. Let w′i be the vertex thatimmediately succeeds wi in this walk over P (note that wk must be an internal vertex of P , and thus w′i is well definedfor all 0 ≤ i ≤ k). We claim that, for all 0 ≤ i ≤ k,

5

Page 6: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

(i) (w′i, wi) is critical

(ii) b`M(w′i, wi) = i

and since b`M(w′k, wk) = k and (w′k, wk) is critical by such a claim, we have by Corollary 1 that b(T ) ≥ b`M(w′k, wk) =k. Since b(T ) ≤ b(M) = k, then b(T ) = k = b(M), concluding the proof.

It remains to prove the claim, which is done by induction on i. For i = 0, we have that w′0 = pn−1 and (pn−1, vn−1) isclearly critical; besides, b`M(pn−1, vn−1) = 0, validating the claim. So, assume 0 < i ≤ k and the claim holds for allvalues less than i.

Since wi is a bend of P , d(wi) ≥ 2. Moreover, d(wi) 6= 2 or, otherwise, the balance step of the algorithm on theparameter v = wi would have eliminated such a bend. Therefore, d(wi) ≥ 3. Again, since wi is a bend, and thereare no bends in P between wi and wi−1, we have that b`M(w′i, wi) ≥ b`M(w′i−1, wi−1) + 1. By induction hypothesis,b`M(w′i−1, wi−1) = i− 1 and, thus, b`M(w′i, wi) ≥ i. On the other hand, as P has exactly i bends from wi to w0, thereis no other way to continue the subpath of P from wk to wi up to a leaf inM using more than i bends in order to notcontradict the maximality of P in number of bends. As a consequence, b`M(w′i, wi) ≤ i, proving property (ii) of theclaim.

Letw′′i be the vertex that immediately precedeswi in P . Let z ∈ N(wi)\{w′i, w′′i }. Due to the maximality in the numberof bends of P , for all z′ ∈ N(z) \ {wi}, we have that b`M(z, z′) ≤ b`M(wi, z) ≤ min{b`M(wi, w

′i), b

`M(wi, w

′′i )} ≤

b`M(z, wi) and, thus, wi = u1M(z). Therefore, after the calling of BALANCE(M, wi, z), we have that (wi, z) is criticalby Lemma 3. On the other hand, by induction hypothesis, b`M(w′i−1, wi−1) = i− 1 and (w′i−1, wi−1) is critical. LetP ′ be the directed path from wi to w′i−1. Since P ′ has no bends, and since b`M(wi, w

′′) = i− 1, then b`M(a, b) for all(a, b) ∈ P ′. As (w′i−1, wi−1) is critical, so is b`M(a, b) = i − 1 for all (a, b) ∈ P ′ (in particular, (wi, w

′′)). As both(wi, u

1M′(w

′i, wi)) and (wi, u

2M′(w

′i, wi)) are critical, then (w′i, wi) is critical, proving property (i) of the claim.

Therefore, the correctness of the algorithm holds. Now, we turn our attention to some other properties regarding thenumber of bends of trees.

Consider a graph G = (V,E), V ′ ⊂ V and E′ ⊂ V × V . We denote G[V \ V ′] by G \ V ′ and (V,E ∪ E′) byG ∪E′. Let r ∈ V (T ) such that d(r) = 2, andM∈M(T ) a balanced s-model of T . Let r1 and r2 be the neighborsof r in T . We define T f

0 as the tree with a single vertex and, for all k ≥ 1, T fk is the tree rooted in r such that

b`M(r, r1) = b`M(r, r2) = k − 1 and the number of vertices of T is the least possible. That is,

T fk = argmin

T is a tree{|V (T )| | r ∈ V (T ), N(r) = {r1, r2},M∈M(T ), M is balanced, b`M(r, r1) = b`M(r, r2) = k−1} .

A rooted binary tree T is an ordered tree with root r in which every vertex has at most two children. The height of T isthe number of edges in the longest existing path that has as extreme vertices r and a leaf of T . An interior vertex of Tis a vertex that is not a leaf of T . Consider u, v ∈ V (T ). The distance from u to v is the length of the path connecting uand v in T . The level of a vertex v ∈ V (T ) is the distance from v to r. A full binary tree is a binary tree in which everyinterior vertex has exactly two children and all leaves are at the same (highest) level. We denote by T b

k the full binarytree with height k.

Consider a path P = u, . . . , v in a tree T and let T ′ be a subtree of T . We say that P follows through T ′ if, and only if,either u ∈ V (T ′) or v ∈ V (T ′).

Lemma 4. For all k ≥ 0, T fk∼= T b

k .

Proof. By induction on k. If k = 0, then T f0 is a tree with a single vertex and, thus, T f

0∼= T b

0 . If k = 1, thenb`M(r, r1) = b`M(r, r2) = 0 and, thus, r1 and r2 are leaves of T f

1 . Therefore, T f1∼= T b

1 . Assume that T fk′∼= T b

k′ ,for all 1 ≤ k′ < k. Consider the neighbors of r, r1 and r2, in T f

k . Since T fk has the least number of vertices,

we will show that d(r1) = 3. If d(r1) = 1, then r1 is a leaf of T fk and, thus, b`M(r, r1) = 0. Therefore, k = 1

(contradiction!). If d(r1) = 2, there exists r11 ∈ N(r1) \ {r}, such that b`M(r, r1) = b`M(r, r11) = k − 1. Andthen, there exists T = (T f

k \ {r1}) ∪ {(r, r11)}, which contradicts the minimality of |V (T fk )|. If d(r1) = 4, let

r1i ∈ N(r1) \ {r}, for all 1 ≤ i ≤ 3. Note that the path P with k − 1 bends, having as extreme vertices r andleaves of T f

k and containing r1, must follow through T (r1, r1i), for some i. Without loss of generality, assume thatr11 and r are aligned. If P follows through T (r1, r11), there exists T = T f

k \ (V (T (r1, r12)) ∪ V (T (r1, r13))), which

6

Page 7: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

contradicts the minimality of |V (T fk )|. Else, if P follows through T (r1, r12), there exists T = T f

k − V (T (r1, r13)),which contradicts the minimality of |V (T f

k )| and if P follows through T (r1, r13), there exists T = T fk −V (T (r1, r12)),

which, again, contradicts the minimality of |V (T fk )|. Thus, d(r1) = 3. Let r11, r12 ∈ N(r1) \ {r}, such that

r11 is aligned with r. Note that the path having as extreme vertices r and leaves of T fk , which contains r1 and

has k − 1 bends, must follow through T (r1, r12). Otherwise, there would exist T = T fk − V (T (r1, r12)), such

that b`M(r, r11) = b`M(r, r2) = k − 1, which contradicts the minimality of |V (T fk )|. Thus, b`M(r1, r12) = k − 2.

Notice that b`M(r1, r11) ≥ k − 2. By the minimality of |V (T fk )|, it follows that b`M(r1, r11) = k − 2. Consider

T ′ = T (r, r1) \ {r}. Note that, in T ′, d(r1) = 2 and b`M(r1, r11) = b`M(r1, r12) = k − 2. By the minimality of|V (T ′)|, T ′ ∼= T f

k−1. By induction hypothesis, T ′ ∼= T bk−1. Similarly, let T ′′ = T (r, r2) \ {r}. Then T ′′ ∼= T b

k−1.Thus, T f

k = (V (T ′) ∪ V (T ′′) ∪ {r}, E(T ′) ∪ E(T ′′) ∪ {(r, r1), (r, r2)}). Therefore, T fk∼= T b

k .

Corollary 2. For all k ≥ 0, |V (T fk )| = 2k+1 − 1.

Proof. By Lemma 4, T fk∼= T b

k . Thus, |V (T fk )| = |V (T b

k)| = 2k+1 − 1.

Consider the problem of finding a tree T with k bends such that |V (T )| is minimum. Let Tk be a tree with k bendsdefined in the following way:

• For k = 0, Tk is a tree with a single vertex.• For k ≥ 1, consider the path P = v0, v1, . . . , vk, vk+1 with k bends. Therefore, each vertex vi is a bend of P ,

for all 1 ≤ i ≤ k. We define Tk built from P in the following way: for each vi, add to P a disjoint copy of thetree T f

di, where di = min{i− 1, k − i}, and add the edge (vi, r), where r is the root of T f

di.

See in Figure 4 two examples of Tk’s. We will show that |V (Tk)| is minimum. Note that |V (P )| = k + 2, thus|V (Tk)| = (k + 2) +

∑ki=1 |V (T f

di)|, for k ≥ 1. Note also that, di = dj , for all i and j such that i + j = k + 1.

Therefore, consider the following cases,

(i) if k is even,

|V (Tk)| = (k + 2) + 2 ·k2∑

i=1

|V (T fi−1)|

= (k + 2) + 2 ·k2∑

i=1

(2i − 1)

= 2k+42 − 2 .

(ii) if k is odd,

|V (Tk)| = (k + 2) +∣∣∣V (T f

k−12

)∣∣∣+ 2 ·

k−12∑

i=1

|V (T fi−1)|

= 3 · 2k+12 − 2 .

Thus,

|V (Tk)| =

{2

k+42 − 2, if k is even

3 · 2 k+12 − 2, if k is odd .

Theorem 2. Let T be a tree such that b(T ) = k. Then, |V (T )| ≥ |V (Tk)|.

Proof. Let T be a tree with a balanced s-model M, such that b(T ) = k and P a path with k bends in T . Letv1, v2, . . . , vk be the vertices in which P bends. Since M is balanced, d(vi) ≥ 3 for all 1 ≤ i ≤ k. Note thatb`M(vi, vi−1) = i− 1 and b`M(vi, vi+1) = k− i, for all vi. We claim that for all vi there is wi ∈ N(vi) \ {vi−1, vi+1},such that b`M(vi, wi) ≥ min{i− 1, k − i}. Consider the following cases:

7

Page 8: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

(i) If i− 1 < k − i, then there is a vertex, wi, aligned with vi+1, such that b`M(vi, wi) ≥ i− 1. Otherwise,Mwould not be balanced.

(ii) If k − i < i− 1, then there is a vertex, wi, aligned with vi−1, such that b`M(vi, wi) ≥ k − i. Otherwise,Mwould not be balanced.

(iii) If k− i = i−1, then there must be a vertex, wi, aligned with either vi−1 or vi+1, such that b`M(vi, wi) ≥ k− i.Otherwise,M would not be balanced.

Thus, consider wi ∈ N(vi) \ {vi−1, vi+1} and the path P ′ having as extreme vertices vi and a leaf ` ∈ T (vi, wi),which contains wi and has di bends, where di = min{i− 1, k − i}. Walk through the vertices of P ′ from vi to ` andlet w1 be the vertex in which P ′ bends for the first time with respect to such a walk. Then, d(w1) ≥ 3. Let w′1 be thevertex that immediately precedes w1 in this walk over P ′ and let N(w1) \ {w′1} = {w1j | 1 ≤ j < d(w1)}. Withoutloss of generality, assume that w11 is aligned with w′1. Since w1 is a bend of P ′, such a path does not follow throughT (w1, w11). Without loss of generality, assume that P ′ follows through T (w1, w12). Then, b`M(w1, w12) = di − 1.SinceM is balanced, b`M(w1, w11) ≥ di − 1. Thus, |V (T (vi, wi) \ {vi})| ≥ |V (T (w′1, w1) \ {w′1})| ≥ |V (T f

di)|.

Notice that |V (T )| ≥ |V (P )|+∑k

i=1 |V (T (vi, wi) \ {vi})| and |V (P )| ≥ k + 2. Therefore,

|V (T )| ≥ (k + 2) +

k∑i=1

∣∣∣V (T fdi

)∣∣∣ = |V (Tk)| .

(a) (b)

Figure 4: Trees T4 (left) and T5 (right).

Theorem 3. If T is a tree with n vertices, then b(T ) ≤ 2 · log2(n+ 2)− 4.

Proof. Let T be a tree with n vertices. By Theorem 2, n ≥ |V (Tb(T ))|. Consider the following cases:

(i) If b(T ) is even,

n ≥ 2b(T )+4

2 − 2

b(T ) ≤ 2 · log2(n+ 2)− 4 .

(ii) If b(T ) is odd,

n ≥ 3 · 2b(T )+1

2 − 2

b(T ) ≤ 2 · log2

(n+ 2

3

)− 1 .

Since 2 · log2(n + 2) − 4 = 2 · log2(n+24 ) ≥ 2 · log2(n+2

3√2) = 2 · log2(n+2

3 ) − 1 for all n > 0, then b(T ) ≤2 · log2(n+ 2)− 4.

8

Page 9: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

3 EPG models of VPT ∩ EPT graphs

We provide an upper bound on the number of bends of an EPG model of VPT ∩ EPT graphs. The VPT ∩ EPT graphsare proved to be those that can be represented in host trees with maximum degree at most 3:

Theorem 4 ([8]). Let G be a graph. The following statements are equivalent:

(i) G is both a VPT and an EPT graph.

(ii) G has VPT and EPT models on a tree with maximum degree 3.

In [9], this class is characterized by a family of minimal forbidden induced subgraphs. In [10], the authors showed thatevery Chordal B1-EPG graph is a VPT ∩ EPT graph.

LetG be a V PT ∩EPT graph and 〈T,P〉 a VPT model ofG in which ∆(T ) ≤ 3. Consider V (G) = {v1, v2, . . . , vn},V (T ) = {u1, u2, . . . , um} and P = {Qi | 1 ≤ i ≤ n}. Build an EPG modelR = {Pi | 1 ≤ i ≤ n} of G in a grid Gin the following way.

First, letM be a model of T with the minimum number of bends on the grid G, as described in Section 2. For all edgesei ∈ E(T ) inM, let e′i be their midpoints in grid G. For all ui ∈ V (T ) such that d(ui) = 1, build an auxiliary path,P ′ui

, going from ui to e′, where e is the edge to which ui is incident. For all ui ∈ V (T ) such that d(ui) = 2, let e1and e2 be the edges incident to ui. Build an auxiliary path P ′ui

having e′1 and e′2 as endpoints. For all ui ∈ V (T ) suchthat d(ui) = 3, let e1, e2 and e3 be the edges incident to ui. Note that, at least one of them is vertical and at least one ofthem is horizontal. Without loss of generality, assume e1 is vertical and e2 is horizontal. Build an auxiliary path P ′ui

having e′1 and e′2 as endpoints. For all Qi ∈ P , let ui be an endpoint of Qi. Initialize Pi to be coincident to Qi. Next,consider the following cases:

- if d(ui) = 2, enlarge Pi by stretching its endpoint so that it coincides with the endpoint of P ′uithat does not

belong to Pi yet.

- If d(ui) = 3 and Pi ∩ P ′ui= {ui}, enlarge Pi by stretching its endpoint so that it coincides with the endpoint

of P ′uiwhich does not impose a new bend in Pi.

- If d(ui) = 3 and Pi ∩ P ′ui6= {ui}, it implies that ui is an endpoint of Pi and Pi already contains one of the

endpoints of P ′ui. In that case, enlarge Pi by stretching its endpoint so that it coincides with the other endpoint

of P ′ui.

Remove the paths P ′uifor all 1 ≤ i ≤ m. We will call such a construction a VPT-EPG transformation. An important

property is that it yields a Bk-EPG model of G with k ≤ b(T ). Indeed, note that if a path Qi with ui as an extremevertex has b(T ) bends, then d(ui) ≤ 2. Therefore, either Pi = Qi or Pi is Qi with their extreme vertices stretchedwithout any new bends. Thus, Pi has b(T ) bends and, therefore,R has a maximum of b(T ) bends in any of its paths.Figure 5(b) presents an EPG model R = {Pi | 1 ≤ i ≤ 10} derived for the family P = {Qi | 1 ≤ i ≤ 10} ofFigure 5(a).

(a) (b)

Figure 5: Construction of a Bk-EPG model with k ≤ b(T ).

It is possible to show that, for some examples, the upper bound is tight. However, it may be arbitrarily far from theactual value, as we show next. Consider in Tk the path P = v0, v1, . . . , vk, vk+1 with k bends. Therefore, v1, . . . , vkare the vertices in which P bends. Let wi ∈ N(vi) \ {vi−1, vi+1}. Let Pi = {P` = vi, . . . , ` | ` is a leaf of T (vi, wi)}.Consider the family of paths Pk =

⋃ki=1 Pi ∪ P and the VPT graph, G, having 〈Tk,Pk〉 as a model. Note that by

applying a VPT-EPG transformation in 〈Tk,Pk〉, the resulting model has k bends, since it contains P . On the otherhand, notice thatG[Pi] is a clique and P is such that the vertex representing it inG is universal. Thus, since it is possible

9

Page 10: Fabiano S. Oliveira arXiv:2109.02733v1 [math.CO] 6 Sep 2021

A PREPRINT - SEPTEMBER 8, 2021

to build an interval model of G, where (0, k) is the interval representing P and each element of Pi is represented by theinterval (i− 1, i− ε), for some ε ∈ <, with 0 < ε < 1, G is B0-EPG. See in Figure 6 an example of such a constructionhaving T4 as host tree.

(a) (b)

Figure 6: The VPT model P4 (left) and its respective interval model (right).

4 Conclusion

In this paper, we presented an algorithm to embed a tree T with ∆(T ) ≤ 4 in a rectangular grid, such that the maximumnumber of bends over all paths of T is minimized. We also described how to construct s-models with k bends, havingthe least number of vertices possible for any k ≥ 0. Moreover, the s-models produced by our algorithm were employedto construct EPG models of VPT ∩ EPT graphs providing an upper bound on the number of bends of such graphs. Weremark that there are some examples showing that the upper bound is tight.

References

[1] Alok Aggarwal, Maria Klawe, David Lichtentein, Nathan Linial, and Avi Wigderson. Multi-layer grid embeddings.In 26th Annual Symposium on Foundations of Computer Science (sfcs 1985), pages 186–196. IEEE, 1985.

[2] Alok Aggarwal, Maria Klawe, and Peter Shor. Multilayer grid embeddings for vlsi. Algorithmica, 6(1-6):129–151,1991.

[3] Moritz Beck and Sabine Storandt. Puzzling grid embeddings. In 2020 Proceedings of the Twenty-Second Workshopon Algorithm Engineering and Experiments (ALENEX), pages 94–105. SIAM, 2020.

[4] Yanpei Liu, Aurora Morgana, and Bruno Simeone. A linear algorithm for 2-bend embeddings of planar graphs inthe two-dimensional grid. Discrete Applied Mathematics, 81(1-3):69–91, 1998.

[5] Walter Schnyder. Embedding planar graphs on the grid. In Proceedings of the first annual ACM-SIAM symposiumon Discrete algorithms, pages 138–148, 1990.

[6] Roberto Tamassia and Ioannis G Tollis. Planar grid embedding in linear time. IEEE Transactions on circuits andsystems, 36(9):1230–1234, 1989.

[7] Fan Chung, Ron Graham, Frederick Hoffman, Ronald C Mullin, Leslie Hogben, and Douglas B West. 50 Years ofCombinatorics, Graph Theory, and Computing. CRC Press, 2019.

[8] Martin Charles Golumbic and Robert E Jamison. Edge and vertex intersection of paths in a tree. DiscreteMathematics, 55(2):151–159, 1985.

[9] Liliana Alcón, Marisa Gutierrez, and María Pía Mazzoleni. Characterizing paths graphs on bounded degree treesby minimal forbidden induced subgraphs. Discrete Mathematics, 338(1):103–110, 2015.

[10] Liliana Alcón, María Pía Mazzoleni, and Tanilson Dias dos Santos. On B1-EPG and EPT graphs. arXiv preprint2007.02755, 2020.

10