Electronic Notes in Discrete Mathematics 31 (2008) 207–211 www.elsevier.com/locate/endm
Untangling polygons and graphs Josef Cibulka
1
Department of Applied Mathematics and Institute for Theoretical Computer Science Charles University Malostransk´e n´ am. 25, 118 00 Prague, Czech Republic
Abstract Untangling is a process in which some vertices of a plane graph are moved to obtain a straight-line plane drawing. The aim is to move as few vertices as possible. We present an algorithm that untangles the cycle graph Cn while keeping at least Ω(n2/3 ) vertices fixed. For any graph G, we also present an upper bound for the number of fixed vertices in the worst case. The bound is a function of the number of vertices, maximum degree and diameter of G. One of its consequences is the upper bound O((n log n)2/3 ) for all 3-vertex-connected planar graphs.
1
Introduction
Given any planar graph and prescribed positions of its vertices in the plane, it is possible to draw the graph so that edges are pairwise non-crossing curves. According to F´ary’s theorem [3], every planar graph can also be drawn in the plane so that edges are non-crossing straight line segments. However, to obtain a straight-line plane drawing, we may need to move some of the vertices; this process is called untangling. It is natural to ask at most how many vertices 1
Email:
[email protected]
1571-0653/$ – see front matter © 2008 Elsevier B.V. All rights reserved. doi:10.1016/j.endm.2008.06.041
208
J. Cibulka / Electronic Notes in Discrete Mathematics 31 (2008) 207–211
can keep their positions, if we want to obtain a straight-line drawing. A vertex that keeps its position, is called fixed, otherwise it is called free. In the following, a drawing of a graph will always mean a straight-line drawing in R2 , which is completely defined by the positions of the vertices. A drawing is plane if no two edges cross. Let G be a graph and let δ be a mapping of vertices of G to points in the plane. We define fix(G, δ) = fix(G) =
max
β plane drawing of G
min
{|v ∈ V (G) : β(v) = δ(v)|},
δ mapping of V (G) to R2
{fix(G, δ)}.
At the 5th Czech-Slovak Symposium on Combinatorics in Prague in 1998, Mamoru Watanabe asked whether every polygon can be turned into a noncrossing polygon by moving at most εn its vertices for some constant ε > 0. This is equivalent to asking whether fix(Cn ) ≥ (1 − ε)n for the cycle graph Cn√ . Pach and Tardos [4] answered this question in the negative by showing Ω( n) ≤ fix(Cn ) ≤ O((n log n)2/3 ). We almost close the gap for cycle graphs 2/3 by designing an algorithm that always keeps atleast Ω(n ) vertices fixed. It is known, that f ix(G) ≥ Ω( Δ(G) + diam(G)) [6] and f ix(G) ≥ Ω(n1/4 ) [5], where Δ(G) is the maximum degree and diam(G) is the diameter of the planar graph G on n vertices. In section 3, we present a general upper bound for fix(G) of a planar graph G. The bound is a function of n, diam(G) and Δ(G). As one of its consequences, any 3-vertex-connected planar graph G satisfies fix(G) ≤ O((n log n)2/3 ).
2
Algorithm for untangling cycles
Let Cn be the graph with vertices v1 , v2 , . . . , vn and edges (v1 , v2 ), (v2 , v3 ), . . . , (vn , v1 ). Theorem 2.1 fix(Cn ) ≥ 2−5/3 n2/3 − O(n1/3 ) = Ω(n2/3 ) Proof. Let l = (m/16)1/3 and s = 2l, where m is the largest integer such that m ≤ n − 4 and (m/16)1/3 is an integer, thus m ≥ n − O(n2/3 ). For the given vertex positions, we fix a horizontal direction so that no two vertices lie on any horizontal or vertical line. Vertices vm+1 , vm+2 . . . vn will be free and will make bends between the last and the first fixed vertex. We will divide some of the remaining vertices to 2l layers, each with s2 vertices. The first layer will consist of the highest s2 ver-
J. Cibulka / Electronic Notes in Discrete Mathematics 31 (2008) 207–211
209
tices. Using the Erd˝os-Szekeres lemma [2], we select among them a sequence of exactly s vertices with indices either increasing or decreasing from left to right. There will be two types of layers - an increasing layer, if the selected vertices have increasing indices and a decreasing layer otherwise. After we select them, we free all the vertices that are below this layer and are at graph distance at most 2(l − 1) from some of the selected vertices. In general, each layer will consist of the highest s2 vertices that are not free and lie below all previous layers. After we select a monotone sequence of length at least s, we free every vertex that is below this layer and whose index differs by at most 2(l − i − 1) from index of some of the selected vertices. Here i is the number of previously created layers of the same type. Without loss of generality, we have l increasing layers, each having s vertices whose indices increase from left to right. These ls vertices are our fixed vertices; call them u1 = vi1 , u2 = vi2 . . . uls = vils , where i1 < i2 < . . . < ils . We assign new positions to the free vertices in the order in which they occur along the path from u1 to uls . If ui and ui+1 lie in the same layer, we connect them by a straight line segment and place on it the free vertices between ui and ui+1 . Otherwise, we have at least 2d + 2 free vertices between ui and ui+1 , where d is the number of increasing layers between layers of ui and ui+1 . We will view the part of path between ui and ui+1 as a line formed by straight line segments and 2d + 2 bends. All the segments will be either horizontal or vertical, except for the first one, which goes from ui almost vertically and slightly to the right to avoid crossing with the last segment of the path between ui−1 and ui . Each vertical segment passes through one layer so that all segments already placed in this layer are to the left of it and all fixed vertices uj in this layer, such that j > i, are to the right. The horizontal segments are placed between layers to connect pairs of vertical segments. At the end, we will connect uls and u1 by a line with 4 bends. See Figure 1. We just need to count that we have enough vertices for all layers. Each of 2l layers consists of s2 vertices and each of the s fixed vertices in the ith increasing or in the ith decreasing layer freed at most 4(l − i) other vertices. The number of considered vertices is l (4(l − i)) + 4 = 8l3 + 4sl(l − 1)) + 4 ≤ 16l3 + 4 ≤ n. 2ls + 2s 2
i=1
The number of fixed vertices is 5
2
5
2
1
ls = 2l2 = 2− 3 m 3 ≥ 2− 3 n 3 − O(n 3 ).
2
210
J. Cibulka / Electronic Notes in Discrete Mathematics 31 (2008) 207–211
u4 u3
u7 u10
u1
u6
u9
u5 u2 u8
Fig. 1. Joining the increasing sequences
3
Upper bounds
Theorem 3.1 Let T be any tree on n vertices. Let Δ be the maximum degree of T and let diam be the diameter of T . Then √ 1 √ √ 1 fix(T ) ≤ 300 n log2 (n) Δ + min n 6 (log2 n)− 3 , diam . Corollary 3.2 (i) For every planar graph G with maximum degree Δ and diameter diam, √ 1 √ √ 1 fix(G) ≤ 300 n log2 (n) Δ + min n 6 (log2 n)− 3 , 2diam . (ii) There is a constant c, such that for every 3-vertex-connected planar G, 2
fix(G) ≤ c(n log2 (n)) 3 . (iii) There is a constant c, such that for every constant ε, every planar G on n vertices with fix(G) ≥ εn has a vertex with degree at least nε2 Δ≥c . (log2 n)2 (iv) There is a constant c, such that for every constant b and every planar G on n vertices with both maximum degree and diameter at most b log2 (n) √ 3 fix(G) ≤ c bn(log2 n) 2 . Proof. All claims are based on the easy observation, that adding edges to G never increases fix(G) and thus if T is a spanning tree of G, then fix(G) ≤ fix(T ). Part iii is then straightforward and part ii follows from a theorem
J. Cibulka / Electronic Notes in Discrete Mathematics 31 (2008) 207–211
211
of Barnette [1] which says, that every planar 3-vertex-connected graph has a spanning tree with maximum degree three. To prove parts i and iv, we will show that any graph G has a spanning tree T with diameter at most 2diam(G). Fix any vertex v of G and run a breadth-first search from it. All vertices lie at distance at most diam(G) from v and thus the depth of the tree is at most diam(G). 2
References [1] Barnette, D., Trees in polyhedral graphs., Canad. J. Math. 18 (1966), pp. 731– 736. [2] Erd˝ os, P. and G. Szekeres, A combinatorial problem in geometry., Compos. Math. 2 (1935), pp. 463–470. [3] F´ ary, I., On straight line representation of planar graphs., Acta Univ. Szeged., Acta Sci. Math. 11 (1948), pp. 229–233. [4] Pach, J. and G. Tardos, Untangling a polygon., Discrete Comput. Geom. 28 (2002), pp. 585–592. [5] Prosenjit Bose and Vida Dujmovi´c and Ferran Hurtado and Stefan Langerman and Pat Morin and David R. Wood, A polynomial bound for untangling geometric planar graphs (2007), available at http://arxiv.org/abs/0710.1641. URL http://arxiv.org/abs/0710.1641 [6] Spillner, A. and A. Wolff, Untangling a planar graph, in: Viliam Geffert and Juhani Karhum¨ aki and Alberto Bertoni and Bart Preneel and Pavol N´ avrat and M´ aria Bielikov´ a, editor, Proc. 34th Internat. Conf. on Current Trends in Theory and Practice of Computer Science (SOFSEM’08), 2008, pp. 473–484.