Divide and Conquer. Subject Series-Parallel Digraphs Planarity testing.

Slides:



Advertisements
Similar presentations
Great Theoretical Ideas in Computer Science
Advertisements

Great Theoretical Ideas in Computer Science for Some.
Two Segments Intersect?
Octagonal Drawing Johan van Rooij. Overview What is an octagonal drawing Good slicing graphs Octagonal drawing algorithm for good slicing graphs Correctness.
Graphs - II Algorithms G. Miller V. Adamchik CS Spring 2014 Carnegie Mellon University.
Planar graphs Algorithms and Networks. Planar graphs2 Can be drawn on the plane without crossings Plane graph: planar graph, given together with an embedding.
WSPD Applications.
22nd International Symposium on Graph Drawing
Cutting trees and the cutting lemma Presented by Amir Mograbi.
8.3 Representing Relations Connection Matrices Let R be a relation from A = {a 1, a 2,..., a m } to B = {b 1, b 2,..., b n }. Definition: A n m  n connection.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
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.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
2/14/13CMPS 3120 Computational Geometry1 CMPS 3120: Computational Geometry Spring 2013 Planar Subdivisions and Point Location Carola Wenk Based on: Computational.
Great Theoretical Ideas in Computer Science for Some.
Divide and Conquer: Rooted Trees. 2 Introduction Rooted trees: acyclic graphs (no cycles) all edges directed away from root. downward planar drawing (child.
1 Monotone Drawings of Graphs Thanks to Peter Eades Patrizio Angelini, Enrico Colasante, Giuseppe Di Battista, Fabrizio Frati,
Applied Combinatorics, 4th Ed. Alan Tucker
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Applied Combinatorics, 4th Ed. Alan Tucker
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Computational Geometry Seminar Lecture 1
Tucker, Applied Combinatorics, Section 1.4, prepared by Patti Bodkin
Straight line drawings of planar graphs – part I Roeland Luitwieler.
Chapter 4: Straight Line Drawing Ronald Kieft. Contents Introduction Algorithm 1: Shift Method Algorithm 2: Realizer Method Other parts of chapter 4 Questions?
1 Separator Theorems for Planar Graphs Presented by Shira Zucker.
Drawing of G. Planar Embedding of G Proposition Proof. 1. Consider a drawing of K 5 or K 3,3 in the plane. Let C be a spanning cycle. 2. If the.
Module #1 - Logic 1 Based on Rosen, Discrete Mathematics & Its Applications. Prepared by (c) , Michael P. Frank and Modified By Mingwu Chen Trees.
Curve Curve: The image of a continous map from [0,1] to R 2. Polygonal curve: A curve composed of finitely many line segments. Polygonal u,v-curve: A polygonal.
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
GRAPH Learning Outcomes Students should be able to:
Graph Theory Ch6 Planar Graphs. Basic Definitions  curve, polygon curve, drawing  crossing, planar, planar embedding, and plane graph  open set  region,
Graph Theory Chapter 6 Planar Graphs Ch. 6. Planar Graphs.
Flow and Upward Planarity
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
Discrete Structures Lecture 12: Trees Ji Yanyan United International College Thanks to Professor Michael Hvidsten.
5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition.
V Spanning Trees Spanning Trees v Minimum Spanning Trees Minimum Spanning Trees v Kruskal’s Algorithm v Example Example v Planar Graphs Planar Graphs v.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 8 Arrangements and Duality.
15-853Page :Algorithms in the Real World Planar Separators I & II – Definitions – Separators of Trees – Planar Separator Theorem.
VLSI Layout Algorithms CSE 6404 A 46 B 65 C 11 D 56 E 23 F 8 H 37 G 19 I 12J 14 K 27 X=(AB*CD)+ (A+D)+(A(B+C)) Y = (A(B+C)+AC+ D+A(BC+D)) Dr. Md. Saidur.
S&H Planarity Test Based on PC-Trees Wen-Lian Hsu.
Algorithms for hard problems Parameterized complexity Bounded tree width approaches Juris Viksna, 2015.
Various Orders and Drawings of Plane Graphs Takao Nishizeki Tohoku University.
Center for Graphics and Geometric Computing, Technion 1 Computational Geometry Chapter 9 Line Arrangements.
Senior Project Board Implementation of the Solution to the Conjugacy Problem in Thompson’s Group F by Nabil Hossain Advisers: James Belk & Robert McGrail.
5.6 Prefix codes and optimal tree Definition 31: Codes with this property which the bit string for a letter never occurs as the first part of the bit string.
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.
Algorithms and Networks
Outline 1 Properties of Planar Graphs 5/4/2018.
Applied Combinatorics, 4th Ed. Alan Tucker
Graph theory Definitions Trees, cycles, directed graphs.
Great Theoretical Ideas in Computer Science
Advanced Algorithms Analysis and Design
Algorithms and Complexity
Graph Algorithms Using Depth First Search
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.
Planarity Testing.
Discrete Mathematics for Computer Science
Bart M. P. Jansen June 3rd 2016, Algorithms for Optimization Problems
CS 583 Analysis of Algorithms
Introduction Wireless Ad-Hoc Network
Applied Combinatorics, 4th Ed. Alan Tucker
Subgraphs, Connected Components, Spanning Trees
SPQR Tree.
Computational Geometry
N(S) ={vV|uS,{u,v}E(G)}
Gaph Theory Planar Graphs
Planarity.
Concepts of Computation
Presentation transcript:

Divide and Conquer

Subject Series-Parallel Digraphs Planarity testing

Series-Parallel Digraphs

Graph with a source and sink nodes Source and sink are called poles Defined recursively Base case: An edge with source and sink vertices sourcesink

Series composition of digraphs Identifying the sink of one and the source of the other as one vertex

Parallel composition of digraphs Identifying as one vertex both their sources Identifying as one vertex both their sinks

Decomposition trees Associating SP digraphs with Parse Trees Binary trees S-nodes, P-nodes and Q-nodes Defined recursively

Decomposition trees G is a single edge so T is a single Q-node Q

Decomposition trees G is a parallel composition of G 1 and G 2 where T 1 and T 2 are their parse trees so T has P-node root with children T 1 and T 2 P T1T1 T2T2

Decomposition trees G is a series composition of G 1 and G 2 where T 1 and T 2 are their parse trees so T has S-node root with children T 1 and T 2 S T1T1 T2T2

Decomposition trees If a node has the same type as his parent it will be the right child 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

Components Let C be a maximal path same node type on T Let u 1 … u k children of C not on C Component is the part of G associated with a subsequence ui.. uj where 1 ≤ i ≤ j ≤ k Component is closed when C is of S-nodes Otherwise it is open

Closed component

Open component

Not a component

Right-pushed embedding (u, v) is transitive in G if there is another path from u to v Drawing transitive edge (u, v) on the right of all components with u and v poles O(n 2 ) drawing area

Δ-SP-Draw Upward embedding of SP-digraph Drawing inside a bounding triangle Δ(Γ) which is isosceles ( שווה שוקיים ) and right-handed Series – one above the other Parallel – one to the right of the other

Δ-SP-Draw invariants 1.Inside an isosceles right-angled triangle Δ(Γ) 2.Top = Sink = t Left = nothing Bottom = Source = s 3.If (s, u) exist then between slopes –π/2 and –π/4 there’s nothing but s 4.If (v, t) exist then between slopes π/2 and π/4 there’s nothing but t t s v u

Δ-SP-Draw

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

Δ-SP-Draw – series If G is a series composition of G1 and G2 Recursively draw Γ1 and Γ2 Translate Γ2 so G2’s sink is on G1’s source Extend bounding triangle Δ(Γ) accordingly G1 G2

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 Δ(Γ) Δ-SP-Draw – parallel G1 G2

“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 κ. G1 G2 v u κ t s λvλv λuλu

Lemma 3.3 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 If invariant 3 holds then λu is below λv s uv λuλu λvλv

Lemma 3.3 – outcome If G2 is placed to the right of G1 and above λu where (s, u) is the rightmost edge of s on G1 Then 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 s u

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 n vertices the length of the base is 2n. So the area needed is O(n 2 )

Calculating distances We’ll describe Γ by: b = length of the base b‘ = vertical distance to λu b‘’ = vertical distance to λv v u κ t s λvλv λuλu b’ b’’ 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 Δy

Δ-SP-label input : decomposition tree T of G output : labeling b, b’, b’’ for each subtree of T if root = Q-node then b(T) = b’(T) = b’’(T) = 2 else Δ-SP-label of T1 and T2 (the subtrees) if root = S-node then b(T) = b(T1) + b(T2) b’(T) = b(T1) b’’(T) = b(T2) else root = P-node then 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

Δ-SP-label Δx can be 0 Δy can be b’(T1) The area needed is O(n 2 ) The algorithm runs in O(n) and needs O(n) space end of Series-Parallel Digraphs

Planarity Testing

Graph is planar if E = 3V - 6 (Euler formula) Graph is planar iff all its connected components are planar Graph is planar iff all its biconnected (connected by 2 edges per vertex) components are planar Preprocessing into connected and biconnected components – the problem is restricted to biconnected graphs

Partitioning into Pieces Let a biconnected graph G contain a cycle C Classify each edge of G not on C: if 2 edges have a path between them with no vertex of C, they have the same class. Subgraph induced by edges in a class is called a piece of G.

Partitioning into Pieces

Attachments Vertices of piece P which are also on cycle C are called attachments Since G is biconnected each piece has at least 2 attachments Cycle C induce a circular ordering on the attachments of P

Separating cycle Cycle C is separating if it has at least 2 pieces If is has one or no pieces it is nonseparating separatingnonseparating

Lemma 3.4 Let G be a biconnected graph Let C be a nonseparating cycle of G Let P be a piece on C If P is not a path then G has a separating cycle C’ consisting of subpath of C and a path of P

Lemma 3.4 proof Let u and v be 2 attachments of P that are consecutive in the circular ordering. Let γ be a subpath of C between u and v without any attachments. Since P is connected there is a path π in P between u and v. Let C’ be the cycle obtained from C by replacing γ with π. Now γ is a piece on G with respect to C’ Let e be an edge on P not π. e exist Because P is not a path. So there is a piece of C’ other than γ which contains e. Thus C’ is a separating cycle in G. C’ C γ π e

Interlacement Each piece can be drawn either entirely inside or outside of the cycle Interlacing pieces are ones that can’t be drawn on the same side of C without crossing Interlacing pieces

Interlacement graph Vertices are pieces on G with cycle C Edges are pairs of pieces that interlace – can’t reside on the same side of C C P1 P3 P2 P4 P1P3 P2P4

Interlacement to planarity If G is planar graph then its interlacement graph must be bipartite C P1 P3 P2 P4 P1 P3 P2 P4

Theorem 3.8 A biconnected graph G with cycle C is planar iff For each piece P, adding P to C is planar The interlacement graph of pieces of G with cycle C is bipartite

Planarity testing 0. Count edges and check Euler's formula 1.Find pieces of G 2.For each piece P that is not a path test planarity by recursion 3.Compute interlacement graph of the pieces 4.Test if the interlacement graph is bipartite

Preliminaries The algorithm receives a biconnected graph G G has n vertices and at most 3n-6 edges Also received is a separating cycle C Returns whether G is planar or not

Finding pieces Finding the pieces of G with respect to C by computing the connected components of G without C. Takes O(n)

Testing piece P planarity For each piece P that is not a path: Let P’ be graph of adding P to C Let C’ be cycle in P’ by replacing part of C with a path in P Since P’ is biconnected and C’ is separating – test planarity recursively Takes O(E(P’)) P2

Computing interlacement graph For each 2 pieces P, Q P, Q’s attachments are numbered along C If attachments are not continuous in region for each piece then P, Q are interlaced

Computing interlacement graph Checking one piece vs. all others takes O(n) All vs. all takes O(n 2 ) Interlacement graph has O(n) vertices and O(n 2 ) edges Checking if it’s bipartite takes O(n 2 )

Overall runtime Each recursive invocation takes O(n 2 ) Each recursion is associated with at least one edge of G There are O(n) edges Runtime is O(n 3 )