presentation 7-02-13 graph drawing

49
Graph Drawing Malte Skambath Introduction Challenges Types of drawings Force-directed approach Spring Embedder Simulated Annealing Crossing Minimization Planarization Approach Dual graph SPQR-tree Orthogonal Bend Minimization Orthogonal Drawing MinCostFlow-Problem Summary Graph Drawing Computational Geometry Malte Skambath Universit ¨ at zu L ¨ ubeck Institute for Theoretical Computer Science February 7, 2012 1 / 46

Upload: catherine-cline

Post on 13-Apr-2015

72 views

Category:

Documents


0 download

DESCRIPTION

Seminar Computational Geometry WT1213 - Graph Drawing

TRANSCRIPT

Page 1: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Graph DrawingComputational Geometry

Malte Skambath

Universitat zu LubeckInstitute for Theoretical Computer Science

February 7, 2012

1 / 46

Page 2: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Outline

Introduction

Force-directed approach

Crossing Minimization

Orthogonal Bend Minimization

Summary

2 / 46

Page 3: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

IntroductionWhat is Graph Drawing?

How to draw nice graphs?

3 / 46

Page 4: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

ChallengesWhat is a nice graph?

I Visualization of the graph should have nice lookI No precisely definition.I Criteria on nice drawings

I SymmetriesI Less crossing as possibleI Less bends as possible

I Drawing should represents special propertiesI Topological sorting

4 / 46

Page 5: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Types of drawings

(a) (b) (c) (d)

Figure : Types of drawings: a polyline (a), straight-line (b) and(c) an orthogonal drawing of K3,3; (d) upward drawing

5 / 46

Page 6: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

MotivationIs it useful for me?

I state-machinesI UML class diagramsI electrical circuits / chip-designI traffic-nets (e. g. bus map)

Graph

Edge

Node

FacesPlanarGraphKernzone

6000

LÜBECKHBF

5

11

21

7

(17)9 10

312

15 1 2 6 7 9 16 (17)

4

5

5

10

4

4

1

12123

1

3

3

2

11

11

39

30

30

2111

10

3139

4

32

32

32 15

15

15

40

40 31

8720 5 15

ZOB/ Hauptbahnhof

enen

Lutherkirche

Hansering

Zeißstr

Walkmühlen-weg Bei der

Gasanstalt

VerwaltungszentrumMühlentor

Theodor-Heuss-St

Welsbachstr.keine Bedienung

Linien 15 u. 32Umleitung wegen

NeubauPossehlbrücke

bis 2014/15

Moltke-platz

Moltkestr. AmBertramshofHüxtertorallee

Stresemannstr.

PensebuschStadthalleTürk

Luisenstr.Adolf-

str. Burgtor-friedhof

Torneiweg Bunwe

Z

HanseReside

Gustav-Adolf-S

Ehren-friedhof

Geschw.-S

Katharineum

Koberg

An derFalkenwiese

Roeck-str. Heinrichstr.

LauerhoDräger- park

Krähen-str.

Wahmstr.Percevalstr.

Blanckstr.

Kaufhof

Marli-ring

Goeben-str.

H

Fleischhauer-str.

GroßeBurgstr.

Meesen-ring

Schenk

Gneisenaustr.

Falkendamm

Breite Str./Stadt-theater

Schulstr.

Wieland-str.

Wisbystr.

Töpferwegche

Lachswehr-allee

Dräger-werk

Fegefeuer

Wickedestr.

Friedenstr.

Drögestr.

FackenburgerAllee

Holstentor- platz

Schüssel-buden

Stadt-werke

Mozartstr.

Meierstr.

Beckergrube

LindenArcaden

rd-Wagner-Str.

rtlenburger Str.

Adler-str.

ibis HotelAn derStadt-

freiheit

Unter-trave

Gustav- Radbruch-

Platz

e

er Kohlmarkt

Sandstr.

Königstr.

31 393040 8720 R1

R2

6 / 46

Page 7: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Force-directed approach

I Used for straight line drawingsI Model the graph-vertices and edges as physical

objects with forcesI Distance of adjacent vertices (v ,w) should be nearly

the same distance d(v ,w)

I No overlapping vertices

7 / 46

Page 8: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Force-directed approach

1. Generate random representation of G with randompositions ~p(v) for v ∈ V

2. Calculate forces between each pair of vertices vi , vj :~f (vi , vj)

3. Calculate resulting force ~f (v) for each node v ∈ V :~f (v)

∑w∈V\{v}

~f (v ,w)

4. Update positions ~p(v) = ~p(v) + ∆~f (v)

8 / 46

Page 9: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Spring Embedder

Remember:we want a unit distance d(v ,w) if v ,w are adjacent⇒ Model edges as springs with a unit length

unit length no force

I attracting force (adjacent vertices): fa = ca log d

I repelling force (non-adjacent vertices): fr =cr

d2

I stepwise simulatable

~f (v) =∑

w∈V\{v}(~p(w)−~p(v))

{fa(v ,w), (v ,w) ∈ E−fr (v ,w), (v ,w) 6∈ E

~p(v) := ~p(v) + ∆~f (v)

9 / 46

Page 10: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Spring EmbedderSample

10 / 46

Page 11: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Advantages & Disadvantages

I easy implementableI usefull for interactive implementationI time-complexity: O(n|V |2)

I slow with huge graphsI non-predictable result

11 / 46

Page 12: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Simulated Annealing

I Goal: optimize drawing σ to selected criteriasI No forces, but physical modelI Inspired by cool-down process in liquidsI Define an energy-function E : σ → RI Low value E(σ)↔ σ fits many criteriaI High temperature T ↔ high propabilty P finding a

better configuration σI Low energy value E(σ)↔ low propability P finding a

better configuration σ

12 / 46

Page 13: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Simulated Annealing

Algorithm 1: Simulated Annealing Graph Drawinginput : A graph G = (V ,E), an initial temperature Toutput: A straight-line drawing of G

beginCreate initial drawing/configuration σ with randompos. for each vertex v ∈ V ;while do

Choose a new configuration σ′ from theneighborhood of σ;Let E and E ′ be the energy values of σ and σ′;if E ′ < E or with a probability of e−(E

′−E)/T thenσ ← σ′;

Decrease T

13 / 46

Page 14: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Energy function

I should depend on the criteriaI low time complexityI Example (by R. Davidson and D. Harel.):

f = λ1 ·∑i 6=j

1d(ni ,nj)

distribution

+ λ2 ·∑n∈V

dbord(n) border dist.

+ λ3 ·∑e∈E

d(e) edge length

+ λ4 · crossings edge crossings

+ λ5 ·∑

e∈E ,n∈V

d(n,e) edge-distance

14 / 46

Page 15: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Neighborhood & energy function

How can we define the neighborhood?⇒ change the position of a single node in σ

15 / 46

Page 16: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Simulated annealingexample

R. Davidson, D. Harel Drawing Graphs Nicely Using Simulated Annealing, 1996 16 / 46

Page 17: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Crossing Minimization

I Goal: reduce number of crossings in a drawing of anon-planar graph G

I We know: planar graphs can be drawn withoutcrossings

⇒ Approximate Graph as a planar graphI Idea: convert non-planar graphs into planar graphs

and replace non-removable crossings as virtualvertices

I Planarizataion approach: create a planar embeddingof the new graph

17 / 46

Page 18: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Planarization Approach

1. Find maximum planar subgraph and embedding,without crossing

2. Create embedding of the graph3. Insert the non-planar edges with a minimum number

of crossing, use crossings as virtual vertices

ProblemFinding a maximum-planar subgraph is NP-hard .

trade off

find a maximal planar subgraph

18 / 46

Page 19: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Planarization Approach

1. Find maximum planar subgraph and embedding,without crossing

2. Create embedding of the graph3. Insert the non-planar edges with a minimum number

of crossing, use crossings as virtual vertices

ProblemFinding a maximum-planar subgraph is NP-hard .

trade off

find a maximal planar subgraph

18 / 46

Page 20: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Maximal planar subgraph

Algorithm 2: Maximal planar subgraphinput : a graph G = (V ,E)output: a maximal planar subgraph G′ = (V ,E ′) of G

beginE ′ = ∅;while there is an edge e ∈ E \ E ′ thatG = (V ,E ′ ∪ {e}) is planar do

E ′ ← E ′ ∪ {e};return G′;

19 / 46

Page 21: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Definition

A dual graph DG = (F ,E) of a planar graph G = (V ,E) isa (multi-)graph where F represents the faces in a planarembedding of G. Each pair f1, f2 ∈ F of adjacent faces issplitted by an edge in G. ⇒ E(F) ≡ E(G)

20 / 46

Page 22: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Insert non-planar edge with min.crossings

Insert non-planar edge e = (v ,w) ∈ E1. Find shortest path p in the dual-graph DG2. Insert e over path p generate new virtual nodes and

split faces

21 / 46

Page 23: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Insert non-planar edge with min.crossings

22 / 46

Page 24: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Insert non-planar edge with min.crossings

23 / 46

Page 25: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Shortest Path in the Dual Graph

k

k+1

ek

k+1

e

24 / 46

Page 26: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Improve with parallel substructures

I Problem: for some edges the graph can easily bemodified to reduce number of crossings

I if the 2 vertices of the edge are in different blocks ofa parallel substructure

⇒ switch the order to decrease number of crossings

25 / 46

Page 27: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-tree

s

t

e

(a) trivial case

e

(b) parallel case

e

(c) series case

e

(d) rigid case

Figure : the four different types of nodes in a SPQR-tree

26 / 46

Page 28: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-tree

ab

c

de

f

h

g

i

j

kl

m

n

op

27 / 46

Page 29: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-tree

ab

cd

e

fh

g

i

jk

lm

n

o p

a

bcd

ed

ed

ef

h e

h e

h

j

nh

jh

jm

lk

h

m

e

n

e

n

g

n

jn

jp

o

hj

i

28 / 46

Page 30: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-trees

a

bcd

ed

edef

h e

h e

hj

n

h

jh

jm

lk

h

m

e

n

e

n

g

n

jn

jp

o

hj

i

R

P

S

P

S P S

P

R

P

S

SR

29 / 46

Page 31: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-trees

ab

c

de

fh

g

i

jk

lm

n

op

R

P

S

P

S P S

P

R

P

S

SR

30 / 46

Page 32: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

SPQR-trees

ab c d

e

fh

g

i

jk

lm

n

op

R

P

S

P

S P S

P

R

P

S

SR

31 / 46

Page 33: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Orthogonal Drawing

I Γ(E) for each edge e ∈ E is a set of orthogonal linesI Γ(v) for each vertex v ∈ V is a point in R2

Definition

We call Γ an orthogonal planar drawing of G if1. ∀v ,w ∈ V : Γ(v) = Γ(w ∈ V )⇔ w = v (invective)2. ∀e = (v ,w) ∈ E : Γ(v), Γ(w) are endpoints of Γ(e)

3. ∀e1,e2 ∈ E : e1 6= e2 ⇒ Γ(e1), Γ(e2) only intersect ata point Γ(v) of a common vertex v (if exists)

32 / 46

Page 34: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Orthogonal Drawing

two different planar orthogonal representations Γ, Γ′ of thesame Graph G, but with a different number of edges andthe same faces

33 / 46

Page 35: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Bend Minimization asMinCostFlow-Problem

If we have a planar representation Γ of a planar Graph,keeping the the same faces we can minimize the numberof bends with solving a minimum cost flow problem.

34 / 46

Page 36: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Bend Minimization asMinCostFlow-Problem

Definition

A min-cost flow network N = (D,u, l ,b, c) consists ofI directed (multi-)graph D = (W ,A)

I capacities u : A→ N0 ∪ {∞}, l : A→ ZI node demands b : W → ZI costs c : A→ N0.

f : A→ N0 is a flow on N ifl(a) ≤ f (a) ≤ u(a)∧b(v) =

∑(v ,w)∈A f (v ,w)−

∑(w ,v)∈A f (w , v)(∑

v∈W (b(v) = 0))

⇒ f is a min-cost-flow if∑

a∈A c(a)f (a) is minimal.

35 / 46

Page 37: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Define the flow network for the problemnode demands & capacities

v1 v2 v3

v4 v5

τ(v3, v5) = 2; τ(v5, v3) = 1;

α(v3, v5) = 1

α(v5, v3) = 2

define labels α(v ,w), τ(v ,w) for each edge (v ,w) in G:τ : (v ,w) ∈ E 7→ #of L-bends in Γ((v ,w))α : (v ,wi) ∈ E 7→ ^ betw. Γ((v ,wi))andΓ((v ,wi+1))

36 / 46

Page 38: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Define the flow network for the problemnode demands & capacities

Remember:We want to minimize the total number of bends on edgesin the drawing Γ(G).

The total number is∑

(v ,w)∈E τ(v ,w) + τ(w , v).⇒So the goal is: minimize

∑(v ,w)∈E τ(v ,w) + τ(w , v)

2

1

1

1

2 1

11

1

1

37 / 46

Page 39: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Theorem

The sum of angles(at vertices or bends) around aninner/outer face f ∈ F is:

π · (deg(f ) + #bends∓ 2)

This implies:∑(v ,w)∈E(f )

(α(v ,w) + τ(w , v)− τ(v ,w)) = 2 deg(f )∓ 4

38 / 46

Page 40: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

∑(v ,w)∈E(f )

(α(v ,w) + τ(w , v)− τ(v ,w)) = 2 deg(f )∓ 4

1

2 1

1

1

1

1

Let the face-to-face edges (producers of bends on anedge) get edges in the flow networks with costs 1

39 / 46

Page 41: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Define the flow network for the problemThe directed (multi-) Graph DG

DG = (W ,A) with W = V ∪ F consists DF as theface-induced subgraph of F by Γ(G)

demands in the flow-network N :

b(x) =

{−2 deg(x)± 4 , x ∈ F (inner / outer face)4 , x ∈ V

:

capacities:e ∈ A : u(e) =∞; e ∈ AF : l(e) = 0; e 6∈ AF : l(e) = 1costs: eF ∈ AF : c(eF ) = 1; e 6∈ AF : c(e) = 0

40 / 46

Page 42: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Assign flow

Given a flow f : E → NI f (v , fv ,w ): angle(α) at node v in face fv ,w left of (v ,w)

I f((f1, f2)e

): #LeftBends (τ ) on the edge (f1, f2)e

between the faces f1 and f2A flow f is a valid model for a valid drawing if:

I for all nodes v : b(v) =∑

(v ,w)∈E f (v ,w) = 4

X

I for all faces f :∑(v ,w)∈E(f )

(α (v ,w) + τ(w , v)− τ(v ,w)) = 2 deg(f )∓ 4

X

I inflow←→ outflow

A valid flow implies a valid graph representation Γ⇒ A cost-minimal flow implies a bend-minimal graphrepresentation Γ

41 / 46

Page 43: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Assign flow

Given a flow f : E → NI f (v , fv ,w ): angle(α) at node v in face fv ,w left of (v ,w)

I f((f1, f2)e

): #LeftBends (τ ) on the edge (f1, f2)e

between the faces f1 and f2A flow f is a valid model for a valid drawing if:

I for all nodes v : b(v) =∑

(v ,w)∈E f (v ,w) = 4XI for all faces f :∑

(v ,w)∈E(f )(α (v ,w) + τ(w , v)− τ(v ,w)) = 2 deg(f )∓ 4

X

I inflow←→ outflow

A valid flow implies a valid graph representation Γ⇒ A cost-minimal flow implies a bend-minimal graphrepresentation Γ

41 / 46

Page 44: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Assign flow

Given a flow f : E → NI f (v , fv ,w ): angle(α) at node v in face fv ,w left of (v ,w)

I f((f1, f2)e

): #LeftBends (τ ) on the edge (f1, f2)e

between the faces f1 and f2A flow f is a valid model for a valid drawing if:

I for all nodes v : b(v) =∑

(v ,w)∈E f (v ,w) = 4XI for all faces f :∑

(v ,w)∈E(f )(α (v ,w) + τ(w , v)− τ(v ,w)) = 2 deg(f )∓ 4X

I inflow←→ outflow

A valid flow implies a valid graph representation Γ⇒ A cost-minimal flow implies a bend-minimal graphrepresentation Γ

41 / 46

Page 45: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Existence of a valid flow: Inflow=Outflow

to proof:∑

v∈W b(v)!

= 0∑v∈W

b(v) =∑v∈V

b(v) +∑f∈F

b(f )

= |V |4 +∑

f∈F\{fo}

(−2 deg f + 4)− 2 deg fo − 4

= |V |4 + (|F| − 2)4− 2∑f∈F

(deg f )

= |V |4 + (|F| − 2)4− 4|E |= 4(|V |+ |F| − |E | − 2) = 0

42 / 46

Page 46: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Bend Minimizationexample

-4-2

-14

213

2

332

-4 -2

-14

13

2

332

43 / 46

Page 47: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

Summary

I graph drawing is a wide area with many problemsI most problems are NP hardI problems depend on the type of drawings and the

slected criteriasI good approximation is possible for many problemsI combination of algorithms may be possibleI there exists many tools for graph drawing

1. yEd2. GraphViz3. Gephi4. Tulip

44 / 46

Page 48: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

GraphVizexample

circo-layout:

twopi-layout:

1graph G{2 node[label=""];3 a1 -- a2; a1 -- a3;4 a1 -- a4;5 a1 -- a5; a1 -- a6;6 a2 -- a3; a2 -- a4;7 a2 -- a5; a2 -- a6;8 a3 -- a4; a3 -- a5;9 a3 -- a6;

10 a4 -- a5; a4 -- a6;11 a5 -- a6;12}

45 / 46

Page 49: Presentation 7-02-13 Graph Drawing

Graph Drawing

Malte Skambath

IntroductionChallenges

Types of drawings

Force-directedapproachSpring Embedder

Simulated Annealing

CrossingMinimizationPlanarization Approach

Dual graph

SPQR-tree

Orthogonal BendMinimizationOrthogonal Drawing

MinCostFlow-Problem

Summary

yEd

46 / 46