rectangular drawing (continue) harald scheper. overview algorithm (directions) algorithm in linear...

29
Rectangular Drawing (continue) Harald Scheper

Post on 19-Dec-2015

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Rectangular Drawing (continue)

Harald Scheper

Page 2: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Overview

• algorithm (directions)

• algorithm in linear time

• outline of algorithm (placement)

• Rect. Drawings without Designated Corners

Page 3: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Algorithm• To find directions of edges in

rectangular drawing of G (vertical, horizontal)

• Later decide the integer coordinates of vertices

Page 4: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 5: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Algorithm Main• Algorithm Rectangular-Draw(G)

1. Draw the outer cycle C0(G) as a rectangle by 2 horizontal line segments PN, PS and 2 vertical line segments PE and PW

2. Find all C0(G) components J1,..,JP

3. For each component Ji

Gi = C0(G) Ji

Draw(Gi,Ji)

Page 6: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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)

Page 7: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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)

Page 8: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Draw(Gi,Ji) else, else part• If Pc ≠ Pcc then

– Draw all edges of Pc and Pcc 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

Page 9: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 10: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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.

Page 11: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 12: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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.

Page 13: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 14: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Rectangular Grid Drawing 2• Graph Ty spanning tree obtained from

G

delete

not deleted

Page 15: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

Rectangular Grid Drawing 3

16 maximal vertical lseg

15 maximal horizontal lseg

Page 16: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 17: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 18: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 19: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

RD no designated corners 2• independent: no common vertex

S1 = {C1,C2}, S2 = {C2,C3,C4}

Page 20: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 21: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 22: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 23: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 24: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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.

Page 25: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

RD no designated corners 6• example

Page 26: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 27: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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)

Page 28: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

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

Page 29: Rectangular Drawing (continue) Harald Scheper. Overview algorithm (directions) algorithm in linear time outline of algorithm (placement) Rect. Drawings

• Questions?