Flow and Upward Planarity

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

Great Theoretical Ideas in Computer Science
Great Theoretical Ideas in Computer Science for Some.
Orthogonal Drawing Kees Visser. Overview  Introduction  Orthogonal representation  Flow network  Bend optimal drawing.
Divide and Conquer. Subject Series-Parallel Digraphs Planarity testing.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
Introduction to Graphs
Great Theoretical Ideas in Computer Science for Some.
Brute-Force Triangulation
Krakow, Summer 2011 Schnyder’s Theorem and Relatives William T. Trotter
Maurizio Patrignani seminar on the paper on the single-source unsplittable flow problem authored by Yefim Dinitz Naveen Garg Michel X. Goemans FOCS ‘98.
Great Theoretical Ideas in Computer Science.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann 1 Polygon Triangulation Motivation: Guarding art galleries Art gallery theorem.
3 -1 Chapter 3 The Greedy Method 3 -2 The greedy method Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each.
Rectangle Visibility Graphs: Characterization, Construction, Compaction Ileana Streinu (Smith) Sue Whitesides (McGill U.)
Computational Geometry Seminar Lecture 1
Tucker, Applied Combinatorics, Section 1.4, prepared by Patti Bodkin
Lecture 3: Polygon Triangulation Computational Geometry Prof. Dr. Th. Ottmann Polygon Triangulation Motivation: Guarding art galleries Art gallery theorem.
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.
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.
Minimum Spanning Trees. Subgraph A graph G is a subgraph of graph H if –The vertices of G are a subset of the vertices of H, and –The edges of G are a.
Brute-Force Triangulation
Graph Algorithms Using Depth First Search Prepared by John Reif, Ph.D. Distinguished Professor of Computer Science Duke University Analysis of Algorithms.
9.2 Graph Terminology and Special Types Graphs
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.
© The McGraw-Hill Companies, Inc., Chapter 3 The Greedy Method.
Crossing Minimisation (1) Ronald Kieft. Global contents Specific 2-layer Crossing Minimisation techniques After the break, by Johan Crossing Minimisation.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
MCS 312: NP Completeness and Approximation algorithms Instructor Neelima Gupta
Approximating the Minimum Degree Spanning Tree to within One from the Optimal Degree R 陳建霖 R 宋彥朋 B 楊鈞羽 R 郭慶徵 R
Advanced Seminar on Graph Drawing – Planar Orientations Olga Maksin Victor Makarenkov Department of Computer Science. Ben-Gurion University of the Negev.
Introduction to Planarity Test W. L. Hsu. Plane Graph A plane graph is a graph drawn in the plane in such a way that no two edges intersect A plane graph.
Paradigms for Graph Drawing Graph Drawing: Algorithms for the Visualization of Graphs - Chapter 2 Presented by Liana Diesendruck.
Data Structures & Algorithms Graphs
Planar Graphs Graph Coloring
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
1 12/2/2015 MATH 224 – Discrete Mathematics Formally a graph is just a collection of unordered or ordered pairs, where for example, if {a,b} G if a, b.
Graph Theory and Applications
Introduction to Graphs. This Lecture In this part we will study some basic graph theory. Graph is a useful concept to model many problems in computer.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Introduction to Graph Theory
Great Theoretical Ideas in Computer Science for Some.
1 Assignment #3 is posted: Due Thursday Nov. 15 at the beginning of class. Make sure you are also working on your projects. Come see me if you are unsure.
Algorithms for hard problems Parameterized complexity Bounded tree width approaches Juris Viksna, 2015.
Graph Concepts Illustrated Using The Leda Library Amanuel Lemma CS252 Algorithms.
COMPSCI 102 Introduction to Discrete Mathematics.
CSC 252: Algorithms October 28, 2000 Homework #5: Graphs Victoria Manfredi (252a-ad) notes: -Definitions for each of the graph concepts are those presented.
Polygon Triangulation
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.
Leda Demos By: Kelley Louie Credits: definitions from Algorithms Lectures and Discrete Mathematics with Algorithms by Albertson and Hutchinson graphics.
Algorithms and Networks
Great Theoretical Ideas in Computer Science
Chapter 5. Optimal Matchings
Graph Algorithms Using Depth First Search
Planarity Testing.
Discrete Mathematics for Computer Science
Polygon Triangulation
Lectures on Graph Algorithms: searching, testing and sorting
CS 583 Analysis of Algorithms
Algorithms (2IL15) – Lecture 7
N(S) ={vV|uS,{u,v}E(G)}
Introduction to Graph drawing
Discrete Mathematics for Computer Science
Planarity.
Locality In Distributed Graph Algorithms
Presentation transcript:

Flow and Upward Planarity Graph Drawing, chapter 6 by: Ami Hauptman Masha Igra

Introduction Upward planar: inclusion in a Planar st-Graph Angles in Upward Drawing Upward Planarity Testing of Embedded Digraphs Optimal Upward Planarity Testing of Single-Source Embedded Digraphs

Introduction A digraph is upward planar if it admits a planar and upward drawing. upward – edges are monotonically increasing in the vertical direction planar – no two edges intersect

Introduction An embedded graph described by circular order of the neighbors of each vertex.

Inclusion in a Planar st-Graph A planar st-graph is an st-graph that is planar and embedded with vertices s and t on the boundary of the external face. St-graph is an acyclic graph with a single source s and single sink t t S

Theorem 6.1 Let G be a digraph. The following statements are equivalent: G is upward planar G admits an upward planar straight-line drawing G is the spanning subgraph of a planar st-graph

1(upward planar) 3(spanning subgraph of a planar st-graph) s,t respc. lowest and highest y coord. At sink v ≠ t draw new edge upward Add new edges (v, dest(e)) Able to cancel all sinks, except t Special cases Similar process cancels all sources, except s Statement shown.

3 (G is spanning subgraph of a planar st-graph G’) 2 (G admits an upward planar straight-line drawing) 3 steps: Add edges to G′. Resulting digraph G′′ is planar st-graph with all faces consisting of three edges Construct an upward planar straight- line drawing of G′′ Remove edges that don’t belong to G from drawing of G′′

Step 1: faces triangulation dest(f) f : a face of planar st-graph G’ (Lemma 4.1): f origin(f) Lemma 6.1: P = or , P = , k >= 4. Edge or can be added, such a resulting digraph is a planar st-graph Lemma 6.2: and has at least 3 vertices. Edge can be added, such a resulting digraph is a planar st-graph

Step 2: Upward planar straight-line drawing Lemma 6.4: Let G be a planar st-graph with all faces consisting of three edges. Given any upward planar straight-line drawing Δ for the external face of G, there exists an upward planar straight-line drawing of G with the external face drawn as Δ. Proof: by induction on the number n of vertices of G. n = 3, holds for graphs with fewer than n vertices: v – not on external face, χ – undirected cycle of the neighbors of v v s t u w G1 G2 Case 1: χ – has a chord (u, w) λ – undirected cycle (u, v, w) G1 and G2 – planar st-graphs By induction: Γ1 of G1, with external face Δ. Γ2 of G2, with external face λ

Step 2: cont. Case 1: χ – has no chord u – a predecessor of v, such that there is no directed path from u to any other predecessor of v (highest topological numbering). *Contract edge (u,v) into vertex u: * The resulting G’ is a planar st-graph with n-1 vertices. * By induction: Γ’ of G’ with external face Δ. * Reinsert v: - every vertex properly visible from v, - below its successors and above its predecessors u v u

2 (G admits upward planar straight-line drawing) 3 (G is spanning subgraph of a planar st-graph) 3 (G is spanning subgraph of a planar st-graph) 1 (G is upward planar): - Given a planar st-graph G’ including G - Construct a planar polyline drawing of G’ (Ch. 4) - Remove edges that do not belongs to G

Planar n-vertex st-graph testing – O(n): - G has a single source s and a single sink t – O(n) - G is planar – O(n) (ch. 3) - G is acyclic – O(n) (DFS) Upward planarity testing algorithm – exponential-time Adding all the possible subsets of edges and testing whether each of the resulting digraphs is a planar st-graph

6.2 – Angles in Upward Drawings Target: polynomial time UP testing for embedded digraphs Drawing = points to Vs; curves to edges Embedding = eqv. class of Drawings (same clockwise edges) Definitions Bimodal vertex: cyclic edge sequence can be partitioned to incoming, outgoing (possibly empty) Bimodal graph: all edges bimodal Upward planarity  Bimodality (Lemma 6.5) Planar st-graphs are UP  they are also bimodal NOT true in other direction: e.g. simple 3-cycle

Angles of a Graph Formed in embedding between 2 consecutive edges of same vertex straight-line drawing Single edge  angle = 2*PI

Large and Small Angles Only between pairs of incoming (or outgoing) edges Intuition: Small < PI; Large > PI Used in UP straight-line drawing If p = vertex OR face L(p) = number of Large angles of p S(p) = number of Small angles of p

Example-Small and Large Angles Here edges are undirected; “F” means a FLAT angle – between incoming AND outgoing edges (not needed)

Angle Consistency Properties The following holds for any UP straight-line drawing (for all fs, vs): Follows from elementary geometry Intuition: external face has more large angles; Start from triangle (S=2,L=0) and add points

Angles Consistency - Example Only Large angles colored Difference between Small & Large is always 2 External (h): more Large angles (due to Ss, Ts)

Incoming OR Outgoing angles A(f)= number of incoming (OR outgoing) angles of face f Small AND Large For a given face: |Incoming| = |Outgoing| A is determined by Embedding; 2A(f) = L(f)+S(f) A independent of DRAWING

Lemma 6.6 Revisited Lemma 6.6 + simple algebra using 2A(f) = L(f)+S(f) WE GET: Lemma 6.7 As before, holds for any UP straight line drawing of G

Assignments Vertices to faces -  : v  f (v): map each source\sink to one incident face At least 2 faces possible Only non-internal vertices (only sources\sinks)  (f) = group of vertices assigned to f -1

Assignments - Example Squares = faces A(f)-1 next to each f; A(f)+1 next to h Squares = faces A(f) -1 shown next to internal faces A(f)+1 shown next to external faces

Consistent Assignments  is consistent if there exists a face h s.t. h is the external face Relative to Lemma 6.7: 6.7: |Large angels| on the left (here: |vs assigned|) 6.7: Also mentions angles of vertices Assigning v to f  v will be Large in f Hence this is (essentially) Lemma 6.7

Consistency and Upward Planarity Lemma 6.8: An embedded bimodal digraph is upward planar only if it admits a consistent assignment of sources and sinks to faces A(f)-1 to all internal edges; A(f)+1 to external edge This is merely a reformulation of previous lemmas Conditions in Lemmas 6.5-6.8 are also sufficient GIVEN embedded, bimodal digraph G with consistent  THEN G spans an UP st-graph (and hence G is UP) Proved by correctness of Algorithm 6.1 below

Algorithm 6.1 Mainly: apply 6.2 to each face; (except for h:) connect to s\t

Switches Source-switch (or sink-switch) of a face f = source (sink) of f Switch of f = source OR sink of f A source (sink) in G is a source(sink)-switch in all incident faces Source in G =\= source in f An internal vertex in G Is a source or sink in all incident fs but two E.g. central v is a switch in all fs but 2 lower ones

Sequences σ of Switches Using , assign to every source\sink: SL, tL = “Large” source\sink of f Ss, ts = “Small” source\sink of f σf = circular symbol sequence, obtained by traversing f clockwise Gathering all SL, tL, Ss, ts symbols on the path E.g. : σf = ts, SL, ts, SL, ts, Ss, ts… S\L not determined by drawing

Algorithm 6.2 – Preliminaries Canonical sub-sequences: “LSS” sequences of σf We want to cancel sinks\sources (canceling Large angels) by adding edges in LSS subsequences Two cases are possible: SL, ts, Ss  add edge from Ss to SL tL, Ss, ts  add edge from tL to ts (cannot have 2 sinks\sources in a row) New edge splits f (and hence splits σf ) Ss  SL cancels SL; tL  ts cancels tL

Algorithm 6.2 – Saturate Face

Example 1 for Algorithm 6.2 f splits to f’ (next to split) and f’’ (containing LSS) σf splits to σf’ and σf’’ Continue recursively with f’, σf’

Splitting – Additional Examples

Correctness Proof of Algorithm 6.1 Prove by showing: Edge insertions preserve planarity, acyclicity and bimodality, as well as consistency of ` After all insertions, G’ has only one source and one sink on same f (which is h)

Planarity, Acyclicity, Bimodality Planarity – each edge is inserted inside a face, and hence no crossings Acyclicity – assume a cycle exists; prove by contradiction to  properties [omitted] Bimodality Assume edge (z,x) is inserted between two source-switches (for sinks – analogous) For x – (z,x) is the only incoming edge  bimodal For z – outgoing edge (z,x) inserted between 2 outgoing  bimodal

Assignment Consistency Invariant After inserting edge (z, x)--  `: All sources\sinks which were not canceled are assigned by ’ to f’ For all other sources\sinks = ` Hence ` is consistent A  A-1 so we need one less angle assigned

Single Source and Sink Internal Faces All are now with A(f)=1 (no vertex assigned) All fs created contain exactly one source and one sink, both labeled S Otherwise, there are still more canonical subsequences A(f)+1 S symbols and A(f)-1 L  “LSS” still exists and we can split

Single Source and Sink [2] The External Face A(h)+1 assigned sources\sinks Stop when we have k≥0 S symbols ; k+2 L symbols; no two S symbols in a row Final sequence has following structure: σh = L1, σ1, L2, σ2; σ1=S,L,S,...,L,S; σ2=S,L,S,...,L,S L symbols in one of σ1\2 referes to sources, the other to sinks

Final Step Either connect L1 to highest and L2 to lowest OR add s,t

Section Conclusion Time complexity of Saturate Face is linear in f’s vertices Simple manipulations of σs  Algorithm 6.2 takes O(n) time Proof: “only if” : from Lemmas 6.5-6.8 “if” and O(n) : Lemma 6.9 and Theorem 6.1

6.3 – Upward Planarity Testing How to construct consistent assignments? An algorithm for testing UP of an embedded digraph Need to test if a consistent assignment of sources\sinks to faces exists given h MAIN IDEA: Construct a biparitite flow network Bh to represent assignments

Bipartite Flow Network Bh Nodes of Bh are sources, sinks and faces of G Sources of Bh = Sources\sinks of G Each supplies 1 unit of flow Sinks of Bh = Faces of G Demand = A(f)-1 for internal faces; A(f)+1 for h Arcs of Bh (v,f) exists if v is a source\sink of G on face f

Flow in Bh An assignment of values {0,1} to arcs of Bh For each source v of Bh : Sum of values assigned to outgoing arcs of v  supply of v For each sink f of Bh : Sum of values assigned to incoming arcs of f  demand of f The Value of the flow = sum of values assigned to all arcs in Bh Multi source\sink network:

Example a.

Network Properties G with n vertices  O(n) vertices in Bh G admits a consistent assignment  Bh admits a flow of value r with correct demands r is number of sources & sinks in G Demands: A(f)+1 for External face; A(f)-1 for internal

Complexity of Basic UP Testing Choose h O(n) possible choices Construct Bh O(n) time [O(n) edges] Test existence of flow |r| for Bh O(rn) time using r flow augmentations If exists return #t ELSE choose next h Overall  O(r*n ) = O(n ) 2 3

Improvement - O(n ) time 2 Algorithm 6.3 – Embedded-UP-Test Construct a network B Same as Bh but demands are [A(f) – 1] for ALL. Independent of h O(n) Test whether B admits a flow of |r-2|. O(n-2) Try to increase demand by two for each face test if flow of |r-2| can be augmented by two units Total: (r-1+r)*n = O(nr) Return the set of all faces of G for which test was successful

Optimal Upward Planarity Testing of Single-Source Embedded Digraphs Face-sink graph F of G: Vertices of F: faces and vertices of G that are sink-switches Edges (f,v): v is a sink-switch of face f F is a forest

Thereom 6.6 Let G be an embedded single-source digraph, and h a face of G. Digraph G is upward planar, subject to h being the external face, if and only if all the following conditions are satisfied: The source of G is on the boundary of face h. The face-sink graph F of G is a forest. One tree T of F has no internal vertices of G, while the remaining trees have exactly one internal vertex. Face h is a vertex of tree T.

Algorithm 6.4 Embedded-Single-Source-Upward-Planar-Test O(n) time

Thank you!