Untangling polygons and graphs

Untangling is a process in which some vertices of a planar 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 C_n while keeping at least \Ome…

Authors: Josef Cibulka

Untangling polygons and graphs
Un tangling p olygons and graphs Josef Cibulk a ∗ Dep artment of Applie d Mathematics Charles U niversity Malostr a nsk´ e n´ a m. 25 118 00 Pr ague, Cze ch R epublic cibulka@ kam.mff.cuni.cz Abstract Un tangling is a pr ocess in wh ich some vertic es of a planar graph are mo ve d to obtain a straight- lin e plane dr a wing. The aim is to mo v e as few vertic es as p ossible. W e present an algorithm th a t untangle s the cycle graph C n while kee p i n g at least Ω( n 2 / 3 ) v er tices fi xe d . F or an y graph G , we also present an up p er b ound on the num b er of fi x ed v ertices in the worst case . The b ound is a fun ction of the n u m b er of v ertices, maxim um degree and diameter of G . One of its consequences is the u pp er b ound O (( n log n ) 2 / 3 ) for all 3-v ertex-connected planar graphs. 1 In tro duc tion Giv en an y planar graph whose ev ery ve rtex has a presc r ibed p osition in the plane, it is p ossible to draw the graph so that edges are pa ir wise non- crossing curve s. According to F´ ary’s theorem [4 ], ev ery planar graph can also b e dra wn in the plane so that edges are non-crossing straight line segmen ts. Ho w ever, to obta in a straigh t-line plane draw ing of a gra ph with given v ertex p ositions, we ma y need to mo v e some o f the v ertices; this pro cess is called untangling . It is natural to ask at most ho w many v ertices can k eep their p ositions during untangling. If a v ertex k eeps its p osition, it is called fix e d , otherwise it is called fr e e . In the following, a dr awing of a g raph will alwa ys mean a straigh t- line dra wing in R 2 , whic h is completely determined b y the p ositions of the v er- tices. A dra wing is plane if no t w o edges cross. ∗ Suppo rted by pro ject MSM00216208 38 of the Czech Ministry o f Education. 1 Let G be a graph and let δ b e a mapping of v ertices of G to p oin ts in the plane. W e define fix( G, δ ) = max β plane drawing of G {| v ∈ V ( G ) : β ( v ) = δ ( v ) |} , fix( G ) = min δ mapping of V ( G ) to R 2 { fix( G, δ ) } . A t the 5th Czec h-Slov a k Symp osium on Combinatorics in Prague in 1998, Mamoru W atanab e ask ed whe ther ev ery p o ly g o n on n v ertices can b e turned in to a noncrossing p olygon by moving at most ε n its ve rt ic es for some con- stan t ε > 0. This is equiv alen t to a s king whether fix( C n ) ≥ (1 − ε ) n for the cycle gra ph C n . P ach and T ardos [6] answ ered this question in the negativ e b y sho wing Ω( √ n ) ≤ fix( C n ) ≤ O (( n log n ) 2 / 3 ). W e almost close the gap fo r cycle graphs b y designing an algorithm t hat alwa ys k eeps at least Ω( n 2 / 3 ) v ertices fixed. The follo wing table summarizes the b est kno wn b ounds on min G ∈G , | V ( G ) | = n (fix( G )) for sev eral graph classes G . Graph class G Lo we r b ound Upp er b ound Cycles Ω( n 2 / 3 ) Theorem 1 O (( n log n ) 2 / 3 ) [6] T rees l p n/ 2 m [5] 3 √ n − 3 [2] Outerplanar gra phs p ( n − 1) / 3 [7] 2 √ n − 1 + 1 [7] Planar graphs 4 p n/ 3 [2]  √ n − 2  + 1 [5] It is kno wn, that fix( G ) ≥ Ω( n 1 / 4 ) [2] and fix( G ) ≥ Ω( p ∆( G ) + p diam( G )) [7], where ∆( G ) is the maxim um degree and diam( G ) is the diameter of the g iv en planar graph G on n v ertices. In Section 3, we presen t a general upp er bo und on fix( G ) of a planar graph G . The b ound is a function of the n umber of v ertices, maxim um degree and diameter of G . This general upp er b ound has three interes t ing sp ec ial cases: • F or any 3-v ertex-connected pla na r graph G , fix( G ) ≤ O (( n lo g n ) 2 / 3 ). • The upp er b ound O ( √ n (log n ) 3 / 2 ) for an y pla n a r graph suc h that its maxim um degree and diameter are b oth in O (log n ). This is close t o the lo we st kno wn upp er b ound on fix( G ) for some graph G , which has v alue O ( √ n ), but w as established only for sev eral sp ecial g raphs [2, 5, 7]. • F or any constan t ε , if a g raph G satisfies fix( G ) ≥ εn , then it has a v ertex o f degree at least Ω( nε 2 / log 2 n ). All logarithms in this pap er are base 2 . 2 2 Algorith m for un t a n gling cyc les Let C n b e the graph with v ertices v 1 , v 2 , . . . , v n and edges ( v 1 , v 2 ), ( v 2 , v 3 ), . . . , ( v n , v 1 ). Theorem 1. fix( C n ) ≥ 2 − 5 / 3 n 2 / 3 − O ( n 1 / 3 ) = Ω( n 2 / 3 ) Pr o of. Let m b e the largest in teger suc h that m ≤ n − 4 and ( m/ 16) 1 / 3 is an in teger. Then m ≥ n − O ( n 2 / 3 ). Define l := ( m/ 16) 1 / 3 and s := 2 l . F or the giv en vertex p ositions, w e fix a horizon tal direction so that no t wo v ertices lie on a n y horizon tal or v ertical line. V ertices v m +1 , v m +2 . . . v n will b e free and will mak e b ends on the line b et w een the last and the first fixed v ertex. W e will divide some of the re- maining v ertices to 2 l la yers , eac h with s 2 v ertices. The first lay er consists of the highest s 2 v ertices. Using the Erd˝ os-Szek eres lemma [3], we select among them a sequence of exactly s v ertices with indice s either increasing or decreasing from left to rig ht. There are t w o t yp es of la ye rs — if the selected v ertices hav e increasing indices, the la y er is an incr e asing layer , otherwise it is a de cr e asing layer . After w e select the monotone sequence of v ertices, w e free all t h e remaining ve r t ices of the lay er. W e also free all the v ertices that are below this lay er and are at g raph distance at most 2( l − 1) from some o f the selected vertice s. In general, eac h lay er consists of the highest s 2 v ertices tha t are not free and lie b elo w all previous la ye rs. F rom the la ye r w e select a monotone sequence of length s and free the remaining v ertices of t he lay er. Then w e free ev ery v ertex that lies b elo w this la y er and whose index differs by at most 2( l − i − 1) from index of some of the selec ted v ertices. Here i is the n umber of previously created la yers of the same t yp e. W e need to count that w e hav e enough vertice s for a ll t he lay ers. Eac h of the 2 l lay ers consists of s 2 v ertices and for each of the s selected v ertices in the i th increasing or in the i th decreasing lay er, we fr eed at most 4( l − i ) v ertices lying b elo w the la y er. The num b er of considered vertice s is th us at most 2 l s 2 + 2 s l X i =1 (4( l − i )) = 8 l 3 + 4 sl ( l − 1)) ≤ 16 l 3 = m. Without loss of generality , we hav e l increasing la ye r s, each ha ving s selected vertices whose indices increase from left to righ t. These l s v ertices are our fixed ve rtices; call them u 1 = v i 1 , u 2 = v i 2 . . . u ls = v i ls , where i 1 < i 2 < · · · < i ls . W e assign new p ositions o f the free v ertices u j satisfying i 1 < j < i ls in the order of increasing indices. If u i and u i +1 lie in the same la ye r, we connect them by a straigh t line segmen t and place o n it the f re e 3 v ertices betw een u i and u i +1 . Otherwise, we ha v e at least 2 d + 2 free ve r t ic es b et w een u i and u i +1 , where d is the n um b er of increasing lay ers b et w een lay ers of u i and u i +1 . W e will view the path b et w een u i and u i +1 as a line formed b y straight line segmen ts and 2 d + 2 b ends. All the segmen ts will b e either horizon tal or v ertical, except for the first one, which go es from u i almost v ertically and slightly to t he rig ht to av oid having a common subsegmen t with the last segmen t of the path b et w een u i − 1 and u i . Each v ertical segmen t passes through one la ye r so that all segments already placed in this la y er are to the left o f it a nd all the fixed v ertices u j in this la yer and with j > i , are to the righ t. The horizontal segmen ts are placed b et w een lay ers t o connect pairs of v ertical segmen ts. At the end, we will connect u ls and u 1 b y a line with 4 b ends and place on it all t he remaining free v ertices. See Fig ure 1. u 1 u 2 u 3 u 4 u 5 u 6 u 7 u 8 u 9 u 10 Figure 1: joining the increasing sequence s The num ber of fixed v ertices is ls = 2 l 2 = 2 − 5 3 m 2 3 ≥ 2 − 5 3 n 2 3 − O ( n 1 3 ) . 3 Upp er b oun ds W e will use the following lemma of P ac h and T ardos [6] who used it to sho w the upp er b ound fix( C n ) = O ( ( n log n ) 2 / 3 ). 4 Lemma 2. (Pach and T ar dos 2002 [6]) L et H b b e the gr aph with vertic es u 1 , u 2 , . . . , u t and e dges ( u 1 , u 2 ) , ( u 2 , u 3 ) , . . . , ( u t , u 1 ) . L et H r b e a r andom Hamiltonian cycle o n the same vertex set, that is, its e dges ar e ( u σ (1) , u σ (2) ) , ( u σ (2) , u σ (3) ) , . . . ( u σ ( t ) , u σ (1) ) , wher e σ i s a r andom p ermutation of { 1 , 2 , . . . , t } . Then, for any inte gers s < t and K , the pr ob ability that the cr ossing numb er of H = H b ∪ H r is at mo st K satisfies Pr ob [ cr ( H ) ≤ K ] ≤  t D  2  2 t s  D s t − D ( t − D )! , wher e D := j 35 p t ( K + t ) /s k . The edges of H r and H b are called r e d e dges and black e dges , resp ectiv ely . Theorem 3. L et T b e a tr e e on n ve rt ic es. L et ∆ b e the maximum de gr e e of T and let diam b e the di a meter of T . Then fix( T ) ≤ 300 √ n log n  √ ∆ + min  6 q n/ log 2 n, √ diam  . Pr o of. If n ≤ 90 000, the statemen t is trivially true, so we will assume n > 90000. Let T b e a give n tree on n v ertices. W e will select one of it s ve r t ices to b e the ro ot. Let a DFS- c y cl e be a n o rie nted closed walk that f ollo ws some depth-first searc h (DF S) p erformed o n T starting in the ro ot. A DF S-cy cle con tains eac h orien tation of ev ery edge exactly once. By a dr awing of a DFS cycle w e will mean a drawing (not necess a rily straight-line) of the orien ted cycle g raph whose vertices a nd edges corresp ond to o cc ur r ences o f v ertices and edges on the DFS- cy cle. V ertices of the drawing corresp o nd ing to a v ertex v of T are placed near to the p osition of v . W e fix one DFS-cycle and n um b er the ve r t ic es in the order in whic h they w ere first visited during the depth-fir st search; the vertic es will b e v 1 , v 2 , . . . , v n . Then w e place a ll the v ertices of T in a random order to the vertice s of a conv ex p olygon. This mapping of v ertices to p oin ts will b e δ . There are  n t  p ossible selec t io ns of t fixed v ertices. The fixed ve r t ic es will b e u 1 = v i 1 , . . . u t = v i t , where i 1 < i 2 < · · · < i t . F or eac h suc h selection, let H b b e defined as in Lemma 2 and let H r b e the cycle whose edges are the edges of the con v ex hull of u 1 , u 2 , . . . , u t . In the rest of the pro of we will find a dra wing o f H with small crossing n um b er assuming that T can b e untangled while kee ping u 1 , . . . , u t fixed. W e 5 Figure 2: a tree and a draw ing of one of its DFS- cy cles will then use Lemma 2 to sho w that the probabilit y that this ha pp ens for a t least o ne selection of u 1 , . . . , u t is smaller than one. Th us there will b e an ordering of the v ertices o f G suc h that G cannot b e un tangled while k eeping t v ertices fixed. The cycle H r is dra wn as the con vex h ull of u 1 , u 2 , . . . , u t . Th us there are no crossings of pairs of r e d edges. Let T ′ b e the smallest subtree o f T that contains all the fixed vertice s. W e tak e the DFS-cycle on T ′ that comes from the fixed DFS- cycle on T b y omitting v ertices o utside T ′ . T o obtain a dra wing of H b w e will find a dra wing of the DFS- c ycle on T ′ and then eac h edge ( u i , u i +1 ) o f H b will b e dra wn as the part o f the DF S-cy cle b et w een the first o ccurrences o f u i and u i +1 . W e ta k e the plane draw ing of T in whic h u 1 , . . . , u t k eep their p ositions. F rom this dra wing, w e get a dra wing of the DFS-cycle on T ′ b y expanding ev ery vertex of T ′ as in F ig ure 3: W e start b y expanding the ro ot of the DFS. W e then expand eac h v ertex v i when its only expanded neigh b or is its paren t (that is, it s unique neigh b or on the pat h to the ro ot). Let p i denote the parent of v i ; if v i is the ro ot, then we define p i to b e the second v ertex visited during DFS. W e tak e a p oin t C near to v i on the line joining p i and v i , but out side the segmen t b et w een p i and v i . Let S b e a circle cen t ered at C with ra d ius chose n so that v i lies on S . V ertex v i will b e expanded to sev eral sub-v ertices placed on S . First, w e create tw o sub-vertice s: ˆ v i whic h k eeps the p osition of v i and ¯ v i whic h is placed near to ˆ v i . Sub-v ertices ˆ v i and ¯ v i are ends of the straigh t line segme nts corresp onding to the orien ted edges ( p i , v i ) and ( v i , p i ) of the DFS-cycle, r esp ectiv ely . V ertex ¯ v i is placed so that the segmen ts corresp onding to ( v i , p i ) and ( p i , v i ) do not cross. F or ev ery v j neigh b or of v i differen t from p i , we create sub-v ertices ˆ v j i and ¯ v j i near the in tersection of S a nd the segmen t b et w een C and v j . Sub-v ertices ˆ v j i and ¯ v j i are ends of t he segmen ts corresp onding t o the orien ted edges ( v j , v i ) and ( v i , v j ) of 6 the DFS- cy cle, respectiv ely . Finally , we connect pairs of the newly created sub-v ertices b y segmen ts inside S — if ( v j , v i ) is follow ed by ( v i , v k ) in the DFS-cycle, then w e connect ˆ v j i with ¯ v k i (if v j = p i then w e define ˆ v j i := ˆ v i and similarly if v k = p i then ¯ v k i := ¯ v i ). If v i has degree tw o, then we place the sub-v ertices ˆ v j i and ¯ v j i so that the tw o segmen ts inside S do not cross. Straigh t line segmen ts of the drawing of t he DF S-cy cle will b e called black se gments . Blac k segmen ts inside S will b e called short black se gments , all the other bla ck segmen ts will b e long black se gments . v i ˆ v i v j H r H r ¯ v j i ˆ v l i ˆ v j i ˆ v k i ¯ v i ¯ v l i ¯ v k i C v k v l p i p i v j v k v l S Figure 3: expanding the v ertex v i in a plane dr awing of T ′ An edge ( u i , u i +1 ) of H b is then drawn as the part of the dra wing of the DFS-cycle b et w een ˆ u i and ˆ u i +1 . Sinc e T ′ is t he smallest subtree of T con taining all the fixed vertice s, all the leav es of T ′ are fixed v ertices. After visiting a leaf, a DFS visits another leaf after no more than diam( T ) steps and thus there are at most dia m ( T ) edges b et w een t wo consecutiv e first visits of fixed v ertices in the DF S cycle. Therefore the draw ing of the whole cycle H b is comp osed of at most min { 4 n, 2 t diam ( T ) } blac k segmen ts. Because H r is drawn as a conv ex p olygon, eac h straight line segmen t of H b crosses it in at most t w o p oin ts (after p erturbing ends of the seg- men ts that hav e a common subsegmen t with H r ). There are th us at most min { 8 n, 4 t diam( T ) } crossings of pairs of edges with differen t colors. Since T ′ is dra wn with no crossings, there are no crossings b et we en an y long black segmen t and a nother blac k segmen t. Short blac k segmen ts cross only short blac k segmen t s created by expanding the same vertex of T ′ ; but only if the degree of the v ertex is at least three. Because T ′ has at most t lea v es, there are at most 3 t short blac k segmen ts that cross some other short blac k se g m ent. Eac h vertex of T ′ has degree at most ∆ and th us the n umber of crossings of pa irs of blac k edges is at most 1 . 5 t ∆. 7 Let K := ⌊ 1 . 5 t ∆ + min { 8 n, 2 t · dia m( T ) }⌋ , t :=  300 √ n log n ( √ ∆ + min { 6 q n/ log 2 n, √ diam } )  , s :=  35 2 K + t t log 2 n  . W e can verify that s < t as required. W e also ha ve D = $ 35 r t ( K + t ) s % ≤ t log n . If T can b e untangled while k eeping t v ertices fixed, then for some t - tuple of its n v ertices, the ab o v e-defined graph H has crossing n umber at most K . F or ev ery t - tuple , H b is exactly as required b y Lemma 2 and H r go es through the v ertices of H b in a unifo rmly distributed random order, b ec ause at the b eginning, w e placed the v ertices of T in a uniformly distributed random order. Therefore w e can apply L e mma 2 a nd Prob[fix( T , δ ) ≥ t ] ≤  n t  Prob[ cr ( H ) ≤ K ] ≤  n t  t D  2  2 t s  D s t − D ( t − D )! ≤  en t  t  et D  2 D  2 t s  D es t (1 − 1 log n ) ! t − D ≤  e 2 ns t 2  t  2 et 4 D 2 s 2  D  1 − 1 log n  D − t ≤  e 2 ns t 2  t  2 e 3 t 4 D 2 s 2  t log n ≤  4 e 2 ns t 2  t ≤  8 e 2 36 2 n log 2 n (min { 4 n, t · diam( T ) } + t ∆) t 3  t . W e distinguish tw o cases: 8 (a) If 6 q n/ log 2 n ≥ p diam( T ), t hen t = l 300 √ n log n ( √ ∆ + p diam( T )) m and Prob[fix( T , δ ) ≥ t ] ≤  8 e 2 36 2 n log 2 n (∆ + diam( T )) t 2  t ≤ 8 e 2 36 2 300 2 ∆ + diam( T ) ( √ ∆ + p diam( T )) 2 ! t < 0 . 9 t . (b) If 6 q n/ log 2 n ≤ p diam( T ), then t =  300 √ n log n ( √ ∆ + 6 q n/ log 2 n  and Prob[fix( T , δ ) ≥ t ] ≤  8 e 2 36 2 n log 2 n ( t ∆ + 4 n ) t 3  t ≤    8 e 2 36 2 300 2 t ∆ + 4 n t  √ ∆ + n 1 6 (log n ) − 1 3  2    t ≤ 8 e 2 36 2 300 2 t ∆ + 4 n t ∆ + tn 1 3 (log n ) − 2 3 ! t ≤ 0 . 9 t ∆ + 4 n t ∆ + 3 00 n 2 3 (log n ) 2 3 n 1 3 (log n ) − 2 3 ! t < 0 . 9 t . Using t he probabilistic metho d w e conclude that for some dra wing δ of T it holds that fix( T , δ ) < t . Corollary 4. 1. F or e v ery planar gr aph G with maximum de gr e e ∆ and diameter diam , fix( G ) ≤ 300 √ n log n  √ ∆ + min  6 q n/ log 2 n, √ 2diam  . 2. The r e is a c onstant c s uch that for eve ry 3-ve rtex-c onne cte d planar gr aph G , fix( G ) ≤ c ( n log n ) 2 3 . 9 3. The r e is a c onstant c such that for every c onstant ε , every planar gr aph G on n ve rtic es with fix( G ) ≥ εn has a vertex with de gr e e at le ast ∆ ≥ c nε 2 log 2 n . 4. The r e is a c onstant c such that for every c onstant b , every planar g r aph G on n vertic es with b oth maxim u m de gr e e and diameter at mo s t b log n satisfies fix( G ) ≤ c q bn log 3 n. Pr o of. All claims are based on the simple observ ation, that adding edges to a graph H nev er increases fix( H ) and th us if T is a spanning t r ee of G , then fix( G ) ≤ fix( T ). P art 3 is then straightforw ard and part 2 follow s from a theorem of Barnette [1] whic h says t hat ev ery pla nar 3-ve r t ex-connected graph has a spanning tree with maxim um degree three. T o prov e parts 1 and 4, w e now show that an y graph G has a spanning tree T with diameter at most 2diam( G ). Fix any v ertex v of G and run a breadth-first searc h from it . All v ertices lie at distance at most diam( G ) from v and thu s the diameter o f the breadth-first searc h tree is a t most 2diam( G ). Ac knowledgm ents. I am grateful to Alexander W olff for a careful read- ing of an earlier v ersion of the pa per a nd man y useful suggestions. References [1] David Bar nette. T rees in p olyhedral gra ph s. Canad. J. Math. , 1 8:731– 736, 1966. [2] Prosenjit Bose, Vida Dujmo vi´ c, F erran Hurtado, Stefan Langer- man, P at Morin, and David R. W o o d. A p olynomial b ound fo r un tangling geometric planar graphs, Octob er 2007. Av ailable at h ttp://ar x iv.org/ abs / 0710.1641. [3] P´ al Erd˝ os and George Szek eres. A combinatorial problem in geometry . Comp os. Math. , 2:463 –470, 1 935. [4] Istv an F´ ary . On straigh t line represen tation of planar graphs. A cta Univ. Sze ge d., A cta Sci. Math. , 11:22 9–233, 1948 . 10 [5] Xavier Goao c, Jan Kr a toch v ´ ıl, Y oshio Ok amoto, Chan-Su Shin, and Alexander W olff. Moving v ertices to mak e dra wings plane. In Seok-Hee Hong and T ak ao Nishizeki, editors, Pr o c. 15th Intern. Symp os. Gr aph Dr awing (GD’0 7 ) , volume 4875, pages 1 01–112, 2008. [6] J´ anos P ac h and G´ ab or T ardos. Un tangling a p olygon. Discr ete Comput. Ge om. , 28(4):585–5 9 2, 2002. [7] Andreas Spillner a nd Alexander W olff. Un tangling a plana r graph. In Viliam Geffert, Juhani Karh um¨ aki, Alb erto Bertoni, Bart Prene el, P av ol N´ avrat, and M´ aria Bielik o v´ a, editors, Pr o c. 34th Internat. Co nf. on Cur- r ent T r ends in The ory and Pr actic e of Computer Scienc e (SOFSEM’08) , v olume 4910, pages 473–484, 2008. 11

Original Paper

Loading high-quality paper...

Comments & Academic Discussion

Loading comments...

Leave a Comment