© 2012 Prof. Dr. Franz J. Brandenburg Graph Drawing main achievements and latest trends an update to 2002 Franz J. Brandenburg University of Passau 1 Graph Drawing © 2012 Prof. Dr. Franz J. Brandenburg Goals: Design algorithms for „nice“ visualizations of graphs Construct well-readable and understandable diagrams Mathematically A drawing is a mapping of a graph on the plane (or another surface) - one to one on the vertices placement phase, assign coordinates to the vertices, no overlaps - simple curves the edges routing phase Nice: specify costs or aesthetics to measure the quality of drawings or to compare two drawings d1(G) and d2(G) and say which is better 2 Graph Drawing © 2012 Prof. Dr. Franz J. Brandenburg Synonyms: 4 6 7 Graph network diagram schema map 3 2 1 5 8 5 8 7 5 8 6 4 1 3-D 4 3 2 6 1 7 3 2 planar 3 Formalization © 2012 Prof. Dr. Franz J. Brandenburg Graph drawing is an optimization problem for a class of graphs (directed / undirected, planar) G compute min {cost (d(G)) | G in G, the drawing d(G) satisfies certain restrictions cost is a cost measure} and such that d(G) is computed efficiently. D.E.Knuth (GD1996) "aesthetics cannot be formalized“ There is a gap between the user's view and the formalism. 4 Application Szenario © 2012 Prof. Dr. Franz J. Brandenburg Graph Drawing is used if there is a graph /network / diagram Graph Drawing is the back-end of a process – and often not well respected $$ Problem Data as lists of discrete objects and relations model as a graph Graph internally: an adjazency list or an adjazencymatrix analysis by graph algorithms Graph internally: an adjazency list or an adjazencymatrix Graph Drawing visualization 5 Classes of Graphs © 2012 Prof. Dr. Franz J. Brandenburg • general undirected graphs spring embedders (1982) stress minimization multi-dimensional • directed graphs (mostly acyclic) four phase approach (Sugiyama algorithm (1981)) • planar graphs (undirected and directed) O(n) tests (1972) shift technique (de Fraysseix, Pach, Pollack and Schnyder realizers (1990)) orthogonal drawings upward drawings for directed graphs • trees Reingold-Tilford algorithm (1981) 6 Drawing Styles © 2012 Prof. Dr. Franz J. Brandenburg • vertices = small points The real expansion and shape is neglected • edges = smooth curves • the standard optimal: special polylines with straight straight segments and few bends straight lines orthogonal polyline drawings splines only in a postprocessing step labels often inside the vertices a separate topic 7 Aesthetics © 2012 Prof. Dr. Franz J. Brandenburg D.E.Knuth (GD1996) "aesthetics cannot be formalized“ There is a gap between the user's view and the formalism. R. Tamassia (IEEE SMC 1988, p.62) aesthetics are criteria for graphical aspects of readability M. Bense (1930, desingner at Bauhaus school) aesthetics = order / compexity order = regularity, symmetry, ... complexity = information theoretic bound, #bits H. Purchase et al. (topic in HCI) experimental tests: what is easier/faster to recognize 8 Aesthetics:Formalized © 2012 Prof. Dr. Franz J. Brandenburg • resolution or geometric criteria – area (2), volume (3D), height, width, aspect ratio – edge length (secondary) – integrality, on the grid • discrete criteria – crossings (no crossings = planar) – bends (no bends = straight line) – and others (slopes e.g. orthogonal) • structure – – – – • direction (upward) planar tree clustering symmetry – center father above the children – geometric symmetry (rotation, reflection) – graph symmetry, graph isomorphy 9 General Graphs © 2012 Prof. Dr. Franz J. Brandenburg Input: a huge undirected graph (1000 and more vertices) and no information on its structure goal: uniform distribution of vertices (and edge length) .... find clusters spring embedders and stress minimization approaches repulsive force between vertices (only in an area of a grid) attractive force along an edge (or a path) use quadratic or cubic formulae for the forces (stress) at each vertex: compute the vector of forces move the vertex along that vector iterate pro: intuitive, easy to adapt (add more forces) cons: slow (you need a bag of tricks) 10 Multidimensional Method © 2012 Prof. Dr. Franz J. Brandenburg in 2002: a promising new concept by D. Harel and Y. Koren, GD2002 choose dimension m, e.g. d = 50 (so to speak: its fpt in d) choose m nodes as pivot elements, randomly distributed here in O(d•|E|) by BFS v1 at random and vi+1 = max {distance{v1,...,vi}} (2-approximation of d-center problem) for each node v compute its graph theoretic distance d(v, vi), i=1,...,d to each of the pivot nodes and assign an d-dim vector X(v) = (d(v, v1), ..., d(v, vd)) This is a d-dimensional drawing of G. 11 Multi-Dimensional © 2012 Prof. Dr. Franz J. Brandenburg projection into R2 (or R3) by ”principal component analysis“ transform the coordinates in each dimension around their barycenter Xi(v) = Xi (v) – 1/n∑vXi(v) build the d n center matrix M[i,v] = Xi (v) and the dd covariance matrix S = 1/n M MT compute the first 2 eigenvectors of S normalize the eigenvectors to ||ui || = 1 the 2-D projection by v --> (Xi (v) u1, Xi (v) u2) (maximal variance in 1st and 2nd dimension) Results: excellent pictures: as good as spring embedders and stress minimization extremely fast, 3 sec. for 100000 node graphs 12 Pictures (Koren) © 2012 Prof. Dr. Franz J. Brandenburg 13 4-Phase Method (Sugiama) © 2012 Prof. Dr. Franz J. Brandenburg a directed graph G = (V, E) (with cycles) decycling, feedback arc set problem heuristics, e.g. Eades et al a directed acyclic graph, DAG leveling of vertices compute Y-coordinates topsort or Coffman-Graham a levelled / layererd graph level by level sweeps or global crossing reductions sort by levels or global crossing sorted level graph, a left to right ordering thinning technique routing, coordinate assignment final drawing with (X,Y) coordinates for all points 14 Sugiyama Algorithm © 2012 Prof. Dr. Franz J. Brandenburg • • • • • • Introduced Sugiyama, Tagawa, Todo, IEEE Trans SMC (1981) refinements and improvements Gansner, Koutsofios, North, Vo, IEEE Trans Soft. Eng (1993) The most frequently used GD algorithm The best studied GD algorithm PRO: decomposition by Software Engineering Principles CONS: mathematics no quality guarantees (area, crossings, ...) no time bounds no standard: a framework of dozens of sub-algorithms 15 recent Advancements © 2012 Prof. Dr. Franz J. Brandenburg 1) feedback arc set NP-hard even for tournaments and 3-approximation by Quicksort sifting (1-OPT) techniques give best quality almost 50% of the edges are „wrong“ (110.000 from 250.000) 2)+3) integrated „leveling + crossing“ approaches with +10% and faster algorithms e.g. by edge bundeling 4) thinning technique by Brandes, Köpf (GD2001) with a guarantee of at most 2 bends per edge 5) solution of Sugiama et al‘s recurrent hierarchies 16 Recurrent Hierarchies © 2012 Prof. Dr. Franz J. Brandenburg proposed K. Sugiyama, T. Tagawa, T. Todo (1981) - a cyclic leveling modulo k - drawing on the rolling cylinder approach (Bachmaier, Brandenburg, Brunner, JGAA 2012) - no decycling - heuristic for leveling - crossing reduction by global technique - coordinate assignment with shearing and 2 bends per edge 17 Trees © 2012 Prof. Dr. Franz J. Brandenburg D.E. Knuth (1968) How shall we draw a tree if the tool is a mechanical type writer with / \ | -Reingold, Tilford (1981): the contour technique recursive bottom-up in O(n) time by a tricky recursion: T(n) < 2 site(tree)-height(tree) TrightTleft 18 Tree Folding © 2012 Prof. Dr. Franz J. Brandenburg save space, minimize the area References: T. Chan, M. Goodrich, S.R. Kosaraju, R. Tamassia, Comput. Geom. 23 (2002) A. Garg, M. Goodrich, R. Tamassia, Int. J. Comput. Geom. Appl. 6 (1996) C. Shin, S.K. Kim K-Y. Chwa, Comput Geom. 15 (2000) 1 2 11--10--9--8--7 12 3 19--18--17--16 15--14--13 24--23 4 31--30--29 22--21--20 28--27--26 25 32 40 5 39--38 47--46 37--36 35--34 33 45--44 43--42 41 49 57 56 6 55 54 53 52 51 63 62 61 60 59 58 48 50 19 planar graphs © 2012 Prof. Dr. Franz J. Brandenburg • shifting technique and realizers de Fraysseix, Pach, Pollack (Combinatorica 1990) Schnyder, ACM SODA 1990 Theorem Every planar graph has a straight-line grid drawing with O(n) area Size of O: 4/9 .. 1 (8/9 is under work) but the pictures are bad with too many too small angles Recent improvements/Refinements segments = # straight lines (one long line for many successive edges counts 1) few slopes slightly weaker preconditions (2-connected + ...) 20 recent Trends © 2012 Prof. Dr. Franz J. Brandenburg Sources: Proc. GD ....,2011 LNCS .... 3843, 4372, 5166,5417,5849, 6502, 7034 Journal Graph Algorithms and Applications JGAA Computational Geometry: Theory and Applications .... all Algorithms and Combinatorics Journals Trends: almost planar weaken the restrictions of planarity generalize the class of planar graphs preserve properites like linear density,... 21 2002-2012 © 2012 Prof. Dr. Franz J. Brandenburg What has been done in the past decade? Hundreds of improvements at all places faster algorithms more parameters (slope, ...) experimental evaluations Some new trends Breakthrough? (NO) 22 Trends © 2012 Prof. Dr. Franz J. Brandenburg - confluent drawings (Eppstein, Kobourov et al, GD2003) - RAC (right angle crossing) - 1-planarity - point set embeddings - clustered planarity - new applications: metro maps, train tracks networks in the biosciences 23 Confluent Drawings © 2012 Prof. Dr. Franz J. Brandenburg • Dickerson, Eppstein, Goodrich, Meng, JGAA 9 (2005) allow crossings at train tracks 24 Confluent Graphs © 2012 Prof. Dr. Franz J. Brandenburg • • • • all planar (trivial) all co-graph (union and edge-complementation) all complements of trees all interval graphs Strong confluency (a curve for an edge does not pass a vertex) is NP-hard non-confluent • Petersen graph • 4-dim hypercube 25 RAC © 2012 Prof. Dr. Franz J. Brandenburg Right angle crossings Didimo, Eades, Liotta: WADS 2008, LNCS 5664 Ref. Angelini et al On the Perspectives Opened by Right Angle Crossing Drawings GD 2010, LNCS 5849 and relaxation to a large angle > a Facts Every graph can be drawn as RAC with 3 bends, and 3 are necessary The area is quadratic straight line, then at most 4n-10 edges 26 1-planarity © 2012 Prof. Dr. Franz J. Brandenburg Definition (G. Ringel, 1965) A graph G is 1-planar if each edge is crossed at most once (by all other edges) Properites an edge coloring black with crossings red x blue a 6-vertex coloring (Borodin 1984) #edges < 4n-8 (Pach, Toth 1997, and others) not closed under edge contraction there are infinitely many minimal non-1-planar graphs (Korzhik, 2007) test is NP-hard (Korzhik, Mohar Graph Drawing 2008, LNCS 5166) 27 1-planar + Rotation System © 2012 Prof. Dr. Franz J. Brandenburg Definition a rotation system (embedding) of a graph G = (V,E) is the cylic order of the edge (neighbors) of v for each vertex v The crossing pair system of a graph G = (V,E) is G together with all pairs (e,e‘) of crossing edges. Lemma Given a crossing pair system. Test for 1-planarity is in O(n), and there is a straight-line drawing of G on a polynomial size grid. Claim (under work) (Auer, Brandenburg, Gleißner, Reislhuber) Given a rotation system: Test for 1-planarity is NP-hard .... by a reduction from planar 3-SAT 28 Point sets © 2012 Prof. Dr. Franz J. Brandenburg Given: A set of N > n points in the plane free scenario Can a graph of size n be embedded into this point set such that e.g. the drawing is planar and straight line Yes, with at most 2 bends per edge NP-hard for outerplanar graphs and straight line embeddings fixed scenario, the vertices are already mapped to the points every planar graphs can be embedded into any point set with O(n) bends per edge 29 Simultaneous Embeddings © 2012 Prof. Dr. Franz J. Brandenburg Is there a set of pints such that two graphs be embedded into the same set one after the other such that planarity is preserved NO for a path and a tree (Kaufmann, Wiese, JGAA 6) NP-hard for two planar graphs The constructions behind points sets are driven by geometry and not by graphs. Triangles, excluding certain combinations are the key tools in the proofs. 30 C-planarity © 2012 Prof. Dr. Franz J. Brandenburg Given: a graph G and a clustering C of the vertices Question: Does G have a planar clustered drawing such that the clustered are drawn inside of rectangles. Complexity: NP?? still open improvements if connectivity (and other assumptions) are imposed 31 Applications © 2012 Prof. Dr. Franz J. Brandenburg Networks metro maps (Sydney) train tracks (European railway systems – and special analysis) in bio-sciences (GD 2009) Perspectives: What is the future of Graph Drawing ??? 32