algorithms for graph visualization - startseite · every n-vertex planar graph has a planar...

103
Algorithms for graph visualization Layouts for planar graphs. Shift method. WINTER SEMESTER 2012/2013 Tamara Mchedlidze –MARTIN OLLENBURG –I GNAZ RUTTER www.kit.edu KIT – Universit¨ at des Landes Baden-W ¨ urttemberg und nationales Forschungszentrum in der Helmholtz-Gemeinschaft

Upload: others

Post on 24-May-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithms for graph visualizationLayouts for planar graphs. Shift method.

WINTER SEMESTER 2012/2013

Tamara Mchedlidze – MARTIN NOLLENBURG – IGNAZ RUTTER

www.kit.eduKIT – Universitat des Landes Baden-Wurttemberg und

nationales Forschungszentrum in der Helmholtz-Gemeinschaft

Page 2: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

History

ss Straight line drawing of a planar graph

1

2

34

5

Page 3: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

History

ss Straight line drawing of a planar graph

1

2

34

5 1

2

3

4

5

Page 4: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

History

ss Straight line drawing of a planar graph

1

2

34

5 1

2

3

4

5

Theorem [Wagner ’36, Fary ’48, Stein ’51]

Every planar graph has a planar straight-line drawing.

Page 5: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

History

ss Straight line drawing of a planar graph

1

2

34

5 1

2

3

4

5

Theorem [Wagner ’36, Fary ’48, Stein ’51]

Every planar graph has a planar straight-line drawing.

ss These algorithms produce drawings with area not bounded by any poly-nomial on n.

Page 6: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Next

This lecture:

Theorem [De Fraysseix, Pach, Pollack ’90]

Every n-vertex planar graph has a planar straight-line drawing of a size(2n− 4)× (n− 2).

Next lecture:

Theorem [Schnyder ’90]

Every n-vertex planar graph has a planar straight-line drawing of a size(n− 2)× (n− 2).

Page 7: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering

Definition: Canonical Ordering

Let G = (V,E) be a triangulated planar embedded graph of n ≥ 3 ver-tices. An ordering π = (v1, v2, . . . , vn) is called a canonical ordering, ifthe following conditions hold for each k, 3 ≤ k ≤ n.ss (C1) Vertices {v1, . . . vk} induce a 2-connected internally triangu-

lated graph, call it Gkss (C2) Edge (v1, v2) belongs to the outer face of Gkss (C3) If k < n then vertex vk+1 lies in the outer face of Gk, and allneighbors of vk+1 in Gk appear on the boundary of Gk consecu-tively.

Page 8: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering

Definition: Canonical Ordering

Let G = (V,E) be a triangulated planar embedded graph of n ≥ 3 ver-tices. An ordering π = (v1, v2, . . . , vn) is called a canonical ordering, ifthe following conditions hold for each k, 3 ≤ k ≤ n.ss (C1) Vertices {v1, . . . vk} induce a 2-connected internally triangu-

lated graph, call it Gkss (C2) Edge (v1, v2) belongs to the outer face of Gkss (C3) If k < n then vertex vk+1 lies in the outer face of Gk, and allneighbors of vk+1 in Gk appear on the boundary of Gk consecu-tively.

Page 9: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering

Definition: Canonical Ordering

Let G = (V,E) be a triangulated planar embedded graph of n ≥ 3 ver-tices. An ordering π = (v1, v2, . . . , vn) is called a canonical ordering, ifthe following conditions hold for each k, 3 ≤ k ≤ n.ss (C1) Vertices {v1, . . . vk} induce a 2-connected internally triangu-

lated graph, call it Gkss (C2) Edge (v1, v2) belongs to the outer face of Gkss (C3) If k < n then vertex vk+1 lies in the outer face of Gk, and allneighbors of vk+1 in Gk appear on the boundary of Gk consecu-tively.

Page 10: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

Page 11: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

G16

16

Page 12: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

16

G15

Page 13: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

15

16

G15

Page 14: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

15

16

G14

Page 15: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

14

15

16

G14

Page 16: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

14

15

16

G13

Page 17: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

13

14

15

16

G13

Page 18: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

13

14

15

16

G12

Page 19: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

Chord

14

15

16

G13

Page 20: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

13

14

15

16

G13

Page 21: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

13

14

15

16

G12

Page 22: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Example of Canonical Ordering

1 2

37

8

9

12

13

15

16

14

10

11

54

66

Page 23: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk

Page 24: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk

Page 25: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk

Page 26: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk

Page 27: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk vk should not be adjacent toa chord

Page 28: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Lemma

Every triangulated plane graph has a canonical ordering.

ss Let Gn = G, and let v1, v2, vn be the vertices of the outer face of Gn. ConditionsC1-C3 hold.ss Induction hypothesis: vertices vn−1, . . . , vk+1 have been chosen such that condi-tions C1-C3 hold for k + 1 ≤ i ≤ n.ss Consider Gk. We search for vk.

vk vk should not be adjacent toa chord

Is it sufficient?

Page 29: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

Page 30: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

Page 31: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

Page 32: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

Page 33: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

Page 34: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

not biconnected

Page 35: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

not biconnected

vk

Gk−1

Page 36: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

not biconnected

vk

Gk−1

not triangulated

Page 37: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

not biconnected

vk

Gk−1

not triangulated

vk

Gk−1

Page 38: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

Statement If vk is not adjacent to a chord then removal of vk leaves the graph bicon-nected.

vk

Gk−1

vk

Gk−1

not biconnected

vk

Gk−1

not triangulated

vk

Gk−1

a chord!

Page 39: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

ss Why a vertex not adjacent to a chord exists?

Page 40: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Canonical Ordering Existence

vk

ss Why a vertex not adjacent to a chord exists?

Page 41: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Computing Canonical OrderingAlgorithm CO

forall the v ∈ V dochords(v)← 0; out(v)← false; mark(v)← false;

out(v1), out(v2), out(vn)← true;for k = n to 3 do

choose v 6= v1, v2 such that mark(v) = false, out(v) = true, wahlev 6= v1, v2 mit chords(v) = 0;vk ← v; mark(v)← true;// Let w1 = v1, w2, . . . , wt−1, wt = v2 denote the boundary of Gk−1;and let wp, . . . , wq be the unmarked neighbors vk;out(wi)← true for all p < i < q;update number of chords for wi and its neighbors;

Page 42: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Computing Canonical OrderingAlgorithm CO

forall the v ∈ V dochords(v)← 0; out(v)← false; mark(v)← false;

out(v1), out(v2), out(vn)← true;for k = n to 3 do

choose v 6= v1, v2 such that mark(v) = false, out(v) = true, wahlev 6= v1, v2 mit chords(v) = 0;vk ← v; mark(v)← true;// Let w1 = v1, w2, . . . , wt−1, wt = v2 denote the boundary of Gk−1;and let wp, . . . , wq be the unmarked neighbors vk;out(wi)← true for all p < i < q;update number of chords for wi and its neighbors;

ss chord(v) - number of chords adjacent to vss mark(v) = true iff vertex v was numberedss out(v)=true iff v is the outer vertex of current plane graph

Page 43: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Computing Canonical OrderingAlgorithm CO

forall the v ∈ V dochords(v)← 0; out(v)← false; mark(v)← false;

out(v1), out(v2), out(vn)← true;for k = n to 3 do

choose v 6= v1, v2 such that mark(v) = false, out(v) = true, wahlev 6= v1, v2 mit chords(v) = 0;vk ← v; mark(v)← true;// Let w1 = v1, w2, . . . , wt−1, wt = v2 denote the boundary of Gk−1;and let wp, . . . , wq be the unmarked neighbors vk;out(wi)← true for all p < i < q;update number of chords for wi and its neighbors;

Lemma

Algorithm CO computes a canonical ordering of a graph in O(n) time.

Page 44: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Page 45: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

Gk−1

Page 46: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 47: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 48: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Overlaps!

Gk−1

Page 49: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Overlaps! What could be the solution?

Gk−1

Page 50: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 51: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 52: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 53: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

vk

Gk−1

Page 54: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

Gk−1

Page 55: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

x

y

Algorithm constraints: Gk−1 is drawn such thatss v1 is on (0, 0), v2 is on (2k − 6, 0)ss Boundary of Gk−1 (minus edge (v1, v2)) isdrawn x-monotoness Each edge of the boundary of Gk−1 (minusedge (v1, v2)) is drawn with slopes ±1

v1 v2

Gk−1

L(vk)

Page 56: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 57: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 58: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 59: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 60: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 61: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 62: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 63: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 64: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 65: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 66: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 67: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

L(10)

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 68: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

L(11)

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 69: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 70: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 71: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

L(13)

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 72: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

L(14)

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 73: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 74: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 75: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

(0, 0) (2n − 4, 0)

(n − 2, n − 2)

12

13

14

15

16

+1 +2

2

37

85

11

10

4

9

1

6

Page 76: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

Page 77: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

Covered vertices

Page 78: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

Covered vertices

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

Page 79: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

Page 80: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

Page 81: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

w1

w2

wp wq

wt−1

wt

Page 82: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

w1

w2

wp wq

wt−1

wt

L(wi)

Page 83: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

vk

Gk−1

ss Each internal vertex is cov-ered exactly oncess Coverence relation defines atree in Gss But a forest inGi, 1 ≤ i ≤ n−1

w1

w2

wp wq

wt−1

wt

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

L(wi)

Page 84: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Page 85: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 86: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 87: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 88: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 89: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 90: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 91: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Lemma

Let 0 < δ1 ≤ δ2 ≤ · · · ≤ δt ∈ N. If we shift L(wi) by δi to the right, we geta planar straight line drawing.

Proofss The proof is by induction on i, i.e. we consider G3, . . . , Gn.ss Assume that this is true for Gk−1.ss Let w1, . . . , wp, vk, wq, . . . , wt be the boundary of Gk.ss Let δ(w1) ≤ · · · ≤ δ(wp) ≤ δ(vk) ≤ δ(wq) ≤ · · · ≤ δ(wt).ss We set δ′(wi) = δ(wi) for 1 ≤ i ≤ p,ss δ′(wi) = δ(wi) + 1 for p+ 1 ≤ i ≤ q − 1ss δ′(wi) = δ(wi) + 2 for q ≤ i ≤ t.ss By induction hypothesis we can move w1 . . . , wt by δ(w1)′ . . . δ(wt)

′,respectively.ss We can complete the drawing by placing vk.

Page 92: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

De Fraysseix Pach Pollack (Shift) Algorithm

Algorithm Shift

Let v1, . . . , vn be a canonical ordering of Gfor i = 1 to n do

L(vi)← {vi};P (v1)← (0, 0); P (v2)← (2, 0); P (v3)← (1, 1);for i = 4 to n do

Let w1 = v1, w2, . . . , wt−1, wt = v2 denote the boundary of Gi−1;and let wp, . . . , wq be the neighbors vi;for ∀v ∈ ∪q−1

j=p+1L(wj) dox(v)← x(v) + 1 ;

for ∀v ∈ ∪tj=qL(wj) dox(v)← x(v) + 2 ;

P (vi)← intersection of +1 and −1 edges from P (wp) and P (wq) ;L(vi) = ∪q−1

j=p+1L(wj) ∪ {vi} ;

Page 93: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

1 2

34

5789

10 1112

6

1315 14

Page 94: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

1 2

34

5789

10 1112

6

1315 14 1

15

13

14

6

2

9

10

8

7

3

4

11

5

12

Page 95: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

1 2

34

5789

10 1112

6

1315 14 1

15

13

14

6

2

9

10

8

7

3

4

11

5

12

ss x(vk) = 12(x(wq) + x(wp) + y(wq)− y(wp)) (1)ss y(vk) = 1

2(x(wq)− x(wp) + y(wq) + y(wp)) (2)ss x(vk)− x(wp) = 1

2(x(wq)− x(wp) + y(wq)− y(wp)) (3)

Page 96: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

Page 97: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

wp+1 wq−1

vk

root

Page 98: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

root

Page 99: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

root

Page 100: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

root

Page 101: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

root

Page 102: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

root

Page 103: Algorithms for graph visualization - Startseite · Every n-vertex planar graph has a planar straight-line drawing of a size (2n 4) (n 2). Next lecture: Theorem [Schnyder ’90] Every

Algorithmen zur Visualisierung von Graphen

Marcus Krug

Institut fur Theoretische Informatik

Lehrstuhl Algorithmik I

Linear Time Implementation of Shift Algorithm

ss If we know the y-coordinates of wp and wq and the differencex(wp)− x(wq), we can compute the relative distance of vk and wp.ss In the binary tree which we construct we keep the relative x-distanceof each node from its parent.

v1 = w1

v2 = wt

w2

wp wq

w3

ss ∆x(wp, wq) = ∆x(wp+1) + · · ·+ ∆x(wq)ss Calculate ∆x(vk) by eq. (3)ss Calculate y(vk) by eq. (2)

wp+1 wq−1

vk

ss ∆x(wq) = ∆x(wp, wq) − ∆x(vk)ss ∆x(wp+1) = ∆x(wp+1) − ∆x(vk)

root