• No results found

Drawing Planar Graphs with Few Geometric Primitives

N/A
N/A
Protected

Academic year: 2022

Share "Drawing Planar Graphs with Few Geometric Primitives"

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

Drawing Planar Graphs with Few Geometric Primitives

Gregor H¨ ultenschmidt

1

Philipp Kindermann

1

Wouter Meulemans

2

Andr´ e Schulz

1

1LG Theoretische Informatik, FernUniversit¨at in Hagen, Germany

2TU Eindhoven, The Netherlands

Abstract

We define the visual complexity of a plane graph drawing to be the number of basic geometric objects needed to represent all its edges. In particular, one object may represent multiple edges (e.g., one needs only one line segment to draw a path with an arbitrary number of edges).

Let n denote the number of vertices of a graph. We show that trees can be drawn with 3n/4 straight-line segments on a polynomial grid, and with n/2 straight-line segments on a quasi-polynomial grid. Further, we present an algorithm for drawing planar 3-trees with (8n−17)/3 segments on an O(n) × O(n2) grid. This algorithm can also be used with a small modification to draw maximal outerplanar graphs with 3n/2 edges on an O(n) × O(n2) grid. We also study the problem of drawing maximal planar graphs with circular arcs and provide an algorithm to draw such graphs using only (5n − 11)/3 arcs. This is significantly smaller than the lower bound of 2n for line segments for a nontrivial graph class.

Submitted:

October 2017

Reviewed:

April 2018

Revised:

July 2018

Accepted:

July 2018

Final:

July 2018 Published:

August 2018 Article type:

Regular paper

Communicated by:

A. Symvonis

A preliminary version of this work appeared in: Proc. 43rd Int. Workshop Graph-Theor.

Concepts Comput. Sci. (WG’17) [14]. The work of P. Kindermann and A. Schulz was supported by DFG grant SCHU 2458/4-1. The work of W. Meulemans was supported by Marie Sk lodowska-Curie Action MSCA-H2020-IF-2014 656741.

E-mail addresses: [email protected] (Gregor ultenschmidt) [email protected] (Philipp Kindermann) [email protected] (Wouter Meulemans) [email protected] (Andr´e Schulz)

(2)

1 Introduction

The complexity of a graph drawing can be assessed in a variety of ways: area, crossing number, bends, angular resolution, etc. All these measures have their justification, but in general it is impossible to optimize all of them in a single drawing. More recently, the visual complexity was suggested as another quality measure for drawings [24]. The visual complexity denotes the number of simple geometric entities used in the drawing.

Typically, we consider as entities either straight-line segments or circular arcs. To distinguish these two types of drawings, we call the former segment drawings and the latter arc drawings. The idea is that we can use, for example, a single segment to draw a path of collinear edges. The hope is that a drawing that consists of only a few geometric entities is easy to perceive. A recent user study [17] suggests that visual complexity may positively influence aesthetics, depending on the background of the observer, as long as it does not introduce unnecessarily sharp corners. It is natural to ask for a drawing of a graph with the smallest visual complexity. Unfortunately, it is an NP-hard problem to determine the smallest number of segments necessary in a segment drawing [12].

However, we can still expect to find algorithms, which guarantee bounds for certain graph classes.

Related work. For a number of graph classes, upper and lower bounds are known for segment drawings and arc drawings; the upper bounds are summa- rized in Table 1. However, these bounds (except for cubic 3-connected graphs) do not require the drawings to be on the grid. In his thesis, Mondal [20] gives an algorithm for triangulations with n vertices using 8n/3−O(1) segments on a grid of size 2O(n log n) in general and of size 2O(n) for triangulations of bounded de- gree. Even with this large grid, the algorithm uses substantially more segments than the best-known algorithm for triangulations without the grid requirement

Table 1: Upper bounds on the visual complexity. Here, n is the number of ver- tices, ϑ the number of odd-degree vertices and e the number of edges. Constant additions or subtractions have been omitted.

Class Segments Arcs

trees ϑ/2 [10] ϑ/2 [10]

maximal outerplanar n [10] n [10]

3-trees 2n [10] 11e/18 [24]

3-connected planar 5n/2 [10] 2e/3 [24]

cubic 3-connected planar n/2 [15, 21] n/2 [15, 21]

triangulation 7n/3 [11] 5n/3 Thm. 5

4-connected triangulation 9n/4 [11] 3n/2 Thm. 6

4-connected planar 9n/4 [11] 9n/2 − e Thm. 8

planar 16n/3 − e [11] 14n/3 − e Thm. 7

(3)

by Durocher and Mondal [11], which uses 7n/3 − O(1) segments.

There are three trivial lower bounds for the number of segments required to draw any graph G = (V, E) with n vertices and e edges:

(i) ϑ/2, where ϑ is the number of odd-degree vertices, (ii) maxv∈Vddeg(v)/2e, and

(iii) de/(n − 1)e.

For triangulations and general planar graphs, a lower bound of 2n − 2 and 5n/2 − 4, respectively, is known [10]. Note that the trivial lower bounds are the same as for the slope number of graphs [26], that is, the minimum number of slopes required to draw all edges, and that the number of slopes of a drawing is upper bounded by the number of segments. Chaplick et al. [4, 5] consider a similar problem where all edges are to be covered by few lines (or planes); the difference to our problem is that collinear segments are counted only once in their model. In the same fashion, Kryven et al. [18] aim to cover all edges by few circles (or spheres).

Contributions. In this work, we present two types of results. In the first part (Sections 2, 3 and 4), we present algorithms for segment drawings on the grid with low visual complexity. This direction of research was posed as an open problem by Dujmovi´c et al. [10], but only a few results exist; see Table 2.

We present an algorithm that draws trees on an O(n2) × O(n1.58) grid using 3n/4 straight-line segments. For comparison, the drawings of Schulz [24] need also 3n/4 arcs on a smaller O(n) × O(n1.58) grid, but use the more complex circular arcs instead. Our segment drawing algorithm for trees can be modified to generate drawings with an optimal number of ϑ/2 segments on a quasi- polynomial grid. We also present algorithms to compute segment drawings of planar 3-trees and maximal outerplanar graphs, both on an O(n) × O(n2) grid. In the case of planar 3-trees, the algorithm needs at most (8n − 17)/3 segments, and in the case of maximum outerplanar graphs the algorithm needs at most 3n/2 segments.

Finally, in sections 5 and 6, we study arc drawings of triangulations and gen- eral planar graphs. In particular, we prove that (5n − 11)/3 arcs are sufficient to draw any triangulation with n vertices. We highlight that this bound is sig- nificantly smaller than the 2n − 2 lower bound known for segment drawings [10]

and the so far best-known 2e/3 = 2n upper bound for circular arc drawings [24].

A straightforward extension shows that (14n − 3e − 29)/3 arcs are sufficient for general planar graphs with e edges.

Preliminaries. Given a triangulated planar graph G = (V, E) on n vertices, a canonical order σ = (v1, . . . , vn) is an ordering of the vertices in V such that, for 3 ≤ k ≤ n, (i) the subgraph Gk of G induced by v1, . . . , vk is biconnected, (ii) the outer face of Gk consists of the edge (v2, v1) and a path Ck, called contour, that contains vk, and (iii) the neighbors of vk in Gk−1 form a sub- path of Ck−1 [8, 9]. A canonical order can be constructed in reverse order by repeatedly removing a vertex without an incident chord from the outer face.

Most of our algorithms make ample use of Schnyder realizers [23]. Assume we selected a face as the outer face with vertices v1, v2 and vn. We decompose

(4)

Table 2: Same as in Table 1 but for grid drawings.

Class Type Compl. Grid Ref.

trees arcs 3n/4 O(n) × O(n1.58) [24]

trees segments 3n/4 O(n2) × O(n1.58) Thm. 1

trees segments ϑ/2 quasi-polynom. Thm. 2

cubic planar 3-conn. segments n/2 O(n) × O(n) [15, 21]

maximal outerplanar segments 3n/2 O(n) × O(n2) Thm. 4 triangulation segments 8n/3 O((3.63n)4n/3) [20]

planar 3-tree segments 8n/3 O(n) × O(n2) Thm. 3

the interior edges into three trees: T1, T2, and Tn rooted at v1, v2, and vn, re- spectively. The edges of the trees are oriented to their roots. For k ∈ {1, 2, n}, we call each edge in Tk a k-edge and the parent of a vertex in Tk its k-parent.

In the figures of this paper, we will draw 1-edges red, 2-edges blue, and n-edges green. The decomposition is a Schnyder realizer if at every interior vertex the edges are cyclically ordered as: outgoing 1-edge, incoming n-edges, outgoing 2-edge, incoming 1-edges, outgoing n-edge, incoming 2-edges. The trees of a Schnyder realizer are also called canonical ordering trees, as each describes a canonical order on the vertices of G by a (counter-)clockwise pre-order traver- sal [7]. There is a unique minimal realizer such that any interior cycle in the union of the three trees is oriented clockwise [3]; this realizer can be computed in linear time [3, 23]. The number of such cycles is denoted by ∆0and is upper bounded by b(n − 1)/2c [27]. Bonichon et al. [1] prove that the total number of leaves in a minimal realizer is at most 2n − 5 − ∆0.

2 Trees with segments on the grid

Let T = (V, E) be an undirected tree. Our algorithm follows the basic idea of the circular arc drawing algorithm by Schulz [24]. We make use of the heavy path decomposition [25] of trees, which is defined as follows. First, root the tree at some vertex r and direct all edges away from the root. Then, for each non- leaf u, compute the size of each subtree rooted in one of its children. Let v be the child of u with the largest subtree (one of them in case of a tie). Then, (u, v) is called a heavy edge and all other outgoing edges of u are called light edges.

The maximal connected components of heavy edges form the heavy paths of the decomposition.

We call the vertex of a heavy path closest to the root its top node and the subtree rooted in the top node a heavy path subtree. We define the depth of a heavy path (subtree) as follows. We treat each leaf that is not incident to a heavy edge as a heavy path of depth 0. The depth of each other heavy path P is by 1 larger than the maximum depth of all heavy paths that are connected from P by an outgoing light edge. Heavy path subtrees of common depth are disjoint.

(5)

1

1

1 2

3

0 0 0 0 0 0 0

0 0 0

(a) A heavy path decom- position and the depths.

ui

`i ri

ti

bi

hi

wi

Bi

(b) The heavy path box Biwith top node ui.

`i ri

ti

bi

hi

wi B2i

B2i−1

Bi

(c) The merged box Bi for B2i−1and B2i. Figure 1: The heavy-path boxes and merged boxes with their respective lengths.

Boxes. We order the heavy paths nondecreasingly by their depth and then draw their subtrees in this order. Each heavy path subtree is placed completely inside an L-shaped box (heavy path box ) with its top node placed at the reflex angle; see Fig. 1b for an illustration of a heavy path box Bi with top node ui, width wi= `i+ ri, and height hi= ti+ bi. We require that

(i) heavy-path boxes of common depth are disjoint, (ii) ui is the only vertex on the boundary of Bi, and (iii) bi ≥ ti.

Note that the boxes will be mirrored horizontally and/or vertically in some steps of the algorithm. We assign to each heavy path subtree of depth 0 a heavy path box Bi with `i= ri = ti= bi= 1.

Drawing. Since a heavy path subtree of depth 0 consists of exactly one vertex that is placed in a box as described above, we have already drawn all heavy path subtrees of depth 0. We will inductively draw the heavy path subtrees by their depth. Assume that we have already drawn each heavy path subtree of depth d ≥ 0. In the (d + 1)-th step of our algorithm, we will draw all heavy path subtrees of depth d + 1. Let hv1, . . . , vmi be a heavy path of depth d + 1. We proceed as follows; see Fig. 2a for an illustration. The last vertex on a heavy path has to be a leaf, so vmis a leaf.

If the outdegree of vm−1 is odd, then we place the vertices v1, . . . , vm on a vertical line; otherwise, we place only the vertices v1, . . . , vm−1on a vertical line and treat vmas a heavy path subtree of depth 0 that is connected to vm−1.

For 1 ≤ h ≤ m − 1, all heavy-path boxes adjacent to vhwill be drawn either in a rectangle on the left side of the edge (vh, vh+1) or in a rectangle on the right side of the edge (vh−1, vh) (a rectangle that has v1 as its bottom left corner for h = 1).

We now describe how to place the heavy-path boxes B1, . . . , Bk with top node u1, . . . , uk, respectively, adjacent to some vertex v on a heavy path into the rectangles described above; see Fig. 2b for an illustration.

First, assume that k is even. Then, for 1 ≤ i ≤ k/2, we order the boxes such that b2i ≤ b2i−1. We place the box B2i−1 in the lower left rectangle and box B2iin the upper right rectangle in such a way that the edges (v, u2i−1) and

(6)

B v1

v2

vm−1

vm

Rl2

Rr2

(a)

v w1

w1 t1

bk 2−1

wk

u1 2

u2

u2i −1

u2i

uk−1

uk

B1

Bi Bk 2

Bi Bk

2

B1

(b)

Figure 2: (a) Placement of a heavy path, its box B, and areas for the adjacent heavy path boxes. (b) Placement of the heavy-path boxes adjacent to v.

(v, u2i) can be drawn with a single segment. To this end, we construct a merged box Bi as depicted in Fig. 1c with `i = max{`2i−1, `2i}, ri = max{r2i−1, r2i}, and wi = `i + ri; the heights are defined analogously. The merged boxes will help us reduce the number of segments.

We mirror all merged boxes horizontally and place them in the lower left rectangle (of width Pk/2

i=1wi) as follows. We place B1 in the top left corner of the rectangle. For 2 ≤ j ≤ k/2, we place Bj directly to the right of Bj−1 such that its top border lies exactly tj−1 rows below the top border of Bj−1 . Symmetrically, we place the merged boxes (vertically mirrored) in the upper right rectangle.

Finally, we place each box B2i−1 (horizontally mirrored) in the lower left copy of Bi such that their inner concave angles coincide, and we place each box B2i (vertically mirrored) in the upper right copy of Bi such that their inner concave angles coincide.

If k is odd, then we simply add a dummy box Bk+1 = Bk that we remove afterwards.

The box of the heavy path subtree hv1, . . . , vmi is the smallest box that contains v1, . . . , vmas well as the rectangles next to these vertices (see Fig 2a).

We proceed the same way for every other heavy path subtree of depth d + 1;

thus, we have obtained a drawing and its box for every heavy path subtree of depth d + 1.

Analysis. We will now calculate the width and the height of this construction.

Lemma 1 Any heavy path subtree of depth d that contains n0 vertices is drawn in a heavy-path box B with width w = ` + r ≤ 2d+1· n0 and height h = b + t ≤ 2 · (3/2)d· n0 and b ≥ t, where `, r, b, t are defined as in Fig. 1b.

Proof: We prove the lemma by induction over d.

Recall that we place the depth-0 heavy paths in a box of width 2 = 21· 1 and height 2 = 2 · (3/2)0· 1, so the bounds hold for d = 0. Assume that the bound holds for all heavy path subtrees of depth d ≥ 0.

(7)

Let hv1, . . . , vmi be a heavy path of depth d + 1. Consider the drawing of the heavy path subtree rooted in v1as described above. Let Rljbe the left rectangle and let Rjr be the right rectangle that contain all heavy-path boxes adjacent to vjfor 1 ≤ j ≤ m − 1; see Fig. 2a. We denote by wjl and hlj the width and the height of Rlj, respectively, and by wrj and hrj the width and the height of Rrj, respectively. Since vmis a leaf, we have wlm= wrm= hlm= hrm= 1.

We will first analyze the width and height of these rectangles for a fixed vertex vj, 1 ≤ j ≤ m − 1. Let uj1, . . . , ujk

j be the children of vj and denote the number of nodes in the heavy path subtrees rooted in them by nj1, . . . , njk

j. Let n0j =Pkj

i=1nji; note thatPm

j=1n0j = n0− m. By induction, we have wji ≤ 2d+1· nji for 1 ≤ i ≤ kj and hji = bji + tji ≤ 2 · (3/2)d· nji.

For the width of the rectangles, we obtain

wlj= wrj≤ 1 +

kj/2

X

i=1

wj∗i = 1 +

kj/2

X

i=1

max{wj2i−1, w2ij} ≤ 1 +

kj

X

i=1

wij

≤ 1 +

kj

X

i=1

(2d+1· nji) = 1 + 2d+1

kj

X

i=1

nji

≤ 2d+1 1 + n0j .

The height of each rectangle in the construction is at least 2Pkj/2

i=1 tj∗i , but we have to add a bit more for the bottom parts of the boxes; in the worst case, this is max1≤λ≤kj/2bj2λ−1 in Rlj and max1≤µ≤kj/2b in Rrj. Since our constructions ensures that bji ≥ tji , we have

hlj+ hrj ≤ 1 + 2

kj/2

X

i=1

tj∗i + max

1≤λ≤kj/2bj2λ−1+ max

1≤µ≤kj/2bj

≤ 1 + 2

kj

X

i=1

tji +

kj

X

i=1

bji ≤ 1 + x3 2

kj

X

i=1

hji

≤ 1 +3 2

kj

X

i=1

2 · 3 2

d

· nji

!

= 1 + 2 · 3 2

d+1 kj X

i=1

nji

≤ 2 · 3 2

d+1

n0j+ 1 .

We will now analyze the width and height of the heavy path box of the heavy path subtree rooted in v1. For the width, we have w = ` + r with

(8)

` ≤ max1≤j≤mwjl and r ≤ max1≤j≤mwjr= `. Hence, we obtain

w = 2` = 2 max

1≤j≤mwlj≤ 2

m

X

j=1

wlj

≤ 2 + 2

m−1

X

j=1

2d+1 n0j+ 1 = 2 + 2d+2

m−1

X

j=1

n0j+ 1

= 2 + 2d+2· (n0− 1) ≤ 2d+2· n0.

For the height of the heavy path box, notice that the vertical distance be- tween two vertices vj−1 and vj, 2 ≤ j ≤ m, is at most maxhlj−1, hrj , while the vertical space below between vmis at most hlm= 1. Hence, we have

h = t + b ≤ hr1+

m

X

j=2

max{hlj−1, hrj} + hlm

m

X

j=1

hlj+ hrj = 2 +

m−1

X

j=1

hlj+ hrj

≤ 2 +

m−1

X

j=1

2 · 3 2

d+1

n0j+ 1

!

= 2 + 2 · 3 2

d+1

(n0− 1)

≤ 2 · 3 2

d+1

n0.

Since all heavy path trees of common depth are disjoint, the heavy-path boxes of common depth are as well. Further, we place only the top vertex of a heavy path on the boundary of its box. Finally, since we order the boxes such that bj2i−1 ≥ bj2i for each i and j, we have hlj≥ hrj for each j and thus b ≥ t.  Due to the properties of a heavy path decomposition, the maximum depth of any heavy path is dlog ne. Thus, by Lemma 1, the whole tree is drawn in a box of width 2·2dlog nen = O(n2) and height 2·(3/2)dlog nen = O(n1+log 3/2) ⊆ O(n1.58).

By using the same heavy path decomposition as the algorithm of Schulz [24]

(that is, we choose the same heavy edge in case of a tie), we have that our algorithm draws a path in T with one segment if and only if the algorithm of Schulz draws this path with one circular arc. Hence, following his analysis, our drawing uses at most d3e/4e = d3(n − 1)/4e segments.

Theorem 1 Every tree admits a straight-line drawing that uses at most d3e/4e segments on an O(n2) × O(n1.58) grid. This drawing can be computed in O(n) time.

Proof: The existence of the drawing is already argued above; what remains is to prove the time bound. By traversing the tree bottom-up, we can calculate

(9)

B

B0

Figure 3: Further improvement on the visual complexity via increasing the size of the boxes.

the heavy path decomposition in O(n) time. Then, we sort the heavy paths by their depth in O(n) time using, e.g., counting sort since the depth is integer and bound by O(log n).

When drawing a heavy path of level d, we only have to place the adjacent heavy-path boxes of level d − 1 around the vertices of the heavy path, which gives us their coordinates and the corresponding heavy path box. The number of these placement steps is equal to the number of light edges in the graph,

which is O(n). 

We finish this section with an adjustment of our algorithm to get a grid drawing with the best possible number of straight-line segments. Observe that there is only one situation in which the previous algorithm uses more segments than necessary, that is the top node of each heavy path. The heavy path is always drawn vertically, while the incoming light edge of the top node will be drawn with a different slope; aligning the two slopes would reduce the number of segments. This suboptimality can be “repaired” by tilting the heavy path as sketched in Fig. 3. Note that the incident subtrees with smaller depth will only be translated. However, when drawing a heavy path box, we do not know yet with which slope the incoming light edge will be drawn.

Our adjustment works as follows. We first draw each heavy path vertically and then change its slope when placing the corresponding heavy path box into a rectangle next to the parent of its top node. Assume that we have already drawn each heavy path subtree of depth d such that their heavy path is drawn vertically. Let v be some vertex on a heavy path of depth d+1 and let B1, . . . , Bk be the heavy-path boxes with top node u1, . . . , uk, respectively, adjacent to v.

Note that the tilting of a heavy path only increases the right and the bottom length of its heavy-path box; in particular, if Bi is a heavy path box with width wi = `i+ ri and height hi = ti+ bi and B0i is the tilted heavy path box with width w0i= `0i+ r0i and height h0i = t0i+ b0i, then we have `0i = `i, r0i > ri, t0i = ti, and b0i > bi. The y-coordinate of the vertices u1, . . . , uk after the placement depends only of the values t1. . . , tk, so they will stay the same after the tilting procedure. Hence, we can determine the y-coordinates by running the previous drawing algorithm and then place the boxes in reverse order (“inside- out” instead of top-down). Then, the x-coordinate of each vertex ui depends only on the width of the already placed boxes ui+1, . . . , uk and of ri = r0i, so

(10)

(a) The drawing produced by our al- gorithm.

(b) Heuristic improvement on the drawing area.

Figure 4: Drawings of a tree with 50 vertices with minimum number of segments.

we know exactly by which slope we have to tilt the box Bi. Finally, to tilt the box Bi, we change the vector of each edge e on its heavy path to be an integer multiple of the vector of the edge from v to ui such that the vertical length of e is not decreased. This keeps the rectangles that contain the adjacent lower-level heavy-path boxes disjoint.

Unfortunately, this procedure increases the area of the drawing. By tilting the heavy-path boxes, we have to blow up their size. We are left with scaling in each “round” by a polynomial factor. Since there are only log n rounds, we obtain a drawing on a quasi-polynomial grid. However, an implementation of the algorithm shows that some simple heuristics can already substantially reduce the drawing area, which gives hope that drawings on a polynomial grid exist for all trees; see Fig. 4.

Theorem 2 Every tree admits a straight-line drawing with the smallest num- ber of straight-line segments on a quasi-polynomial grid. This drawing can be computed in O(n) time.

Proof: The existence of the drawing is argued above. The time bound is the same as in Theorem 1 as the only new step is tilting the heavy-path boxes, which changes the slope of each heavy edge at most once. 

3 Planar 3-trees with few segments on the grid

In this section, we show how to construct drawings of planar 3-trees with few segments on the grid. We begin by introducing some notation. A 3-tree is a maximal graph of treewidth k, that is, no edges can be added without increasing the treewidth. Each planar 3-tree can be produced from the complete graph K4

by repeatedly adding a vertex into a triangular face and connecting it to all three vertices incident to this face. This operation is also known as stacking.

Any planar 3-tree admits exactly one Schnyder realizer, and it is cycle-free [3],

(11)

that is, directing all edges according to T1, T2, and Tn gives a directed acyclic graph.

Let T be a planar 3-tree. Let T1, T2, and Tn rooted at v1, v2, and vn, respectively, be the canonical ordering trees of the unique Schnyder realizer of T . Recall that each canonical ordering tree describes a canonical order on the vertices of T by a (counter-)clockwise pre-order traversal [7]. Without loss of generality, let T1be the canonical ordering tree having the fewest leaves, and let σ = (v1, v2, . . . , vn) be the canonical order induced by a clockwise pre-order walk of T2; see Fig. 5. The fact that we choose the canonical order induced by T2 instead of T1 may seem counter-intuitive, but we will require a specific property of the canonical order that is ensured only by this choice later. The following lemma holds for any vk, 4 ≤ k ≤ n.

Lemma 2 Let Ck−1 = (w1, . . . , wr) be the contour of Gk−1, let wp be the 1- parent of vk, and let wq be the 2-parent of vk. Then,

(a) either (wq, wp) ∈ T1 or (wp, wq) ∈ T2

(b) the subgraph inside the triangle (wp, wq, vk) is a planar 3-tree

(c) if q > p + 1, then wp+1, . . . , wq−1 lie inside the triangle (wp, wq, vk), (wp+1, wp) ∈ T1, and (wq−1, wq) ∈ T2.

Proof: Proof for (a): For q = p + 1 the statement holds trivially. So we assume that there exists a vertex woon Ck between wpand wq. Let X = {vn} and Y = {wo}. Obviously, the contour Ck is an X-Y -separator; see Fig. 6.

Let Z be a minimal X-Y -separator that contains only vertices from Ck. By the properties of the Schnyder realizer, each incoming n-edge of a vertex on Ck

v1

v10

v2

(a)

4 8

3 5 6

7

2 1

9

(b)

v1

v10

v2

v5

v9

v4

v6

v7

v8

v3

(c)

Figure 5: Obtaining a canonical order from a clockwise pre-order traversal of a canonical ordering tree. (a) The canonical ordering trees of a planar 3-tree;

(b) the clockwise pre-order traversal on T2; (c) the canonical order induced by this traversal.

(12)

vk

vn

wp wq

wo

v2

v1

Figure 6: Proof that the edge (wp, wq) exists.

comes from a vertex below the contour. Hence, there is a path from each vertex on Ck to vn in Tn that does not revisit Ck. Further, the paths (wo, vk), (wo, wo−1, . . . , wp), and (wo, wo+1, . . . , wq) connect woto each of vk, wpand wq

without traversing any other vertex from Ck. Hence, Z has to contain vk, wp, and wq; otherwise, a vn–wo-path would remain after deleting Z. Rose [22]

has shown that every minimal X-Y -separator in a k-tree is a k-clique; thus, Z has to be the 3-cycle (wp, wq, vk). The edge (wp, wq) cannot be an n-edge, since otherwise we would have a cycle in Tn. So either (wq, wp) ∈ T1or (wp, wq) ∈ T2. Proof for (b): Mondal et al. [21] have shown that this is true for every triangle in a planar 3-tree.

Proof for (c): The vertices have to lie inside the triangle (wp, wq, vk) since otherwise their outgoing n-edge to vk would cross the edge (wp, wq). Fur- ther, since the subgraph inside (wp, wq, vk) is again a planar 3-tree, wp, wq, and vk are the roots of the corresponding Schnyder realizer; (wp+1, wp) ∈ T1

and (wq−1, wq) ∈ T2 follows immediately. 

Given some drawing Γ and two points a and b (that are not necessarily a part of Γ), we say that a sees b if and only if the straight-line segment between a and b is interior-disjoint from Γ. If two points p and q have the same x-coordinate and p lies above q, then we define slope(p, q) = −∞ and slope(q, p) = +∞. The following lemma was proven by Durocher and Mondal [11]; see Fig. 7 for an illustration.

Lemma 3 ([11]) Let a1, . . . , am be a strictly x-monotone polygonal chain C.

Let p be a point above C such that the segments a1p and amp do not in- tersect C except at a1 and am. If the positive slopes of the edges of C are smaller than slope(a1, p), and the negative slopes of the edges of C are greater

than slope(p, am), then every ai sees p. 

Note that the first condition trivially holds if all slopes of C are non-positive and that the second condition trivially holds if all slopes of C are non-negative.

We will further need the following lemma which relies on Lemma 3.

Lemma 4 Let a1, . . . , ambe a strictly x-monotone polygonal chain C. Let p be a point below C that is connected to a1, . . . , am such that slope(a1, p) ≥ 0 and slope(ai, ai+1) > slope(a1, p) for i = 1, . . . , m − 1. Then the resulting drawing Γ

(13)

p

a1

am

Figure 7: Illustrations of Lemma 3.

am

a1 p

(a) Γ

am

a1

p H

(b) Γ0 Figure 8: Illustrations of Lemma 4.

is planar. Furthermore, assume that p sees a1 and am. If we move p to a point on the ray emanating from p with slope slope(a1, p), then the resulting drawing Γ0 preserves the embedding of Γ .

Proof: We first prove that Γ is planar. To this end, we first mirror Γ at the x- axis to obtain a drawing Γ. Then a1, . . . , amis a strictly x-monotone polygonal chain C without positive slopes and p is a point above C such that all (negative) slope of C are smaller than slope(a1, p). Then by Lemma 3 Γand, hence, Γ is planar.

Now we prove that Γ0 preserves the embedding of Γ. To change the em- bedding, at least one triangle (ai, ai+1, p) has to change its orientation, that is, p moves across the supporting line of some (ai, ai+1). Recall that for all 1 ≤ i < m we have slope(ai, ai+1) > slope(a1, p) = slope(a1, p0) (see Fig. 8).

Since we increase the distance from a1 when moving from p to p0 (and due to the slopes), we also increase the distance to (ai, ai+1). Thus, both p and p0 lie in the same halfplane defined by the supporting line of (ai, ai+1). This proves

the lemma. 

Overview and notation. The main idea of the algorithm is as follows. We inductively place the vertices according to the canonical order σ = (v1, . . . , vn) and refer to the step in which vertex vk is placed as step k. By the choice of

(14)

vi

par1(i)

vj= par2(i) lca(i, j)

out2(i) out1(i)

dom(i, j) in(i)

Figure 9: Definitions for the drawing algorithm for planar 3-trees.

the canonical ordering, when we place vertex vk, its parent v`in T1has already been placed. If vk is the first child of v` in T1, then we place vk such that the edge (v`, vk) has the same slope as the edge from v`to its parent in T1, so that both edges are drawn with one segment. This way, we obtain a drawing of G in which the edges of T1 are drawn with exactly one segment for every leaf of T1.

In order to be able to do this placement, we have to maintain a series of invariants which rely on additional notation; see Fig. 9. For each vertex vi, the 1-out-slope out1(i) is the slope of its outgoing 1-edge, the 2-out-slope out2(i) is the slope of its outgoing 2-edge, and the in-slope in(i) is the highest slope of the incoming 1-edges in the current drawing. Further, we denote by par1(i) the 1- parent of viand by par2(i) the 2-parent of vi. For two vertices vi, vj, we denote by lca(i, j) the lowest common ancestor of vi and vj in T1. For an edge (vi, vj) we call the closed region bounded by (vi, vj), the path (vi, . . . , lca(i, j)), and the path (vj, . . . , lca(i, j)) the domain dom(i, j) of (vi, vj). For each step k, we denote by λk the number of leafs in the currently drawn subtree of T1, by sk

the number of segments that are used to draw the current subtree of T1, and by ηk the highest slope of the 1-edges in the current drawing. We denote by Ck the part of the contour Ck between vk and v2.

Before describing the invariants and the algorithm in detail, we first show the following property of Ck.

Lemma 5 The edges on Ck are exactly the path from vk to v2 in T2, and par2(k) ∈ Ck−1 .

Proof: We proof the lemma by induction. For k = 3, we have that Ck = (v3, v2) with par2(3) = v2, so the lemma holds. For k > 3, recall that we chose the canonical order induced by T2 in clockwise pre-order. Hence, either vk−1

is the parent of vk in T2, or they have a common ancestor v` with ` < k − 1 in T2. In the former case, par2(k) = vk−1 ∈ Ck−1 and Ck = vk ◦ Ck−1 , so the lemma holds by induction. In the latter case, we in fact have par2(k) = v`. By induction, Ck−1 = (vk−1, . . . , v`, . . . , v2), so par2(k) ∈ Ck−1 and Ck =

(vk, v`, . . . , v2). 

(15)

v1 v2

vk

vl

vr

(a) Case (i)

v1 v2

vk

vl

vr

(b) Case (ii)

v1 v2

vk

vl

vr

(c) Case (iii) Figure 10: Inserting vertex vk while maintaining invariant (I5).

Invariants. After each step k ≥ 3, we maintain the following invariants.

(I1) The contour Ck is a strictly x-monotone polygonal chain; the x-coordinates along Ckincrease by exactly 1 per vertex.

(I2) The 1-edges are drawn with sk= λk segments in total with integer slopes between 1 and ηk≤ λk.

(I3) For each (vi, vj) ∈ Ck and for each 1-edge e 6= (par1(j), vj) in dom(i, j) it holds that slope(e) > out1(j).

(I4) For each vi∈ Ck, out1(i) > out2(i).

(I5) The current drawing is crossing-free and for each (vi, vj) ∈ Tn, we have slope(vi, vj) > out1(j).

(I6) Vertex v1is placed at coordinate (0, 0), v2is placed at coordinate (k−1, 0), and every vertex lies inside the rectangle (0, 0) × (k − 1, (k − 1)λk).

The algorithm. The algorithm starts with placing v1 at (0, 0), v2 at (2, 0), and v3 at (1, 1). Obviously, all invariants (I1)–(I6) hold. In step k > 3, the algorithm proceeds in two steps. Recall that vk is a neighbor of all vertices on the contour between vl= par1(k) and vr= par2(k).

Step 1: Insertion. In the insertion step, vkis placed with the same x-coordinate as vr. We distinguish between three cases to obtain the y-coordinate of vk; see Fig. 10 for an illustration.

(i) If no incoming 1-edge of vl has been drawn yet, then we draw the edge (vl, vk) with slope out1(l).

(ii) If vlalready has an incoming 1-edge and vl and vrare the only neighbors of vk in the current drawing, then we draw the edge (vl, vk) with slope in(l) + 1.

(iii) Otherwise, we draw the edge (vl, vk) with slope ηk−1+ 1.

Note that this does not maintain invariant (I1).

Step 2: Shifting. In the shifting step, the vertices between vr and v2 on the contour Ck have to be shifted to the right without increasing the number of segments sk used to draw T1. To this end, we iteratively extend the outgoing 1-edge of these vertices, starting with vr, to increase their x-coordinates all by 1;

(16)

see Fig. 11. This procedure places the vertices on the grid since the slopes of the extended edges are all integer by invariant (I2).

In the following, we will show that every planar 3-tree admits a straight- line drawing that uses at most (8n − 17)/3 segments on an O(n) × O(n2) grid, and that this drawing can be computed in O(n2) time. We have to show that, after each step k > 3, all invariants (I1)–(I6) hold. We denote by x(v) the x-coordinate of the vertex v, and similarly, by y(v) the y-coordinate of v.

Invariant (I1). The contour in step k is Ck = (v1, . . . , vl, vk, vr, . . . , v2). By induction, (v1, . . . , vl, vr, . . . , v2) is strictly x-monotone. We place vk above vr

and move all vertices from vrto v2 to the right by one unit, so x(vl) < x(vk) = x(vr) − 1 and Ck is strictly x-monotone. By Lemma 5, vr lies on Ck−1 , so the x-coordinates along (vr, . . . , v2) increase by 1 per vertex; since x(vr) = x(vk), the same holds for Ck.

Invariant (I2). In case (i) of the insertion step, vl changes from a leaf to a non-leaf, while vk is added as a leaf. Since (vl, vk) is drawn with the same slope as the outgoing 1-edge of vl, we have sk = sk−1= λk−1= λk ≥ ηk. In cases (ii) and (iii) of the insertion step, vl was not a leaf before and a new integer slope is used to draw (vl, vk), so we have sk = sk−1+ 1 = λk−1+ 1 = λk; since the maximum slope increases by at most one, we have ηk ≤ ηk−1+ 1 ≤ λk. For the shift step, as the vertices on Ck have no incoming 1-edges, and the slopes of their outgoing 1-edges do not change, the number of segments remains the same.

Invariant (I3). We have to only address the insertion step, since the shifting step does not affect the relevant slopes. Since the slopes of the 1-edges do not change, and since the edges on (vr, . . . , v2) lie on Ck−1 by Lemma 5, the invariant holds for edges on (vr, . . . , v2) by induction; hence, it suffices to show the invariant for (vk, vr). By Lemma 2(a), the edge (vl, vr) exists in T1 or T2. We distinguish between two cases.

Case 1: (vr, vl) ∈ T1; see Fig. 12a. It immediately follows that lca(k, r) = vl = par1(k). Hence, the domain dom(k, r) is bounded by the

v2

vk

vr

v2

vk

vr

v2

vk

vr

v2

vk

vr

Figure 11: Shifting vr, . . . , v2 along their outgoing 1-edge.

(17)

vk

vr

vl

(a) Case (vr, vl) ∈ T1

vk= t0

vr

ts

vl= t1

t2

(b) Case (vl, vr) ∈ T2

Figure 12: The domain dom(k, r) as in invariant (I3).

triangle (vl, vr, vk), which is a planar 3-tree by Lemma 2(b) with vl as the root of T1. By construction, the edge (vr, vl) has the smallest slope of all incoming 1-edges of vl within the domain. In particular, by construction, the first incoming 1-edge of each vertex is assigned the same slope as the outgoing 1-edge, while all other incoming 1-edges are assigned higher slopes. Thus, all 1-edges in the domain must have higher slopes than (vr, vl).

Case 2: (vl, vr) ∈ T2; see Fig. 12b. Consider the unique path from vk to v1

in T1. Denote the vertices on this path by t0, t1, t2, . . . , tq with t0= vk, t1= vl, and tq = v1. By Lemma 2, t1 = vl is connected to vr and (t1, vr) ∈ T1 or (t1, vr) ∈ T2. If (t1, vr) ∈ T2, then consider the drawing of Gl after step l of the algorithm. In this step, t1 = vl was placed, vr is its 2-parent, and t2 is its 1-parent. Hence, by Lemma 2, t2 is connected to vr and (t2, vr) ∈ T1 or (t2, vr) ∈ T2. It follows by induction that, as long as (ti, vr) ∈ T2, then (ti+1, vr) exists.

Let ts be the first vertex on the path t0, t1, . . . , tq such that (ts, vr) exists but is not a 2-edge. Since tq = v1 but v1 has no 2-parent, this vertex exists;

since (t0 = vk, vr), (t1= vl, vr) ∈ T2, we have s > 1. By choice of ts, we have that (ts−1, ts) ∈ T1and (ts−1, vr) ∈ T2; hence, by Lemma 2(a), the edge (vr, ts) exists and since (ts, vr) 6∈ T2 it has to be a 1-edge. Hence, we have par1(r) = ts= lca(k, r). The domain dom(k, r) is bounded by the edges (vk, vr), (vr, ts), and the path (t0:= vk, t1, . . . , ts). By Lemma 2(b), the domain can be divided into s planar 3-trees (ti, vr, ti−1), 1 ≤ i ≤ s. For the triangle (ts, vr, ts−1), the argument from Case 1 can be directly applied; for i < s, we can use the same argument to show that no 1-edge has a higher slope than (ti, ti+1), which proves the invariant.

Invariant (I4). Let vi ∈ Ck. First, consider the case that vi = vk; see Fig. 13a. In the insertion step, vk is placed at the same x-coordinate as vr. In the shifting step, vris moved to the right by one column and upwards by out1(r) rows; hence, we have y(vr) < y(vk) + out1(r). Since dom(k, r) contains vl = par1(k), it follows from invariant (I3) that out2(k) = y(vr) − y(vk) < out1(r) <

out1(k).

Now, consider the case that v26= vi6= vk; see Fig. 13b. Let vj= par2(i). By Lemma 5, (vi, vj) ∈ Ck−1 , so we had out1(i) > out2(i) before the shifting step of

(18)

vk

vr

par1(k)

par1(r)

(a) i = k and vr= par2(k)

vi

vj

par1(i) par1(j)

(b) i 6= k and vj= par2(i) Figure 13: Shifting par2(i) while maintaining invariant (I4).

the algorithm. In the shifting step, out1(i) does not change. However, viand vj are shifted to the right by one column and upwards by out1(i) rows and out1(j) rows, respectively; hence, out2(i) increases by out1(j) − out1(i). Since dom(i, j) contains vl= par1(i), it follows from invariant (I3) that out1(j) < out1(i). This implies that out2(i) becomes smaller by the shifting step, so out1(i) > out2(i) is maintained.

Invariant (I5). First, consider the drawing after the insertion step, but be- fore the shifting step. By induction, the drawing was crossing-free before this step. Since no existing edge is modified, each crossing has to involve an edge of vk. We will use Lemma 3 to show that vk sees all its neighbors. By in- variant (I1), the neighbors of vk lie on a strictly x-monotone polygonal chain.

Because of slope(vk, vr) = −∞, it suffices to show that the edges between vl and vr on the contour have smaller slope than slope(vl, vk).

Consider case (i) of the insertion step: vlhas no incoming 1-edge; see Fig. 10a.

Then, (vl, vr) ∈ Ck−1; otherwise, we get a contradiction from Lemma 2(c).

Hence, vl and vr are the only neighbors of vk and we have to show only that slope(vk, vl) > slope(vl, vr). By construction and invariant (I4), we have slope(vk, vl) = out1(l) > out2(l) = slope(vl, vr).

Consider case (ii) of the insertion step: vl already has an incoming 1-edge and vl and vr are the only neighbors of vk; see Fig. 10b. In particular, that means that (vr, vl) ∈ T1and, by construction, slope(vk, vl) = in(l) + 1 > in(l) ≥ slope(vr, vl).

Consider case (iii) of the insertion step: vl already has an incoming 1- edge and (vl, vr) /∈ Ck−1; see Fig. 10c. In this case, (vk, vl) is drawn with slope(vk, vl) = ηk−1+ 1, so every 1-edge on the contour between vl and vr has lower slope than (vk, vl). By invariant (I2) and (I4), the 2-edges on the contour between vland vr also cannot have higher slope than ηk−1.

Hence, we can use Lemma 3 in each case of the insertion step to show that the drawing remains planar. The second part of the invariant, for each (vi, vj) ∈ Tn, slope(vi, vj) > out1(j), holds for each vertex but vk by induction. Since the edges of vk are planar and vk is placed vertically above vr = par2(k), all edges (vi, vk) ∈ Tn have positive slope with x(vi) > x(vl), so slope(vi, vk) >

out1(k).

Now, consider the drawing after the shifting step. We shift the vertices between vrand v2one by one on the contour Ckand show that, after each step, the invariant holds. Let vt be the vertex next to shift, let vs be its predecessor

(19)

am= vs

vt

a1=par1(t)

(a) Maintaining the invariant in dom(s, t)

vt

a1=par1(t)

am= vu

(b) Maintaining the invariant in dom(t, u)

Figure 14: Shifting vertex vtwhile maintaining invariant (I5).

and let vu= par2(t) be its successor on the contour. Since either vs= vk or vs

has been shifted in the previous step, the edge (vs, vt) is drawn vertically and the edge (vt, vu) has slope out2(t). Since (vt, par1(t)) lies on the boundary of both domains dom(s, t) and dom(t, u), the union of these domains contains all edges incident to vtand all n-edges of vtlie in dom(t, u). We will now show that both domains remain planar and for all (vi, vt) ∈ Tn, slope(vi, vt) > out1(t).

Consider the domain dom(s, t); see Fig. 14a. By the Schnyder realizer prop- erties, all edges incident to vt (except (vt, par1(t))) are 2-edges. Let par1(t) = a1, . . . , am= vsbe the path through the neighbors of vt. All edges on this path are 1-edges or n-edges (otherwise T2 would not be a tree). By invariant (I3), all 1-edges on this path have slope higher than out1(t). By induction and by invariant (I3), for each n-edge (ai−1, ai) on this path, we have slope(ai−1, ai) >

out1(i) > out1(t). As out1(t) > 0, the path a1, . . . , am is an x-monotone chain without negative slopes. Hence, we can apply Lemma 4 to prove that the new position of vtpreserves the embedding, so the drawing remains planar.

Now, consider the domain dom(t, u); see Fig. 14b. By the Schnyder re- alizer properties, all edges incident to vt (except (vt, par2(t))) are n-edges.

Let par1(t) = a1, . . . , am= vube the path through the neighbors of vt. All edges on this path are 1-edges or 2-edges (otherwise Tnwould not be a tree). If m = 2, then there is no n-edge in dom(t, u). By invariant (I3), we have out1(t) >

slope(a1, a2) = out1(u) and we can move vtin direction−−−−−−→

par1(t)vtwithout chang- ing the embedding. If m > 2, we look back on step t of the algorithm. Observe that a1, . . . , am were the neighbors of vt on the contour Ct−1. Since case (i) and (ii) imply m = 2, vthad to be inserted with case (iii). By construction, the edge (par1(t), vt) was inserted with a higher slope than all 1-edges and, by invari- ant (I3), also all 2-edges on the contour. Further, as a1, . . . , am−1were removed from the contour and the algorithm only changes the drawing of edges incident to a vertex on the contour, the edges (ai, ai+1) for 1 ≤ i ≤ m − 2 were not changed afterward. Thus, we still have out1(t) > slope(ai, ai+1), 1 ≤ i ≤ m − 2.

Additionally, by invariant (I3), also out1(t) > slope(am−1, am) holds, so by

(20)

Lemma 3 we can place vt above vu with slope out1(t) without crossings (since we obtain slope(vt, vu) = −∞). The movement of vt to the right and the pla- narity maintain that slope(ai, vt) > out1(t), 2 ≤ i ≤ m − 1. This establishes invariant (I5).

Invariant (I6). Since v1 is never moved, it remains at (0, 0). Vertex v2 is moved k −3 times to the right by one column, so it is located at ((k −3)+2, 0) = (k − 1, 0). As vk is not placed to the right of v2 and no vertex is moved to the right by more than one column, the maximum x-coordinate of all vertices is k−1.

The contour consists of only 1-edges and 2-edges; by invariants (I4) and (I2), their maximum slope is λk. Hence, the maximum y-coordinate of all vertices is at most (k − 1)λk.

This proves the correctness of all invariants. We will now analyze the number of segments used by the algorithm. By Invariant (I2), the 1-edges are drawn with sn = λn slopes, where λn is equals to the number of leaves in T1. Recall that the number of leaves in the Schnyder realizer is at most 2n − 5 [1] and that we chose T1 as the canonical ordering tree with the fewest leaves, so we have λn ≤ (2n − 5)/3. The trees T2 and Tn contain n − 1 vertices, so they are both drawn with at most n − 2 segments. Hence, the total number of segments is at most (2n − 5)/3 + (n − 2) + (n − 2) = (8n − 17)/3.

It remains to show the running time of the algorithm. Both the Schnyder realizer and the canonical order can be computed in linear time [23, 9]. The insertion step can be handled in constant time by storing at each vertex the highest slope of its incoming 1-edges (if it exists) and updating the value ηk at each step. In the shifting step, we have to move all vertices on the contour between the placed vertex and v2 by stretching their outgoing 1-edges. Since there are at most n−2 vertices on this part of the contour and we have n−2 steps, this takes O(n2) time in total. It is not clear whether we can use an approach similar to the one by Chrobak and Payne [6] in order to reduce the running time of the shifting step as the vertices have to be moved in two directions instead of only one and since we have to know the exact coordinates and slopes at every step.

This proves the following theorem, which is the main result of this section.

See Figure 15 for an example.

Theorem 3 Every planar 3-tree admits a straight-line drawing that uses at most (8n − 17)/3 segments on an O(n) × O(n2) grid. This drawing can be computed in O(n2) time.

4 Maximal outerplanar graphs with segments on the grid

A graph is outerplanar if it can be embedded in the plane with all vertices on one face (called outerface), and it is maximal outerplanar if no edge can be added while preserving outerplanarity. This implies that all interior faces of a maximal

References

Related documents

Previously, we cloned a cDNA encoding a Canavalia ensiformis ure- ase isoform named JBURE-II, corresponding to a putative smaller urease protein (78 kDa) when compared to other

It is in realisation of the important role and contributions of urban parks to city development and prosperity that this paper seeks to examine the creation,

Salinity_Flag Integer Salinity quality flag (see QF table) Oxygen Number Dissolved oxygen in umol/kg Oxygen_Flag Integer Dissolved oxygen flag (see QF table) Tritium Number

Parish Council- Anne Schrishuhn [email protected] Education- Mary

“The person identified by 1234 is called Anne and has the job of a Lawyer, earning 100,000 pounds per year” is a meaningful instantiation of it (by substituting the values given by

The first problem, GRacSim drawing, asks for finding a simul- taneous geometric embedding of two planar graphs, sharing a common subgraph, such that only crossings at right angles

Afterwards, in Section 3, we point out consequences for drawings that minimize the slope number: There are planar graphs such that each drawing that minimizes the planar slope

• A ”good“ planar drawing algorithm with good distribution of the nodes. (or arguments that this