Chapter 13

Rectangular

13.1 Intro duction

In this chapter we consider the problem of representing a graph G bya rectangu-

lar dual. This is applied in the design of o or planning of electronic chips and in

architectural design. A rectangular dual is de ned as follows. A rectangular subdi-

vision system of a rectangle R is a partition of R into a set = fR ;R ;:::;R g

1 2 n

of non-overlapping rectangles such that no four rectangles in meet at the same

p oint. A rectangular dual of a planar graph G is a rectangular sub division system

and a one-to-one corresp ondence R : V ! suchthattwovertices u and v are

adjacentin G if and only if their corresp onding rectangles RuandRv  share a

common b oundary. In the application of this representation, the vertices of G repre-

sent circuit mo dules and the edges represent mo dule adjacencies. A rectangular dual

provides a placement of the circuit mo dules that preserves the required adjacencies.

Figure 13.1 shows an example of a planar graph and its rectangular dual.

This problem was rst studied by Bhasker & Sahni [6, 7] and Ko zminski & Kin-

nen [73 ]. Bhasker & Sahni gave a linear time algorithm to construct rectangular

duals [7]. The algorithm is fairly complicated and requires manyintriguing pro ce-

dures. The co ordinates of the rectangular dual constructed by it are real numb ers

and b ear no meaningful relationship to the structure of the graph. This algorithm

consists of two ma jor steps: 1 constructing a so-called regular edge labeling REL

of G; and 2 constructing the rectangular dual using this lab eling. A simpli cation

of step 2 is given in [47]. The co ordinates of the rectangular dual constructed by

the algorithm in [47] are integers and carry clear combinatorial meaning. However,

step 1 still relies on the complicated algorithm in [7]. A parallel implementation



of this algorithm, working in O log n log n time with O n pro cessors, is given by

He [46 ].

In this pap er we present a linear time algorithm for step 1: nding a regular

edge lab eling. In [71 ] another algorithm is presented. This algorithm extends

the canonical ordering of triconnected planar graphs, de ned in Section 2.5 to 4- 179

180 Rectangular Duals

connected triangular planar graphs. It turns out that the canonical ordering also

gives a reduction of a factor 2 in the width of the visibility representation of 4-

connected planar graphs. Moreover, using this ordering it is shown that a visibility

representation of any planar graph can b e constructed on a grid of size at most

3

b n 1  n 1 grid.

2

This chapter is organized as follows: in Section 13.2 we present the de nition of

the regular edge lab eling REL and we review the algorithm in [47] that computes a

rectangular dual from a REL. In Section 13.3, we present the REL algorithm based

on the canonical ordering. Section 13.4 discusses the algorithm for the visibilityrep-

resentation of 4-connected planar graphs. Section 13.5 brie y outlines the visibility

representation algorithm for general planar graphs.

13.2 The Rectangular Dual Algorithm

Consider a plane graph H . Let u ;u ;u ;u b e four vertices on the exterior face

0 1 2 3

in counterclo ckwise order. Let P i =0; 1; 2; 3 b e the path on the exterior face

i

consisting of the vertices b etween u and u addition is mo d 4. We seek a rectan-

i i+1

gular dual R of H suchthat u ;u ;u ;u corresp ond to the four corner rectangles

H 0 1 2 3

of R and the vertices on P P ;P ;P , resp ectively corresp ond to the rectangles

H 0 1 2 3

lo cated on the north west, south, east, resp ectively b oundary of R . In order to

H

simplify the problem, we mo dify H as follows: Add four new vertices v ;v ;v ;v .

N W S E

Connect v v ;v ;v , resp ectively to every vertex on P P ;P ;P , resp ectively

N W S E 0 1 2 3

and add four new edges v ;v ; v ;v ; v ;v ; v ;v . Let G b e the resulting

S W W N N E E S

graph. It is easy to see that H has a rectangular dual R if and only if G has a

H

rectangular dual R with exactly four rectangles on the b oundary of R see Figure

G G

13.1a and b. Let a quadrangle b e a cycle of length 4. The following theorem

was proved in [6, 73 ]:

Theorem 13.2.1 A planar graph G has a rectangular dual R with four rectangles

on the boundary of R if and only if 1 every interior face is a triangle and the

exterior face is a quadrangle; 2 G has no separating triangles.

A graph satisfying the conditions in Theorem 13.2.1 is called a proper triangular

planar PTP graph. From nowon,we will discuss only such graphs. Note that

condition 2 of Theorem 13.2.1 implies that G is 4-connected. Since G has no

separating triangles, the degree of anyinterior vertex v of G is at least 4. If

degv  = 3, then the triangle induced on the neighb ors of v would b e a separating

triangle.

The rectangular dual algorithm in [47] heavily dep ends on the concept of regular

edge labeling REL de ned as follows [7, 47 ]:

De nition 13.2.1 Aregular edge labeling of a PTP graph G isapartition of the

interior edges of G into two subsets T ;T of directededges such that:

1 2

13.2 The Rectangular Dual Algorithm 181

vn vn a g j a g f d j f v b v d b v w ve w e

i e e c h i c h

v s v

s

a The initial graph G. b A rectangular dual of G.

v 6 n n*

vn 5 j a g e* j a g f 4 5 w* f d b d v 2 w 3 ve v 1 b 6 2 w 4 ve 2 3 0 i i 5 e c h e c h 7 1

v v s s* s

0

c The graph G . d The graph G .

1 2

Figure 13.1: A PTP graph, its rectangular dual, and the st-graphs G and G

1 2

1. For each interior vertex v , the edges incident to v appear in counterclockwise

order around v as fol lows: a set of edges in T leaving v ;asetofedges in T

1 2

entering v ; a set of edges in T entering v ;asetofedges in T leaving v .

1 2

2. Let v ;v ;v ;v be the four exterior vertices in counterclockwise order. All

N W S E

interior edges incident to v arein T and entering v . Al l interior edges

N 1 N

incident to v arein T and leaving v .Al l interior edges incident to v are

W 2 W S

in T and leaving v .Al l interior edges incident to v areinT and entering

1 S E 2

v .

E

The regular edge lab eling is closely related to planar st-graphs, describ ed in

Section 9.3.

Let G b e a PTP graph and fT ;T g b e a REL of G.From fT ;T g we construct

1 2 1 2

two planar st-graphs as follows. Let G b e the graph consisting of the edges of T

1 1

182 Rectangular Duals

high(F)

above(v)

left(e)e right(e) left(v)v right(v) v F below(v)

GG12

low(F)

Figure 13.2: Prop erties of planar st-graphs.

plus the four exterior edges directed as v ! v , v ! v , v ! v , v ! v ,

S W W N S E E N

and a new edge v ;v . G is a planar st-graph with source v and sink v .For

S N 1 S N

eachvertex v , the face of G that separates the incoming edges of v from the outgoing

1

edges of v in the clo ckwise direction is denoted by leftv . The other face of G that

1

separates the incoming and the outgoing edges of v is denoted by rightv . See

Figure 13.2.

Let G b e the graph consisting of the edges of T plus the four exterior edges

2 2

directed as v ! v , v ! v , v ! v , v ! v , and a new edge v ;v . G

W S S E W N N E W E 2

is a planar st-graph with source v and sink v .For eachvertex v , the face of G

W E 2

that separates the incoming edges of v from the outgoing edges of v in the clo ckwise

direction is denoted by abovev . The other face of G that separates the incoming

2

and the outgoing edges of v is denoted by belowv . See Figure 13.2.



The dual graph G of G is de ned as follows. Every face F of G is a no de

1 k 1

1

 

v in G , and there exists an edge v ;v inG if and only if F and F share

F F F i k

i

k 1 k 1



a common edge in G .We direct the edges of G as follows: if F and F are the

1 l r

1

left and the right face of an edge v; wof G , direct the dual edge from F to F

1 l r



is a planar st-graph if v; w 6=v ;v  and from F to F if v; w=v ;v . G

S N r l S N

1



whose source and sink are the right face denoted by w  and the left face denoted

 

by e ofv ;v , resp ectively.For eachnode F of G ,letd F  denote the length

S N 1

1

 

of the longest path from w to F .LetD = d e . For eachinterior vertex v of

1 1

G, de ne: x v = d leftv , and x v =d rightv . For the four exterior

left 1 right 1

vertices, de ne: x v =0; x v =1; x v =D 1; x v =D ;

left W right W left E 1 right E 1

x v =x v =1; x v =x v =D 1.

left S left N right S right N 1

 

The dual graph G of G is de ned similarly.For eachnodeF of G ,letd F 

2 2

2 2



denote the length of the longest path from the source no de of G to F .LetD b e the

2

2



length of the longest path from the source no de to the sink no de of G .For eachin-

2

terior vertex v of G, de ne: y v = d belowv , and y v =d abovev . For

low 2 high 2

13.3 Computing a REL Using a Canonical Ordering 183

the four exterior vertices, de ne: y v =y v =0; y v = y v =

low W low E high W high E

D ; y v =0; y v =1; y v =D 1; y v = D .

2 low S high S low N 2 high N 2

The rectangular dual algorithm relies on the following theorem from He.

Theorem 13.2.2 [47] Let G beaPTPgraph and fT ;T g be a REL of G.For

1 2

each vertex v of G, assign v the rectangle Rv  bounded by the four lines x =

x v , x = x v , y = y v , y = y v . Then the set fRv jv 2 V g form a

left right low high

rectangular dual of G.

Figure 13.1 shows an example of the theorem. Figure 13.1c shows the st-graph



G . The small squares in the Figure represent the no des of G and the integers in

1

1

the squares representtheird values. Figure 13.1d shows the graph G . Figure

1 2

13.1b shows the rectangular dual constructed as in Theorem 13.2.2. The algorithm

for computing a rectangular dual is as follows [47 ]:

RectangularDualG;

construct a regular edge lab eling fT ;T g of G;

1 2

construct from fT ;T g the planar st-graphs G and G ;

1 2 1 2

 

construct the dual graph G from G and G from G ;

1 2

1 2

 

compute d F  for no des in G and d F  for no des in G ;

1 2

1 2

assign eachvertex v of G a rectangle Rv  as in Theorem 13.2.2;

End RectangularDual

If wehave a REL of a PTP graph, then the rectangular dual can easily b e

constructed in linear time by this algorithm. In the next section we showhowto

compute a REL of a PTP graph.

13.3 Computing a REL Using a Canonical Order-

ing

In this section we consider 4-connected planar triangular graphs. Note that adding

an edge connecting two non-adjacent exterior vertices of a PTP-graph G leads to a

4-connected planar triangular graph. So we assume that G is a 4-connected planar

triangular graph. Let the exterior vertices of G be u; v ; w .

Theorem 13.3.1 There exists a labeling of the vertices v = u; v = v; v ;:::, v =

1 2 3 n

w of G meeting the fol lowing requirements for every 4  k  n:

1. The subgraph G of G inducedbyv ;v ;:::;v is biconnectedandthe

k 1 1 2 k 1

boundary of its exterior face is a cycle C containing u; v .

k 1

2. v is in the exterior faceofG , and its neighbors in G form a at least

k k 1 k 1

2-element subinterval of the path C fu; v g.Ifk  n 2, v has at least

k 1 k

2 neighbors in G G .

k 1

184 Rectangular Duals

Pro of: The vertices v ;v ;:::;v are de ned by reverse induction. Number

n n1 3

the three exterior vertices u; v ; w by v ;v and v .LetG b e the subgraph of G

1 2 n n1

after deleting v . By 4-connectivityof G, G is triconnected, and its exterior face

n n1

C is a cycle and, hence, admits the constraints of the theorem. Let v 6= v

n1 n1 1

b e the vertex of C adjacent to b oth v and v in G. By the 4-connectivity,

n1 2 n

G fv ;v g is biconnected and its exterior face C is a cycle and, hence, admits

n n1 n1

the constraints.

Let k k

i

such that the subgraph G induced by V fv ;:::;v g satis es the constraints

i i+1 n

of the theorem. Let C denote the b oundary of the exterior face of G . Assume

k k

rst that C has no interior chords. Supp ose v ;c ;:::;c ;v are the vertices of

k 1 k k 2

p

1

C in this order b etween v and v . Then it follows by the 4-connectivityof G that

k 1 2

p  2. If all vertices c ;:::;c have only one edge to the vertices in G G ,

k k k

p

1

then since G is a planar triangular graph, they are adjacent to the same vertex

v for some k

j 1 j 2 j

fv ;v ; v ;v ; v ;v g would b e a separating triangle. Hence at least one vertex,

1 j j 2 2 1

say c , has at least 2 neighb ors in G G . c is the next vertex v in our ordering.

k k k k

Next assume C has interior chords. Let c ;c b> a+1beachord such

k a b

that b a is minimal. Let also c ;c beachord with e>d b suchthat e d is

d e

minimal. If there is no suchachord, let c ;c =c ;c  and number the vertices

a b d e

in clo ckwise order around C such that a =1

k

loss of generality, that v ;v 62 fc ;:::;c g. If all vertices c ;:::;c have

1 2 a+1 b1 a+1 b1

only one edge to the vertices in G G ,thensinceG is a triangular graph, they

k

are adjacent to the same vertex v ,andwealsohavev ;v ; v ;v  2 G. But then

j a j b j

fv ;v ; v ;v ; v ;v g would b e a separating triangle. Hence there is at least one

a j j b b a

vertex c ;a < < b,having at least twoneighbors in G G and having no incident

k

chords. c is the next vertex v in our ordering. 2

k

Theorem 13.3.2 The canonical ordering can becomputed in linear time.

Pro of: Weaddtwo lab els to eachvertex v : visitedv , denoting the number of

visited and extracted neighb ors of v ,and chordsv , denoting the numb er of incident

chords of v . The algorithm follows the structure of the pro of of Theorem 13.3.1.

We start with v and v and initialize the lab els visited and chords of their

n n1

neighb ors, after deleting the vertices v and v . We compute the ordering in

n n1

reverse order and up date the lab els after cho osing a vertex v as follows: we visit

k

each neighbor v of v .Letc ;:::;c j>i b e the neighb ors in this order of v

k i j k

in G .We increase visitedc byone,fori  l  j .Ifj = i + 1, then there was

k 1 l

achord c ;c inG , hence we decrease chordsc andchordsc by one, since

i j k 1 i j

c ;c  b ecomes part of C .Ifj>i+ 1, then for each c i< l

i j k 1 l

chordsc . If there is a chord c ;v, then we also increase chordsv byone.Thisis

l l

done by marking the vertices that are part of the current exterior face.

13.3 Computing a REL Using a Canonical Ordering 185

By Theorem 13.3.1 it follows that, if k  3, then there is a vertex v with visitedv 

 2and chordsv  = 0, and this can b e chosen as the next vertex v in our ordering.

k

We mark v as b eing visited. Since there are only a linear number of edges, the

canonical ordering is obtained in linear time. 2

14

vk chords = 0 11 12 visited = 2 5 6 10 1 13 7

3 4 8 9

vv 12

2

Figure 13.3: Computing the canonical ordering of the graph from Figure 13.1.

To compute a REL of a PTP graph G,we rst add an edge connecting twonon-

adjacent exterior vertices of G. This gives a 4-connected planar triangular graph

0 0

G .We compute a canonical numb ering of G and then delete the added edge. The

four exterior vertices of G are nownumb ered as v ;v ;v ;v , resp ectively. Next

1 2 n1 n

we show that a REL of G can b e easily derived from the canonical ordering.

First, for eachedgev ;v ofG, direct it from v to v ,ifi< j. De ne the

i j i j

base-edge of a vertex v tobetheedgev ;v  for which l

k l k

vertex v has incoming edges from c ;:::;c b elonging to C the exterior face of

k i j k 1

G , assuming in this order from left to right. Wecallc the leftvertex of v and

k 1 i k

c the rightvertex of v . Let v ;:::;v b e the higher-numb ered neighbors of v ,in

j k k k k

1

l

this order from left to right. We call v ;v theleftedge and v ;v therightedge

k k k k

1

l

of v . Notice that following the de nitions of Section 6, v = leftupv  and v =

k k k k

1

l

rightupv .

k

Lemma 13.3.3 Abase-edge cannot be a leftedge or a rightedge.

of v is Pro of: Assume the lemma is false. Supp ose the leftedge v ;v

k k k

1

. Since G is .Thus v is the lowest-numb ered neighbor of v the base-edge of v

k k k

1 1

triangular, there is an edge b etween the leftvertex of v ,say v with i< k,and v .

k i k

1

But this contradicts the fact that v ;v  is the base-edge of v . The argumentis

k k k

1 1

similar for the rightedges. 2

Lemma 13.3.4 Anedge is either a leftedge, a rightedge or a base-edge.

186 Rectangular Duals

Pro of: The \exclusive or" follows from the previous lemma. We only need to

provethatevery edge is a leftedge, a rightedge or a base-edge. Let v 3  k  n 2

k

beavertex with incoming edges coming from c ;:::;c , in this order from left to

i j

right. Let v ;c  b e the base-edge of v .Allvertices c i< l

k k l

higher-numb ered neighb ors, one of them is v , the other one is adjacenttoc ;v ,

k l k

hence it is either c ;c orc ;c . Thus b etween c and c it follows that c

l1 l l l+1 i l+1

is the rightvertex of c 1  l< . Between c and c vertex c is the leftvertex of

l j l

c   l

l+1 l k

for

k

lemma holds for the incoming edges of v and v . 2

n1 n

We construct a REL for G as follows: all leftedges b elong to T , all rightedges

1

b elong to T . The base-edge c ;v of v is added to T ,if = j ,toT ,if = i,and

2 k k 1 2

otherwise arbitrarily to either T or T . The four exterior edges b elong to neither

1 2

T nor T .

1 2

Lemma 13.3.5 fT ;T g forms a regular edge labeling for G.

1 2

Pro of: Let v ;:::;v b e the outgoing edges of the vertex v 3  k  n 2.

k k k

1

d

It follows from Theorem 13.3.1 that d  2. Then v ;v  is the leftedge of v and is

k k k

1

in T .v ;v  is the rightedge of v and is in T . The edges v ;v ;:::;v ;v 

1 k k k 2 k k k k

2

d d1

are the base-edges of v ;:::;v , resp ectively. Let the vertex v 1   d

k k k

2

d1

b e the highest-numb ered neighbor of v . Then all vertices from v to v havea

k k k

1

monotone increasing numb er, as well as the vertices from v to v . Otherwise there

k k

d

was a vertex v suchthat v and v are numb ered higher than v . But this

k k k k

l l1 l+1 l

implies that v is the only lower-numb ered neighbor of v ,whichisa contradiction

k k

l

with the canonical ordering of G. Hence for every v 1

k

l

k k >k .Thus, by the construction of T and T ,the

l1 l l+1 l1 l l+1 1 2

edges v ;v  are added to T ,if1  l< , and to T ,if

k k 1 2

l

v ;v  is arbitrarily added to either T or T . This completes the pro of that the

k k 1 2

edges app ear in counterclo ckwise order around v as follows: a set of edges in T

k 2

entering v ; a set of edges in T entering v ; a set of edges in T leaving v ;a setof

k 1 k 2 k

edges in T leaving v .

1 k

Let v ;:::;v b e the higher numb ered neighb ors of v from left to right. Then

1 1 1

1

d

;:::,v ;v  = v and v = v ,andby the argument describ ed ab ove, v ;v v

1 1 n 1 2 1 1 1

2 1

d1 d

b elong to T . Similarly, all outgoing edges of v b elong to T . All incoming edges

2 2 1

of v b elong to T , and all incoming edges of v b elong to T . This completes the

n1 2 n 1

pro of. 2

Since the construction of fT ;T g from the canonical numb ering can b e easily

1 2

done in O n time, Theorem 13.3.2 and Lemma 13.3.5 constitute our linear time

REL algorithm. See Figure 13.3 for the construction of a REL from a canonical ordering.

13.4 Algorithm for Visibility Representation 187

13.4 Algorithm for Visibility Representation

The visibility representation of a planar graph G maps the vertices of G to horizontal

line segments and edges of G to vertical line segments. In Section 10.4 wegavea

new algorithm for constructing a visibility representation of a triconnected planar

graph, using the lmc-ordering. Indeed, we observed that if outv   2forevery

k

vertex v ;k < n 1, then the grid size is at most n 1  n 1. Since this holds

k

for the canonical ordering for 4-connected triangular planar graphs, this leads to the

desired grid size for 4-connected planar graphs. If the 4-connected planar graph

is not triangulated, then we can apply any triangulation algorithm, as describ ed in

Chapter 6. In Section 9.3.1 we presented the algorithm VisibilityG of [96, 104 ],

which constructs in linear time a visibility representation of a graph G. Visibility

G starts with constructing an st-numb ering. If G is a 4-connected planar triangular

graph, then we can use the describ ed canonical ordering, since this ordering is also

an st-numb ering. Figure 13.4 shows an example of applying VisibilityGofa4-

connected planar triangular graph, using the canonical ordering. Wewillnowshow

that also the algorithm VisibilitiyG leads to the same grid size.

14

13 14 12

0 1 2 11 11 12 3 5 10 2 5 3 4 9 10 6 13 1 1 3 6 8 7 11 4 5 7 2 7 6 6 3 6 4 8 9 5 2 3 7 8 9 10 4

3

2 2

1

Figure 13.4: The canonical ordering leads to a compact visibility representation.

Theorem 13.4.1 VisibilityG constructs a visibility representation of G on a

grid of size at most n 1  n 1.

Pro of: The correctness of VisibilityGisshown in [96, 104 ]. Weshow that

the grid size is at most n 1  n 1. This follows directly for the height, since

the length of the longest path from v to v is at most n 1.

1 n

   

Let s b e the source no de of G and t be the sink node of G .Every vertex v



.Ifv 6= v ;v ;v ;v , then v has  2 incoming of G corresp onds to a face F of G

1 2 n1 n v

188 Rectangular Duals

and  2 outgoing edges, hence the two directed paths from lowF to highF  b oth

v v

0

 

have length  2. Let G b e the graph obtained from G by removing the sink

 

no de t and its incident edges. In Figure 13.4, t is the no de represented bythe



square lab eled by 11. This merges the faces F ;F and F of G into one face

v v v

n

1 2

0

0 

F . Note that for every face F 6= F of G , the two directed paths of F between

v

n1

0



lowF and highF inG have length  2.

0 0 0 0 0

    

Let s b e the source of G and let t bethesinkof G . Notice that s =

0 0

 0  0 

s = lowF andt = leftv ;v  = highF . In Figure 13.4, t is the no de

2 n

represented by the square lab eled by 10. Clearly, there are at least twoedgese

0



with F = lefte, and the only edge e with righte=F has endp oint t .Let

v v

n1 n1

0 0

 

P be any longest path from s to t . Then the length of any longest path from

long

  

s to t in G is 1 plus the length of P .

long

We claim that P has at most one consecutive sequence of edges in common

long

0



with anyfaceF of G .Toward a contradiction assume the claim is not true. Supp ose

that P visits some no des of F , assume that w is the last one, then l  1nodes

long 1

u ;:::;u 62 F , thensomenodesof F again, let w b e the rst one. Let w ;:::;w

1 l d 2 d1

b e the no des, in this order, of F , which are not visited by P see Figure 13.5.

long

Supp ose F = rightw ;w . If F = leftw ;w , the pro of is similar. Let F =

1 2 1 2 1

leftw ;w . Notice that w = lowF . The directed path of F , starting with edge

1 2 1 1 1

w ;w , has length  2. Hence w has an outgoing edge to a no de of F , and an

1 2 2 1

outgoing edge to w .Thus w = lowF , with F = leftw ;w . Rep eating this

3 2 2 2 2 3

argumentitfollows that w = lowF , with F = leftw ;w . However it

d1 d1 d1 d1 d

is easy to see that w = highF . This means that one of the two directed paths

d d1

of F has length 1. This contradiction proves the claim.

d1

P long F F 1 2 w w 1 2 w 3

low(F) F

high(F)

Figure 13.5: Example of the pro of of Theorem 5.1.

When traversing an edge e of P ,we visit either lefteorrighte or b oth

long

for the rst time. We assign eachedge e to the face F ,with e 2 F , whichwe visit

0 0

 

for the rst time now. G has n 2 faces. Toevery face F of G ,by the claim, at

13.4 Algorithm for Visibility Representation 189

  

most one edge e 2 P is assigned. Hence the longest path from s to t in G has

long

length  n 1. 2

VisibilityG can b e applied to a general 4-connected planar graph by rst

triangulating it. The triangulation of a 4-connected planar graph is clearly still

4-connected. Since the worst-case b ounds for visibility representation by applying

an arbitrary st-numb ering is 2n 5  n 1 [96 , 104 ], our algorithm reduces the

width of the visibility representation by a factor 2 in the case of 4-connected planar

graphs. In Chapter 14 weshow that this algorithm can b e used to construct more

compact visibility representations of general planar graphs.

190 Rectangular Duals