Page 1
PeterEades
y
QingwenFeng
y
XueminLin
z
HiroshiNagamochi
x
June???????
Abstract
Hierarchicalgraphsandclusteredgraphsareusefulnon?classicalgraphmodelsforstructured
relationalinformation?Hierarchicalgraphsaregraphswithlayeringstructures?clusteredgraphs
aregraphswith recursiveclusteringstructures?BothhaveapplicationsinCASEtools?software
visualization? andVLSIdesign? Drawing algorithmsfor hierarchical graphshaveb eenw ellinv es?
tigated?Howev er?theproblemofstraight?linerepresentation hasnotbeensolvedcompletely?
Inthis paper?we answer the question?does ev ery planarhierarc hical graphadmita planar
straight?linehierarc hicaldrawing?We presentanalgorithm thatconstructssuchdrawings in
lineartime?Also?we answ erabasicquestion for clusteredgraphs?thatis?do esev eryplanar
clusteredgraphadmitaplanarstraight?linedra wing withclusters drawnasconvexpolygons?
Wepro videamethod forsuch drawingsbased onouralgorithmforhierarchicalgraphs?
Keywords?Computational geometry?automaticgraph dra wing? hierarchicalgraph?clustered
graph?straight?linedrawing?
?Introduction
A graphG??V?E?consists ofa setVofv ertices anda setEofedges?that is?pairsofvertices?
Graphsarecommonlyusedto mo delrelationsincomputing?andmanysystemsformanipulating
graphs have recentlybeen develop ed?Examples includeCASEtools??? ??knowledgerepresentation
systems ??? ??softw arevisualizationtools??? ??andVLSI designsystems?????Agr aphdrawing
algorithmreads asinputacom binatorialdescriptionofagraph? and producesasoutputavisual
representationofthegraph?Suchalgorithmsaimto producedrawingswhich areeasytoreadand
easytorememb er? Manygraph dra wing algorithmshaveb eendesigned? analyzed? tested andused
in visualizationsystems?? ??
With increasingcomplexityof the informationthatwew antto visualize?we need more structure
ontop ofthe classical graphmo del?Sev eralextended graphmo delshavebeen proposed?????????
??? ?? ??In thispaper?weconsidertwo suchmo dels?
?
Thisw orkw as supp ortedbya research grant fromtheAustralianResearc hCouncil andthesubsidyfromKyoto
UniversityFoundation?Anextendedabstract ofthispap erw aspresen tedat theSymp osiumonGraphDra wing
?GD?????Berkeley?California??????
y
Department ofComputerScience and Softw areEngineering?Univ ersityofNewcastle?Univ ersity Drive?
Callaghan?NSW ?????Australia?Email?feades?qwfengg?cs?newcastle?edu?au
z
SchoolofComputerScienceandEngineering?University ofNew SouthW ales?SydneyNSW?????Australia?
Email?lxue?cse?unsw?edu?au
x
Departmentof AppliedMathematics and Physics?Ky otoUniversity?Ky oto ?????????Japan?Email?
naga?kuamp?kyoto?u?ac?jp
?
Page 2
ELEC170
COMP112
Discrete Str.
COMP114
Society
MATH112
MATH111
MATH151
Discr. Math
COMP222
Th. Comp.
COMP223
Algs.
COMP221
SE I
COMP224
OS
Networks
COMP328
COMP333
Mach Int
COMP329
Compilers
COMP325
DB
COMP226
CPL
COMP326
Data Sec
SE II
COMP321
Graphics
COMP332
COMP330
GUI
COMP331
Adv Algs
COMP324
Par Proc
COMP441
Cryptog
COMP443
FR in AI
COMP445
CGeom
COMP453
Inf Vis
GraphAlgs
COMP447
COMP451
ParProc
DisOS
COMP450
COMP452
DataBases
COMP448
Adv Comp
COMP111
Intro to CS
COMP444
Prog Sem
COMP421
SE PROJ
Assumed Knowledge
Prerequisite
Core Subject
Sem 3
Sem 4
Sem 7
Sem 8
Sem 2
Sem 1
Sem 6
Sem 5
Figure ??An exampleofa hierarchicalgraph?
? Hier archic al graphsare graphs withvertices assignedtolay ers? Hierarchicalgraphsapp earin
applicationswhere hierarchicalstructures are inv olv ed????????Forexample?Figure?shows
aprerequisitediagramfor subjectsina Bachelor?sdegree inComputerScience? anedgefrom
atobmeans thata isaprerequisiteofb? andeach layerrepresentsasemester ofstudy? In
the exampleof Figure??thevertices areassigned tolayers for semantic reasons?Inother
examples?the lay erassignment ischosen toimprovethe readability of thedrawing?see? for
example? ?????
? Clustered graphsaregraphswithrecursiveclustering structures which appearin many struc?
tureddiagrams ???? ??? ????? ??Forexample? Figure?showsarelationaldiagram ofsome
organizations in NewSouthWales? anedgeb etw eena andbindicatesajoint projectb etw een
a andb?and eachclusterrepresentsa group oforganizations?
Both hierarchicalgraphsandclustered graphshave thepow erofrepresentingcertainadditional
structures requiredbyapplications? Thedra wings ofhierarchical graphs andclustered graphs
should re?ect these structures?and thereforem ustmeetadditional constraints?
A graphG??V?E?isdra wnby specifyinga location inthe planefor eachv ertex inV and
a route?a simpleJordan curve? for eachedge inE? Thedrawing isplanar if no pairof edge
?
Page 3
UNcstle
ANU
UNSW
Universities
Institutions
UTS
CSIRO
Telstra
BHP
Industry
Figure??An example ofaclustered graph?
routes cross? andthegraph isplanar if itadmitsa planar drawing? The planarity prop erty has
b een theob ject ofm uch ofGraph Theory?For visualization purp oses?it isw ellestablishedthat
edgecrossings signi?can tlyinhibitreadability ????? andmanyalgorithms for constructingplanar
drawings havebeen dev eloped ?? ??
A hierarc hicalgraphis drawnwithv erticesofa lay er on thesame horizon talline? andedges as
curves monotonicinydirection?Ahierarchical graphishierar chical planar?h?planar? ifit admitsa
drawingwithoutedge crossings?Algorithms fortestinghierarc hicalplanarityarepresentedin ?????
F ora clusteredgraph? theclustering structureisrepresentedbyaclosed curvethatde?nesa
region? The region containsthedra wing ofall thevertices whichbelong tothatcluster?Aclustered
graph iscompound planar ?c?planar? if itadmitsadrawing with no edgecrossings oredge?region
crossings? Algorithms for testingcompoundplanarit yarepresen ted in???? ?? ??
Thehierarchicalstructure inhierarchical graphs imposesconstrain tsonthey ?coordinate? since
allverticesof the samelay erhastobe drawnon exactlythesamehorizon talline? How ev er?there
arenoconstrain tson theotherdimension? thatis? thex?coordinate?Theclusteringstructure in
clustered graphscanbe viewedasconstrain ts onb othdimensions? that is?allv erticesof thesame
cluster are restrictedtoaregion?
One of thebasic graph drawing conv entions consistsof representing edges as straight?line seg?
ments?Thestraigh t?line dra wingconv entionis widely usedinvisualization?Graph drawing systems
suchasthe GraphLay outTo olkit ????? GraphEd???? andDiagram Serv er??? containa mo dule
for creating straight?line dra wingsof classical graphs? In tuitiv ely? theeye canfollowa straigh t?line
easily?Sugiy ama????and Batini ???? liststraigh tness oflinesas an importantaim forgraph drawing
algorithms? This intuitionhasb eencon?rmedbyhuman experiments ???? ???? More imp ortantly?
there are sev eralgeneralmethods for drawing graphswhichb eginbyadding dummyv erticeson
edges andthenapplyastraight?linedra wingalgorithm? Thisdemand has spa wnedaconsiderable
amount ofattentionto straight?linedra wingsinthe researchcomm unity?
Forclassical graphs?itiswellknownthateveryplanargraphadmits astraight?line drawing
withoutedgecrossings ???? ???????Tutte????prov edthatev erytriconnectedplanargraph ad?
mitsaplanarstraight?line drawing whereallthe faceboundariesaredrawnas convexpolygons?
Algorithmsfor such drawingsha vealsobeen investigatedbyChibaet al???????Morerecently?
?
Page 4
ings??The ?rstquestionwe addressis offundamentalsigni?cance for drawinghierarchicalgraphs?
doesev eryplanarhierarchical graphadmita planar straight?linehierarchical drawing?While many
algorithms haveb eendevelop ed todrawhierarc hicalgraphs ??? ?????? ??? ??? ??? ?? ?? theyallintro?
duceb endstoroutetheedges?and the basicproblem ofplanar straight?line dra wingshas notb een
solv edcompletely? It hasb een shownby diBattista andT amassia ???that everyplanar st?graph
admits an upward drawing? that is?a dra wingwhere all arcsare dra wnas straight?linesegmen ts
p oin ting upw ard? How ev er? theproblem forhierarc hicalgraphs isdi?eren t?b ecausewe have more
constraints?v ertices of thesame lay ershouldbe drawn on the same horizontal lineand the layers
shouldbe an equaldistance apart?A method toconstruct straight?line drawings ofplanar hier?
archical graphswas presen tedby Eades?Lin andT amassia ??? ??Theyusea tec hniquesimilar to
thatin????byTutte??nding thepositionfor ev eryvertex ina globalmanner? Intheiralgorithm?
dummyvertices areaddedto transform anedge that spans morethantwolay ers toasequence of
edges? each ofwhichspanstwoconsecutive layers? Infact?by theconv exityofthe drawing?the
dummyvertices donotproduceb ends?The problemwiththe algorithmof ???? isthatit onlyw orks
foraspecialclass ofhierarchicalgraphs?
Herewepresen tanalgorithm thatw orks for any planar hierarchicalgraphs?We useadivide
and conquerapproac h??nding theposition for everyvertex inarecursive manner?Thecore ofthe
algorithm is?ndingasuitablepartition ofthegraph?
Thesecondquestionaddressed inthis paper isfor clusteredgraphs?do esev eryplanarclustered
graphadmita planarstraight?linedrawingwithclustersdra wn asconvexpolygons?Analgorithm
forstraight?linedrawing ofclustered graphshasbeen presentedbyFeng?CohenandEades?????
Again?however?it onlyappliestoaspecialclassofgraphs? In particular?it onlyappliesto graphs
witha certain strongconnectivity property?
Therestofthepaperisorganized asfollows? Insection ??wepresentsome terminologyfor
hierarchical graphs?Insection??we provethat ev eryplanarhierarchicalgraphadmitsaplanar
straight?linedrawing?Alineartimealgorithmthatproducessuchdrawingsispresen ted?We
in troduce theclusteredgraphmodel insection ??Insection??weshowthateveryplanarclustered
graphadmitsa planarstraight?lineconvexclusterdrawing?Thisisaccomplished by transforming
clustered graphsinto hierarchicalgraphs?Basedonthis?we presentanalgorithmthatcomputes
suchdrawings inlineartimeinterms ofthe outputsize? In section??we discusssomeexamples?
andposesomeopenproblems?
?HierarchicalGraphs
Inthissectionweintroduce theterminology?and somefundamen talprop ertiesofhieorarchical
graphs?
Adirected edge witha tailu andaheadvis denotedby?u?v??Ahier archicalgraphH?
?V?A???k?consistsofadirectedgraph?V?A??ap ositivein tegerk? and? for eachvertexu?an
integer??u??????????k? withthe prop ertythat if?u?v??A?then??u????v??F or??i?k?
thesetfuj??u??igis theithlayerofH andisdenotedbyL
i
?Thesp anof anedge?u?v?is
??v????u??Anedge ofspangreaterthanoneislong?andahierarchicalgraphwith nolongedges
?
Page 5
H
A drawing ofa graphG??V?E?assignsapositionp?v???x?v??y?v ??toeachv ertexv?V
anda curve joiningp?u? andp?v? to each edge?u?v??E?A hierarchical graphis conv entionally
dra wn withlayerL
i
on the horizontalliney?i ?thatis?y?v????v? forallv erticesv ?? andedges
as curvesmonotonic inydirection? If nopair ofnonincident edges intersect inthedrawing? thenwe
say it isa hier archic alplanar?h?planar?drawing? Note thatanon?prop erhierarchicalgraph canbe
transformed intoaprop erhierarc hicalgraphby adding dummyv ertices onlong edges? Itis easily
shown thatanon?prop erhierarchicalgraph is h?planarifandonlyifthe corresp onding proper
hierarc hicalgraph is h?planar?Ahierar chic al planar embedding ofaproperhierarchicalgraph is
de?nedby theorderingofverticesoneachlay er ofthegraph? Notethatev erysuchemb edding
hasa uniqueexternalface?Alsonotethat ev eryprop erh?planar graphadmitsastraight?line
hier archical drawing?thatis?a drawing whereedges aredra wn asstraigh t?linesegmen ts?How ev er?
fornon?proper hierarchicalgraphs?the problem isnottrivial?sincenob endsare allow ed onlong
edges?
Aplanegr aph referstoa planar graphembedded inthe plane?Inother words?aplanegraph
containsaplanargraphandaplanar embedding witha sp eci?edexternalface?We callaplane
embedded hierarchicalgraphahier archic alplanegraph? Ifahierarchicalplanegraph hasonlyone
sourcesandonesinkt? thenwecallitahier archical?stplanegraph?Observethatahierarchical?st
planegraph isaconnectedgraph?anditssourcesand sinktm ust lieonthebottomlayerand
thetoplayer? respectiv ely? InSection ????wewill showthat everyhierarchicalplanegraphcanbe
extendedtoahierarchical?stplanegraphby addingO?n? newverticesandedges?
Theemb edding ofahierarchical?stplane graphHdetermines?for ev eryvertexv?a left?right
relation amongup?neighb orsofv?seeFigure??? Theheadwof therightmost ?respectivelyleftmost?
edgeoutgoingfromviscalled theright up?neighbor?respectiv ely the left up?neighbor?ofv? andis
denotedbyr
?
H
?v??respectiv ely?
?
H
?v ???Therightdown?neighb orr
?
H
?v? and theleft down?neighbor
?
?
H
?v?ofv arede?ned analogously?
Hierarchicalgraphs aredirected graphs andthuswe canborrowmuchof the standardtermi?
nology of graph theory???? Theterms ?path???cycle?? and?biconnectivit y??when appliedtoa
directedgraphin this paper?refer totheunderlying undirected graph?To denoteacycleofa
plane graph?we usethesequenceofvertices onthe cyclein clockwiseorder?F oracycleorpath
P??v
?
?v
?
?????v
k
??anedgeb etweentwonon?consecutivev ertices inPiscalledachordofP?see
Figure??a???A cycleorpathis calledchordlessifithasnochord?Inhierarchical graphs?edges
aredirectedfroma low er lay er toahigher layer? Apathiscalledmonotonicifthe directionsof the
edges do notchangealongthepath?Inotherw ords?apathismonotonicifthe lay er increases?or
decreases?aswegoalongthepath?see Figure??b???Notethatfrom avertexv?amonotonicand
chordless pathfromvtoasinkcanbeobtainedbytraversing thehighest up?neighb orsoneafter
another?Similarly?amonotonicandchordlesspathfromasourcetovcanbefoundbytracingthe
low estdown?neighborsfromv?
Thefollowinglemma givessomebasicpropertiesofthebiconnectedcomponentsofhierarchical?
stplanegraphs?Essentiallyitimpliesthat?forhierarchical?stplanegraphs?we canrestrict our
attentionto thebiconnectedcomponents?
Lemma?LetH??V?A???k?beahier archical?stplanegraph?then?
?
Page 6
v
the lowest downneighbor

the left downneighbor
the right upneighbor
+
(v)
H
the left upneighbor
+
H
V
+(v)
H
the right downneighbor
the highest upneighbor

(v)
(v)
low
high

H
H
(v)
(v)
(v)
l
l
r
r
H
V(v)
Figure ??De?nition ofleft?rightrelationsinV
?
?v? andV
?
?v ??
1
3
v
v2
v
4
v
v
6
v
5
(a) (b)
Figure???a?Ac hord?v
?
?v
?
? ina path?v
?
?v
?
?????v
?
???b?Amonotonicpath?
?
Page 7
w
s
s
s
2
1
Figure ??Illustration ofthe proof of Lemma???a??
?a? Every biconnectedcomp onentofHis alsoa hierarchical?st planegraph?
?b?Supp osethatB
?
andB
?
are twobiconne ctedc omponents ofH? and fori????? the source of
B
i
iss
i
andthe sink ist
i
? Then max???s
?
????s
?
??? min???t
?
????t
?
???
?c?H hasa planar straight?linehier ar chical drawing ifandonly ife ach ofits bic onnectedc om?
p onents hasa planar straight?linehier archic aldrawing?
Pro of? Lets andtbe thesource andsink ofH? resp ectively?
?a? LetBbea biconnectedcomponent ofH? The hierarc hical planarity ofB isinherited from
H?Then itsu?cesto show thatB hasonly onesource and onesink?SupposethatB hastwo
sourcess
?
ands
?
? ThenH hastwo monotonicpathsP
?
froms tos
?
andP
?
froms tos
?
? Hence
these pathshavea commonvertexwsuch that thesub?path ofP
?
fromw tos
?
andthesub?path
ofP
?
fromw tos
?
aredisjointexcept forw ?asinFigure ??? Consequently? allvertices onthesetwo
sub?pathsb elong tothe samebiconnectedcomp onentB? Thishow ever contradicts the assumption
thats
?
isa source ofB? Similarly?we can show thatB hasasingle sink?
?b?SinceB
?
andB
?
arebiconnected components ofH?we canconclude from?a?thatB
?
andB
?
arehierarchical?st planegraphs? Lets
i
andt
i
?i????be the sourceandthe sink ofB
i
?
We prove thatmaxf??s
?
????s
?
?g? minf??t
?
????t
?
?g? fromwhichprop erty?b?follo ws? Clearly?
H hasa monotonicpath froms tos
?
andamonotonic path froms tos
?
inH?These give
rise toa pathP
s
??s
?
????? s?????s
?
? ?notnecessarilymonotonic?? andforev eryvertexwonP
s
?
??w??maxf??s
?
????s
?
?gholds?Similarly?thereisHhasapathP
t
??t
?
????? t?????t
?
??andfor
ev eryv ertexz onP
t
???z??minf??t
?
????t
?
?gholds?Ifmaxf??s
?
????s
?
?g? minf??t
?
????t
?
?g?
thenwe seethatP
s
andP
t
mustbedisjoint?see Figure ???This? how ev er? impliesthatB
?
and
B
?
belongtothesamebiconnectedcomponent ofH? contradictingourassumption?Therefore
maxf??s
?
????s
?
?g? minf??t
?
????t
?
?g?
?c?Theif?partisimmediate?We show theonly?if?part?Fromthe above?b??we seethat the
lay ersofev erypairofbiconnectedcomponen ts ofH donotoverlap exceptat thelayerof their
commonvertex?thatis?acutv ertex??Therefore?ifeach biconnected component ofH hasa planar
straigh t?linehierarchical drawing? thenwe canconstructa planarstraigh t?linehierarchical drawing
ofH asa ?chain?of the drawingsof itsbiconnectedcomponen ts?asinFigure ??
?
?
Page 8
t
B
B
s
1t
2t
1
2
1s
2
s
Figure??Illustration ofthe proofofLemma???b??
Figure??Drawingachainofbiconnectedcomponents?
?
Page 9
j
1
i
2
1
k
v
v
v
v
H
H
w
l
w
v
1
2
Figure?? IllustrationforLemma??
F romthe above lemma?we canassume thatagiv enhierarchical?st planegraphisbiconnected?
whichimplies that itsexternalface isboundedbyasimplecycle ?exceptforthetrivialcase that
thegraph consists ofasingle edge??
Inthenext section?wepresenta methodfor dividingabiconnected hierarchical?st plane graph
H in toparts? Thefollo winglemma allows ustoinfer properties oftheparts from theproperties of
H?
Lemma?L etHbea hier ar chical?st plane gr aph whichis biconne cted? andhas theexternal facial
cycleC??v
?
?????v
k
?v
?
?? Supp osethatP??v
i
?w
?
?????w
l
?v
j
? isamonotonicp athfromv
i
tov
j
in
H? and thevertices ofP are not onC exceptv
i
andv
j
?L etH
?
andH
?
be the twosub graphsb ounded
inside by cyclesC
?
??v
?
?????v
i
?w
?
?????w
l
?v
j
?????v
k
?v
?
? andC
?
??v
i
?????v
j
?w
l
?????w
?
?v
i
?inclu?
sive?ThenH
?
andH
?
are hierar chical?stplane gr aphsand are biconne cted?seeFigure???
Pro of?Thehierarchicalplanarit y ofH
?
andH
?
isinherited fromH? Since pathP??v
i
?w
?
?????w
l
?v
j
?
ismonotonic?b othH
?
andH
?
haveasinglesource andasinglesink? Thebiconnectivity ofH
?
and
H
?
isimmediate??
?Straight?Line Hierarc hicalDrawings
Inthissection? we show thatgiv enahierarchicalplanegraph?aplanar straight?linehierarchical
drawing canbecomputed inlineartime?
Weapplya divideand conquerapproac h? dividethehierarc hical graphin to subgraphs?compute
the drawings ofthesubgraphs? andobtaina dra wing of thegraphby com biningthe drawings of
the subgraphs? Thek eypartof thisapproachisto?ndasuitable partition?
Forthispurp ose?we ?rstassume thata giv en hierarchical planegraphsatis?estwo prop erties?
?i? theboundary ofthe externalfacehasasimplecycleand?ii? theb oundaryofevery non?
external faceconsists ofexactly three edges? Sucha hierarchical?stplanegraph iscalledatriangular
hierar chical?stplanegraph?
Section???presen tsa proof? usingthe divideandconquerapproach? thateverytriangular
hierarchical?stplanegraph admitsastraight?linedrawing?Basedontheproof?Section ???pro vides
a straigh t?linedrawingalgorithmwhichruns inlineartime?F urther? in Section????? we showthat
an yhierarchicalplane graphcanbeextendedtoatriangular hierarchical?stplanegraphby adding
O?n? dummyv ertices andedgesin lineartime?
?
Page 10
(b)
u
z
w
(a)
Figure?? ?a?Dividing intotwopartsalongac hord?and?b?dividing in to threeparts?
??? Straigh t?linedrawings oftriangular hierarchical?stplane graphs
Inthis sectionwe show that everytriangular hierarchical?stplane graph admitsa straight?line
dra wing withaprescrib edconv expolygonasitsexternal face?
Todescribethecorrespondenceb etween theprescrib edpolygonandthe theexternalface?we
needsometerminology? Anapexofapolygon isageometricvertexofa convexp olygon? that is?a
v ertexsuchthat thetwo linesegmen tsincident toit formanangle notequalto ???degrees? Let
Hbeahierarchical?stplanegraph? letcycleCbe the cycleof itsexternal face? Notethat there
canbev erticesofC which arenotdra wn asapices of thepolygon which forms the externalface?
IfC hasac hord?u?z? such thatnovertex ofCb etw eenu andz is atan apex?thena straight?line
dra wingw ould requirethat theedge?u?z?ov erlapwith edgesonC?To help withthisproblem?we
in troducesomeconcepts? LetpolygonPbea straight?linehierarc hicaldrawing ofcycleC?We say
thatP isfe asible forH if thefollowing conditions hold?
?Pisa conv exp olygon?
? IfcycleChasac hord?u?z ?? then oneach ofthetwopathsof cycleCb etw eenuandz?there
existsav ertexv whichisdrawn as anap exofp olygonP?
Wepresentadivideandconquerapproac h?Foragiv entriangular hierarc hical?stplane graph?
wedistinguishtwosituations?illustratedin Figure ??
? Iftheexternalfacialcycle hasac hord?u?z ??thenwe simplydividethe graphin totwoparts
with?u?z? incommon?The inputp olygon isdividedwitha straightlineb etw eenp?u? and
p?z ??Using Lemma ??weapplyrecursion?
? If theexternal facialcycle hasa noc hord?thenwe ?ndavertexw noton theexternal
facial cycle?suchthat there arethreemonotonic andchordlesspathsthat connectwwith
theexternal facialcycle?Wethen divide thegraph andthepolygon intothreeparts?using
Lemma?twice?weapplyrecursion?
Thefollowing lemma guaranteesthatsuchapartitionalwa ysexistsinatriangularhierarchical?
stplanegraph?
Lemma?L etHbeatriangularhier ar chical?stplane graph withn?? vertices and withsources
and sinkt?and letCbe theexternal facialcycle ofH?L etv??? s?t?beavertex ontherightpath
fr omstot alongC? Then
??
Page 11
Pro of? SinceHistriangulated? threev erticesv??
?
H
?v? and?
?
H
?v? formatriangle? where???
?
H
?v ???
??v?????
?
H
?v ?? holds?
?i?Assumethatb oth?
?
H
?v? and?
?
H
?v? areonC? Thenv has degree??sinceH istriangulated?
it follows thatthere is an edgeb etw een?
?
H
?v? and?
?
H
?v ??
?ii?Assume thatavertexw?f?
?
H
?v???
?
H
?v?g? sayw??
?
H
?v? isnot onC?To ?nda path
P
w ?z
??w?????z? fromw toavertexzonC?we traversethehighest up?neighbors fromw un tilwe
comeacrossav ertexz onC? Clearly?z??v?and the path ismonotonic andchordless?Similarly?
wec hoosea pathP
u?w
??u?????w?bytrav ersingthe lowest down?neighb orsfromwun tilwereach
avertexu onC?Clearly?P
u?w
is monotonicandchordless?We see thatu??v?b ecausev is notthe
low est down?neighb or ofw??
?
H
?v?by?
?
H
?v??V
?
H
?w?and???
?
H
?v ?????v?????
?
H
?v???Thecase
that?
?
H
?v? isnot onCcanbetreated analogously??
Clearly? theabovelemmaholdsfor the casethatv is onthe leftpathfromsto talongC?by
replacing?
?
H
?v? and?
?
H
?v? in thestatementwithr
?
H
?v?andr
?
H
?v??resp ectiv ely? Nextwe prove the
maintheorem?
Theorem?Supp ose thatHisatriangular hierar chical?stplanegr aph?andp olygonP isa straight?
linehierarchicaldrawingof its externalfacialcycleC? IfPis fe asibleforH? then there existsa
planar straight?line hierar chicaldr awingofHwithexternal faceP?
Proof?Weprove theclaimby inductionon then umb ern ofv ertices ofH? Thebasisof the
induction?n?? is immediate?No w?assumethat thetheoremholds forgraphs withless thann
vertices?SinceP is convex? thereisavertexvotherthan the sourcesor sinkt ontheexternal
face? suchthatv is drawnasanap exof P?We distinguishtwocases?
Case??Theexternal facialcycle CofH hasachord ?u?z??ByLemma??chord?u?z?divides
Hin totwosubgraphsH
?
andH
?
?We drawa straightlinesegmentbetweenp?u? andp?z ??whic h
dividesPintotwopolygonsP
?
andP
?
? Itcanbeveri?edthatP
?
andP
?
arefeasibleforH
?
andH
?
?
Sinceb othH
?
andH
?
havelessthannvertices?byinduction?thereexist straight?line hierarchical
drawingsofH
?
andH
?
withexternalfacesP
?
andP
?
?Hence?bycombiningthetwo drawings?we
obtainastraight?linehierarchicaldrawing ofH withexternalfaceP?
Case ??TheexternalfacialcycleCofH hasnochord? Supp osethatvisavertex suchthatp?v?
isan ap ex ofP? ByLemma??thereareverticesw? u?zandtwomonotonic andc hordlesspaths
P
u?w
??u?????w? andP
w?z
??w?????z?such thatno in ternalvertex ofeitherpath ison calC?The
insideofHhastwomonotonicpathsP
?
??u? ????w?????z??whichconsistsofP
u?w
andP
w?z
?and
P
?
consisting ofa singleedgeb etw eenvandw? ByapplyingLemma??wecan divideHin tothree
parts?see Figure????
?H
?
?v?b oundedbycycle ?u?????z?????w????u??
?H
?
?v?boundedbycycle?u?????w?v????u??
?H
?
?v?boundedbycycle?z?????v?w????z ??
??
Page 12
??
??
t
??
?? ??
?? ??
u
??
??
s
??
?? ??
?? ??
?? ??
????
z
??
??
??
s
??
????
????
wH2
??
??
??
??
??
??
z
??
s
????
?? ??
??
????????
v
H1
??
????????
H
2
(a)
(b)
(d)
(c)
s
v
w
H
H
????
????
H
H
H
u
v
H
v
w
v
t
H
w
H
H
0
2
0
1
0
0
2
1
1
z
t
z
t
u
u
( )
v
( ) v
( ) v
( ) v
( ) v
( ) v
( ) v
( ) v
( ) v
( ) v
( ) v
( )
Figure???Allp ossible partitions ofH?
??
Page 13
v
i
i+1
e1
e2
u1
2
Figure??? Eliminatinga sink?
ItisclearthatH
?
?v ??H
?
?v? andH
?
?v? aretriangularhierarchical?st planegraphs?
LetH
fr ame
?v?bethe graph thatconsists of onlythe externalfaces ofH
?
?v ??H
?
?v? andH
?
?v ??
NowH
fr ame
?v? hasthesame externalfaceasH?hencepolygonP isalsoa hierarchicalplanar
dra wingofthe external face ofH
fr ame
?v ??We needapositionp?w? forw suchthat thedra wings
ofthethree internal faces ofH
fr ame
?v? are conv expolygons?F or this? it issu?cient todrawvertex
w strictlyinsidethe triangle formedby thethreep ositionsp?u??p?v?andp?z ?? They coordinate
y?w????w?is ?xedby the layering?We can alwa ysc hooseanappropriatex?coordinate x?w ??
b ecause??u????w????v?andthethreepositionsp?u??p?z? andp?v? arenotonastraight line
?sincevisc hosenas an apexonthe convexpolygon??Forinstance?if??w????v? thenwecan
c hoosex?w? anywhereinthe rangex
a
?x?w??x
c
?where
x
a
?
??w????u?
??z????u?
x?u??
??z????w?
??z????u?
x?z??
x
c
?
??w????u?
??v????u?
x?u??
??v????w?
??v????u?
x?v??
Weplaceotherin ternalv erticesofH
frame
?v??whichhave withdegree? inH
fr ame
?v ??on to
the linesegmen tsfromu tow and fromw toz atappropriate horizontallinesaccording totheir
y ?coordinates?
Sincew is dra wnstrictlyinside thetriangleformedbypositionsp?u??p?v? andp?z ??thevertex
w dividesp olygonP in tothreeconv expolygonsP
?
?P
?
andP
?
?andverticesu?z?v andware
drawn asapices ofthese polygons?Clearly?thesourceandsinkofH
?
?v??respectiv elyH
?
?v? and
H
?
?v ?? areatthesmallestandgreatesty?coordinatesonP
?
?respectiv elyP
?
andP
?
?? andthey
are thereforeapicesofP
?
?respectivelyP
?
andP
?
??Note that edgesonpath?u?????w?aredrawn
on thesameline? as aretheedges onpath?w?????z?? thatis?thev erticeson thesepaths arenot
apices?How ever?since therearenochordson thesepaths?P
?
?P
?
andP
?
arefeasible forH
?
?v??
H
?
?v?andH
?
?v? respectiv ely?
As each ofH
?
?v??H
?
?v? andH
?
haslessthannvertices?byinductionthereexiststraight?
line hierarc hical drawings ofH
?
?v??H
?
?v?andH
?
withexternalfacesP
?
?P
?
andP
?
? Hence?by
combiningthese dra wings?weobtaina straigh t?linehierarchicaldrawingofH with externalface
P??
??
Page 14
(a)
(b)
multiple edges
Figure ???Triangulatingthehierarchicalgraph?
???Thealgorithm
Thealgorithmtocomputeaplanar straigh t?linehierarchicaldrawingis basedon theproofof
Theorem ??Theinputofthealgorithmisahierarchical plane graphH?the outputisa planar
straight?line hierarc hical drawing ofH? Thealgorithmconsistsoftwophases? Preproc essing and
Dr awing? In thepreprocessing phase?we extendthehierarchicalplanegraph toa set oftriangular?
stplane graphs? Thedrawingphaseactually constructsastraight linedra wingof eachof those
triangular?st plane graphs?Nowwe describe thetwo phasesinmoredetail?
????? Preprocessing
We extenda giv enhierarc hicalplane graph toa setof triangularhierarc hical?stplane graphs in
foursteps?
??? Extendthehierarc hicalplanegraphsothat allthe sources andsinkslie onthebottom lay er
andtop lay er?Wecan usea methodsimilar tothosein??? ??? which sw eepsfromb ottomto
top and fromtop tobottom toeliminate the sourcesandsinks inb etw een?see Figure ????
???Adda newvertexsb elow thebottom lay erand connectitto all thesources? then adda new
vertext above the toplayerand connectallthesinks to it?This giv esa hierarchical?st plane
graph?
???Computeallbiconnected componen ts of thehierarchical?st plane graph?each of which isa
biconnectedhierarchical?st planegraphbyLemma??
???Extend each ofthebiconnectedhierarchical?st planegraphsobtainedin ??? toa triangular
one asfollo ws?inserta layerb etweenev erytwo consecutive lay ers?thisensuresthatoriginal
lay ers arestill evenly distributed?? adda ?star?structure insideeach face?see Figure???a???
andplace the cen terof theeachstar on aninsertedlay er?Afterthis?everyinternalface is
boundedby exactlythree edges?Thistriangulationmethod isa little unusual?butnecessary?
Figure???b? shows thatifwe donotaddnewvertices?multiple arcs canbe produced?F urther?
we cannotallowdummyv erticesonthe arcsb ecause thismayin troduceb ends? Also note
that no arcs are allowedb etw eentwov erticesof the samelay er?
Note that thesize ofthegraph remainslinear?Further?each ofthefoursteps above canbe
carriedoutinlineartime?
??
Page 15
and thec hordsandpaths described in Lemma? areadded? Essentially thealgorithmtrav erses the
subgraphsH
i
asdescrib ed inthe proof ofTheorem ??aqueueHis usedto managethis traversal?
AlgorithmHierarc hical
Draw
Input?Atriangular hierarchical?stplanegraphH
Output?A planarstraight?linehierarc hicaldra wing? ofH
???Initialize?
????? Choosea conv expolygonP
?
suchthat ev eryvertexon theexternalfacialcycle ofH is
anap ex ofP
?
?
?????Let? ??P
?
andH ??fHg?
?????IfH isatriangle? then output? andhalt?
???WhileH??? do
????? Choosea subgraphH
?
?H and an ap exvin thepolygon oftheexternal faceofH
?
? and
removeH
?
fromH?
?????Ifthere isachord?u?z?statedinLemma ??i?for theap exvthen?
???????DivideH
?
in toH
?
?
andH
?
?
withchord?u?z ??
???????Drawastraight?linesegmentb etw eenp?u?andp?v?in?? andlet?be theresulting
drawing?
???????F ori?????ifH
?
i
is nota triangle?thenH??H?fH
?
i
g?
????? else
???????Find av ertexw adjacent totheapexv andpathsP
u?w
??u?????w? andP
w ?z
?
?w?????z?insideH
?
? asstated inLemma ??ii??
???????DivideH
?
intoH
?
?
?H
?
?
?v ??H
?
?
?H
?
?
?v? andH
?
?
?H
?
?
?v?with the edgee andpaths
P
u?w
?P
w?z
?
??????? Findap ositionp?w? ofwstrictlywithinthreepositionsp?u??p?v? andp?z??
???????Dra w straight?linesegmentfromp?w?toeach ofp?u??p?v? andp?z?in ??
??????? Let?be theresultingdra wing?wherethepositionsp?w
?
? ofotherv erticesw
?
on
P
u?w
orP
w?z
are determinedbytheirlayers?
???????Fori???????ifH
?
i
isnota triangle?thenH??H?fH
?
i
g?
???Output?and halt?
Thecorrectnessofthisalgorithm isimmediatefromLemma?andthepro of ofTheorem ??
Figure ??sho wsanexampleforthe pro cedure?
Wenowpresenta linear timeimplementationof the abovethealgorithm?Weshowthatstep
?????canbe executedinO??? time?andb othsteps ????? and????? canbeexecutedin thetime
proportional to then umb erofedges innewstraight linesegmentsdrawninthe step? that is? step
??
Page 16
algorithm of JuengerandMutzel ?????Weassume ananalogousn umb eringonV
?
H
?v? forallv?V?
F orasubgraphH
?
?H of aninput graphH?we denotetheexternal facial cycle ofH
?
byC?H
?
??
and thedra wing ofC?H
?
?computedbythealgorithm isdenotedbyP?H
?
??
Avertexvinap olygonP is trivial inP ifv isthe sourceor the sink ofP orP isap olygon
fora triangleC?A non trivial andnon?apexvertexvinap olygonisapr e?apex ofP?A nontrivial
apex ?resp ectiv elya pre?apex?v inP isaright apex?respectiv ely rightpre?ap ex? ofPifv is on the
right pathfrom thebottomto thetop inP?Similarlyde?neleft apexandleft pr e?apex?
During theexecution of thealgorithm? the apices satisfythefollo wing important properties?
?? Ifv isa right apex in?????? theneveryvertexw
?
???v?w?u?v? onpathP
u?w
?respectiv ely
P
w
results
?z
? in step ?????becomes a rightpre?apexofP?H
?
?
?v ??andaleft pre?apexof P?H
?
?
?v ??
?respectiv elyP?H
?
?
?v????
??At any moment during thetheexecution of thealgorithm?eachv ertexhas atmostone
subgraphH
?
?H such thatvisa rightapexor rightpre?ap ex onP?H
?
??
?? Onceavertexvbecomesaright apexofap olygonP?H
?
??thereisalwayssomesubgraph
H
??
?Hsuchthatv isa right ap ex ofitspolygonP?H
??
? untilvbecomesaright apexofa
triangle?
Similar hold fora left apexv?
These prop ertiessuggestthatwe shouldmaintaina setAP?H?ofapices ofsubgraphsinH
?thatis?AP?H??fv?Vjv isan apex inP?H
?
? forsomeH
?
? Hg??insteadofmaintainingH
explicitly?F urther?forasubgraphH
?
andanapexv in??????weneedtomaintain theneighb orsets
V
?
H
?
?v?andV
?
H
?
?v? ofv insuchawaythatsteps ???????????? and?????canbeexecutede?ciently ?
Weno wshowhow todothis?
Foreachv?V?wede?ne
R
H
?v????
?
H
?
?v??r
?
H
?
?v???
?
H
?
?v??r
?
H
?
?v??
ifthere isasubgraphH
?
in thecurrentH suchthatvisarightapexorright pre?apexonP?H
?
??
andde?neR
H
?v???otherwise?Similarly?let
L
H
?v????
?
H
??
?v??r
?
H
??
?v???
?
H
??
?v??r
?
H
??
?v ??
if thereisasubgraph H
??
?Hsuchthatv isaleft apex orleft pre?apex onP?H
?
??andlet
L
H
?v???otherwise?Also?letV
?
andA
?
be thesets ofv erticesandedgesonthe current drawing
??respectiv ely?
Instep????we caninitialize AP?H??fv?VjvisanontrivialapexinP
?
g?V
?
?A
?
and
fR
H
?v??L
H
?v?g?v?VinO?n? timeforH?fHg?
Wemaintain AP?H ??R
H
?v??andL
H
?v?through eachiteration ofthewhile?lo op????Withthis
datathenitisnotdi?culttosee?fromtheproofsofLemma?and Theorem??thatwe candetecta
chord?u?z?instep ?????inO???time?if nosuc hchordexists? thenwecan?ndasetfe?P
u?w
?P
w ?z
g
instep ?????inO?jP
u?w
j?jP
w?z
j???time? Provided thatallthe abovedataare properlyupdated
??
Page 17
HH
fR
H
?z??L
H
?z?g ?the caseoffR
H
?u??L
H
?u?gcanbe treated analogously??IfR
H
?z???? and
R
H
?z????
?
H
??
?v??r
?
H
??
?v???
?
H
??
?v??r
?
H
??
?v ??satis?es???
?
H
??
?v ?????u????r
?
H
??
?v ???thentheedge
?u?z? is insideH
??
?H ?althoughwe donot know the entiregraphH
??
?? andthen up dateR
H
?z?
to?u?r
?
H
??
?v???
?
H
??
?v??r
?
H
??
?v ???wherewe seethat
?u?r
?
H
??
?v???
?
H
??
?v??r
?
H
??
?v ?????
?
H
i
?v??r
?
H
i
?v???
?
H
i
?v??r
?
H
i
?v ??
for oneof thenewsubgraphsH
i
?i???? in??????Similarly?we canupdatea nonemptyL
H
?z?
byc hoosingL
H
?z? tobe??
?
H
???
?v??u??
?
H
???
?v??r
?
H
???
?v?? ifL
H
?z????
?
H
???
?v??r
?
H
???
?v???
?
H
???
?v??r
?
H
???
?v??
satis?es???
?
H
???
?v?????u????r
?
H
???
?v???
Finallyconsider thecasethat nochord?u?z?exists? andanedgeeandtwopathsP
u?w
?P
w?z
is foundin?????? Inthiscasewe canupdateR
H
andL
H
for theverticesv? u?z?V
?
inamanner
similar to ??????Also?whenavertexv
?
??V
?
b ecomes anap ex?thatis?v
?
?w?ora pre?apex?that
is?v
?
???v?w?u?z? is onP
u?w
orP
w ?z
??we caneasily compute aninitialfR
H
?v
?
??L
H
?v
?
?g inO ???
time?
The above argument provesthatalgorithm Hierarchical
Drawruns inO?n?time?
Theorem?LetHbeahierar chicalplane graphwithn vertic es?Theab ovealgorithmconstructs
aplanarstraight?linehierar chicaldrawingforHinO?n?timeandO?n? spac e?
Basedonour resultsforhierarchicalgraphs?wenextconsiderthe straight?line drawing problem
forclustered graphs?
?Clustered Graphs
Oneofthefundamen talquestions in planarclustered graphdra wingis?doesev eryc?planarclustered
graphadmita planar drawing suchthat edgesare drawnasstraight?linesegmentsandclustersare
drawnasconv expolygons? Inthissection?we answerthisquestionbasedonourresultsfor
hierarchicalgraphs?We transformaclustered graphintoa hierarchicalgraph?andconstructa
straight?lineconvex clusterdrawingontopofthestraight?linehierarchical drawing?
First?insection ????we introducesome ofthenecessarynotation?de?nec?planarityprecisely?
andstatethe relevantprop ertiesofc?planarity? Then? in section????we show how toconstruct an
?c?st?n umbering ofthevertices?this ismostcritical andmost di?cultpart of thealgorithm? The
algorithm forconstructing thec?stn umberingruns in lineartime? Usingthisordering?we give in
section???a transformationfromclustered graphsto hierarchical graphs sothatthealgorithm of
section???canbeappliedtoproducec?planardrawingswithconvexclusters?Thetimecomplexity
ofthealgorithm is linearin theoutputsize?
???Preliminaries
AclusteredgraphC??G?T? consistsofanundirectedgraphG??V?A? anda rootedtree
T??V?A?suchthatthe leav esofT are exactly thevertices ofG?F oranode??V?let chl???
denote theset ofc hildrenof??andpa???denotethe parentof? ?if? isnotaroot??Each no de?of
??
Page 18
(b)
(a)
(d)
(c)
(e)
Figure??? AnExample??a?Atriangularhierarchical?stplanegraph??b???d?In termediatedrawings
producedbythepro cedure??e? The?naldrawing?
??
Page 19
a
b
c
f
g
h
ij
k
l
m
n
p
A
C
D
E
ROOT
d
e
B
Figure ???Ac?planarclustered graph?
T represen tsa clusterV????asubsetof thev ertices ofG that are leav esof thesubtree ro otedat??
LetG??? denote thesubgraphofGinducedbyV?? ??Note that the treeTdescrib esan inclusion
relationb etw eenclusters?Ifa node?
?
isadescendant ofano de? inthe treeT?thenwe say that
thecluster of?
?
isasub?clusterof?? Ina dr awingofaclustered graphC??G?T ?? graphG is
dra wn asp oin tsandcurv es asusual?F oreach no de? ofT?thecluster is drawnasa simple closed
regionRthat contains thedra wingofG?? ?? suchthat?
? theregions for allsub?clustersof? arecompletelycontained in thein teriorofR?
?the regionsfor allother clustersarecompletely con tainedin theexterior ofR?
? ifthere is anedgeeb etw eentwovertices ofV?? ??then thedra wingofeiscompletely contained
inR?
We say thatthe drawing ofedgee andregionR have anedge?regioncrossing if thedrawing ofe
crossestheb oundaryofR morethanonce?A drawing ofa clusteredgraph is c?planarifthereare
noedge crossingsoredge?regioncrossings?Ifaclustered graphC hasac?planar drawing thenwe
say that itisc?planar ?seeFigure ????
A clusteredgraphC??G?T? isaconne ctedclustered gr aphif each clusterV??? inducesa
connectedsubgraphG??? ofG? Thefollo wingresultsfromF engthesis? ????characterize c?planarity
inaway which canbeexploitedby our drawingalgorithm?
Theorem?Aconne ctedclustered graphC??G?T? isc?planar ifandonly if graphGis planar
andthereexistsaplanar dr awingofG?suchthatfore ach no de?ofT? all thevertic esande dges
ofG?G??? are intheexternal faceof thedrawing ofG????
LetC
?
??G
?
?T
?
? andC
?
??G
?
?T
?
?betwoclusteredgraphs suchthatT
?
isasubtree ofT
?
andfor each no de?ofT
?
?G
?
??? isasubgraphofG
?
?? ??WesaythatC
?
isasub?clustere d?graph
ofC
?
?
Theorem?A clustered graphC??G?T?isc?planarif andonlyifit isasub?clusteredgraphof
aconnected andc?planar clustered gr aph?
Ac?planarembeddingofaconnectedclusteredgraph canbefounde?ciently???? ?? ??Inthe
rest ofthepaper?weassume thatC??G?T? isac?planarandconnectedclusteredgraphwhich
??
Page 20
ancestoralgorithm ???????? eachquery of?nding LCA?u?v? canbeansw eredinO ???time after
O?n? timepreprocessing? Witha slight modi?cation inthestep? ofthe algorithm??? ?? GUA?u?v?
canbefound inO???time based on thesamepreprocessing?
Inthe follo wingsections?wealsoassumethat?fora giv enc?planarandconnectedclustered
graphC??G?T??eachface?includingtheexternalface? ofGisatriangle?We triangulateG
sothat resultingclusteredgraphremainsc?planar?This is accomplishedbyusinga triangulation
algorithm???? orbytriangulating eachfacef in troducinga newvertexv
f
?togetherwithedges
b etw eenv
f
andv ertices onthecycleC
f
off ??wherefv
f
g willbeac hildcluster ofthe smallest
cluster?
f
that contains thefacef? Thelatter triangulation canbedone inO?n? time?because
for eachfacef? thecluster?
f
canbecomputedinO?jC
f
j?timebyusing the theleastcommon
ancestoralgorithm ???? ????
??? Thec?stn umberingalgorithm
In thissection?we de?netheconcept of?c?stn umb ering?and show howtocompute itinlinear
time?
ByTheorem ??weassume thatwe aregivenac?planarconnectedclusteredgraphC??G?T?
withac?planar emb edding?F or eachvertexu? letA?u?beadoubly?link edlistofedges aroundu?
wheretheedges inA?u?appear alonguinthe orderof thelist intheembedding?
The st numbering ofthevertices ofa graphhasprov ed tobeauseful tool formanygraph
algorithms?esp eciallygraphdra wingalgorithms?see? forexample? ???? ????we nextreviewthis
concept?Supp ose that?s?t?isanedgeofabiconnectedgraphGwithnvertices?In anstnumbering?
thevertices ofGaren umb eredfrom? ton sothatv ertexsreceiv esn umber ??v ertextreceiv es
numbern? and anyvertex excepts andt is adjacentb oth toa lower?numbered vertex anda higher?
n umberedv ertex?V erticess andtarecalledthesource andthesink resp ectively? Anstnumbering
ofabiconnectedgraph canbecomputed inlineartime ??? ??
Anoutlineof ouralgorithmisdescrib edasfollows?We needto generalize thisnotiontoclustered
graphs?Givena clusteredgraphC??G?T ??anstn umbering of thev erticesofG suchthat the
v erticesthatbelong tothe same clusteraren umb ered consecutively isac?stnumb ering?
Lookingahead to Section????thec?stn umb eringgivesusalayerassignment ofthevertices
ofG? Hence? theclusteredgraph istransformedtoahierarchicalgraph?seeFigure????andeach
cluster has consecutivelayers?Because ofthisproperty?wecanshowthatastraight?lineconvex
clusterdrawingcanbeconstructed from thestraight?linehierarchicaldra wing?
The criticalpartofthis method is theconstruction of thec?stnumbering? Theremainderof
thissectionisdevotedto theconstruction of thec?stnumb ering?
We constructsomeauxiliary graphs tocomputesuchac?stnumb ering?Notethat stn umb er?
ings are constructedon biconnectedgraphs?Weneed thefollowinglemma to ensureappropriate
connectivity of ourauxiliaryplane graphs?
Lemma?Supp osethatC??G?T? isaconne ctedc?planar clustered gr aph? andG istriangulate d?
Then? foreverynon?root node? ofT? the sub gr aphofGinducedbyV?V??? isconne cte d?
??
Page 21
3
4
5
6
7
8
9
10
11
12
2
1
Figure???ClusteredGraph?HierarchicalGraph
G( Î½)
F
Fj
i
f
Figure ???Illustration forthe pro of ofLemma ??
??
Page 22
Î½
a
b
c
d
Î½e
Î½
e
a
c
b
d
C
G ( )
âˆ—
Figure ???Aclustered graphCwitha node?? andthegraphG
?
?? ??
Pro of?Supposethatthe subgraphofGinducedbyV?V??? haskcomponen ts? denotedby
F
?
?????F
k
?k? ??Hence? there areno edges thatconnectvertices ofF
i
toverticesofF
j
??? i?j?k?
i??j ??
SinceGis triangulated? ithasaunique planar emb edding?By Theorem?? allv erticesand edges
ofG?G??? are inthesame face ofG???? Hence? alledgesthat connectG??? andF
i
?i???????k?
are in thesame faceofG???? Supp osethatk? ??thenthereisa facef ofGwhoseboundary
con tains anedgethatconnectsG??? andF
i
?andalsoanedge thatconnectsG???andF
j
? andi??j
?seeFigure ???? BecauseG istriangulated? thefacef isboundedbyexactlythree edges?Therefore?
theb oundaryof the facef alsocontains an edgethatconnectsF
i
andF
j
? This contradicts the
fact thatthere arenoedges thatconnectv erticesofF
i
andv erticesofF
j
??? i?j?k?i??j ??We
deducethatk? ???
Thecriticalprop erty ofa c?stn umbering is thatthev ertices ofthe samecluster aren umb ered
consecutiv ely?To computean umberingwiththis property?wepro ceed down thetree fromthe ro ot?
ateachnon?leafcluster?we orderthechildclusters of?? This inv olves thecomputationof an
auxiliarygraphG
?
?? ?? asfollo ws?Intuitiv ely?G
?
??? isthe graphobtainedfromG???byshrinking
eachchild clusterV?????? chl?? ??in toasinglev ertex? itmay con tainm ultipleedges? An example
is showninFigure ???Moreprecisely? thev ertexsetofG
?
??? ischl????andtheedge setE??? of
G
?
?? ?? isf?u?v?j LCA?u?v???g?Clearly?eachedgeinE appearsinexactlyoneofthesegraphs
G
?
?? ??Hence the totalsize of allgraphsG
?
??? is
P
??V
?jchl???j?jE???j??O?jVj?jEj??O?n??
Nextweshowhowto computeG
?
??? e?ciently?
Lemma?All graphsG
?
??????Vc anbecomputed inO?n?time?
Proof?We?rst partitiontheedge setE intotheedgesetsE????f?u?v?jLCA?u? v???g???V?
This partitioncanbe computedinO?n?timebycomputing allLCA?u?v ???u?v??E inO ???time
p eredge?u?v??ToconstructG
?
??? explicitly?we how everneed toidentify endv erticesofeachedge
??
Page 23
canbecomputed inO?jEj??O?n? time??
Fromthis lemma?wecanassume that all thegraphsG
?
?? ????V areathand?F orlater
processing? itis important that foreach no de? ofG
?
?? ??the setof edges incident to? isstored in
a doubly?link edlistA????
Usingthe graphsG
?
?? ??we cancomputea c?stn umb ering? Thealgorithm usesanotherauxiliary
graphF?? ??derivedfromG
?
?? ??We proceedfromthero ot toleav esinTduringwhicha particular
order ofc hildreninchl??? isdeterminedafter eachF???iscomputed?Thecomputationis slightly
di?erent when? isthe root?Wedescribe thiscase?rst? andthen thegeneral casewhen? is not
the root?
Supp osethat? is thero ot ofT? letthe graphF???beG
?
????We nowdescribethecomputation
of thec?stnumbering forF?? ??Firstly?wec ho ose anedge?s? t? in theexternal facial cycle? ofG
suchthatLCA?s?t????thatis?suchthat?s?t?that do es not?belong? to any otherclusterexcept
the rootcluster??Since theinput clustered graphgraph isconnected?suchan edge exists?Lemma?
implies thatdeleting anynode fromF??? do esnotincrease then umb er ofcomp onents?Therefore
F???isbiconnected?and hencewecan computean stn umb eringforagiven sourceanda sink in
F???? Bychoosingthevertex?? chl??? withs?V??? asthesource?andthevertex?
?
? chl???
witht?V??
?
?asthe sink?we computeanstn umberinginF????andorder childrenof? according
tothisn umbering?
Now suppose that??Visanon?rootnode?Wecanassumebyinduction thatforanyproper
ancestor?? of?? theorder ofthec hildrenof?? has alreadyb een determinedbyanstnumbering in
F??? ??
ThegraphF??? dependson theorderingofchildren ofitsancestors?Itisconstructedfrom
G
?
???byaddingtwonewverticesSandTand someedgesbetw eenG
?
???andfS?Tgde?nedas
follo ws?
?For each node??chl????thatis? foreachv ertexinG
?
?? ????we connect?andS witha
newedge if thereis anedgee??u
?
?u
?
??Ewithu
?
?V??? such thatanancestor?
?
of
u
?
is orderedbefore anancestor?
?
ofu
?
among thec hildren ofLCA?u
?
?u
?
? inT ?hence
??
?
??
?
??GUA?u
?
?u
?
???See Figure ???a??
?We connect? andTwitha newedge ifthere isanedgee??u
?
?u
?
??Ewithu
?
?V???
such that?
?
isorderedb efore?
?
for??
?
??
?
??GUA?u
?
?u
?
??
?WeconnectS andTwitha newedge?
ThisformsgraphF????see Figure ????Inthe casethatthevertex sb elongs tothe cluster??we
simplychoose thevertexwhichrepresents thechild clusterthatcon tainssasS?similarlyforv ertex
t andvertexT?
Note thatthegraphF???isnot signi?cantly largerthanG
?
?? ?? Letchl
S
???? chl????respec?
tivelychl
T
????chl?? ??denote the setofv erticesthatareadjacenttoS?respectivelyT? inF?? ??
ClearlyeachF???hasjchl???j??verticesandjchl
S
???j?jchl
T
???j?jE???j???jchl???j?jE???j?
edges?
??
Page 24
}
}
{
Ï…
Ï…â€²
root Î³
LCA(u ,u )
1 2
2
u
1
u
Ï…2
e
S
T
1
Ï…
{
: nodes whose
children have
been ordered
: nodes whose
children are not
ordered yet
Ï…2
1
Ï…
2
u
e
1
u
Ï…
"s"
"s"
"s"
"s"
(b)
(a)
Figure???IllustrationofcomputinggraphF????
S
T
F( ) Î½
G*( ) Î½
Figure??? IllustrationofgraphF?? ??
??
Page 25
??V maybe ??n
?
?? althoughthetotaln umb er ofedges in allgraphsF??????V isO?n??
Th us?tocomputeallF??? inO?n? time?we needtoiden tify chl
S
???andchl
T
??? withoutexplicitly
computingthoseedgesb etw eenV??? andV?V??? inG? Somewhat surprisingly?this canbe done?
Lemma?All graphsF??????Vc anbecomputed inO?n?time?
Proof?Clearly?forthero ot?ofT?F????G
?
??? anditsst?numbering canbe computed inO?n?
time? Inwhatfollo ws?we computeF???foreachnode? from the roottotheleav es?visiting
siblingsin anarbitraryorder?? andshow how toidentify chl
S
???for each??V?computingchl
T
???
canbe treatedanalogously? When thegraphF???foranode? is computed?graphsF???? for
allancestors??of? havebeendeterminedandhenceallnodeswhichbelong tochl
S
???inG
?
???
alsohaveb eendetermined?That is? chl
S
??? isdeterminedbytheset ofnodes??chl??? such
thatthereisanedgee??u
?
?u
?
??Ewithu
?
??V???andu
?
?V????and?
?
isorderedbefore
?
?
for??
?
??
?
?? GUA?u
?
?u
?
? intheorderofchildren ofLCA?u
?
?u
?
??seeFigure ???a???To
identifysuch nodese?cien tly?weperformthefollowing op erationfor eachedge?u
?
?u
?
? inG
?
???
afterconstructingF????F orV?e??fu
?
?u
?
g?V ofthec hosenedgeeinG
?
???? Supp osethat
u
?
?V??
?
? andu
?
?V??
?
?for?
?
??
?
?chl?? ?? andassumethat?
?
isorderedbefore?
?
inthe st
n umbering ofF?? ?? Then?wemarkwith?s?all nodesinthepathP
u
?
??
?
fromleafno deu
?
to?
?
in
T ?seeFigure???b???During thetraversal ofP
u
?
??
?
?wecanstopmarkingnodesoncewe encoun ter
a node?
?
which isalreadymark ed?s??b ecausewe seebyinductionthat inthiscase therest of
nodesfrom?
?
to?
?
inP
u
?
??
?
haveb eenmark ed?s??Afterapplyingthis proceduretoalledges
inG
?
??? andG
?
???? forallancestors?? of??thedesiredchl
S
???foreac h??chl??? isgivenby
thesetofnodesinchl??? thathave receivedmark?s?? Thusanynodewill neverbemarkedwith
?s?morethanonce? anditfollo wsthat thetotaltimefor markingoperationsisO?jVj?jEj??By
applyingtheabove proceduretoeachnodefrom toptob ottominT?we can identifyall chl
S
??? in
O?n?time? Similarly?allchl
T
???canbeobtainedinO?n? time?As mentioned abov e? allF??? can
becomputed inO?n?timefromchl
S
???and chl
T
?? ???
After computingall thegraphsF????eachcluster? isassignedan umb er givenbytheorder
withinthegraphF?pa?????Therefore?arecursivehierarchyofordersis formed?We expandit
lexicographicallyin toalinear order andhenceform an ordering ofallv erticesofG? It canbe
veri?edthatthisorder givesusc?stnumbering?thatis?anstn umbering on thev erticesofG such
thattheverticesthatbelongtothesameclusteraren umberedconsecutively?
Lemma?Ac?stnumberingofa triangulated andc?planarconnectedclusteredgraphC??G?T?
canbec omputedinO?n?time?
??? The drawing algorithmfor clusteredgraphs
Usingthec?stnumb eringcomputed in theprevioussection?wetransformaclusteredgraph in to
a hierarchicalgraphbyassigning thelayerofeachvertexwithitsc?stnumb er? Thenapply the
straigh t?linehierarchical drawingalgorithmdescrib edin section?? andobtainaplanarstraight?line
hierarc hicaldrawingofG? Thec?stnumberingensures thateachclusteroccupiesconsecutive lay ers
??
Page 26
ByTheorem ??there arenoedge crossingsin thedra wing? sinceourhierarc hicalplanar drawing
algorithmdoesnot produceany edge crossings?
Sincewe are givena connectedclusteredgraph?each cluster formsaconnectedsubgraphofG?
If? isastraigh t?linesegment with endpoin ts outsidetheconv exh ullfor cluster?? and? intersects
the conv exh ullfor?? then? crossesan edgeinG?? ?? Thereforethere arenoedges that crossthe
region?the conv exh ull?ofa clusterwhere theydo notb elong?b ecauseotherwise therew ouldbe
anedgecrossing?
A conv exh ullofagivensimplepolygonwith m apicescanbeconstructedinO?m? time ????? In
fact?there isasimpleO?m?timealgorithm forcomputinga conv exh ull ofa set ofmp oints which
already sortedbytheiry?coordinates?Since allverticesineach clusterV??? haveconsecutive st
numbers?hencey?coordinates??aconv exh ullofV??? canbecomputedinO?jV???j??O?n? time?
Then thetotal time of computingall conv exhullsinC??G?T?becomesO?n
?
?? Thiscomplexity
is slightly reduced asfollows? LetCH??? denotethesetofvertices which are on theconvexhull
ofaclusterV????hence?jCH???j is theoutputsize oftheconvexhull??TocomputeCH??? ofa
clusterV?? ??we candiscardallv erticesthatare prop erly containedinsidetheconvexh ullCH???
forsomechildcluster V?????? chl?? ??Beforecomputingtheconvex hullCH???forano de??V?
wecomputeall convexhullsCH???for thec hildren??chl????Thenwe cancomputeCH???
from the set?V????
S
??chl???
CH???ofv erticesinO?j?V???j?
P
??chl???
jCH???j?time?where
?V??? denotesV????
S
??chl???
V????Therefore?by computingconv exhullsfrom thebottom of
treeTtotheroot?wecanobtainallCH??????VinO?n?
P
? ?V
jCH???j?time?which islinear
interms of theoutputsize ofastraightlineconv ex clusterdrawing ofC?
ByTheorem ??computinga straigh t?linedrawing ofthe hierarc hicalgraphwithnv ertices can
bedone in lineartime?Ac?stn umb eringofaclusteredgraphwithnv erticescanbecomputed
inO?n?time? Insummary?weestablish thefollowing result onplanar straigh t?lineconv excluster
drawings?
Theorem?L etC??G?T?beac?planarclusteredgraphwithnvertices?Aplanarstr aight?line
convex cluster dr awingofCin whicheachclusterisaconvex hullofpoints intheclusterc anbe
constructed inO?n?D?time?whereD?O?n
?
?isthetotalsizeofc onvexpolygonsfor clustersin
the dr awing?
? ExamplesandOp enProblems
Inthissectionwe discuss somedra wingspro ducedbyouralgorithms?
Ouralgorithmfor drawinghierarchicalgraphs usesadivide andconquerapproach?Atev ery
division?wechooseavertexv which is drawnas an apex ofthep olygon?this determinesasuitable
partition ofthepolygon?Experiments have shownthatthechoiceofsuchavertexvcanhave
asigni?cantimpact on the?nal drawing?F orexample?considerFigure???InFigure???a??we
alwa ysuseav ertexvontheright side ofthep olygonto ?nda partition?In this case?the?nal
drawing isnotquitebalanced?although itmeets thestraight?lineandnon?crossingrequirements?
Anotherdrawingofthesamehierarchicalgraphis showninFigure???b?? Inthiscase?we have
chosen anavailablev ertexvrandomly?andthe dra wing ismorebalanced?
??
Page 27
Figure ???Ap ossiblecrossingb etw eena segmentandarectangle?
Wehaveperformedthesamekind ofexperiment onclustered graphs?We used rectangular
hulls instead ofconvexhulls torepresentacluster?b ecausewe ?nd rectanglesaremorepleasing?
though thereisstillac hanceofedge?region crossings in this case?seeFigure ????We useddi?erent
partitioningstrategies andproduced di?erent dra wings?F romthe examples?c hoosingavertexv
randomlyfrom theav ailableones seems tobeasuccessfulstrategy ?see Figure????
Thealgorithmspresen tedinsections? and? userationaln umb ersfor co ordinates?Inb othcases?
theprecision of the coordinates mayincrease exponentially withthenumb er of no des?In other
words? if thenodesw ere placedat integer gridpoin tsthen the areaof theresulting dra wingwould
be exponential? Infact?this is inevitable?exponentialarealow erb ounds haveb eenestablished
b othforstraigh t?lineh?planar dra wingsand for straight?linec?planar conv ex clusterdra wings?
? In??? ?? it isshownthereisa classof hierarchical planargraphsH
n
?n????? ???? of?n??
lay ersand ??n??v ertices such thatany hierarchicalplanarstraigh t?line drawing ofH
n
has
width ????n????? undervertexresolution? ?that is? every pair ofvertices are atleast?unit
distanceapart??Figure ?? showsa dra wingofH
?
?
? In??? ??aclass ofclustered graphsC
n
?n????? ????is giv en? InC
n
?there are?nvertices
which arepartitioned intotwoclusters? Itissho wn in????that any straight?line conv ex
clusterdra wingofC
n
hasarea ???
n
??Figure ??sho wsa drawing ofC
?
?
Futurew orkonhierarchicalgraphs andclusteredgraphs shouldaddress thefollowing op en
problems?
?Wenotethat relaxingthestraight?lineconstrain tscangive uspolynomial areab oundsb oth
inhierarchicaldra wingsand in conv excluster dra wings??????? ????Infuturework?wew ould
liketoinvestigatethetrade?o?b etw eenthen umberofbends andthe areaof thedrawing?
? Thedrawings ofclusteredgraphs maylackv erticalcompactionbecausewe usean stn umb er?
ingasthelayer assignment? Itisv eryw orthwhile to investigatemethodsthat canimprove
thev erticalcompaction?
?In ouralgorithm?we can onlyensurethat thenon?crossingprop erty holdsforclustersdrawn
as convexpolygons?How ever? itismoredesirableto representclusters asmoreregular
convexbo diessuch as circlesandrectangles?Thisalsoforms an interesting topic forour
futureresearc h?
Acknowledgemen ts
The authorswish tothank Dr?Bry anBeresford?Smith for Figure?? andtheanon ymousreferees
forgiving many helpful comments andsuggestions?
??
Page 28
?a?
?b?
Figure ???Example drawings ofa hierarchicalgraph?with di?erent strategiesforthepartition??a?
Alwa yscho oseanapex ontherightside??b?Cho osean ap ex randomlyfromb oth sides?
??
Page 29
?a?
?b?
Figure ???Example drawings ofaclustered graph? withdi?erent strategies forthepartition? ?a?
Alwa yschooseanapexontherightside??b? Choose anap exrandomly fromb othsides?
??
Page 30
Figure ???A drawing ofH
?
?
Figure ???A dra wingofC
?
?
??
Page 31
???G?Di Battistaand R?T amassia?Algorithmsfor planerepresen tations ofacyclicdigraphs?
Theoretic alComputer Science???????????? ?????
???Claude Berge?Graphs andHyp ergraphs?North?Holland? ?????
???J?A? Bondyand U?S?R?Murty? Gr aphTheory with Applications? North?Holland? NewY ork?
N?Y???????
???M?J?Carpano?Automatic display ofhierarchizedgraphs forcomputeraided decisionanalysis?
IEEETransactions onSystems? ManandCybernetics?SMC?????????????????????
???N? Chiba?K? Onoguchi? andT?Nishizeki? Drawing planar graphsnicely?ActaInformatica?
??????????? ?????
???N? Chiba? T?Y amanouchi?and T?Nishizeki? Linearalgorithms forconvexdrawingsofplanar
graphs? InJ?A? BondyandU?S?R? Murty? editors? Pro gr essin Graph Theory?pages????????
AcademicPress? NewY ork? N?Y???????
???M?Chrobakand T?H?Pa yne?A lineartimealgorithm fordrawinga planargraphona grid?
InformationProc essingL etters?????????????????
???G? diBattista?P?Eades? R?T amassia?and I? G?T ollis?Gr aphDr awing?algorithmsfor the
visualization of graphs?Pren ticHall??????
????P?Eades andX?Lin? How to drawdirectedgraphs? InPro c? IEEEWorkshopon Visual
Languages?VL????? pages?????? ?????
????P? EadesandK?Sugiyama? How to drawadirectedgraph?Journal ofInformation Proc essing?
pages???????? ?????
????P eterEades andQing?WenFeng? Drawingclustered graphsonanorthogonalgrid? InG? di
Battista?editor?Graph Draing?????volume???? ofLectureNotes inComputerScience? pages
???? ????Springer?Verlag? ?????
????PeterEades? Qing?W enFeng? and HiroshiNagamochi? Dra wingclustered graphs on theor?
thogonalgrid?????? ?toapp ear??
????Peter D?Eades? XueminLin? andRob ertoT amassia? Analgorithmfor drawinga hierarchical
graph?InternationalJournalofComputationalGeometryand Applications??????????????
?????
???? S?Even?GraphAlgorithms?Computer SciencePress??????
???? S? Ev enand R? E?Tarjan?Computing anst?numb ering? Theoretic alComputer Science? ??????
???? ?????
???? I?Fary? Onstraightlinesrepresen tation of planargraphs?ActaSci?Math? Szege d?????????????
?????
??
Page 32
????Q?F eng?R? Cohen?andP?Eades?Planarity forclustered graphs?InESA????volume ??? of
Le ctureNotes inComputer Science? pages???????? Springer?Verlag? ?????
????Qing?WenF eng?P eter Eades? andRobert F? Cohen?Clusteredgraphs andC?planarity?T ec h?
nicalRep ort ??????Department ofComputerScience? TheUniv ersity ofNewcastle?Australia?
?????
????H?DeF raysseix? J?P ach? andR?Pollack?Howtodrawa planargraph onagrid? Combinatorica?
????????? ?????
???? E?R?Gansner? S?C?North? andK?P?V o? Dag?aprogram that drawsdirectedgraphs?Software
? Practice and Experience???????????????????????
????D? Harel?Onvisualformalisms?Communications oftheA CM????????????????????
???? D? HarelandR?T arjan?F astalgorithmsfor ?nding nearestcommonancestors?SIAM J?
Computing? ??????? ?????????
????M?Himsolt?Graphed? An interactivegraph editor?In Pro c?STA CS???volume ??? ofLe cture
NotesinComputerScience? pages???????? Berlin? ?????Springer?Verlag?
???? M?Juenger? S?Leipert? andP?Mutzel? Pitfallsof usingPQ?trees inautomoatic graph drawing?
InG?diBattista? editor? GraphDraing?????volume???? ofLe ctureNotes inComputer
Science?pages ???? ????Springer?Verlag??????
???? T?Kamada?VisualizingA bstr actObjects andR elations?W orld Scienti?cSeries inComputer
Science? ?????
????G?Kan t?Dra wingplanar graphsusingthecanonicalordering?Algorithmica????????? ?????
???? J? Kawakita?The KJ method?a scienti?capproach to problemsolving?T echnicalrep ort?
Kaw akita ResearchInstitute?T okyo??????
???? W?Lai?Building Inter activeDigramApplications? PhDthesis?Department ofComputer
Science? University ofNewcastle??????
????ThomasLengauer?Hierarchicalplanarity testingalgorithms?JournalofA CM? ???????????
?????
????XueminLin?Analysis ofAlgorithmsfor Drawing Graphs?PhD thesis?DepartmentofComputer
Science?University of Queensland?Australia??????
????M? May andP?Menneck e? Lay outof schematic drawings? Syst?Anal? Model?Simul???????????
?????????
????F rancoP?Preparata and Michael I? Shamos?Computational geometry? anintroduction?
Springer?V erlag?NewY ork? ?????
??
Page 33
pages???????? Springer?Verlag??????
????R?Read?Metho dsforcomputer displayandmanipulation ofgraphs andthecorresp onding
algorithms?T echnical Report??????Faculty ofMathematics?Univ? ofWaterlo o?July ?????
???? L?A?Row e? M? Da vis? E?Messinger? C?Meyer? C?Spirakis? and A?T uan?A browserfordirected
graphs? Software? Practice and Experience??????????????????
????B?Schieb er andU?Vishkin? On?nding low estcommonancestors?simpli?cationand paral?
lelization? SIAMJ? Computing?????????????? ?????
????W?Schnyder? Emb eddingplanargraphson thegrid? In Pro c?FirstA CM?SIAMSymp? on
DiscreteA lgorithms? pages?????????????
????T om Sa wy erSoftw are? Graph lay out toolkit user?sguide? Berkeley? CA??????
????S?K? Stein? Conv exmaps?Procee dingsA mericanMathematic al Society????????????????
???? K?Sugiyama?Acognitiveapproach forgraphdra wing? Cybernetics andSystems?AnInter?
national Journal???????????? ?????
????K?Sugiy amaand K?Misue?Visualization of structural information?Automatic drawingof
compounddigraphs? IEEETransactionson Systems? Manand Cybernetics? ??????????????
?????
???? K?Sugiyama? S?T agaw a? and M?To da?Metho dsforvisualunderstanding of hierarchical
systems?IEEETransactions onSystems? ManandCyb ernetics?SMC??????????????? ?????
????R?T amassia?G?DiBattista? and C?Batini?Automaticgraphdra wing andreadabilityof
diagrams?IEEETransactions onSystems?Man andCybernetics?SMC??????????????????
???? W?T?Tutte? How todrawa graph? ProceedingsLondonMathematic alSo ciety???????????????
?????
????K?W agner?Bemerkungen zum vierfarbenproblem? Jber?Deutsch?Math??Verein??????????
?????
????C?Williams?J? Rasure? and C?Hansen?The state oftheartof visuallanguagesforvisualization?
InVisualization??? pages?????????????
???? R?Wirfs?Brock? B?Wilkerson?and L?Wiener?DesigningObje ct?Oriented Software?PTR
PrenticeHall? Englewood Cli?s?NJ???????????
??