COMP4048 Planar and Orthogonal Graph Drawing Algorithms - PowerPoint PPT Presentation

1 / 62
About This Presentation
Title:

COMP4048 Planar and Orthogonal Graph Drawing Algorithms

Description:

Tessellation Drawings. Visibility Drawings. Polyline Drawings ... Tessellation Drawing Visibility Drawing. degenerate vertices, non-degenerate faces ... – PowerPoint PPT presentation

Number of Views:151
Avg rating:3.0/5.0
Slides: 63
Provided by: lisastev
Category:

less

Transcript and Presenter's Notes

Title: COMP4048 Planar and Orthogonal Graph Drawing Algorithms


1
COMP4048Planar and Orthogonal Graph Drawing
Algorithms
  • Richard WebberNational ICT Australia

2
Lecture Overview
  • Planarity
  • Testing Planarity
  • Tessellation Drawings
  • Visibility Drawings
  • Polyline Drawings
  • Orthogonal Drawings via Visibility Drawings
  • Orthogonal Drawings via Network Flow
  • Degree gt 4
  • Bend Stretching
  • Degree gt 4 again

3
Planarity
  • A graph is planar if it can be drawn such that no
    edges cross
  • A drawing is planar if it is drawn with no edges
    crossing

4
Planarity
  • Straight-line drawing with no edge crossings
    Fáry Drawing (Fáry 1948)
  • 2D Fáry Drawing Planar (Graph) Drawing
  • ? Planar Drawing
  • ? ? Planar Embedding ? Planar Graph
  • Plane Graph (drawing) 2d

5
Planarity
  • Simple Planar Embedding
  • ? n f m 2
  • ? m O(n) and f O(n)
  • ? m ? 3n-6

Euler (http//www-history.mcs.st-andrews.ac.uk/Bio
graphies/Euler.html)
6
Testing Planarity
  • (Di Battista et al. 1999, Goldstein 1963)
  • Trees and SP Digraphs planar
  • Graph planar ?
  • connect components planar
  • Connect components planar ?
  • biconnected components planar
  • Biconnected ? two vertex-disjoint paths

7
Testing Planarity
  • Find a cycle C in G (biconnected ? cycle must
    exist)
  • Decompose remaining edges into pieces Pi
  • Connected without passing vertices of C
  • Incident vertices in C are attachments of Pi
  • If C ? 2 pieces then C is separating
  • If C ? 1 piece then C is non-separating
  • C non-separating and P1 ? a path ? ? separating C

8
Testing Planarity
9
Testing Planarity
  • Each piece must lie entirely inside or outside C
  • Two pieces interlace if they cannot both be
    inside (outside) C without breaking planarity
  • Interlacement graph I of G with respect to C
  • Vertices pieces of G
  • Edges between interlacing
  • pieces

10
Testing Planarity
  • Biconnected G with cycle C is planar iff
  • For each piece P, P P ? C is planar and
  • Interlacement graph I is bipartite
  • Planarity of P
  • determined
  • recursively

11
Testing Planarity
  • Compute piece of G with respect to C
  • For each non-path piece P
  • P P ? C
  • C cycle of P by replacing C between
    consecutive attachments with a path through P
  • Recursively test P with C return if
    non-planar
  • Compute interlacement graph I
  • Return non-planar if I not bipartite
  • Return planar

12
Testing Planarity
  • Computing pieces and finding C O(n)
  • Computing I and testing bipartite O(n2)
  • Each invocation O(n2), O(n) invocations ?
  • O(n3) running time
  • Can be improved to O(n) (HopcroftTarjan 1974)
  • Can construct planar embedding
  • use bipartite interlacement graph to alternate
    inside/outside pieces
  • path-pieces trivially inserted
  • non-path-pieces constructed recursively

13
Planar st-Graphs
  • (Di Battista et al. 1999, Lempel et al. 1967)
  • Digraphs only
  • s source, t sink only one of each
  • Add dummies if needed
  • Topological numbering number(v) for v ? V
  • such that (u, v) ? E ? number(v) gt number(u)
  • Topological sorting numbering ? 0..n-1
  • For weighted edges
  • number(v) ? number(u) weight(u, v)
  • number(s) 0 number(v) by max over BFS
  • optimal in O(n m) time

14
Planar st-Graphs
15
Planar st-Graphs
  • F faces of planar st-graph G such that
  • external face split left s and right t
  • orig(e), dest(e), left(e), right(e)
  • left(v), right(v), orig( f ), dest( f )
  • orig(v) dest(v) v left( f ) right( f ) f
  • G ( F, ( left(e), right(e) ) e ? E )
  • G is also planar st-graph

16
Planar st-Graphs
17
Planar st-Graphs
18
Tessellation Drawings
  • (Di Battista et al. 1999, TamassiaTollis 1989)
  • Vertices / Edges / Faces Objects
  • Object o drawn as a rectangle ?(o)
  • Possibly degenerate
  • ?(o1) ? ?(o2) ?
  • Union over all o ? V ? E ? F rectangle
  • ?(o)s horizontally adjacent ? os left/right
  • ?(o)s vertically adjacent ? os orig/dest

19
Tessellation Drawings
  • G from G
  • Topological numbering Y of G
  • Topological numbering X of G
  • For each o ? V ? E ? F
  • xL(o) X(left(o))
  • xR(o) X(right(o))
  • yB(o) Y(orig(o))
  • yT(o) Y(dest(o))
  • O(n) time and O(n2) area

20
Tessellation Drawings
21
Visibility Drawings
  • (Di Battista et al. 1999, TamassiaTollis 1986)
  • Vertices Horizontal lines
  • Edges Vertical lines
  • Intersections only where edges meet end-points
  • Tessellation Drawing ? Visibility Drawing
  • degenerate vertices, non-degenerate faces

22
Visibility Drawings
  • G from G
  • weight(e) 1 Optimal topological numbering Y
    of G
  • weight(e) 1 Optimal topological numbering X
    of G
  • For each v ? V
  • y (v) Y(v) xL(v) X(left(v)) xR(v)
    X(right(v))-1
  • For each e ? E
  • x (e) X(left(e)) yB(e) Y(orig(e)) yT(e)
    Y(dest(e))
  • O(n) time and O(n2) area

23
Visibility Drawings
24
Constrained Visibility
  • (Di Battista et al. 1999, Di Battista et al.
    1992)
  • Identify non-intersecting paths ?i in G
  • No common edges
  • No crossings
  • Can touch at vertices

25
Constrained Visibility
  • Set of paths ? covers G Add single-edge paths
  • Duplicate each path, adding faces to G gives G?
  • weight(e) 1, Y(s) 0 Optimal topological
    numbering Y of G
  • weight(e) 0.5, X(s) -0.5 Optimal
    topological numbering X of G?

26
Constrained Visibility
  • For each ? ? ? for each e ? ?
  • x (e) X(?)
  • yB(e) Y(orig(e))
  • yT(e) Y(dest(e))
  • For each v ? V
  • y(v) Y(v)
  • xL(v) minv ? ? X(?)
  • xR(o) maxv ? ? X(?)
  • O(n) time and O(n2) area

27
Constrained Visibility
28
Polyline Drawings
  • (Di Battista et al. 1999, Di Battista et al.
    1992)
  • Construct a visibility drawing
  • Place vertex vi at an arbitrary pi on its line
    segment
  • Draw short edge (vi, vj) as line pi ? pj
  • Draw long edge (vi, vj) as polyline pi ? (x(u,
    v), yu1) ? (x(u, v), yv-1) ? pj

29
Polyline Drawing
  • Place vertex at mid-point of its line segment
  • O(n) time and O(n2) area
  • ? 6n-12 bends (2 per edge)

30
Polyline Drawing
  • Place vertex above long edges if they exist
  • O(n) time and O(n2) area
  • ? (10n-31)/3 bends

31
Polyline Drawing
  • Use constrained visibility
  • Place vertex on path
  • O(n) time and O(n2) area
  • ? 4n-10 bends

32
Orthogonal via Visibility
  • (Di Battista et al. 1999)
  • Input planar st-graph
  • Create subpaths ?v for v ? s,t
  • 2 incoming edges ? leftmost-in?rightmost-out
  • 1 or 3 incoming edges ? median-in?median-out

33
Orthogonal via Visibility
34
Orthogonal via Visibility
  • Unify subpaths with common edges to give ?
  • Apply Constrained-Visibility algorithm

35
Orthogonal via Visibility
  • Create orthogonal drawing
  • Place vertex v ? s,t on path ?v
  • Place s (t) on path of median of out (in) edges
  • Routes general edges via paths
  • Route s (t) edges as

?
?
36
Orthogonal via Visibility
  • O(n) time, O(n2) area, ? 2n4 bends

37
Orthogonal via Network Flow
  • (Di Battista et al. 1999, Tamassia 1987)
  • Visibility guarantees O(1) bends per edge
  • Want to minimise total bends for embedding
  • minimising over all embeddings in NP-hard
  • Represent angles as a commodity
  • Produced by vertices, consumed by faces,
    transferred by bends
  • Apply a cost to each bend
  • Minimising bends minimising cost of flow!

38
Orthogonal via Network Flow
  • Replace each (undirected) edge (u, v) with two
    darts (u, v) and (v, u)
  • dart counterclockwise for f ? f is on left
  • ?(u, v)?/2 angle from dart (u, v) to next dart
    counterclockwise about u
  • ?(u, v) number of left bends in (u, v)
  • Orthogonal representation all (?, ?)
  • Same representation ? same number bends

39
Orthogonal via Network Flow
40
Orthogonal via Network Flow
  • Network N such that
  • Source (sink) v produces (consumes) ?(v)
  • Arc (u, v) has
  • Lower bound ?(u, v)
  • Capacity ?(u, v)
  • Cost ?(u, v)
  • Flow ?(u, v) such that ?(u, v) ? ?(u, v) ? ?(u,
    v)
  • Sum ? into v ? s,t sum ? out
  • Cost of flow ? in N sum all ?(u, v)?(u, v)

41
Orthogonal via Network Flow
  • Embed Graph G into Network N by
  • Nodes of N vertices and faces of G
  • Vertex-node v produces ?(v) 4
  • Internal face-node f consumes ?(f) 2a(f)-4
  • External face-node f consumes ?(f) 2a(f)4
  • a(f) number vertex-angles in face f

42
Orthogonal via Network Flow
  • Dart (u, v) with left (right) face f (g) ?
  • arc (u, f) ?(u, f) 1, ?(u, f) 4, ?(u, f) 0
    ? ?(u, v)
  • arc (f, g) ?(f, g) 0, ?(f, g) ?, ?(f, g) 1
    ? ?(u, v)

43
Orthogonal via Network Flow
  • Construct N from G O(n) time
  • Compute minimum cost flow for N O(n2 log
    n) (Ahuja et al. 1993) or O(n7/4 log n)
    (GargTamassia 1997) time
  • Map N to orthogonal representation for G O(n)
    time

44
Orthogonal via Network Flow
  • To map orthogonal representation to drawing
  • Divide the faces into rectangles
  • e ? corner(e) ? next(e) counterclockwise
  • turn(e) 1 (left), 0 (straight), 1 (right)
  • front(e) 1st next(e) s.t. sum e..e 1
  • If turn(e) 1 then insert
  • Vertex project(e) in front(e)
  • Edge extend(e) (corner(e), project(e))

45
Orthogonal via Network Flow
  • External face by enclosing in a rectangle
  • Total O(nb) time b number of bends

46
Orthogonal via Network Flow
  • Assign edge lengths
  • Minimising lengths/area compaction
  • Interior rectangles ?(u, v) ? 2, ?(u, v) 0
  • Exterior rectangle ?(u, v) ? 2, ?(u, v) 0
  • Use horizontal and vertical flow networks, Nhor
    and Nver

47
Orthogonal via Network Flow
  • Horizontal Flow Network Nhor
  • Nodes interior faces of G plus lower s and
    upper t outer face
  • Arcs (f, g) ? face f shares horizontal edge with
    face g f below g
  • ?(f, g) 1, ?(f, g) ?, ?(f, g) 1
  • ?(f, g) length of horizontal edge
  • Nver is analogous

48
Orthogonal via Network Flow
49
Orthogonal via Network Flow
  • Run-time dominated by network flow
  • O(n2 log n) or O(n7/4 log n)
  • Guarantees minimal width/height/length/area
  • Alternative Method
  • Place dummy vertices in external corners
  • Treat vertical (horizontal) paths as vertices
  • Calculate topological ordering X (Y)
  • Edge length X(v)-X(u) (Y(v)-Y(u))
  • O(n) time, but no guarantee of minimal total edge
    length

50
Degree gt 4
  • (Di Battista et al. 1999, Fößmeier Kaufmann
    1996)
  • Replace vertex v of degree d gt 4 with a cycle v1,
    , vd each vi incident to one edge incident to
    v
  • Solve using Network Flow such that cycle edges
    have no bends
  • For edge (u, v) separating faces f and g,
  • ?(f, g) ?(g, f) 0
  • By planarity, still O(n) vertices

51
Degree gt 4
52
Bend Stretching
  • (Di Battista et al. 1999, TamassiaTollis 1989)
  • Take any planar orthogonal drawing
  • Identify configurations that can be transformed
    to reduce bends
  • Iterate
  • General case requires O(n2)
  • Identifying special cases requires O(n)

53
Bend Stretching
?
?
?
54
Bend Stretching
55
Bend Stretching
56
Bend Stretching
57
Bend Stretching
58
Alternative Degree gt 4
  • (Di Battista et al. 1999, PapakostasTollis 1997)
  • Vertices are rectangular boxes
  • width max(1, out-degree-1)
  • height max(1, ?in-degree/2?-1)
  • Place vertices in order by st-numbering
  • Place above previous vertex
  • Place between median in-coming edges
  • Route in-coming edges to left and right sides
  • Route out-going edges from top

59
Degree gt 4
60
References
  • I. Fáry (1948) On Straight Lines
    Representations of Planar Graphs in Acta
    Scientiarum Mathematicarum, 11229-233
  • G. Di Battista, P. Eades, R. Tamassia, I. G.
    Tollis (1999) Graph Drawing Algorithms for the
    Visualization of Graphs, Prentice-Hall
  • A. J. Goldstein (1963) An Efficient and
    Constructive Algorithm for Testing Whether a
    Graph can be Embedded in the Plane, Proc. Graph
    and Combinatorics Conf.
  • J. Hopcroft, R. E. Tarjan (1974) Efficient
    Planarity Testing, J. ACM, 21(4)549-568
  • A. Lempel, S. Even, I. Celerbaum (1967) An
    Algorithm for Planarity Testing of Graphs, Proc.
    Int. Symp. Theory of Graphs (1966), pp. 215-232,
    Gordon and Breach

61
References
  • R. Tamassia, I. G. Tollis (1989) Tessellations
    Representations of Planar Graphs, Proc. 27th
    Allerton Conf. Communication, Control and
    Computing
  • R. Tamassia, I. G. Tollis (1986) A Unified
    Approach to Visibility Representations of Planar
    Graphs, Discrete and Computational Geometry,
    1(4)321-341
  • G. Di Battista, R. Tamassia, I. G. Tollis (1992)
    Constrained Visibility Representations of
    Graphs, Information Processing Letters, 411-7
  • R. Tamassia (1987) On Embedding a Graph in the
    Grid with the Minimum Number of Bends, SIAM J.
    Computing, 16(3)421-444
  • R. K. Ahuja, T. L. Magnanti, J. B. Orlin (1993)
    Network Flows Theory, Algorithms and
    Applications, Prentice-Hall

62
References
  • A. Garg, R. Tamassia (1997) A New Minimum Cost
    Flow Algorithm with Applications to Graph
    Drawing, Proc. Graph Drawing (1996),
    Springer-Verlag, LNCS 1190193-200
  • U. Fößmeier, M. Kaufmann (1996) Drawing High
    Degree Graphs with Low Bend Numbers, Proc. Graph
    Drawing (1995), Springer-Verlag, LNCS
    1027254-266
  • R. Tamassia, I. G. Tollis (1989) Planar Grid
    Embedding in Linear Time, IEEE Trans. Circuits
    and Systems, 36(9)1230-1234
  • A. Papakostas, I. G. Tollis (1997) Orthogonal
    Drawing of High Degree Graphs with Small Area and
    Few Bends, Proc. 5th Work. Algorithms and Data
    Structures, Springer-Verlag, LNCS, 1272354-367
Write a Comment
User Comments (0)
About PowerShow.com