## Presentation on theme: "Graph Drawing Graph Drawing Tutorial Isabel F"— Presentation transcript

Graph DrawingGraph Drawing TutorialIsabel F. CruzWorcester Polytechnic InstituteRoberto Tamassia
Graph Drawing
Graph Drawing
models, algorithms, and systems for theapplicationstosoftwareengineering(classhierarchies),knowledgerepresentationhierarchies),
Graph Drawing drawing
n on the geometricrepresentation of vertices and edges
drawing drawing
Graph Drawing
strong visibilityrepresentationdrawing
abc
abdec
Graph Drawing
directed acyclic graphs are usually drawnin such a way that all edges ÒßowÓ in thesame direction, e.g., from left to right, orsuchupwarddrawingsvisualize hierarchical relationships, suchnot every planar acyclic digraph admits aplanar upward drawing
Graph Drawingdisplay devices and the human eye have
Graph Drawing ¥Theangularresolutionofastraight-line drawing is the smallest angleapplicationsandinthenetworks. ¥A
------
Graph Drawing
some drawings are better than others incharacterize readability by means of
Graph Drawing
Trade-Offstesting upward planarity is NP-harddrawing:
min # crossingsmax symmetries
Graph Drawing
Graph Drawing
speciÞc graph (e.g., place Òmostareprovidedasadditionalinput to a graph drawing algorithmthe drawingboundary of the drawingdraw a subgraph with a prescribedkeep a group of vertices ÒcloseÓ together
Graph DrawingLayoutofthegraphgeneratedaccording. E.g.User-deÞnedalgorithmic approachE.g., [Tamassia Di Battista Batini 87]
Graph DrawingLayout of the graph speciÞed by aLayout generated by theSomenaturalaesthetics(e.g.,planarity)Lack of a powerful language for thefacts, or with a set notation)
Graph Drawing
BookonGraphDrawingbyG.DiBattista,P.Eades,R. Tamassia, and I. G. Tollis, ISBN 0-13-301615-3,, (available in August 1998).Roberto TamassiaÕs WWW pageTutorial on Graph Drawingand Roberto Tamassia (about 100 pages)Annotated Bibliographyon Graph Drawing(more than 300 entries, up to 1993)Battista, Eades, Tamassia, and Tollis.Geometry: Theory and Applications,(about 8,000 BibTeX entries, including mostpapers on graph drawing, updated quarterly)Proceedings of the Graph Drawing(Springer-Verlag, LNCS)Graph Drawing Chapters
Graph Drawing
Trees
Graph Drawing
Drawings of Rooted Treesthe usual drawings of rooted trees are(parents above children)itisdesirabletominimizetheto displaylevel drawings may require
Graph DrawingAlgorithm for Binary Treeslevel grid drawingdisplay ofsymmetries and of isomorphicparent in between left and right childparents not always centered on children
123456789
1011
Graph Drawing
Algorithm for Binary Treesreesndraw the left subtreedraw the right subtreeplace the drawings of the subtrees atway between the childrenifthereisonlyonechild,placetherootathorizontal distance 1 from the child
Graph Drawing
for Binary Trees level drawingdisplay of symmetries and of isomorphiccan be extended to draw general rootedtrees (e.g., root is placed at the averagex-coordinate of its children)
Graph Drawing
Tree Drawing Algorithm
minimum width drawingdrawing constructed by the algorithm
minimizing the width is NP-hard ifinteger coordinates are required
Graph DrawingArea-EfÞcient Drawings of Treesplanar straight-line orthogonal upwardgrid drawing of a binary tree withwing of a binary tree with[Shiloach 76]draw the
Graph DrawingArea-EfÞcient Drawings of Treesplanar straight-line upward grid drawingsAVL treesVL trees[Crescenzi Penna Piperno 95]
Graph Drawing
Area-EfÞcient Drawings of Treesplanar polyline upward grid drawings[Garg Goodrich Tamassia 93]
Graph Drawing
Drawings of Treesrequirement of planar upward straight-line drawings of treesupwardlevel[RT 83]upwardardupwardardupwardardnon-upwardardnon-upwardleaves-on-hull
Graph Drawing
of Binary Treesofadrawingisthemaximumofitsdrawings of binary trees:achieved for (nonupward) planar straight-line drawings of binary trees?upward, straight-linelevel[RT 83]upward, polylineard, polylineupward, straight-lineAVL treesVL treesupward, straight-line
Graph DrawingDrawings of Binary Trees withrecursivewindingtechnique[CGKT96]:let N be number of nodes in the tree,andN()bethenumberofnodesintheforeachnode,swapchildrentohavepath such that:draw the left subtrees on the path draw recursively the subtrees
Graph DrawingRecursive Winding DrawingNlogNO(NlogN
T"
Graph Drawing
Tip-OverDrawingsofRootedTreesTip-over drawings are upward planarorthogonal drawings such that the childrenWidely used in organization charts.Allow to better Þt the drawing in a
personnel
purchasing
Graph Drawing
Trees display the parent-child relationship by the inclusion betweenisothetic rectangles.Closely related to tip-over drawings.Used for displaying compound graphs (e.g.,Allow to better Þt the drawing in ainternationaldomesticEurope
Australia
Western
air reservations
Graph Drawing
Area of Tip-Over and InclusionEades,LinandLin(1992)studyofthearearequirement of tip-over and inclusiondrawings of rooted trees.Thedimensionsofthenodelabelsaregiven of the drawing is:drawing.
Graph Drawing
How to Draw Free Treescycles and do not represent hierarchicalrelationships (e.g., spanning trees)Leveldrawingsofrootedtreesyieldwith minmax distance from the leaves),which gives a rooted tree T'construct a level drawing)toobtainfromradial drawing
Graph Drawing
Graph Drawing
PlanarDrawingsandEmbeddings is a class oftopologically equivalent planar drawingsof edges around eachvertexbounding eachfacetriconnected planar graphs have a unique
Graph Drawing
TestingPlanaritytestingandconstructingaplanar[Hopcroft Tarjan 74][de Fraysseix Rosenstiehl 82]ysseix Rosenstiehl 82][Even Tarjan 76]arjan 76][Chiba Nishizeki Ozawa 85]
Graph Drawing
[Hopcroft Tarjan 74]: planarity testing and[Fary 48, Stein 51, Steinitz 34, Wagner 36]:straight-line drawingPlanar straight-line drawings may need[deFraysseixPachPollack88,Schnyder89,grid drawings can be constructed in O(n)
Graph Drawing)-area drawings may have[Garg Tamassia 94]:Trade-off (area vs. angular resolution):
1n
Odlogd3ç÷
Wcrn
Graph Drawing[Malitz Papakostas 92]: the angularGood angular resolution can be achievedfor special classes of planar graphs:[Malitz Papakostas 92][Garg Tamassia 94][Garg Tamassia 94]can we achieve
7dæö
Graph Drawing
givenplanargraphofdegree4,wewanttoÞnd a planar orthogonal drawing of G with
Graph Drawing
[Tamassia 87][Di Battista Liotta Vargiu 93][Tamassia Tollis 89]O(n)-timeapproximationwithO(n)bends[Garg Tamassia 93]
Graph Drawing
na unit of ßow is a 90° anglena vertex (source) produces 4 unitsna face f (sink) consumes 2 deg(f)- 4units (deg(f) + 4 for the external face)nEdges transport ßow across faces
12
211
Graph Drawing
nvertex-face arcs: ßow³ 1, cost = 0222322
111111111
Graph Drawing
nface-face arcs: ßow³ 0, cost = 11111112
Graph Drawing
444214
1
2
3
Graph Drawing
EulerÕs formuladrawing of Goptimal drawing [Tamassia 87] Computing thenetwork N, and takes
Graph Drawing
upperboundonthenumberofbendsondrawing can be expressed by settingE.g., we can prescribe a maximum of 2bendsonagivenedgebysettingequalto
Graph Drawing
A drawing has the minimum number ofclosed curve C such that(#edgescrossedbyCfrom90or180If such a curve exists, ÒrotatingÓ theportion of the drawing inside C reduces
Graph Drawing
on each facevertices cannot be traversed by CC traverses edge from 270°Þ DFC traverses edge from 90°Þ DFbends removed going ÔÔinwardÕÕ andinserted going ÔÔoutwardÕÕC is a closed curveHence,
234432105
Graph Drawing
Visibility Representationpreliminarystepfordrawingalgorithms
Graph Drawing
FromVisibilityRepresentationsto
Graph Drawing
1.Construct visibility representation2.Transform visibility representationinto a preliminary drawing3.Apply bend-stretching transformations4.Compact orthogonal representation
Graph Drawing
Graph Drawing
Upward Planarity Testingupward planarity testing for ordered sets[Kelly 87, Di Battista Tamassia 87]:upward planarity is equivalent tosubgraph inclusion in a planar st-digraph(planaracyclicdigraphwithonesourceand[Kelly 87, Di Battista Tamassia 87]:upward planarity is equivalent to upward
Graph DrawingPlanarity TestingestingMannino 91]nO(n2)-time forÞxed embeddingn[Hutton Lubiw 91]nO(n2)-timeforsingle-sourcedigraphsn[Bertolazzi Di Battista ManninoTamassia 93][Garg Tamassia 93]
Graph DrawingSince an upward planar digraph is aneedtoknowhowtodrawplanarst-digraphsIfGisaplanarst-digraphwithouttransitiveedges, we can use the
right (y)1234567891005792613841001210
012345678910
Graph DrawingUpward,planar,straight-line,O(n)area are displayed
Graph DrawingAvariationoftheleft/rightnumberingyieldsdominance drawings withedges and are displayed as bends (upwardplanar polyline drawings)
Graph DrawingWe can use the techniques for dominancedrawings also for undirected planar graphs:construct a dominance drawing of G'
Graph Drawing
Graph DrawingAlgorithmicStrategiesforDrawingif the graph is nonplanar,use one of the drawing algorithms fore.g.,GIOTTO[TamassiaBatiniDiBattista87]use one the drawing algorithms fore.g.,
Graph Drawing1.try adding the edges one at a time, and2.construct a planar embedding of the3.add the nonplanar edges, one at a time, tothe embedding, minimizing each time thenumberof(shortestpathin
Graph DrawingTopological Constraints in thedraw the graph such that the havedraw the graph such the vertices
Graph DrawingGIOTTO
planarization
bend minimization
Graph Drawing
Graph Drawingin GIOTTOtopological contraints have
Graph DrawingPlanarization Techniquestostraight-line,orthogonalandpolyline drawingssupportedbytheoreticalresultsonplanardrawings in practice,alsofor large may alterthe userÕs mental map
Graph Drawing
nreplace the edges bysprings with unitnatural lengthnconnect nonadjacent vertices withadditional springs with inÞnite naturallengthnrecall that the springs attract theendpoints when stretched, and repel thestate is eventually reached)
Graph Drawing
Graph DrawingOther Force-Directed Techniques[Kamada Kawai 89]drawing is equal to theirfor each pair of vertices (u,v) use a[Fruchterman Reingold 90]given drawing region acts as wall[Davidson Harel 89]vertex distribution, edge-lengths, andgiven drawing region acts as wall
Graph Drawingdrawings of the same graph constructedwith the technique of [Davidson Harel 89]
Graph DrawingForce-Directed Techniques of the drawing into theuserÕs mental mapoften able to detect and displayfewtheoreticalresultsonthequalityofthedrawings producedpolyline drawings
Graph DrawingConstraints in Force-DirectedTechniqueswe can constrain each vertex to remaincanbesatisÞedprovidedtheycanbeexpressedbymeansofforcese.g,
Graph Drawing
pindowntheverticesoftheexternalfaceface length(e)]2nequivalent to thebarycentric mapping[Tutte 60]:p(v) = 1/deg(v) S(v,w)
Graph Drawing
Graph DrawingLayerassignment:assignverticestolayers arrange vertices on each layer improve the drawing withwing with[Sugiyama Tagawa Toda 81]
Graph Drawing[Sugiyama Tagawa Toda 81]
Graph Drawing
Graph Drawing
¥These approaches cover a broad range ofTightly-coupledcannot be separated from each other.separate module from the algorithms module. ¥Most of the approaches are somewhere in between ...Tightly-coupled approaches ¥The algorithms can be optimized for the particular ¥The problem is well-deÞned. ¥Takes an expert to modify the code (difÞcult ¥User has less ßexibility.
Graph Drawing
¥Flexible: the user speciÞes the drawing usingconstraints, and the graph drawing module executes ¥Extensible: progressive changes can be made to thespeciÞcation module and to the algorithms module. ¥Potential Òimpedance mismatchÓ between the twomodules. ¥EfÞciency: more difÞcult to guarantee.
Graph Drawing
¥Languages for display speciÞcationy speciÞcation ¥IDEAL [Van Wyk 82] ¥TripTrip ¥GVL [Graham & Cordy 90] ¥GrammarsVisual Grammarsisual Grammars ¥Picture Grammars [Golin and Reiss 90] ¥Attribute GrammarsAttribute Grammars§ ¥Layout Graph Grammars [Brandenburg94] [Hickl94] ¥Relational Grammars [Weitzman &Wittenburg 94]Visual Constraints ¥U-term languageU-term language ¥Sketching[Gleicher93][Gross94]
Visual Used in GD and Visual
Graph Drawing
nGraphicalobjectsaredeÞnedbyexample,andhave aConstraints are associated with the classesObject-oriented (message passing,Visual programming language.[Van Wyk 82]Textual speciÞcation of constraints.abstract data types, and adding constraints.Uses complex numbers to specify coordinates..nVisual language to specify the display ofprogram data structures.display of a linked list is the display of thedisplay of the rest of the list.
Graph Drawing
[Brandenburg 94] [Hickl 94]drawing graphslayout speciÞcation for its productionsby repeated applications of its productions,agraphgrammargenerateslabeledgraphs,which deÞne its graph languageclass of layout graph grammars for whichoptimal graphdrawingsH-tree layouts of complete binary treeshv-drawings of binary treesNFA state transition diagrams from
Graph Drawing
¥Production rules use constraints. ¥Terminals are: (e.g., rectangle, circle, text)(e.g., arrow) ¥spatial relationships between objects arein the grammar (e.g., over, left_of) ¥More expressive relationships : ¥Complexity of parsing has been studied.
over (rectangle
rectangle:(rx,ty)(lx,by)
rectangle1rectangle2
Graph Drawing
[Weitzman & Wittenburg 93, 94] ¥Generalization of attribute string grammarspositionsin2Dand3D,topologicalconnectivity,Text Text Text Number Image ¥Constraints are solved with DeltaBlue (U. ofWashington) for non-cyclic constraints.
(2Text(Author-Of21))
Graph Drawing
Visual Grammarsisual Grammars ¥Contex-free grammar. ¥Symbols are visual, and are visually annotated. ¥The interpretation of the visual symbols is left
®
*bar-list*
textline
Graph Drawing
¥BriarBriar Constraint-based drawing program: ¥Direct manipulation drawing techniques. ¥Makes relationships between graphical objects ¥Performance concerns in solving constraints. ¥Spatial Relation PredicatesSpatial Relation Predicates ¥Applicationsincluderetrievalofbuildingsfromanarchitecture database.
(CONTAINS BOX CIRCLE)(CONTAINS BOX TRIANGLE)(IMMEDIATELY-RIGHT-OF CIRCLE TRIANGLE)
Graph Drawingwingnframework for visualizing abstract objectsand relations.constraint-based object layout system
original textual representation
Visual Mapping
layout library
Graph Drawing
nlayout-aestheticconcernssubordinatedtoalignment, zoning, symmetry, T-shape,layout task as aoptimalitycriteriaderivedfromlayout-
Graph Drawing
Visual Graph Drawingisual Graph DrawingCruz, Tamassia Van Hentenryck 93] approach to graph drawing canVisual speciÞcation of layout:theusershouldnothavetoVisualspeciÞcationofaestheticcriteriarepresentations.: the user should not have togive precise geometric speciÞcations.
Graph Drawing
¥Visual constraints. ¥Simplicityandgenericityofthebasicconstructs. ¥Ability to specify a variety of displays: graphs, ¥Compatibility with the framework of an object- ¥Recursive visual speciÞcation.
GRIDON
DEFAULT
Vis Lan
Graph Drawing
EfÞcient Visual Graph Drawing[Cruz Garg 94] [Cruz Garg Tamassia 95]drawing deÞned Òwing deÞned Òna set ofconstraints is generated by theapplication of the visual rules to the inputgraphnvarious types of drawings can be visuallyexpressed in such a way that the resulting, e.g.,drawingsoftrees(upwarddrawings,boxinclusion drawings)drawings of series-parallel digraphs(delta drawings)drawings of planar acyclic digraphs(visibility drawings, upward planarpolyline drawings)
Graph Drawing
Tree Layout
L [h]
L , HR) [v]LR
R [h]
WL + 1 [h]1 [v]
VON
Vis Lan
TREEDEFAUL
[root®N:node;left®L:binTree;right®R:binTree]
R [v]HL [v]
Graph Drawing
Characteristics of the Previous TreeLevel DrawingsUpwardDisplay of symmetries.Display of isomorphic subtrees.
Graph Drawing
[root®N:node;left®L:binTree;right®R:binTree]
VON
Vis Lan
L [h]max(HL , HR) + 1R
R [h]
1 [v]
R [v]HL [v]
Graph Drawing
EfÞcientVisualGraphDrawingDrawing ¥RecognizeefÞciently. ¥Devise algorithms and data structures for ¥Trees (upward drawing, box inclusion drawing). ¥Series-parallel digraphs(delta drawing). ¥Planar acyclic digraphs(visibility drawing,upward planar polyline drawing). ¥Next: ¥Extend above results to other classes of graphsand drawings. ¥Constraint viewpoint: framework for evaluatingconstraints efÞciently. ¥Incorporate these algorithms into a declarativegraph drawing system that uses
Graph Drawing
Series-parallel graphs / delta-drawings[Bertolazzi,Cohen,DiBattista,Tamassia&Tollis, 92]
GG1G1G2G2
u
acbd
ExampleSeriesParallelcompositioncompositionBase case
Graph Drawing
MWSOURCESINK , U1 [v]1 [v]ME
SOURCESINKUUUMWUU
G1XY
D [v]
SOURCE
D [h]D [v]D [v]MWMESINKSOURCE
SINK
X
parallel (x,y)sp-digraph (G1)
Graph Drawing
planar upward drawingvisibility drawingtessellation drawing
Graph Drawing
Tessellation Drawing
TessellationDrawing
v: sourceVertex [ leftFace f : face ;rightFace
v: sourceVertex
f
LE
RE
ORIGIN
TessellationDrawing
v: vertex [ leftFace f : face ;rightFace
v: vertex
f
LE
F-Language
g
f: face
TessellationDrawing
RE
f: face [: vertex ;bottomVertex
F-Language
Graph Drawing
Tessellation Drawing
TessellationDrawing
v2
f
MWv1
g
ME
max ( 1,D) [h,v]
® v1: vertex;: vertex; leftFace f: face; rightFaceg: face ]
RE
Graph Drawing
Visibility Drawing
v: sourceVertex [ leftFace f : face ;rightFace
v: sourceVertex
F-LanguageORIGIN
fF
0.5 [h]
0.5 [h]
v: vertex [ leftFace f : face ;rightFace
v: vertex
F-Language
fF
0.5 [h]
0.5 [h]
Graph Drawing
Visibility Drawing
f: face
f: face
VisibilityDrawing
e:edge
VisibilityDrawing
v2
f
MWv1
g
ME
max ( 1,D) [h,v]
® v1: vertex;: vertex; leftFace f: face; rightFaceg: face ]
RE
MN
Graph Drawing
Upward Polyline Drawing
v: sourceVertex [ leftFace f : face ;rightFace
v: sourceVertex
f
LE
RE
ORIGIN
v: vertex [ leftFace f : face ;rightFace
v: vertex
F-Language
LE
RE
Graph Drawing
Upward Polyline Drawing
f: face
f: face
PolylineDrawing
F-Language
1 [v]
1 [v]LBUB
PolylineDrawing
MN
v2
f
MWv1
g
ME
max ( 1,D) [h,v]
® v1: vertex;: vertex; leftFace f: face; rightFaceg: face ]
RE
Graph Drawing
¥New approach, therefore much left toexplore, in particular: ¥New speciÞcation languages. ¥Reducing the Òimpedance mismatch.Ó ¥Design of user interfaces, andapplications. ¥IdentiÞcationoflevelsofcomplexityindrawing graphs (e.g., with graphgrammars, constraint languages). ¥Expressiveness of the speciÞcationlanguages,inparticularofdeclarativeand visual languages. ¥ReÞnement of thehierarchy, so that we can have a trueÒtool boxÓ for the declarative, loosely-coupled approach.
Graph Drawing
Graph Drawing(Brown University, USA)Roberto TamassiaGDToolkit(University of Passau, Germany)Michael HimsoltGraphViz(AT&T Research)