Planar Drawings of Graphs

on the Rectilinear Grid

with Few Bends in Each Edge

research thesis

submitted in partial fulfillment

of the requirements for the degree of

master of science

in Computer Science

GILAD GRANOT

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

submitted to the senate of the technion israel institute of technology

tamuz haifa june

The work described herein was supervised by prof Shimon Even

I want to thank Shimon Even for his helpful guidance Shimon always knew to suggest

a direction to work on when I needed it He help ed me to put together my disorganized

thoughts I learned a lot from our long conversations which were fun also when not

related to the work

I want to thank Go os Kant and Arnold L Rosenberg for their useful comments on

previous versions of chapter

I thank all my friends at the Computer Science department who made my stay there

a pleasure I wont mention names so that I wont forget anyone

Finally I have to thank the various secretaries that handle graduate students I want

to thank them for not preventing me from nishing my studies

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994 i

Contents

Abstract

Background

Introduction

denitions

Previous Work

Visibility Representations

Preliminaries

Finding a Visibility Representation of a Nonseparable Graph

Constrained Visibility Representations

Drawings with Vertices Drawn as Points

Introduction

Left Adjusted Visibility Representations

Drawing Vertices as Points

Graphs That Are Hard to Draw

Drawings with Vertices Drawn as Rectangular Mo dules

Introduction

Planarity Checking

Planar GridLayouts The Case of No SelfLo ops

Planar GridLayouts The Case With SelfLo ops

Mo dule Descriptions that are Hard to Draw

An Application

NonPlanar Drawings

Vertices as Points

Vertices as Mo dules GridLayouts

Bibliography

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994 ii

Abstract

For a a lineartime algorithm is describ ed to construct a planar drawing

on the rectilinear grid with at most b ends in each edge The drawings found by this

algorithm for planar graphs with no self lo ops have at most b ends in each edge The

drawings use O n area and edges of length O n

We also show a planar graph that has no rectilinear planar drawing with at most

b ends in each edge and a planar graph that has no rectilinear planar drawing with at

most b end in each edge

Consider an input data which sp ecies a blo ck diagram of some mo dules and connec

tions b etween them edges which can b e drawn on the plane in such a way that lines

representing the connections do not cross The size of the mo dules and the placements of

the terminals on them is given as part of the input

A lineartime algorithm is describ ed to construct a planar drawing on the rectilinear

grid with at most b ends in a line representing a connection b etween two terminals of

the same mo dule and at most b ends in any other line The external face of the drawing

may b e chosen We show a planar input with no self lo ops that has no planar drawing

with less than b ends in each edge and another planar input that has no planar drawing

with less than b ends in each self lo op

Finally we consider grid drawings of sp ecied blo ck diagrams which are not neces

sarily planar We present a lineartime algorithm to construct such grid drawings with

at most b ends in any line of the blo ck diagram We show inputs that have no such

drawing with at most b ends in any line

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Chapter

Background

Introduction

We consider drawing a graph in the plane in a way suitable for the layout of one layered

electrical circuits or VLSI comp onents The drawing is done on the rectilinear grid which

is a collection of parallel lines at a constant distance one from another and a copy of them



rotated by Edges are drawn as paths on the grid connecting their two end vertices

The drawing must b e planar that is the drawing of two dierent edges have no common

p oint except maybe at their ends where the two edges have a common end vertex



A b end is a p oint in the path representing an edge in which the path has a

angle We want the drawing to have few b ends in each edge This is imp ortant where the

drawing realizes a circuit and a b end may cause a delay or a signal loss It also makes it

easier for humans to follow the drawings of the edges We call a drawing in which every

edge has no more than k b ends a kbend drawing We investigate two types of drawings

which are dierent in the way the vertices are drawn

In the rst type of drawings we consider the vertices are drawn as distinct p oints at

intersections of grid lines A planar graph is a graph that has a planar drawing A d

planar graph is a planar graph that has no vertex of degree greater than d By denition

drawable graphs must b e planar We describ e a lineartime algorithm that pro duces a

b end drawing for any planar graph and a b end drawing for any planar graph with

no self lo ops The drawings have O n area a total of O n b ends and edges of length

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

O n We then show a planar graph that has no b end drawing and a planar graph

that has no b end drawing

In the second type of drawings we investigate the vertices are drawn as rectangular

mo dules on the grid and edges are drawn as nonintersecting paths on the grid b etween

the p erimeters of two mo dules The p oint that an edge connects to the p erimeter of a

mo dule is called a terminal The size of the mo dules and the placements of the terminals

on them is given as part of the input The input assigns to each edge two sp ecic terminals

We try to pro duce drawings with few b ends in each edge We consider two versions of

the problem in one ipping of the mo dules is allowed in the other it is not Rotation of

the mo dules is always allowed

For b oth versions of the problem lineartime algorithms are known that determine if a

planar drawing of the input is p ossible When we say that a planar drawing is p ossible

we do not mean that such a drawing has to b e on the rectilinear grid We will show

a lineartime algorithm that constructs a b end drawing for any input that p ermits a

planar drawing In the pro duced drawings edges that are not self lo ops have at most

b ends We will show planar input with no self lo ops that has no b end drawing and

planar input that has no b end drawing

denitions

We present here denitions that will b e used throughout the thesis The denitions are

gathered here so that later the explanations will b e more uent and to make them easier

to nd Some denitions brought here may also app ear elsewhere and some denitions

relevant only to a sp ecic chapter may only app ear there

When we talk ab out a graph GV E we are not restricted to simple graphs This

means that the graph may have parallel edges and self lo ops We denote jV j n and

jE j m For denitions of basic terms in the context of graphs see Eve We use the

e

e

v for an edge e which connects vertices u and v and uv for a directed edge notation u

e from u to v

If a connected graph has three dierent vertices abc such that all the paths b etween

a and c pass through b then b is called a cut vertex or a separation vertex of the graph

A connected graph that has no cut vertex is called nonseparable Nonseparable graphs

are sometimes called biconnected

A planar drawing of a graph on the plane is a mapping of it to the plane Vertices are

mapp ed to p oints or to closed curves in the plane and edges are mapp ed to curves in the

plane The endp oints of the curve representing an edge must b elong to the drawings of

the end vertices of that edge Except for this case no p oint b elonging to a drawing of an

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

edge or a vertex may b elong to a drawing of another edge or vertex

A planar graph is a graph that has a planar drawing Adplanar graph is a planar

graph that has no vertex of degree greater than d

We consider drawing a graph in the plane in a way suitable for the layout of a one

layered electrical circuit or a VLSI comp onent The drawing is done on the rectilinear

grid which is a collection of parallel lines with a constant distance b etween neighboring



lines and a copy of them rotated by Edges and vertices are drawn only on the grid

We dene the following for drawings on the rectilinear grid A bend is a p oint in the



path representing an edge in which the path has a angle We call a drawing in which

every edge has no more than k b ends a kbend drawing The area of a drawing is the area

of the smallest rectangle sides parallel to the grid lines containing the drawing The area

is measured in grid squares

When we remove from the plane p oints that b elong to a planar drawing of a connected

graph the plane is divided into continuous areas Points inside a drawing of a vertex are

also removed The b oundary of each of these areas represents a of the graph an

edge may app ear twice in such a cycle Theses cycles are called the faces of the drawing

The face which represents the b oundary of the innite area is called the external face

An edge incidence ordering of a graph is a sp ecication for each vertex of a cyclic

order of the endp oints of its incident edges A graph with an edgeordering is called

an ordered graph A drawing of an ordered graph in the plane is proper if the edge

ordering of the ordered graph corresp onds to the clo ckwise arrangement of the endp oints

around the vertices in the drawing A planar ordered graph is an ordered graph that has

a prop er planar drawing The edge ordering of a planar ordered graph is called a planar

representation An ordered graph determines the faces of any prop er drawing but do esnt

determine which one is external

An st bipolar orientation of a graph G is a whose underlying

undirected graph is G it has one source s one sink t and an edge st

In an st bip olar orientation of a planar ordered graph the only source sink of a

subgraph consisting of one face is called the source sink of the face As will b e shown

later Lemma in every st bip olar orientation of a planar ordered graph for every ver

tex the incoming outgoing edges app ear consecutively The set of consecutive incoming

outgoing edges of a vertex is called an edge block

A visibility representation of a graph is a planar drawing of the graph on the rectilinear

grid where vertices are drawn as horizontal lines or p oints and edges are drawn as vertical

lines A visibility representation of a graph induces directions to the edges of the graph

the edges are directed from the lower vertex to the higher vertex We assume that the ends of the drawing of a vertex are at the endp oints of its leftmost and rightmost incident

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

edges

We will call a vertex in a visibility representation left adjusted if the leftmost p oint of

its drawing is the end of the drawings of two edges An LAVR Left Adjusted Visibility

Representation of a graph is a visibility representation such that in the it

induces every vertex which isnt left adjusted is a source or a sink See gure for an

example

Previous Work

Drawings on the rectilinear grid have b een studied b ecause of their applications in VLSI

planning and automatic graph and data drawing DETT TDB Planar drawings

in which lines do not cross have b een given a sp ecial consideration In planar drawings

following the drawings of edges is easier and the drawing can b e used as a layout of a

one layered electrical circuit

Most of the previous work dealt with drawings in which vertices are drawn as grid

p oints Several asp ects of such drawings have b een considered The area of the drawing is

the area of the smallest rectangle sides parallel to the grid lines containing the drawing

The area is measured in grid squares and is considered b etter when small It is known that

every planar graph can b e drawn in O n area Shi TT and that some planar

graphs require n area to b e drawn Shi Other prop erties of drawings which are

of interest are the total edgelength the maximum length of an edge MO and the

total number of b ends Sto Tam TT TTV A b end is a p oint in the path



representing an edge in which the path has a angle

Our interest is in drawings which minimize b ends but instead of considering the total

number of b ends in the drawing we want to minimize the maximum number of b ends

which o ccur in any edge This is imp ortant where the drawing realizes a circuit and a b end

may cause delay or signal loss It also makes it easier for humans to follow the drawings

of the edges We call a drawing in which every edge has no more than k b ends a kbend

drawing See gure An algorithm in Tam given k and a planar representation

nds a k b end drawing consistent with the representation with the minimum total number

of b ends in O n log n time In TT a lineartime algorithm is given to nd a b end

drawing for simple graphs Kant Kan shows that every planar graph without self

lo ops and with ve vertices or more has a b end drawing however the choice of the

external face is determined by the algorithm Two relevant pap ers have b een written

after our do cumentation of the results of chapter they are

Biedl Bie shows a lineartime algorithm to nd a b end nonplanar drawing of

a graph

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Biedl and Kant BK show a lineartime algorithm to nd b end planar drawings

of most simple graphs

So far we have only referred to drawings in which the vertices are drawn as grid

p oints In chapters we consider drawings in which vertices are drawn as rectangles on

the grid The shap e of each rectangle and the placements of the edge endp oints on its

p erimeter are given as part of the input Although such drawings seem natural for VLSI

planning we do not know of algorithms for nding such planar drawings We only know of algorithms to check if a planar drawing exists for a given input Pin Ami Zak

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Chapter

Visibil i ty Representations

In this chapter we describ e known algorithms for nding visibility representations of

graphs The algorithms are describ ed for two reasons The rst reason is that the the

descriptions of the algorithms makes the thesis more self contained And the second

reason is to clarify the use of these algorithms in later chapters

Pro ofs are omitted in this chapter since they can b e found in the referenced work

Preliminaries

An edge incidence ordering of a graph is a sp ecication for each vertex of a cyclic

order of the endp oints of its incident edges A graph with an edgeordering is called

an ordered graph A drawing of an ordered graph in the plane is proper if the edge

ordering of the ordered graph corresp onds to the clo ckwise arrangement of the endp oints

around the vertices in the drawing A planar ordered graph is an ordered graph that has

a prop er planar drawing The edge ordering of a planar ordered graph is called a planar

representation An ordered graph determines the faces of any prop er drawing but do esnt

determine which one will b e external

Graphs are usually represented in computers by adjacency lists The order of the

incident edges of a vertex in the list can b e viewed as their cyclic order Therefore

ordered graphs can b e represented in a computer in the same way that regular graphs

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

are When dealing with planar graphs we will usually op erate on a corresp onding planar

ordered graph

An st bipolar orientation of a graph G is a directed acyclic graph whose underlying

undirected graph is G it has one source s one sink t and an edge st Given a non

t an st bip olar orientation of the graph with separable graph and one of its edges s

the sp ecied st edge can b e found in linear time ET Even and Tarjan use an

equivalent notion of an st numbering

Lemma RT TT In an st bipolar orientation of a planar ordered graph the

fol lowing hold

For every vertex its incoming outgoing edges appear consecutively in the edge

ordering

Every face consists of two edge disjoint directed paths

Thus if we take a subgraph consisting of one face of an st bip olar orientation of a planar

ordered graph the subgraph has exactly one source and one sink called the source and

the sink of the face The set of consecutive incoming outgoing edges of a vertex is called

an edge block

Let us consider an st bip olar orientation whose edges have nonnegative integer weights

The weight of the longest path from s to each vertex v which we denote by dv can

b e found in linear time See for example Eve pp A top ological ordering

for a directed acyclic graph with nonnegative edge weights is an assignment of a p ositive

integer to each vertex such that for each edge the number assigned to its destination

minus the number assigned to its origin is greater than or equal to the weight of the edge

The values of d are a top ological ordering

We lo ok at an edge e of a directed graph with a planar representation We will denote

the face to the left right of e when e is drawn upwards as Le Re

A visibility representation of a graph is a planar drawing of the graph on the rectilinear

grid where vertices are drawn as horizontal lines or p oints and edges are drawn as vertical

lines A visibility representation of a graph induces directions to the edges of the graph

the edges are directed from the lower vertex to the higher vertex We assume that the

ends of the drawing of a vertex are at the endp oints of its leftmost and rightmost incident

edges A visibility representation is describ ed by the following data For each vertex v

its Y axis co ordinate y v and for each edge e its X axis co ordinate xe

We will call a vertex in a visibility representation left adjusted if the leftmost p oint of

its drawing is the end of the drawings of two edges An LAVR Left Adjusted Visibility

Representation of a graph is a visibility representation such that in the directed graph it

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

induces every vertex which is not left adjusted is a source or a sink See gure for an

example

We will now describ e two known linear time algorithms for nding visibility represen

tations The dierence b etween the two algorithms is that the second algorithm nds a

visibility representation with some constraints

Figure a graph and an LAVR representation of it

åìù ìàîùì øùåéî éåå÷ øåéöå óøâ :2.1 íéùøú

Finding a Visibility Representation of a Non

separable Graph

In this section we describ e an algorithm of Rosenstiehl and Tarjan RT that was

discovered indep endently by Tamassia and Tollis TT

  

The directed G V E of an st bip olar orientation GV E with a planar

representation is dened as follows



V ff j f is a face of Gg



E fLeRe j e E fstgg fRs tLstg



It can b e shown that G is an st bip olar orientation with Rs tLst b eing the

st edge

Theorem RT TT algorithm VR described in gure nds a visibility rep

resentation for any nonseparable graph without selfloops in lineartime

The st edge is the leftmost edge in the visibility representation and the face on its

left is the external face Therefore the choice of st in the algorithm ensures that f will

b e the external face

The edges in the visibility representation are drawn upward according to their direction

in the st bip olar orientation of G

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Lemma The visibility representations produced by algorithm VR are left adjusted

Proof Let v s t and let e b e the leftmost incoming edge of v and e b e the

 

leftmost outgoing edge of v Since d Le d Le xe xe

The height of the drawing is less than jV j and the width of the drawing is less than

the number of faces of G

pro cedure VRG f f RT very similar to TT g

f G is a planar undirected nonseparable ordered graph and its data structure g

f species its planar representation The face f is specied to be external g

b egin

let s b e a vertex on f

e

let s t b e an edge in the clo ckwise traversal of f

direct the edges of G as an st bip olar orientation f ET g



nd G the directed dual graph of G

set all edge weights to

 

calculate dv for the vertices of G and d v for the vertices of G

for each vertex v of G do

y v dv

e

xst

e

0

for each edge e E fstg do

0  0

xe d Le

end

Figure nding an LAVR of a nonseparable graph

÷éøô-éà óøâ ìù ìàîùì øùåéî éåå÷ øåéö úàéöî :2.2 íéùøú

As will b e shown later the VR algorithm can b e used to construct a visibility rep

resentation of any planar connected graph with no selflo ops If the graph is connected

but separable it can b e made nonseparable by adding edges These edges will b e called

auxiliary An LAVR of the graph with the auxiliary edges can b e found using the VR

algorithm After removing the drawings of the auxiliary edges from the resulting LAVR

one gets a visibility representation of the graph Notice that this visibility representation

may not b e left adjusted An algorithm for nding an LAVR of a connected graph is

describ ed in section

Constrained Visibility Representations

In this section we are interested in pro ducing visibility representations under certain

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

constraints we want certain paths of the graph to b e drawn as straight vertical lines We

describ e an Algorithm of Di Battista Tamassia and Tollis DTT that runs in linear

time For consistency with the rest of the thesis we describ e this algorithm in a slightly

dierent way than in DTT

The input consists of a planar ordered graph which is an st bip olar orientation GV E

and some constraints The output is a visibility representation of G that is prop er in

which all edges are drawn p ointing upwards What we have describ ed so far can b e done

by the VR algorithm if one removes the nding of the st bip olar orientation from the

algorithm Next we describ e the constraints imp osed on the visibility representation

which force us to use the new algorithm

A set of mutually edge disjoint directed paths of the st bip olar orientation is

sp ecied in the input All the sp ecied directed paths have to b e aligned in the output

visibility representation That is the X axis co ordinate of all edges b elonging to the

same path must b e the same The sp ecied paths may not cross one another in a prop er

drawing That is for any four edges e e e e incident to the same vertex in this order

not necessarily consecutively if e and e b elong to the same path then e and e may

not b elong to the same path

If some edge do es not app ear in a path of it can b e added as new path to

Therefore we may assume that every edge app ears in one path of We denote by pe

the path of that an edge e E app ears in

  

We dene the constrained dual graph G V E of GV E as follows



V ff j f is a face of Gg

E fpeRe j e E g

w

E fLepe j e E fstgg fpstLstg

z



E E E

w z



It can b e shown that G is an st bip olar orientation with pstLst b eing the st

edge

Theorem DTT algorithm CVR that is described in gure nds a constrained

visibility representation for any st bipolar orientation of a planar ordered graph in linear

time

If one applies CVRG but assigns higher integer weights to the edges the result

is still a constrained visibility representation This can b e used to creating gaps in the visibility representation in sp ecic places

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

pro cedure CVRG f DTT very similar to TT g

f GV E is an st bipolar orientation of a planar ordered graph g

f is the set of aligned paths g

b egin

 

Construct G V E E the constrained dual graph of G

w r

Set edge weights as follows e E w e

     

e E w e e E w e

w z

 

Calculate dv d v for the vertices of G G resp ectively

for each vertex v of G do

y v dv

for each edge e E do



xe d pe

end

Figure nding a constrained visibility representation

ìáâåî éåå÷ øåéö úàéöî :2.3 íéùøú

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Chapter

Drawings with Vertices Drawn as

Points

Introduction

In this chapter we consider drawing a planar graph on the rectilinear grid with no

crossings such that there are few b ends in the drawing of every edge Vertices are drawn

as p oints at intersections of grid lines Edges are drawn as nonintersecting paths on the

grid By denition drawable graphs are planar

In this chapter we denote G as the underlying undirected graph of the directed graph

G

Planar drawings on the rectilinear grid have b een studied b ecause of their applications

in VLSI planning and automatic graph and data drawing TDB Several asp ects of

the drawings have b een considered The area of the drawing is the area of the smallest

rectangle sides parallel to the grid lines containing the drawing The area is measured in

grid squares and is considered b etter when small It is known that every planar graph

can b e drawn in O n area Shi TT and that some planar graphs require n

area to b e drawn Shi Other prop erties of drawings which are of interest are the total

edgelength the maximum length of an edge MO and the total number of b ends

Sto Tam TT TTV A b end is a p oint in the path representing an edge in



which the path has a angle

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Our interest is in drawings which minimize b ends but instead of considering the total

number of b ends in the drawing we want to minimize the maximum number of b ends

which o ccur in any edge This is imp ortant where the drawing realizes a circuit and a b end

may cause delay or signal loss It also makes it easier for humans to follow the drawings

of the edges We call a drawing in which every edge has no more than k b ends a kbend

drawing See gure An algorithm in Tam given k and a planar representation

nds a k b end drawing consistent with the representation with the minimum total number

of b ends in O n log n time In TT a lineartime algorithm is given to nd a b end

drawing for simple graphs Kant Kan shows that every planar graph without self

lo ops and with ve vertices or more has a b end drawing However the choice of the

external face is determined by the algorithm

Figure a b end drawing which is not a b end drawing

éúééðô-2 àì àåäù éúééðô-3 øåéö :3.1 íéùøú

We describ e an algorithm that pro duces b end drawings for planar graphs and

b end drawings for planar graphs The drawings have O n area a total of O n b ends

and edges of length O n We then show a planar graph that has no b end drawing

and a planar graph that has no b end drawing The algorithm runs in linear time

We will draw each connected comp onent of the graph separately and thus consider

from now on only connected graphs

The algorithm starts by nding an LAVR of the graph without its self lo ops Next

the drawing is converted to a drawing with vertices drawn as p oints

Left Adjusted Visibility Representations

We start with some preliminaries

The input to our drawing algorithm is a planar ordered graph and a sp ecication of

the face which is to b e external If no external face is sp ecied we can choose any face

to b e external The output is a drawing congruous with the input data

Lineartime algorithms for checking the planarity of a graph and nding a planar

representation of it are known LEC ET BL CNAO HT Therefore if we

do not have a planar representation of the graph or do not know if the graph is planar

then we can check for planarity and nd a planar representation while keeping the running

time linear We will work with planar ordered graphs and assume that the data structure

of the graph sp ecies its planar representation

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

We assume knowledge of the discussion of st bip olar orientations and the related

denitions that app ear in section

Lemma A graph that has an st bipolar orientation is nonseparable

We denote the input graph without its self lo ops G Recall that the planar repre

sentation and chosen external face of G are derived from the input data The drawing

algorithm of this chapter uses an LAVR of G We show an algorithm that given G a

connected ordered graph with no self lo ops which may b e separable and f a face of G

nds an LAVR of G that is prop er and f is its external face This algorithm generalizes

the algorithm in RT describ ed in section to nd an LAVR of connected graphs

which are not necessarily nonseparable

0

Our algorithm mo dies G V E to form a planar ordered graph G V E G s

00

undirected underlying version G V E contains G as a subgraph and is nonseparable

00

The edges of G which corresp ond to edges in E E are called auxiliary If we remove

the auxiliary edges from G the planar representation is the same as that of G The con

struction of G from G is done as follows The edges of G are directed one nonseparable

comp onent after another Each comp onent is directed as an st bip olar orientation The

auxiliary edges are comp osed of up to one auxiliary edge for each directed comp onent

each auxiliary edge corresp onds to a dierent comp onent After directing the edges of

each comp onent the comp onents directed so far together with the auxiliary edges corre

sp onding to them constitute an st bip olar orientation we will call this temp orary graph

0

G The auxiliary edge corresp onding to each comp onent is determined at the time the

comp onent is directed but it is only added later The auxiliary edges are added only

after directing all of the edges When directing a comp onent C other than the rst that is

0

connected to G by a cut vertex u it is directed in one of two ways dep ending on u b eing

0

the sink of the face of G containing C see gure The auxiliary edge corresp onding

to C is also shown in gure However in case b of gure this edge may not b e

eventually added to the graph if it is not needed in this case there will b e no auxiliary

edge corresp onding to C in G

u

case a case b

t

e

new

comp onent

t

new

comp onent

s

s

u

e

e is the auxiliary edge corresp onding to the new comp onent

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Figure a visual description of the two cases of directing a nonseparable comp onent

÷éøô-éà áéëø ìù úåúù÷ì ïååë ïúî ìù íéø÷îä éðù ìù éìàåæéå øåàéú :3.2 íéùøú

Next the auxiliary edges are added to the graph This is done according to markings

made when directing the graph Following an LAVR of the new graph is found by the

algorithm in RT We remove the auxiliary edges from the visibility representation and

it remains an LAVR due to the sp ecial way the auxiliary edges have b een added Our

algorithm is describ ed in gures

Remarks

We p erform DFS on G to nd the nonseparable comp onents We start the DFS

e

t and choose the edges incident to a vertex in the order of their at the stedge s

r r

placement in the planar representation starting with the edge through which the

vertex has b een reached Later when we do a DFS on the nonseparable comp onents

tree we traverse the comp onents in the order in which their rst edge is traversed

here This ensures that we wont traverse a comp onent that is inside a face of

another yetuntraversed comp onent

The rst edge in the clo ckwise traversal of an external face of a comp onent starting

at the entry cutvertex of the comp onent can b e found easily It is the rst traversed

edge of the comp onent in the DFS used to determine the nonseparable comp onents

See remark

00

Observe that the edges of f are a subset of the edges of the face of G containing

00

f but some of the edges of this face may not b e directed yet These latter edges

b elong to the external faces of other comp onents of G

If a vertex is not a source or a sink and if its blo ck of incoming outgoing edges

consists of more than one edge then the rst and last edges of the blo ck are called

extreme The remaining visibility representation after the removal of the auxiliary edges

is ensured to b e left adjusted by making sure that no auxiliary edge is extreme

Lemma The auxiliary edges in G as constructed by the algorithm are not extreme

Proof After the rst edgeadding stage each of the added auxiliary edges is the only

00 0

incoming edge of its end vertex s In the edgeblo cks of their start vertex s these

edges are inserted b etween the two edges of f Therefore after the rst stage there are

no extreme auxiliary edges

After the second edgeadding stage each of the added auxiliary edges is the only

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

00 0

outgoing edge of its start vertex t In the edgeblo cks of their end vertices t they

are always inserted b etween the two edges of f Therefore the edges added in this stage

are not extreme What is left to show is that the edges that are added in the rst stage

do not b ecome extreme in the second stage This may happ en if an edge is added to an

edgeblo ck that contained only one auxiliary edge For this to happ en an incoming edge

has to b e added to a vertex marked as a temp orary source In the second stage we add

only incoming edges to vertices marked as sinks of faces A vertex marked as a temp orary

0

pro cedure LAVRG f

0

f G V E is a planar undirected ordered graph The face f is specied as external g

b egin

0

let s b e a vertex on f

r

e

0

let s t b e an edge in the clo ckwise traversal of f

r r

e

orientationG s t f see gure g

r r

f The current graph is G a directed version of G g

f Every face of G has two vertices marked as its source and sink g

f Also vertices may be marked as temporary sources or as temporary sinks g

for every face f of G do f rst adding stage g

b egin

0

let s b e the vertex marked as the source f

0

e

0 0

traverse f clo ckwise starting at s with s a

00 0

for every vertex s traversed that is marked as a temp orary source and isnt s do

0 00

b egin add a new auxiliary edge s s inside f end

0 0

f The added edges are ordered consecutively around s after e in their creation order g

the vertex marked as the sink of f is marked as the sink of all the newly created faces

end

f Now the faces of the current graph may be dierent g

for every face f of the current graph do f second adding stage g

b egin

0

let t b e the vertex marked as the sink of f

0

e

0 0

a traverse f clo ckwise starting at t with t

00 0

for every vertex t traversed that is marked as a temp orary sink and isnt t do

00 0

b egin add a new auxiliary edge t t inside f end

0 0

f The added edges are ordered consecutively around t after e in their creation order g

end

f We call the resulting nonseparable graph G g

nd an LAVR of G such that s t is the leftmost edge f RT section g

r r

remove the auxiliary edges from the LAVR of G to pro duce an LAVR of G

end

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Figure nding an LAVR of a connected graph

øéù÷ óøâ ìù ìàîùì øùåéî éåå÷ øåéö úàéöî :3.3 íéùøú

e

pro cedure orientationG s t

r r

f a subroutine of the algorithm in gure that directs the edges of G to produce G g

b egin

nd the nonseparable comp onents of G f see remark g

let c b e the comp onent containing e

r

nd the nonseparable comp onents tree of G such that the ro ot comp onent is c

r

e

direct the edges of c as an st bip olar orientation with s t b eing the st edge f ET g

r r r

00

mark the source sink of each face f of c as the source sink

r

00

of the face of G containing f f see remark g

do a DFS on the comp onent tree and when rst reaching a comp onent c other than c do

r

b egin f see remark g

0

let s b e the entry cutvertex of the comp onent in the tree

let f b e the external face of c

0 0 0

t b e the rst edge in the clo ckwise traversal of f starting at s f see remark g let s

0

if s is the vertex marked as the sink of the face of G that f is a part of then

b egin

0 0

direct the edges of c as an st bip olar orientation with t s b eing the st edge

0

mark t as a temp orary source

end

else

b egin

0 0

direct the edges of c as an st bip olar orientation with s t b eing the st edge

0

mark t as a temp orary sink

0

if s is marked as a temp orary sink then unmark it

end

00

mark the source sink of each face f of c other than f as the source sink

00

of the face of G containing f f see remark g

end end

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Figure a subroutine of the algorithm in gure

3.3 íéùøúá íúéøåâìàä ìù äøâéù :3.4 íéùøú

The dotted lines represent parts of the drawing that are removed due to the removal

of the auxiliary edges

Figure input and output of the LAVR algorithm

ìàîùì øùåéî éåå÷ øåéö úàéöîì íúéøåâìàä ìù èìôäå èì÷ä :3.5 íéùøú

source cannot b e marked as a sink of a face therefore G has no extreme auxiliary edges

Lemma G the undirected underlying version of G is a nonseparable planar or

dered graph

Proof G is planar and the auxiliary edges are added inside faces of the current graph

without introducing edge crossings Therefore G is a planar ordered graph

e

Next we show that G is an st bip olar orientation with s t b eing the st edge We

r r

have to show that s and t are the only source and sink of G and that G is acyclic

All the sources and sinks of G other than st are marked as temp orary sources and

temp orary sinks resp ectively Following we show that the vertices marked as temp orary

sources and sinks are not sources and sinks of G and therefore the only source and sink

of G are s and t

r r

Every vertex v that is marked as a temp orary source app ears on a face f of G for

which v is not marked as a source This is the face containing the external face of the

nonseparable comp onent closest to the ro ot in the comp onent tree that contains v In

the rst adding stage while traversing f an edge entering v is added Therefore v is not

a source of G

Every vertex v that is marked as a temp orary sink app ears on a face f of G for

which v is not marked as a sink If f is split to several faces in the rst adding stage the

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

resulting face that contains v still has the same marked source which is not v Therefore

in the second adding stage an edge leaving v is added Consequently v is not a sink of

G

Now we show that G has no directed cycles First we show that the faces of G are

not directed cycles and then we show that this implies that G has no directed cycles

Clearly the faces of G are not directed cycles Observe that after the rst adding

stage there are no faces that are directed cycles this is b ecause the new faces that are

formed by adding auxiliary edges have a source which is the start vertex of the auxiliary

edge After the second adding stage there are still no faces that are directed cycles since

the newly formed faces have a sink which is the end vertex of the new auxiliary edge So

we see that the faces of G are not directed cycles

We prove that G has no directed cycle by contradiction Lets assume that G has a

directed cycle We showed that G is planar We lo ok at a prop er planar drawing of G

in which the st edge is on the external face Every cycle in G b ounds a nite area in

the drawing We take a directed cycle c that b ounds the least area in the drawing The s

and t vertices are outside of the area c b ounds since they cant b e on c and the st edge

is on the external face This implies that there is no source or sink inside the b ounded

area There must b e an edge incident to a vertex on c that is drawn in the b ounded

area otherwise c is a face and we have seen that a face cant b e a directed cycle We

trace a path in the b ounded area starting with this edge going through edges in the same

direction until we reach a vertex which is on c This must happ en since there is neither

a source nor a sink nor a smaller directed cycle in the b ounded area This path with

a part of c constitutes a smaller directed cycle A contradiction

Thus G has no directed cycles and has only one source and one sink connected by

an edge rendering it an st bip olar orientation By Lemma G is nonseparable

Theorem The algorithm in gure nds an LAVR for any connected planar or

dered graph with no self loops Also the drawing is proper and has the given external

face

Proof G is a subgraph of G The planar representation of the original edges is the

same We have shown in Lemma that G is nonseparable and planar and therefore

we can nd an LAVR of it RT After deleting the auxiliary edges we get a visibility

representation of the original graph which is prop er

The side of the st edge which is in the given external face of G is drawn in the

external face of the LAVR of G After the deletion of the auxiliary edges it stays in the

external face of the drawing Therefore the given external face which contains this side

of the st edge is the external face of the drawing of G

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

What is left to b e shown is that the visibility representation of G that is pro duced is

left adjusted The edges that are removed the auxiliary edges are not extreme as shown

in Lemma Therefore the leftmost edge of an edgeblo ck is not removed unless the

edgeblo ck contains only this edge or the vertex of the edgeblo ck is a source or a sink

of G This means that a vertex that has b oth outgoing and incoming edges in G will

either keep b oth its leftmost incoming and outgoing edges or it will b ecome a source or

a sink of G Therefore the drawing remains an LAVR after the deletion of the auxiliary

edges

Clearly the algorithm for nding an LAVR runs in linear time including the algorithm

used from RT which runs in linear time see section As we will see in the following

section changing the LAVR to the wanted drawing can also b e done in linear time Thus

the whole pro cedure runs in linear time

Let us consider the area of the determined LAVR We get an LAVR for G as in

0 0 0

RT We denote the number of faces edges and vertices of G by f m n resp ectively

According to the algorithm of RT see section the height of the LAVR is at most

0 0

n n and its width is at most f The original graph is planar so we

0

have m n We add at most n auxiliary edges so we have m n By Eulers

0 0 0

formula we have f m n n n n Therefore the width of

the LAVR is at most n and its height is at most n

Drawing Vertices as Points

In this section we consider the construction of a planar drawing with vertices drawn as

p oints

A self lo op adjacent to a vertex of degree four whose endp oints do not app ear con

secutively around the vertex can not b e drawn with less than b ends These incidences

can b e searched for and corrected by changing the planar representation at such vertices

in linear time It is the the only exception in which the planar representation has to b e

changed

If the graph has only one vertex and two self lo ops then we will draw it in the obvious

way A problem arises if a face containing only one of the self lo ops is supp osed to b e

the external face There is no b end drawing of this case in fact a b end drawing is

required This is the only exception to the free choice of the external face

If the connected graph has more than one vertex then we will use a pro cedure similar

to the one used in TT to create the desired drawing We nd an LAVR of the graph

without its self lo ops using the algorithm in gure Next we change the drawing so

that vertices are drawn as p oints This is done by applying transformations to the vertices

A transformation on a vertex in the LAVR transforms the shap e of the vertex and the

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

connections of its incident edges It also adds a self lo op to the vertex if one existed in the

original graph The shap es of edges change just near their ends the rest remains a vertical

line The transformations are describ ed in gure Some transformations require new

grid lines to b e added to the drawing These are inserted to the drawing so that all the

lines in the new shap e of the vertex can b e drawn on grid lines This increases the area of

the drawing The height and width of the drawing are increased with each transformation

by at most two Therefore the height and width of the drawing increase by no more than

The horizontal p osition of the edges n each and the area of the drawing remains O n

after the transformations stays the same except for the comp ensations for the added

grid lines The nal drawing can b e found in linear time

Another approach to the pro duction of the nal drawing is to mo dify the transfor

mations to record only the shap e of the drawing but omit the length of the lines This

pro cedure pro duces an orthogonal representation TT The orthogonal representation

can b e converted to the nal drawing in linear time Tam This approach may lead

to a smaller multiplicative constant in the b ound on the total number of b ends in the

drawing but it also leads to a bigger constant in the b ound on the area

T1 T13 T7 T19 T2 T14

T8 T15 T20 T3

T16 T21 T9 T4 T22

T10 T17 T23 T5 T11 T18 T24

T6 T12

Figure transformations on the drawings of vertices in an LAVR

ìàîùì øùåéî éåå÷ ÷åéöá úåúù÷ä øåéö ìò úåéöîøåôñðøè :3.6 íéùøú

The op eration of the whole drawing pro cedure is illustrated in gure The graph

drawn is taken from TTV

Theorem After performing the transformations every edge has no more than

bends

Proof In the pro of we will lo ok at the edges of G as directed The directions induced by

the visibility representation of G are the same as in G All the transformations except

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

for T T present no more than two b ends at the b ottom of an edge and no more than

one b end at the top of an edge Therefore every edge that isnt the leftmost incoming

edge of a vertex on which T or T has b een p erformed has no more than three b ends

What is left to prove is that those edges which have two b ends at the top have no

e

0 00

more than one b end at the b ottom Such an edge v v is the st edge of the st bip olar

orientation of its comp onent c since it is the leftmost incoming edge of the sink of c This

0

among those which b elong to c If e is implies that e is the leftmost outgoing edge of v (a) (c)

(b)

a a graph b an LAVR of the graph c a b end drawing of the graph

Figure a demonstration of the algorithm

íúéøåâìàä ìù äîâãä :3.7 íéùøú

0

not the rightmost outgoing edge of v then it has no more than one b end in the b ottom

0

Otherwise e is the only outgoing edge of v b elonging to c so c is comp osed only of e This

00

means that there are two comp onents connected at v and they are b oth in the external

e

00 00 0

v is s t So face of the other This is p ossible only if v is t which implies that v

r r r

e is the leftmost outgoing edge of v which is a source and therefore e has no more than

one b end at the b ottom

It is imp ortant that we use an LAVR since the transformations work only on left

adjusted vertices Otherwise we could have had vertices with shap es for which suitable

transformations dont exist

The transformations of vertices without self lo ops present at most four b ends at each

vertex Therefore the total number of b ends is at most n In case of a graph with self

lo ops two of the transformations present six b ends thus increasing the upp er b ound on

the total number of b ends The edges remain of length O n

When the algorithm is applied to a planar graph with no self lo ops the transfor

mations present at most one b end at each end of every edge Thus a b end drawing is

pro duced for planar graphs For planar graphs one can transform the LAVR into a

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

rectilinear drawing by simply choosing a p oint to represent each vertex Obviously the

area stays the same as in the LAVR

Here is an example of a vertex with a shap e that cant app ear in an LAVR for which

1

there is no transformation that presents no more than two b ends at the b ottom of

an edge and no more than one b end at the top of an edge

Graphs That Are Hard to Draw

We show here graphs that are hard to draw These graphs are not ordered graphs

Following we prove that there isnt a b end b end drawing for every planar

planar graph

Lemma The planar and triangulated simple graph in which every vertex is of degree

four octahedron see gure has no bend drawing

Proof This graph is triconnected and therefore has only one planar representation

which uniquely determines the faces We choose any face to b e the external face and

show that it cant b e drawn with no more than two b ends in each edge in a way that the

rest of the graph can b e drawn inside

The external face as all the others has three edges and its three vertices are of degree



four In the drawing of the external face the drawing of each vertex must have a angle

 

and a angle where the angle must b e inside otherwise the two edges that are

incident to the vertex and are not in the external face cant b e connected to the vertex

We show that such a drawing of the external face is not p ossible with at most two b ends

in each edge

When we go around the drawing of the face which is a closed curve at the drawing



of each vertex we turn towards the outside of the curve To close the curve we must



turn towards the inside of the curve and to comp ensate for the turns at the vertices

 

we must turn inside Each b end on an edge can turn at most inside so we will

b ends to draw the face With at most two b ends in each of the three need at least

edges there cant b e seven b ends in the external face

o ctahedron tetrahedron

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Figure the graphs used in lemmas and

. 3.4,3.5 úåîìá ùåîéùáù íéôøâä :3.8 íéùøú

Lemma The planar and triangulated simple graph in which every vertex is of degree

three tetrahedron see gure has no bend drawing

Proof The pro of is similar to the previous lemma Again we show we cant draw the

external face in a way that the rest of the graph can b e drawn Here at every vertex at

 

b est we turn so we have to turn inside with the b ends This requires four b ends

but with at most one b end in each of the three edges there cant b e four b ends in the

external face

Lemmas and imply that for k there is a k planar graph for which a

k b end drawing do es not exist The case for k is trivial

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Chapter

Drawings with Vertices Drawn as

Rectangular Mo dules

Introduction

In this chapter we consider drawings in which the vertices are drawn as rectangular

mo dules on the grid that is blo ck diagrams Not much work has b een done on drawings

in which vertices are more complex structures in spite of the fact that this approach is

natural in VLSI where the vertices can represent predened mo dules

As b efore our interest is in drawings which have a small constant upp er b ound on the

number of b ends which o ccur in any edge This is imp ortant where the drawing realizes

a circuit and a b end may cause delay or signal loss

We want to control certain qualities of the blo ck diagram that we draw nd a layout

of Therefore more data is sp ecied in the input than just a graph

The input for drawing a blo ck diagram called a module description consists of

A set of rectangular mo dules of integral dimensions Each mo dule has a set of

terminals which are designated p oints on the mo dules p erimeter at integral places

A set of connections Each connection has two designated terminals which are its

endp oints and each terminal is an endp oint of exactly one connection

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

The task of drawing the blo ck diagram on the rectilinear planar grid consists of

Placing each mo dule on the grid adjusted to the grid lines The placed mo dules

are nonoverlapping and do not touch each other

Drawing each connection as a path on the grid so that

No two such paths share a gridedge

If two paths share a grid p oint then they cross each other at that p oint

No path shares any p oint with any mo dule except its designated endp oints

Such a drawing is referred to as a gridlayout of the mo dule description If no two

paths intersect the gridlayout is called planar See gure

Figure a b end planar gridlayout which is not b end

úéúééðô-2 àì àéäù úéúééðô-3 úéøåùéî úéâéøñ äùéøô :4.1 íéùøú

Clearly a mo dule description corresp onds to an ordered graph Each mo dule is rep

resented by a vertex and each connection is represented by an edge of the graph Note

that the ordered graph is not necessarily simple it may have parallel edges and selflo ops

If this ordered graph is planar we say that the mo dule description is planar A mo dule

description has a planar gridlayout without ippings if and only if it is planar

When referring to a mo dule description we will frequently use terms b elonging to

the corresp onding ordered graph That is we will say edge and degree of a vertex in

stead of connection and number of terminals on a mo dule We denote the ordered graph

corresp onding to the input mo dule description as GV E

There are several natural tasks concerning gridlayout They can b e classied accord

ing to the following issues

Do we insist on a planar gridlayout If we do the corresp onding ordered graph

must b e planar

Do we allow to ip mo dules Of course ipping a mo dule reverses the edgeordering

in the corresp onding vertex

There are known lineartime algorithms to check if a given ordered graph is planar

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Also in case ipping is allowed there is a known lineartime algorithm to check if a

ipping exists for which the resulting ordered graph is planar and if so to sp ecify such

a ipping Applying these ippings to the original mo dule description yields a planar

mo dule description In such a case the mo dule description is called ipplanar We allow

rotation of the mo dules since it do es not eect planarity

Here b ends have the same meaning as b efore A bend is a p oint of a path in a grid



turn we say that the corresp onding edge of the layout in which the path makes a

ordered graph has a b end A gridlayout is called kbend if no edge path has more than

k b ends

In this chapter we present two lineartime algorithms

For any given planar mo dule description as well as a sp ecied external face a

b end planar gridlayout is constructed Each edge which is not a selflo op has

at most b ends This result is the b est p ossible in the following sense There

are ipplanar mo dule descriptions with selflo ops for which none of their planar

mo dule descriptions after ippings has a b end planar gridlayout Also there

are ipplanar mo dule descriptions without selflo ops for which none of their planar

mo dule descriptions has a b end planar gridlayout

For any mo dule description a b end gridlayout is constructed It may b e nonpla

nar There is no need to rotate or ip any mo dule Again this result is the b est

p ossible in the following sense There are mo dule descriptions for which no b end

gridlayout exists even if rotation and ipping is allowed

e

e

v for an edge e which connects vertices u and v and uv for We use the notation u

a directed edge e from u to v

Planarity Checking

The planar gridlayout problem is divided into two indep endent parts The rst part

is checking if the input is planar This is dierent when ippings are allowed or not

Both cases have known lineartime solutions The second part is nding a corresp onding

gridlayout

In case ippings are not allowed we need to know if the input mo dule description

is planar One may use a lineartime algorithm Zak Pin Ami to check if the

mo dule description is planar

In case ippings are allowed we need to check if by ipping some of the mo dules we

can get a planar mo dule description In this case we say that the mo dule description is

ipplanar Pinter Pin shows a lineartime algorithm to determine if a given mo dule

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

description is ipplanar For the drawing algorithm we also need the actual planar mo dule

description which we get by ipping some of the mo dules Following is a description of

Pinters algorithm

0

Create a new nonordered graph G a mo dication of the input ordered graph G in

which every vertex of degree three or more is replaced by a wheel as shown in Figure

0

G is called the wheel graph corresp onding to G

The following lemma is a well known corollary of a theorem of Whitney Whi

Figure changing a vertex to a wheel

ìâìâì úîåö éåðéù :4.2 íéùøú

Lemma A planar triconnected graph with no self loops has only one planar repre

sentation up to ipping the whole graph

Proof In Whi it is shown that a planar triconnected graph with no self lo ops has the

same faces in any planar drawing The meaning of the same face there is the same set

of edges b elonging to the face Since the graph is nonseparable and has no self lo ops a

vertex may not app ear more than once in a face Every face is a simple cycle Therefore

there are exactly two p ossibilities for the clo ckwise order of the edges in each face when

one is the reverse of the other

We have seen that there are two p ossibilities to order the edges in each face Now

we will lo ok at the relation b etween the selections of the order of each face Let us

lo ok at some planar drawing of the graph on the sphere and at an arbitrary face f of

the drawing Each edge app ears on two dierent faces and when walking clo ckwise along

the two faces we pass the edge in opp osite directions This means that the selection the

order of the face at one side of the edge determines the order of the face on the other

side We lo ok at the order of f in the drawing since the dual graph is connected this

order determines the order of all other faces without having to refer to the drawing The

clo ckwise order of the edges in each face gives us a planar representation We have seen

that the clo ckwise order of the edges in f determines the edge ordering Since there are

two reverse not necessarily dierent p ossibilities for this order there are at most two

planar representations of the graph What is left to show is that the other edge ordering

if dierent is a planar representation and that one of these planar representations is the

ipp ed version of the other This can b e seen by taking a planar drawing on the sphere

and turning the sphere inside out

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Lemma A module description is ipplanar if and only if its corresponding wheel

graph is planar

Proof If the wheel graph is planar there is a planar drawing of it Since each wheel is

triconnected it has only one planar representation up to ipping by lemma The order

of the edges around the center of the wheel is either identical to the edge order around

the original vertex or is its reversal By removing the edges and vertices of the rim of the

wheel we get a planar drawing of the original graph

If there is a planar drawing of the graph that corresp onds to a ipplanar mo dule

description then by adding a small circle around each vertex in the drawing we get a

planar drawing of the wheel graph Therefore the wheel graph is planar

0

To check if a drawing is p ossible we check if G is planar LEC ET BL HT

0

If G is planar we make it a planar ordered graph CNAO and extract from it an edge

ordering that makes G a planar ordered graph The clo ckwise cyclic order of the edges

incident to a vertex is the order of the corresp onding radial edges in the wheel around the

center This shows what mo dules are ipp ed yielding a planar mo dule description To

summarize

Theorem There is a lineartime algorithm that checks if a module description is ip

planar and if it is produces a corresponding planar module description and a specication

of the ipped modules

All the algorithms used in this section run in linear time The remaining task is to

construct a planar gridlayout for the planar mo dule description at hand

Planar GridLayouts The Case of No Self

Lo ops

We assume G is connected for otherwise we can draw a planar gridlayout of each con

nected comp onent separately The connected comp onents of a graph can b e found in

linear time Thus we show that any graph can b e drawn in linear time by showing

that connected graphs can b e drawn in linear time In this section we assume G has no

selflo ops

We draw G in several stages Following we give an overview of the algorithm and

later discuss the details First some edges may b e added and the edges of the ordered

graph are directed to b ecome an st bip olar orientation Next the rotation of the drawing

of each vertex is determined that is for every vertex we choose one of the four p ossible

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

rotations for its mo dule Following the edges incident to each vertex are divided to edges

that will b e drawn to the right or to the left of the mo dule Then we nd a visibility

representation of the ordered graph with enough space in it to accommo date the drawings

of the mo dules And nally we translate the visibility representation to the gridlayout

by drawing the mo dules Now let us present a more detailed description

If the graph is nonseparable we nd an st bip olar orientation of it ET Otherwise

we rst add edges to the ordered graph which make it nonseparable without impairing

its planarity This is done without changing the order around vertices of the edges of the

input ordered graph it can b e done by adding edges inside faces in which a cut vertex

app ears more than once or as describ ed in the previous chapter Next we nd an st

bip olar orientation of the new ordered graph The added edges are called auxiliary and

are not drawn in the gridlayout As in ET one may choose any edge to b e st We

choose an edge such that when it is draw vertically with s at the b ottom the face we

want to b e external is on its left hand side This ensures that the sp ecied face will b e

external Henceforth we consider the ordered graph to b e directed the edges having the

directions of the st bip olar orientation

Next for each vertex we want to determine the rotation of its mo dules drawing and

divide its incident edges to two subsets one containing edges that will b e drawn to the

right of the vertex and the other containing edges that will b e drawn to the left of the

vertex

First let us describ e how this is done for vertices which are neither s nor t We need to

know which edges are the leftmost and rightmost edges of the incoming outgoing edges

incident to a vertex Lemma implies that there is no ambiguity in their indication for

vertices other than s and t

Lemma implies that the p erimeter of the mo dule can b e divided to two paths

one incident only to incoming edges and the other incident only to outgoing edges The

mo dule can b e rotated such that the path of outgoing edges has a section on the top of

the mo dule and the path of incoming edges has a section at the b ottom of the mo dule

Figure demonstrates how this can b e done More than one appropriate rotation may

b e p ossible

Figure rotation of a vertex which is not a source nor a sink

øå÷î àìå øåá àì àåäù úîåö ìù áåáéñä úòéá÷ :4.3 íéùøú

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

the marked path on the p erimeter of the mo dule is the path that contains

only outgoing edges and should have a section on the top of the mo dule

etc

We choose a p oint on the path incident to outgoing edges which is on the top of the

mo dule and a p oint on the path incident to incoming edges which is at the b ottom of the

mo dule Such p oints exist due to the way the paths have b een selected These two p oints

divide the p erimeter of the mo dule to two new paths The edges incident to the new path

which contains the right hand side of the mo dule are the edges that will b e drawn to the

right of the vertex The edges incident to the other new path which contains the left hand

side of the mo dule are the edges that will b e drawn to the left of the vertex Although

the auxiliary edges are marked as drawn to the right or to the left of the mo dule they

will not b e actually drawn

Now we deal with s and t First we consider the edge st to b e the leftmost edge

of s and t Since s t has only outgoing incoming edges we choose a p oint on the

p erimeter of the mo dule b etween the leftmost and rightmost incident edges and consider

it to b e the path incident to incoming outgoing edges The rotation of the mo dule

and the division of the incident edges is done as with the other vertices Note that this

ensures that st will b e the leftmost edge of the resulting visibility representation and

the correct face will b e external

Next for every vertex we determine how much space the drawing of the vertex needs

We calculate for every vertex a quantity called the drawn height of the vertex The drawn

height is comp osed of the height of the mo dule plus added space b elow and ab ove the

mo dule The size of the added space ab ove b elow the mo dule is the maximum of the

number of edges incident to the top b ottom of the mo dule that are drawn to its left

and the number of edges incident to the top b ottom of the mo dule that are drawn to

its right

Next we want to construct a visibility representation so that each vertex will have

the space needed to draw its mo dule and its connections This requires that if we stretch

each vertex of the visibility representation downwards to b e in the height of its drawn

height the vertices of the visibility representation will remain nonoverlapping We also

require that in the drawing of each vertex v in the visibility representation there will b e

a section having the width of the mo dule of v with the following prop erties All edges

to b e drawn to the right left of v are incident to v at p oints to the right left of the

section therefore no edge is incident to v at this section

Such a visibility representation can b e found using the algorithm of DTT This

algorithm nds a visibility representation for an st bip olar orientation with certain sp ec

ied directed paths of the st bip olar orientation drawn as straight vertical lines That

is the edges of each such path are vertically aligned The given paths are required not

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

to cross each other in a prop er planar drawing of the ordered graph In this algorithm

the co ordinates of the visibility representation are found by two top ological orderings

A topological ordering for a directed acyclic graph with nonnegative edge weights is an

assignment of a p ositive integer to each vertex such that for each edge the number as

signed to its destination minus the number assigned to its origin is greater than or equal

to the weight of the edge One ordering is done on the vertices of the original graph

and the other is done on the vertices of a mo dication of the dual graph The weights

represent the minimal space b elow a vertex in the rst top ological ordering and represent

the minimal space to the right of an edge in the second top ological ordering Following

we describ e how to determine the weights and how to sp ecify the paths to b e aligned

For a vertex that has incoming outgoing edges drawn to the left of the vertex we

will call the rightmost incoming outgoing edge which is drawn to the left of the vertex

aligned at the vertex If a vertex has incoming outgoing edges but they are all drawn to

the right of the vertex we duplicate the leftmost incoming outgoing edge The duplicate

edge will b e considered drawn to the left of the vertex and will b e called aligned at the

vertex The added edge is auxiliary and will not app ear in the gridlayout

For every vertex which is neither the source nor the sink of the st bip olar orientation

its incoming aligned edge and outgoing aligned edge will b e put in a path to b e aligned

in the visibility representation This path may continue farther if any of these two edges

are aligned at their other end vertices The paths created do not cross each other in a

prop er planar drawing of the ordered graph since by denition there can b e at most one

path which passes through a vertex

The weight of an edge in the top ological ordering of the original graph including the

auxiliary edges is the drawn height of its target vertex plus The weight of an edge

in the top ological ordering of the mo died dual graph is as follows If the corresp onding

edge is aligned at one of its end vertices its weight is the vertexs mo dule width plus

If the edge is aligned at b oth of its end vertices its weight will have the greater value of

the two mo dule widths plus Otherwise the edge will have a weight equal to

The sp ecication of the input to the visibility representation algorithm ensures us that

the visibility representation pro duced will b e as required There will b e a section of the

line representing the vertex with length greater than or equal to the mo dule width plus

with no incident edges and it will b e to the right of the edges aligned at the vertex

Finally we translate the visibility representation to the gridlayout changing the draw

ing of each vertex We make all the changes to the drawing of the vertex in an area of the

size of a rectangle whose top side is on the line of the vertex in the visibility representa

tion The height of the rectangle is the drawn height of the vertex plus The mo dule

itself is drawn b elow the section of the vertex in the visibility representation that has no

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

incident edges such that it will have the correct amount of space ab ove and b elow it as

calculated in the drawn height See gure

For every edge incident to the right and left sides of the mo dule a horizontal line is

drawn connecting its terminal with the vertical line representing the edge in the visibility

representation For every edge incident to the b ottom and top of the mo dule two lines

are used for the connection A vertical line originating at the terminal and a horizontal

line The horizontal lines of the edges incident to the top b ottom of the mo dule that

are drawn to the right left of the mo dule are stowed next to the mo dule See gure

b

RR R

R L

L

R

a

RR L

c

Figure the steps of drawing a mo dule in the algorithm

íúéøåâìàá ìåãåî ìù øåéöä éáìù :4.4 íéùøú

a after the edges are directed the rotation of the mo dule is determined

and the incident edges divided to edges drawn to the left and to the right

of the mo dule this is done by twice dividing the p erimeter of the mo dule

to two paths b the drawing of the vertex in the visibility representation

c the nal drawing of the mo dule in the gridlayout

This pro duces the gridlayout The connection of an edge to a mo dule introduces one

b end when incident to the right or left side of the mo dule and two b ends when incident

to the top or b ottom of the mo dule An edge has at most two b ends at the top at most

two b ends at the b ottom and no b ends in b etween Thus an edge has no more than four

b ends in the gridlayout

Theorem A lineartime algorithm exists that given a planar module description with

no selfloops nds a corresponding bend planar gridlayout

Planar GridLayouts The Case With SelfLo ops

Self lo ops imp ose a problem A visibility representation can not represent self lo ops Also

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

some mo dule descriptions with self lo ops have no b end drawings as shown in lemma

Following we describ e how we deal with mo dule descriptions that may have self lo ops

Before drawing a mo dule description we put a new vertex in the middle of every

selflo op that is replace every selflo op by two edges and a new vertex This is shown in

gure b The newly created vertices are called dummy vertices and the vertices of

the original graph are called normal The dummy vertices will b e drawn dierently from

normal vertices they will not b e drawn as mo dules Other than this the graph is drawn

in the same way as describ ed in the previous section

After introducing the dummy vertices the resulting graph is separable and we use the

techniques describ ed in the previous section to make it nonseparable For each normal

vertex we determine the rotation of the mo dule and the placement to the right or to the

left of the incident edges as in section

Next we nd a visibility representation of the graph with enough space in it to accom

mo date the drawings of the vertices The weights of the edges in the top ological ordering

of the original graph are determined as b efore when the drawn height of dummy vertices

is zero The weights of the edges in the top ological ordering of the mo died dual graph

are determined as b efore when no edge is considered aligned at a dummy vertex

When translating the visibility representation we do not change the drawing of the

dummy vertices we just change the drawing of the normal vertices as b efore The hor

izontal line representing a dummy vertex together with the drawing of the two edges

incident to it constitute the drawing of the selflo op in the gridlayout

t w t

t v

w

u

v

su

v

L RR

v

v

v u

u

su

w

u

a b c d e f

L RR

Figure drawing a graph that has selflo ops

íééîöò íéâåç ìòá óøâ øåéö :4.5 íéùøú

the steps of nding the drawing are shown a the input b the input

graph after changing the selflo ops the choice of st and of the external

face c the st bip olar orientation the edges are drawn upward according

to their direction d the rotation of the mo dules and the division of edges

to b e drawn to the left or to the right of the mo dule e the visibility

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

representation f the nal gridlayout

This yields a gridlayout of a mo dule description with selflo ops A demonstration run

of the algorithm is describ ed in gure Edges which are not selflo ops have as b efore

at most four b ends Self lo ops are comp osed of two edges and a dummy vertex in the

visibility representation Each of these two edges has at most two b ends near the normal

vertex the selflo op is incident to and exactly two b ends at the drawing of the dummy

vertex in the visibility representation Thus selflo ops have a total of at most six b ends

Theorem A lineartime algorithm exists that given a planar module description

nds a corresponding bend planar gridlayout in which every edge that is not a selfloop

has at most bends

The co ordinates of the drawing are determined by the two top ological orderings there

fore the maximal co ordinate is smaller than the sum of the edge weights We denote the

sum of the widths of the mo dules in their rotation in the gridlayout by W and the sum

of the heights of the mo dules by H So the width and height of the pro duced drawing are

W O jE j H O jE j resp ectively

Mo dule Descriptions that are Hard to Draw

There are lineartime algorithms to check if a mo dule description is planar or ipplanar

We have shown a lineartime algorithm that given a planar mo dule description nds a

corresp onding b end planar gridlayout in which every edge that is not a selflo op has at

most b ends Thus the whole pro cess of nding a planar gridlayout for a given mo dule

description if one exists can b e done in linear time As far as the upp er b ounds on the

number of b ends in each edge are concerned we give examples of planar mo dule descrip

tions which demonstrate that our b ounds are tight See gure These examples do

not dep end on mo dule ippings or on the choice of the external face

a b

Figure planar mo dule descriptions that do not draw well

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

áèéä íéøééèöî àìù íééøåùéî íéìåãåî éèì÷ :4.6 íéùøú

a requires at least b ends for some edge b requires at least b ends for

some selflo op

Lemma The module description in gure a has no bend gridlayout

Proof We show that any gridlayout of the mo dule description has an edge that must

have at least b ends Notice that ipping only one of the mo dules would make the

mo dule description nonplanar First we lo ok at the rotation of the two mo dules only

their relative angle is imp ortant For any planar gridlayout there is a side A of the rst

mo dule and a side B of the second mo dule such that

A faces the same direction as the opp osite side of B

an edge connects A and B

an edge connects the opp osite sides of A and B

One of these edges needs at least b ends

Lemma The module description in gure b has no bend gridlayout

Proof Each of the self lo ops needs at least b end to b e drawn if the face comp osed only

of that self lo op is not the external face Since only one of these faces can b e external at

least one of the self lo ops has at least b ends

An Application

The drawing algorithm we presented can draw the gridlayout with any sp ecied external

face This is imp ortant since it enables us to pro duce a planar gridlayout including

external connections

This is demonstrated in the following example which is an application of the drawing

algorithm

We consider constructing a planar gridlayout intended to b e the internal layout of

a big mo dule Ideally we would get the description of the big mo dule consisting of its

size the placement of its terminals and the mo dule description of its inside That is

in addition to the inner mo dule description its external face is sp ecied as well as the

following constraints on external terminals For each external terminal a connection to

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

a terminal on the p erimeter of an inner mo dule is sp ecied Notice that the additional

sp ecication of the terminals of the big mo dule may cause the input to b ecome nonplanar

Unfortunately the problem of nding if such a planar gridlayout exists is hard Consider

an input with no edges The problem b ecomes the D binpacking problem which is NP

hard In certain cases the following approach solves the problem Find a gridlayout of

the inside of the mo dule and if it is not to o big connect it to the p erimeter of the big

mo dule This can b e done as follows

Add four sp ecial vertices to the inner mo dule description These vertices represent the

sides of the big mo dules p erimeter The sp ecial mo dules are connected to the original

mo dule description by edges representing the terminals of the big mo dule and the sp ecial

mo dules are also connected to each other see gure a Also the sp ecial mo dules

will b e drawn in the same rotation as they have in gure a This is p ossible since

these rotations comply with the rules of selecting a rotation and one may select any such

compliant rotation A gridlayout of the new mo dule description is constructed using our

algorithm Also the st is chosen as in gure a

the st edge

a b

the

original

c

mo dule

description

Figure an example of an application planar layout of a big mo dule

ìåãâ ìåãåî ìù úéøåùéî äùéøô - íåùééì àîâåã :4.7 íéùøú

a the new mo dule description b the gridlayout pro duced after removing

edges b etween the sp ecial mo dules c the nal layout of the big mo dule

If the gridlayout pro duced is bigger than the size given for the big mo dule we fail

If not erase from the gridlayout the edges that connect the sp ecial mo dules see g

ure b Remove the drawings of the sp ecial mo dules and change the drawing of the

remaining edges connected to them so they connect to the terminals of the big mo dule

on its p erimeter This is demonstrated in gure c

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Chapter

NonPlanar Drawings

In this chapter we consider the nonplanar versions of the problems we dealt with b efore

Namely there is no requirement that that the input or the output b e planar We allow

edges to cross one another in the drawings In this chapter the fact that a drawing is

called kb end do es not imply that the drawing is planar

Vertices as Points

We call a graph with no self lo ops which has no vertex of degree greater than d a d

graph Biedl Bie describ es a lineartime algorithm that nds a b end drawing for

every graph

Techniques similar to Biedls can b e used to nd in lineartime a b end drawing for

any simple Graph

It is trivial to nd a graph with no b end drawing and a graph with no b end

drawing

Vertices as Mo dules GridLayouts

In this section we consider the nonplanar versions of the problems we dealt with in chap

ter The input mo dule description is not assumed to b e planar and even if it is the

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

output gridlayout is not required to b e planar

We show how to nd b end nonplanar gridlayout of any mo dule description The

ippings of the mo dules and the angle in which they are drawn may b e determined

arbitrarily The input to the algorithm is a mo dule description and it includes the rotation

in which each mo dule is to b e drawn A lineartime drawing algorithm is describ ed in

gure The algorithm is demonstrated in gure The algorithm works by rst

placing the mo dules diagonally so that if we continue the line of any terminal it do es

not hit any mo dule Next we complete the drawing of the edges

pro cedure NPGLM

f M is a module description with a rotation specied for each module g

b egin

place the mo dules in the drawings diagonally such that

the drawings of two mo dules do not share any row or column

R the smallest rectangle on the grid which contains all mo dules

for every edge e of M do

b egin

continue the lines of the two terminals of e till they exit from R

and connect them by at most lines around the b oundary of R

expand R to contain the drawing of e

end

end

Figure construction of a b end nonplanar gridlayout

(úéøåùéî àì) úéúééðô-4 úéâéøñ äùéøô úééðá :5.1 íéùøú

Figure output of the nonplanar gridlayout algorithm

úéøåùéî àìä úéâéøñä äùéøôä úàéöî íúéøåâìà ìù èìô :5.2 íéùøú

the edges are numbered in the order in which they are added by the algo rithm

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Theorem Algorithm NPGL see gure nds in lineartime a bend nonplanar

gridlayout for any module description with any specied rotations of the modules

The area of the gridlayouts has the same upp er b ound as for the planar gridlayouts

Finally we mention two mo dule descriptions which have no b end gridlayout The

rst mo dule description consists of one mo dule which has one selflo op The terminals of

the selflo op are on opp osite sides of this mo dule Clearly the self lo op needs at least

b ends The second mo dule description has two mo dules and sixteen edges Every side of

one mo dule is connected by one edge to every side of the other mo dule

Lemma A module description that has two modules and sixteen edges such that

every side of one module is connected by one edge to every side of the other module has

no bend gridlayout

Proof We lo ok at any gridlayout of the mo dule description and show an edge that must

have at least b ends in this gridlayout First we lo ok at the placement and the rotation

of the two mo dules The mo dules are b oth drawn nonoverlapping on the grid therefore

the following holds There is a side A of the rst mo dule and a side B of the second

mo dule such that A and B are parallel and the terminals exit A and B in opp osite

directions Every side of the rst mo dule is connected by one edge to every side of the

second mo dule Therefore one edge connects A and B and it must have b ends in the gridlayout

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

Biblio graphy

Ami A Amiho o d A direct lineartime planarity test for unippable mo dules In

tern J Computer Math vol pp

Bie T Biedl Embedding nonplanar graphs in the rectangular grid Technical

Rep ort RUTCOR Rutgers University

BK T Biedl and G Kant A b etter heuristic for orthogonal graph drawings In

ESA to appear in Lecture Notes in Computer Science SpringerVerlag

BL K S Bo oth and G S Lueker Testing for the consecutive ones prop erty inter

val graphs and graph planarity using PQtree algorithms Journal Comput

System Sci vol pp

CNAO N Chiba T Nishizeki S Ab e and T Ozawa A linear algorithm for embed

ding planar graphs using PQtrees Journal Comput System Sci vol pp

DETT G Di Battista P Eades R Tamassia and I G Tollis Algorithms

for drawing graphs an annotated bibliography This do cument is avail

able via anonymous ftp from wilmacsbrownedu les

pubpaperscompgeogdbibliotexZ and

pubpaperscompgeogdbibliopsZ

DTT G Di Battista R Tamassia and I G Tollis Constrained visibility represen

tations of graphs Information Processing Letters vol pp

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

ET S Even and R E Tarjan Computing an stnumbering Theoretical Computer

Science vol pp

Eve S Even Graph Algorithms Computer Science Press

HT J Hop croft and R Tarjan Ecient J Assoc Comput

Mach vol pp

Kan G Kant Drawing planar graphs using the lmcordering In Proc of the rd

Annual IEEE Conference on Foundations of Computer Science pp

LEC A S Lemp el S Even and I Cederbaum An algorithm for planarity testing of

graphs In P Rosenstiehl editor Theory of Graphs International Symposium

Rome pp New York Gordon and Breach

MO Z Miller and J B Orlin NPcompleteness for minimizing maximum edge

length in grid embeddings Journal of Algorithms vol pp

Pin R Y Pinter River routing Metho dology and analysis In third CALTECH

conference on Very Large Scale Integration pp Computer Science

Press

RT P Rosenstiehl and R E Tarjan Rectilinear planar layouts and bip olar ori

entations of planar graphs Discrete and Computational Geometry vol no

pp

Shi Y Shiloach Linear and Planar Arrangements of Graphs PhD thesis Depart

ment of Applied Mathematics Weizmann Institute of Science Rehovot Israel

Sto J A Storer On minimalnodecost planar embeddings Networks vol

pp

Tam R Tamassia On embedding a graph in the grid with the minimum number

of b ends SIAM J Computing vol no pp

TDB R Tamassia G Di Battista and C Batini Automatic and

readability of diagrams IEEE Transactions on Systems Man and Cybernet

ics vol no pp

TT R Tamassia and I G Tollis A unied approach to visibility representations

of planar graphs Discrete and Computational Geometry vol no pp

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994

TT R Tamassia and I G Tollis Planar grid embedding in linear time IEEE

Transactions on Circuits and Systems vol no pp

TTV R Tamassia I G Tollis and J S Vitter Lower b ounds for planar orthogonal

drawings of graphs Information Processing Letters vol pp

Whi H Whitney Congruent graphs and the connectivity of graphs American

Journal of Mathematics vol pp

Zak S Zaks An easy planarity test for unippable mo dules Technical Rep ort

Computer Science Department Technion Israel Inst of Tech

Technion - Computer Science Department M.Sc. Thesis MSC-1994-01 1994