5-Minute Review How does the Inorder tree layout algorithm work? Which tree drawing requirements does it (not) fulfill? What is its main drawback? How.

Slides:



Advertisements
Similar presentations
Two Segments Intersect?
Advertisements

Octagonal Drawing Johan van Rooij. Overview What is an octagonal drawing Good slicing graphs Octagonal drawing algorithm for good slicing graphs Correctness.
22nd International Symposium on Graph Drawing
Orthogonal Drawing Kees Visser. Overview  Introduction  Orthogonal representation  Flow network  Bend optimal drawing.
Divide and Conquer. Subject Series-Parallel Digraphs Planarity testing.
I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G Graph Drawing: Algorithms for the Visualization.
Efficient access to TIN Regular square grid TIN Efficient access to TIN Let q := (x, y) be a point. We want to estimate an elevation at a point q: 1. should.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
AVL Trees COL 106 Amit Kumar Shweta Agrawal Slide Courtesy : Douglas Wilhelm Harder, MMath, UWaterloo
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Divide and Conquer: Rooted Trees. 2 Introduction Rooted trees: acyclic graphs (no cycles) all edges directed away from root. downward planar drawing (child.
CMPS 2433 Discrete Structures Chapter 5 - Trees R. HALVERSON – MIDWESTERN STATE UNIVERSITY.
Seminar Graph Drawing H : Introduction to Graph Drawing Jesper Nederlof Roeland Luitwieler.
The number of edge-disjoint transitive triples in a tournament.
Advanced Topics in Algorithms and Data Structures 1 Rooting a tree For doing any tree computation, we need to know the parent p ( v ) for each node v.
Graph Drawing and Information Visualization Laboratory Department of Computer Science and Engineering Bangladesh University of Engineering and Technology.
Rectangle Visibility Graphs: Characterization, Construction, Compaction Ileana Streinu (Smith) Sue Whitesides (McGill U.)
Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?
Advanced Topics in Algorithms and Data Structures Page 1 An overview of lecture 3 A simple parallel algorithm for computing parallel prefix. A parallel.
Proving Lower Bounds on Graph Drawing Problems Rajat Anantharam Department of Gaming and Media Technology Utrecht University.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
2/10/03Tucker, Sec Tucker, Applied Combinatorics, Sec. 3.2, Important Definitions Enumeration: Finding all of the possible paths in a rooted tree.
C++ Programming: Program Design Including Data Structures, Third Edition Chapter 20: Binary Trees.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
Flow and Upward Planarity
Orthogonal Drawings of Series-Parallel Graphs Joint work with Xiao Zhou by Tohoku University Takao Nishizeki.
I NTRODUCTION TO G RAPH DRAWING Fall 2010 Battista, G. D., Eades, P., Tamassia, R., and Tollis, I. G Graph Drawing: Algorithms for the Visualization.
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
Lecture 81 Data Structures, Algorithms & Complexity Tree Algorithms GRIFFITH COLLEGE DUBLIN.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
1 Trees 2 Binary trees Section Binary Trees Definition: A binary tree is a rooted tree in which no vertex has more than two children –Left and.
Advanced Seminar on Graph Drawing – Planar Orientations Olga Maksin Victor Makarenkov Department of Computer Science. Ben-Gurion University of the Negev.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Preview  Graph  Tree Binary Tree Binary Search Tree Binary Search Tree Property Binary Search Tree functions  In-order walk  Pre-order walk  Post-order.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Discrete Structures Trees (Ch. 11)
Trees 2: Section 4.2 and 4.3 Binary trees. Binary Trees Definition: A binary tree is a rooted tree in which no vertex has more than two children
Algorithms for hard problems Parameterized complexity Bounded tree width approaches Juris Viksna, 2015.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
1 Schnyder’s Method. 2 Motivation Given a planar graph, we want to embed it in a grid We want the grid to be relatively small And we want an efficient.
Trees.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Algorithms and Networks
Non Linear Data Structure
CS 201 Data Structures and Algorithms
Mathematical Foundations of AI
Computational Geometry
Data Structures – LECTURE Balanced trees
Heaps, Heapsort, and Priority Queues
Binary Search Tree (BST)
Minimum Spanning Tree 8/7/2018 4:26 AM
12. Graphs and Trees 2 Summary
Trees Another Abstract Data Type (ADT)
Section 8.1 Trees.
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Mean Shift Segmentation
Tonga Institute of Higher Education
Advanced Algorithms Analysis and Design
i206: Lecture 13: Recursion, continued Trees
Graph Algorithms Using Depth First Search
Planarity Testing.
Trees Another Abstract Data Type (ADT)
Convex Sets & Concave Sets
Ch. 8 Priority Queues And Heaps
Trees Another Abstract Data Type (ADT)
CE 221 Data Structures and Algorithms
SPQR Tree.
Computational Geometry
Introduction to Graph drawing
Presentation transcript:

5-Minute Review How does the Inorder tree layout algorithm work? Which tree drawing requirements does it (not) fulfill? What is its main drawback? How does the algorithm by Whetherell and Shannon (WS) work? How efficient is it, why? Drawbacks? Are isomorphy preservation and minimum width always compatible with each other? Compared to WS, what is the advantage of the algorithm by Reingold and Tilford (RT)? What is its complexity? What is a simple radial layout algorithm? What is a possible hitch with it, how can that be avoided? Inorder tree layout: y-coordinate according to layer (= distance to root), x-coordinate given by inorder traversal order (left subtree - root - right subtree). Is planar, grid drawing, straight-line, layered (and hence strictly upward), order preserving, separates subtrees. Not: centering of parents over children, isomorphy preservation. Drawback: often unnecessarily wide, does not preserve isomorphy. WS: 1) postorder traversal computes next available position at each level and provisional place for each node as average of child position. Shift subtrees if provisional place is too far left. Has linear efficiency, by keeping track of subtree shifts in modifiers, which are accumulated in preorder pass. Drawback: again often unnecessarily wide, does not preserve isomorphy. Isomorphy preservation and minimum width may conflict with each other. Might have to „bend“ drawings in different ways to achieve min width, see example from RT RT: preserves isomorphy. Draws subtrees recursively, computes distance of neighboring subtrees when they are completely drawn. Complexity is again linear, made possible by efficient book keeping of contours Simple radial layout: divide circle among subtrees in sectors whose size is proportional to number of nodes in subtree. Possible hitch: edge crossings. Can avoid this by limiting sectors according to annulus wedge.

Series-Parallel Digraphs Inf-GraphDraw: Automatic Graph Drawing Lecture 9 Series-Parallel Digraphs Reinhard von Hanxleden rvh@informatik.uni-kiel.de This lecture is based in part on material kindly provided by Eran Geva and Matya Katz

Series-Parallel (SP) Digraphs Directed graph with a source and sink nodes Source and sink are called poles Defined recursively Assume simple graph, thus no multiple edges SP digraphs are planar Base case: An edge with source and sink vertices sink source https://link.springer.com/content/pdf/10.1007%2F3-540-55706-7_23.pdf [Di Battista et al. book ‘99, Sec. 3.2] Bertolazzi, Cohen, Di Battista, Tamassia, Tollis, How to Draw a Series-Parallel Digraph, SWAT ’92, LNCS vol. 621

Series composition of digraphs Identify sink of one and source of other as one vertex t2 t1 t’2 G2 + = G1 G2 t1 s1 s2 G1 s1

Parallel composition of digraphs Identify as one vertex both their sources Identify as one vertex both their sinks t1 t2 t1 + = G1 G2 G1 G2 s1 s2 s1

Decomposition trees Associate SP digraph with parse tree T Binary tree Consists of S-nodes, P-nodes and Q-nodes Defined recursively

Decomposition trees G is a single edge: T is a single Q-node t Q s

Decomposition trees G is a series composition of G1 and G2 where T1 and T2 are their parse trees: T has S-node root with children T1 and T2 t2 G2 S t1 T1 T2 G1 s1

Decomposition trees G is a parallel composition of G1 and G2 where T1 and T2 are their parse trees: T has P-node root with children T1 and T2 t1 P G1 G2 T1 T2 s1

Decomposition trees If a node has the same type as his parent, make it the right child Then T is unique for G If G has n nodes, then T has O(n) nodes T can be created in O(n) time, so will be assumed to be part of the input

Area Requirements Q: How much area may an upward, straight-line, embedding-preserving drawing of an SP digraph require? A: A lot ... Consider Gn: P (sn+1, tn+1) S tn+1 (sn+1, sn) P t0 tn (sn, tn+1) S G0: Gn+1: Gn (tn, tn+1) Gn s0 sn sn+1 Decomposition Tree for Gn+1

Area Requirements Theorem [Bertolazzi et al. ‘92]: An upward, embedding-preserving, straight-line drawing of Gn requires area Ω(4n), under any resolution rule. Resolution rule: e.g., minimum separation between two nodes integer coordinates Proof: We show that Area(Gn+1) ≥ 4 * Area(Gn).

Drawing of Gn is bounded by triangle Δn given by sn, sn-1, tn tn+1 must be in here tn τ Δn λ sn-1 σ sn sn+1 sn+1 must be in here ρ

Drawing of Gn+1 contains Δn+1 tn+1 tn τ Δn λ sn-1 Δn+1 σ sn sn+1 ρ

Now calculate lower bound on Area(Δn+1) from Area(Δn) tn Δ’’ τ Δn p λ Δ’ sn-1 Π σ ρ sn For parallelogram Π: Area(Π) ≥ 2 * Area(Δn) Also: Area(Δ’) + Area(Δ’’) ≥ Area(Π) Thus Area(Δn+1) = Area(Π) + Area(Δ’) + Area(Δ’’) ≥ 2 * Area(Π) ≥ 4 * Area(Δn) q.e.d.

Right-pushed embedding (u, v) is transitive in G if there is another path from u to v As pre-processing to Δ-SP-Draw, modify embedding into right-pushed embedding: transitive edge (u, v) is on the right of all components with u and v poles This permits O(n2) drawing area

Δ-SP-Draw Produces upward embedding of SP-digraph Drawing inside a bounding triangle Δ(Γ) which is isosceles (gleichschenklig) and right-handed Series – place one above the other Parallel – place one to the right of the other

Δ-SP-Draw – Base If G is a single edge: Draw it as a vertical edge with length 2 Bounding triangle Δ(Γ) will have width 1 t G s

Δ-SP-Draw – Series If G is a series composition of G1 and G2: Recursively draw Γ1 and Γ2 Translate Γ2 so G1’s sink is on G2’s source Extend bounding triangle Δ(Γ) accordingly Note: sources differ on whether G1 is placed above or below G2. We here stick to the order of the original paper, which places G1 below G2 (and calls them G’ and G’’). G2 G1

Δ-SP-Draw – Parallel If G is a parallel composition of G1 and G2: Recursively draw Γ1 and Γ2 Translate Γ2 to the “prescribed-region” of G2 (right of the dashes) Extend bounding triangle Δ(Γ) accordingly Move sources and sinks to upper and lower corners of Δ(Γ) G2 G1

“Prescribed Region” (v, t) and (s, u) are rightmost edges on G1 λv and λu are rays parallel to G1’s bounding triangle G2 will be translated to anywhere on the right of λv, λu and κ. Remaining question: Can the move of sources/ sinks to lower/upper corner create crossings? κ λv t v G2 u G1 s λu

Δ-SP-Draw invariants Is inside an isosceles right-angled triangle Δ(Γ) Top = Sink = t Bottom = Source = s Left = nothing For any vertex u adjacent to s, in slopes –π/2 and –π/4 there’s nothing but s For any vertex v adjacent to s, in slopes π/2 and π/4 there’s nothing but t t v u s

Lemma Let u and v be neighbors of the source so (s, u) is left of (s, v) Let λu and λv be rays of slope -π/4 from u and v Invariant 3 ⇒ λu is below λv u v s λu λv

Consequence of Lemma If G2 is placed to the right of G1 and above λu where (s, u) is the rightmost edge of s on G1: No vertex of G2 is in the wedge limited by the –π/4 ray from the neighbors of s Hence, if invariant 3 is held on G1 and G2, it is also held on G Symmetrically invariant 4 can be proved u s

Therefore: Proving Invariants 3 and 4 guarantee that s and t can be moved as described in the algorithm without creating crossings. Invariant 2 states that left corner of Δ(Γ) is always empty, so G2’s left corner can be on the base of G1.

Area of the triangle So the base of resulting triangle is equals the sum of bases of both triangles. For a graph with e edges the length of the base is 2e (prove this inductively!) So the area needed is O(e2) Due to planarity, this is O(n2), where n is number of nodes

Calculating distances We’ll describe Γ by: b = length of the base b’ = vertical distance to λu b’’ = vertical distance to λv κ b’’ λv t v b u s λu b’

Parallel distances To describe parallel combinations we’ll use: Δx = horizontal distance from Δ(Γ1) to Δ(Γ2) Δy = vertical distance from bottom ray of Δ(Γ1) to left corner of Δ(Γ2) Δx Γ1 Γ2 Δy

Δ-SP-label input : decomposition tree T of G output : labeling b, b’, b’’ for each subtree of T if root(T) is Q-node then b(T) = b’(T) = b’’(T) = 2 else Call Δ-SP-label for T’s subtrees T1 and T2 if root is S-node then b(T) = b(T1) + b(T2) b’(T) = b’(T1) b’’(T) = b’’(T2) else // root is P-node b(T) = b(T1) + b(T2)+2Δx if T2 is Q-node (transitive edge) then b’(T) = b’’(T) = b(T) else b’’(T) = b(T1) + 2Δx – Δy + b’’(T2) b’(T) = b’(T2) + Δy T2 T1 T1 T2

Δ-SP-label Δx can be 0 Δy can be b’(T1) The area needed is O(n2) The algorithm runs in O(n) and needs O(n) space

Summary SP Digraphs are planar graphs, defined recursively by serial and parallel decomposition Embedding preserving, straightline, upward drawing may require exponential area Δ-SP drawing by Bertolazzi et al. changes embedding and achieves quadratic area, runs in linear time