67
Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout 1 Torsten Ueckerdt Algorithms for Graph Visualization INSTITUT F ¨ UR THEORETISCHE INFORMATIK · FAKULT ¨ AT F ¨ UR INFORMATIK Layered Layout 08.01.2019

Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout1

Torsten Ueckerdt

Algorithms for Graph Visualization

INSTITUT FUR THEORETISCHE INFORMATIK · FAKULTAT FUR INFORMATIK

Layered Layout

08.01.2019

Page 2: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout2

Example

Page 3: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout3 - 1

Layered Layout

Given: directed graph D = (V,A)

Find: drawing of D that emphasizes the hierarchy

Page 4: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout3 - 2

Layered Layout

Given: directed graph D = (V,A)

Find: drawing of D that emphasizes the hierarchy

• many edges pointing to the same direction• nodes lie on (few) horizontal lines

Page 5: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout3 - 3

Layered Layout

Given: directed graph D = (V,A)

Find: drawing of D that emphasizes the hierarchy

• edges as straight as possible and short• few edge crossings• nodes distributed evenly

Page 6: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout4

Application: Java Profiler

yEd Gallery: Java profiler JProfiler using yFiles

Page 7: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout5

Application: Storylines

Source: ”Design Considerations for Optimizing StorylineVisualizations”Tanahashi et al.

Page 8: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout6

Application: Storylines

Source: ABC news, Australia

Page 9: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout7

Application: Text-Variant graphs

Source: Improving the Layout for Text VariantGraphs Janicke et al.

Page 10: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout8

Application: Mythological Creatures and Gods

Source: Visualization that won theGraph Drawing contest 2016.Klawitter&Mchedlidze

Page 11: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 1

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 12: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 2

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 13: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 3

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 14: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 4

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 15: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 5

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 16: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 6

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 17: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 7

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

• paper cited more than 1600 times(100 in the past year)• implemented in

– yEd– graphviz/dot– tulip– . . .

Page 18: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 8

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 19: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout9 - 9

Sugiyama Framework (Sugiyama, Tagawa, Toda 1981)

given resolve cycles layer assignment

crossing minimization node positioning edge drawing

Page 20: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout10

Step 1: Resolve Cycles

Page 21: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout11 - 1

Feedback Arc Set

Idea: • find maximum acyclic subgraph• reverse the directions of the other edges

Page 22: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout11 - 2

Feedback Arc Set

Idea: • find maximum acyclic subgraph• reverse the directions of the other edges

Maximum Acyclic SubgraphGiven: directed graph D = (V,A)Find: acyclic subgraph D′ = (V,A′) with maximum |A′|

Page 23: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout11 - 3

Feedback Arc Set

Idea: • find maximum acyclic subgraph• reverse the directions of the other edges

Maximum Acyclic SubgraphGiven: directed graph D = (V,A)Find: acyclic subgraph D′ = (V,A′) with maximum |A′|

Minimum Feedback Arc Set (FAS)Given: directed graph D = (V,A)Find: Af ⊂ A, with Df = (V,A \Af ) acyclic with minimum|Af |

Page 24: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout11 - 4

Feedback Arc Set

Idea: • find maximum acyclic subgraph• reverse the directions of the other edges

Maximum Acyclic SubgraphGiven: directed graph D = (V,A)Find: acyclic subgraph D′ = (V,A′) with maximum |A′|

Minimum Feedback Arc Set (FAS)Given: directed graph D = (V,A)Find: Af ⊂ A, with Df = (V,A \Af ) acyclic with minimum|Af |

Minimum Feedback Set (FS)Given: directed graph D = (V,A)Find: Af ⊂ A, with Df = (V,A \Af ∪ rev(Af )) acyclic with

minimum |Af |

Page 25: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout11 - 5

Feedback Arc Set

Idea: • find maximum acyclic subgraph• reverse the directions of the other edges

Maximum Acyclic SubgraphGiven: directed graph D = (V,A)Find: acyclic subgraph D′ = (V,A′) with maximum |A′|

Minimum Feedback Arc Set (FAS)Given: directed graph D = (V,A)Find: Af ⊂ A, with Df = (V,A \Af ) acyclic with minimum|Af |

Minimum Feedback Set (FS)Given: directed graph D = (V,A)Find: Af ⊂ A, with Df = (V,A \Af ∪ rev(Af )) acyclic with

minimum |Af |All three problems are NP-hard!

Page 26: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout12 - 1

Heuristric 1 (Berger, Shor 1990)

A′ := ∅;foreach v ∈ V do

if |N→(v)| ≥ |N←(v)| thenA′ := A′ ∪N→(v);

elseA′ := A′ ∪N←(v);

remove v and N(v) from D.

return (V,A′)

N→(v) := {(v, u) : (v, u) ∈ A}N←(v) := {(u, v) : (u, v) ∈ A}N(v) := N→(v) ∪N←(v)

Page 27: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout12 - 2

Heuristric 1 (Berger, Shor 1990)

A′ := ∅;foreach v ∈ V do

if |N→(v)| ≥ |N←(v)| thenA′ := A′ ∪N→(v);

elseA′ := A′ ∪N←(v);

remove v and N(v) from D.

return (V,A′)

N→(v) := {(v, u) : (v, u) ∈ A}N←(v) := {(u, v) : (u, v) ∈ A}N(v) := N→(v) ∪N←(v)

• D′ = (V,A′) is a DAG• A \A′ is a feedback arc set

Page 28: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout12 - 3

Heuristric 1 (Berger, Shor 1990)

A′ := ∅;foreach v ∈ V do

if |N→(v)| ≥ |N←(v)| thenA′ := A′ ∪N→(v);

elseA′ := A′ ∪N←(v);

remove v and N(v) from D.

return (V,A′)

N→(v) := {(v, u) : (v, u) ∈ A}N←(v) := {(u, v) : (u, v) ∈ A}N(v) := N→(v) ∪N←(v)

• D′ = (V,A′) is a DAG• A \A′ is a feedback arc set

Work with your neighbour(s) and then share

5 minWhy doesn’t D′ contain cycles?What can one say about |A′| in terms of |A|?

Page 29: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 1

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 30: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 2

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 31: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 3

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 32: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 4

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 33: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 5

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 34: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 6

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 35: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 7

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 36: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 8

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 37: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 9

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 38: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 10

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 39: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 11

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 40: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout13 - 12

Heuristic 2 (Eades, Lin, Smyth 1993)

1 A′ := ∅;2 while V 6= ∅ do3 while in V exists a sink v do4 A′ ← A′ ∪N←(v)5 remove v and N←(v): {V, n,m}sink

6 Remove all isolated node from V : {V, n,m}iso

7 while in V exists a source v do8 A′ ← A′ ∪N→(v)9 remove v and N→(v): {V, n,m}source

10 if V 6= ∅ then11 let v ∈ V such that |N→(v)| − |N←(v)| maximal;12 A′ ← A′ ∪N→(v)13 remove v and N(v): {V, n,m}{=,<}

Page 41: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout14 - 1

Heuristic 2 – Analysis

Theorem 1: Let D = (V,A) be a connected, directed graphwithout 2-cycles. Heuristic 2 computes a set of edgesA′ with |A′| ≥ |A|/2 + |V |/6.The running time is O(|A|).

Page 42: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout14 - 2

Heuristic 2 – Analysis

Theorem 1: Let D = (V,A) be a connected, directed graphwithout 2-cycles. Heuristic 2 computes a set of edgesA′ with |A′| ≥ |A|/2 + |V |/6.The running time is O(|A|).

Exact Solution:• integer linear programming, using branch-and-cut technique

(Grotschel et al. 1985)

Page 43: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout15 - 1

Example

Page 44: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout15 - 2

Example

Page 45: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout16 - 1

Step 2: Layer Assignment

dummynode

Page 46: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout16 - 2

Step 2: Layer Assignment

dummynode

Think for a minute and then share

1 minWhat could we optimize when doing thelayer assignment?

Page 47: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout17 - 1

Step 2: Layer Assignment

Given.: directed acyclic graph (DAG) D = (V,A)

Find: Partition the vertex set V into disjoint subsets (layers)L1, . . . , Lh s.t. (u, v) ∈ A, u ∈ Li, v ∈ Lj ⇒ i < j

Def: y-Coordinate y(u) = i⇔ u ∈ Li

Page 48: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout17 - 2

Step 2: Layer Assignment

Given.: directed acyclic graph (DAG) D = (V,A)

Find: Partition the vertex set V into disjoint subsets (layers)L1, . . . , Lh s.t. (u, v) ∈ A, u ∈ Li, v ∈ Lj ⇒ i < j

Criteria that we discuss• minimize the number of layers h (= height of the layouts)• minimize the total length of edges (≈ number of dummy

nodes)• minimize width, e.g. max{|Li| | 1 ≤ i ≤ h}

Def: y-Coordinate y(u) = i⇔ u ∈ Li

Page 49: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout18 - 1

Height Optimization

Idea: assign each node v to the layer Li, where i is the lengthof a longest simple path ending in v• all incoming neighbours lie below v• the resulting height h is minimized

Page 50: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout18 - 2

Height Optimization

Idea: assign each node v to the layer Li, where i is the lengthof a longest simple path ending in v• all incoming neighbours lie below v• the resulting height h is minimized

Algorithm• L1 ← the set of sources in D• set y(u)← maxv∈N←(u){y(v)}+ 1

Page 51: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout19 - 1

Example

Page 52: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout19 - 2

Example

Page 53: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout20 - 1

Total Edge Length

Can be formulated as an integer linear program:

min∑

(u,v)∈A(y(v)− y(u))

subject to y(v)− y(u) ≥ 1 ∀(u, v) ∈ Ay(v) ≥ 1 ∀v ∈ Vy(v) ∈ Z ∀v ∈ V

Page 54: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout20 - 2

Total Edge Length

Can be formulated as an integer linear program:

min∑

(u,v)∈A(y(v)− y(u))

subject to y(v)− y(u) ≥ 1 ∀(u, v) ∈ Ay(v) ≥ 1 ∀v ∈ Vy(v) ∈ Z ∀v ∈ V

One can show that:• Constraint-Matrix is totally unimodular• ⇒ Solution of the relaxed linear program is integer• The total edge length can be minimized in polynomial time

Page 55: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout21 - 1

Width of the Layout

Page 56: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout21 - 2

Width of the Layout

→ bound the width!

Page 57: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout22 - 1

Layer Assignment with Fixed Width

Fixed-Width Layer AssignmentGiven: directed acyclic graph D = (V,A), width BFind: layer assignment L of minimum height with at most B

nodes per layer

B = 4

Page 58: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout22 - 2

Layer Assignment with Fixed Width

Fixed-Width Layer AssignmentGiven: directed acyclic graph D = (V,A), width BFind: layer assignment L of minimum height with at most B

nodes per layer

→ equivalent to the following scheduling problem:

Minimum Precedence Constrained Scheduling (MPCS)Given: n jobs J1, . . . , Jn with identical unit processing time,

precedence constraints Ji < Jk, and B identical machinesFind: Schedule of minimum length (makespan), that satisfies

all the precendence constraints

B = 4

M1

M2

M3

M4

Page 59: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout23 - 1

Fixed Width: Complexity

Theorem 2: It is NP-hard to decide, whether for n jobsJ1, . . . , Jn of identical length, given partial orderingconstraints, and number of machines B, there exists aschedule of makespan at most T , even if T = 3.

Page 60: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout23 - 2

Fixed Width: Complexity

Theorem 2: It is NP-hard to decide, whether for n jobsJ1, . . . , Jn of identical length, given partial orderingconstraints, and number of machines B, there exists aschedule of makespan at most T , even if T = 3.

Corollary: If P 6= NP, there is no polynomial algorithm forMPCS with approximation factor < 4/3.

Page 61: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout23 - 3

Fixed Width: Complexity

Theorem 2: It is NP-hard to decide, whether for n jobsJ1, . . . , Jn of identical length, given partial orderingconstraints, and number of machines B, there exists aschedule of makespan at most T , even if T = 3.

Corollary: If P 6= NP, there is no polynomial algorithm forMPCS with approximation factor < 4/3.

Work with your neighbour(s) and then share

2 minWhy the corollary holds?

Page 62: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout24 - 1

Fixed Width: Algorithm

Theorem 3: There exists an approximation algorithm forMPCS with factor ≤ 2− 1

B .

Page 63: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout24 - 2

Fixed Width: Algorithm

Theorem 3: There exists an approximation algorithm forMPCS with factor ≤ 2− 1

B .

List-Scheduling-Algorithm:• order jobs arbitrarily as a list L• when a machine is free, select an allowed job from L;

Machine is idle of there is no such job

Page 64: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout25 - 1

Summary

crossing minimization node positioning edge drawing

given resolve cycles layer assignment

Page 65: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout25 - 2

Summary

crossing minimization node positioning edge drawing

Resolve cycles• equivalent to minimum feedback set problem, and is

NP-hard• Heuristic with |A′| ≥ |A|/2• Heuristic with |A′| ≥ |A|/2 + |V |/6

given resolve cycles layer assignment

Page 66: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout25 - 3

Summary

crossing minimization node positioning edge drawing

given resolve cycles layer assignment

Layer assignment• Height optimization: topological numbering• Total edge length: polynomial algorithm through integer

linear program• Height optimization with fixed width: equivalent toMPCS. NP-hard for 3 levels. Approximation algorithmwith factor ≤ 2− 1

B .

Page 67: Layered Layout Algorithms for Graph Visualization...Application: Mythological Creatures and Gods Source: Visualization that won the Graph Drawing contest 2016. Klawitter&Mchedlidze

Torsten Ueckerdt · Algorithmen zur Visualisierung von Graphen Layered Layout25 - 4

Summary

crossing minimization node positioning edge drawing

given resolve cycles layer assignment