290 likes | 402 Views
Rectangular Drawing (continue). Harald Scheper. Overview. algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings without Designated Corners. Algorithm. To find directions of edges in rectangular drawing of G (vertical, horizontal)
E N D
Rectangular Drawing (continue) Harald Scheper
Overview • algorithm (directions) • algorithm in linear time • outline of algorithm (placement) • Rect. Drawings without Designated Corners
Algorithm • To find directions of edges in rectangular drawing of G (vertical, horizontal) • Later decide the integer coordinates of vertices
Algorithm (outline) • Assume plane graph G has no bad cycle. • Each C0(G) component treated independently. • If there exists a boundary NS-, SN-, WE-, or EW-path then choose it as a partition path • Otherwise find partition path PC and PCC from westmost NS-path, and recurse over subgraphs
Algorithm Main • Algorithm Rectangular-Draw(G) • Draw the outer cycle C0(G) as a rectangle by 2 horizontal line segments PN, PS and 2 vertical line segments PE and PW • Find all C0(G) components J1,..,JP • For each component Ji Gi = C0(G) Ji Draw(Gi,Ji)
Draw(G,J) if part • If G has boundary NS-, SN-, WE-, or EW-path P • assume without loss of generality that P is a boundary NS-path • Draw all edges of P on vertical line (directions are vertical) • If |E(P)| ≥ 2 then • F1,..,Fq are C0 components of GP • For each Fi, i ≤ 1 ≤ q do • Draw (C0(GP ) Fi, Fi)
Draw(Gi,Ji) else part • No boundary NS-,SN-,EW-, or WE path • Find westmost NS-path P • Find partition-pair Pc and Pcc from P • If Pc = Pcc then • Draw all edges of Pc on a vertical line segment • Recursive • Draw(C0(Gi) Fi,Fi)
Draw(Gi,Ji) else, else part • If Pc≠ Pcc then • Draw all edges of Pc andPcc on alternating sequences of horizontal, vertical line segments • G1 is graph obtained form GW by contracting all edges of PCC that are on horizontal sides of rectangular embeddings of C1,C2,..Ck G2 = of Pc G3 = G(C1), G4 = G(C2)…G(Ck) • Recursive: Draw(C0(Gj) Fj,Fj), 1 ≤ j ≤ q for each graph Gi, 1 ≤ i ≤ k+2 Pcc
Linear time • Find all C0 components • For each C0 we find boundary NS-,SN-,EW- and WE-paths if exist, by traversing all boundary faces of G by cc depth-first search. • Each boundary path gets a label, NN, NE,…, WW (start/end points). So NS-, SN-, EW-, WE-paths are found in constant time
Linear time • no boundary NS-, SN-, EW-, WE paths • find partition-pair Pc and Pcc • give labels to the newly created paths by traversing them (once) • problem if a subpath of the westmost NS-path is chosen as westmost NS-path P’ in a later recursive stage, which is not on Pc or Pcc.
Linear time • then again have to traverse the facial cycles attached to P’, so time complexity not linear • so store: • list edges ei elemof E(P) contained in boundary NN- and EN-paths • list edges ei elemof E(P) contained in boundary SS- and SE-paths • to find Pst and Pen in later recursive stages
Linear time • store array of length n = whether the vertex is a head or a tail vertex of a clock wise critical cycle C attached to P and whether ncc(C) = 1 or ncc(C) >1 • indicate existence of critical cycles attached to P’ (not to find critical cycles again) • every face become boundary face, and not again. so traversed constant time. => linear time.
Rectangular Grid Drawing 1 • Algorithm finds only directions of all edges in G • Now coordinates of vertices in G determined in linear time • Assume for simplicity not-corner vertices have degree 3
Rectangular Grid Drawing 2 • Graph Ty spanning tree obtained from G delete not deleted
Rectangular Grid Drawing 3 16 maximal vertical lseg 15 maximal horizontal lseg
Rectangular Grid Drawing 4 • to each maximal horizontal line segment L, we assign y(L) as y-coordinate of every vertex on L • PS is lowermost, PN is topmost • y(PS)=0 • compute y(L) bottom to top • For each vertex v assign temp(v) as temporary y-coordinate of v • For every vertex v on L two cases: • v has neighbor u below v (temp(v) = y(L’)+1) • v has no neighbor u below v (temp(v) = 0) • y(L) = max{temp(v)} v
Rectangular Grid Drawing 5 • All maximal horizontal line segments with depth-first search = linear time • Upperbounds on area of grid, W+H ≤ n/2 and W · H ≤ n2/16 • coordinate of south-west corner = (0,0), northeast = (W,H), at least one hor., vert. line segment • lv = #vertical linesegments, lh = #horizontal linesegments, l = lv + lh • each vertex (- 4) = one of the l-4 max. line seg (PN…) so n-4 = 2(l-4) => l-2 = n/2 because compact: H ≤ lh -1, W ≤ lv -1 = W+H ≤ lh + lv – 2 = l – 2 = n/2 => W · H ≤ n2/4
RD no designated corners 1 • until now considered rect. plane graph G with Δ ≤ 3 with 4 outer vertices of degree 2 as corners • now corners not designated • efficiently find whether G has 4 outer vertices (degree 2) such that there is a rect. drawing
RD no designated corners 2 • independent: no common vertex S1 = {C1,C2}, S2 = {C2,C3,C4}
RD no designated corners 3 • Theorem 6.4.1: G is 2 connected graph, Δ ≤ 3, has min. 4 outer vertices of degree 2, then rect. draw with 4 corners desig. corners if G satisfies: • every 2-legged cycle in G contains at least 2 outer vertices of degree 2 • every 3-legged cycle in G contains at least 1 outer vertex of degree 2 • if an independent set S of cycles in G consists of c2 2 legged cycles and c3 3-legged cycles then 2c2 + c3 ≤ 4
RD no designated corners 2 • independent: no common vertex S1 = {C1, C2}, c2 = 2, c3 = 0, 2*2+0 = 4 S2 = {C2, C3, C4}, c2 = 1, c3 = 2, 2*1+2 = 4
RD no designated corners 3 • Necessity of Th. 6.4.1 : • assume G has rectangular drawing D with 4 corners. by fact 6.3.1: an indep. set S has c2 2-legged C contains at least 2 corners, c3 3-legged C contains at least 1 corner. All cycles independent, so at least 2c2 + c3 corners in D. Since there are 4 corners in D, 2c2+c3≤ 4 In any rectangular drawing D of G, every 2-legged cycle of G contains 2 or more corners, every 3-legged cycle of G contains 1 or more corner, more than 3-legged has no corner
RD no designated corners 4 • prove of 6.4.1: • show if the 3 conditions hold, then can choose 4 outer vertices of degree 2 as corners a,b,c,d, such that (theorem): • any 2-legged cycle contains 2 or more corners • any 3-legged cycle contains 1 or more corners
RD no designated corners 5 • outline = (complete in article) • let J1,..,Jp p ≥ 1 be C0(G) components of G in series • C1 and C2 in J1 and Jp • if 4 corners not been chosen, we choose a corner from each of innermost 3-legged cycles.
RD no designated corners 6 • example
RD of Planar Graphs • until now considered rectangular drawings of plane graphs (with fixed embedding), now of planar graphs with Δ≤ 3 (without fixed embedding) • say planar graph G has rect. drawing if at least one of the plane embeddings has rect. drawing
RD of Planar Graphs • b, c, d are embeddings of planar graph b = rd, c and d not (3-legged cycle with no outer vertex of degree 2)
RD of Planar Graphs • finding not trivial because exponential number of plane embeddings by algorithm as before. • now linear algorithm to examine if there is a plane embedding with rect. drawing