Testing planarity part 1 Thomas van Dijk. Preface Appendix of Planar Graph Drawing Quite hard to read So we’ll try to explain it, not just tell you about.

Slides:



Advertisements
Similar presentations
Graph Algorithms Algorithm Design and Analysis Victor AdamchikCS Spring 2014 Lecture 11Feb 07, 2014Carnegie Mellon University.
Advertisements

Great Theoretical Ideas in Computer Science
Great Theoretical Ideas in Computer Science for Some.
Graphs, Planar graphs Graph coloring
Planar graphs Algorithms and Networks. Planar graphs2 Can be drawn on the plane without crossings Plane graph: planar graph, given together with an embedding.
Connectivity - Menger’s Theorem Graphs & Algorithms Lecture 3.
 Theorem 5.9: Let G be a simple graph with n vertices, where n>2. G has a Hamilton circuit if for any two vertices u and v of G that are not adjacent,
22C:19 Discrete Math Graphs Fall 2014 Sukumar Ghosh.
Midwestern State University Department of Computer Science Dr. Ranette Halverson CMPS 2433 – CHAPTER 4 GRAPHS 1.
Planar Orientations Chapter 4 ( ) in the book Written By: Tomer Heber.
More Efficient Generation of Plane Triangulations Shin-ichi Nakano Takeaki Uno Gunma University National Institute of JAPAN Informatics, JAPAN 23/Sep/2003.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Graphs Chapter 20 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Last time: terminology reminder w Simple graph Vertex = node Edge Degree Weight Neighbours Complete Dual Bipartite Planar Cycle Tree Path Circuit Components.
Chapter 23 Minimum Spanning Trees
Data Structures & Algorithms Graph Search Richard Newman based on book by R. Sedgewick and slides by S. Sahni.
R. Bar-Yehuda © 1 קומבינטוריקה למדעי - המחשב – הרצאה #17 Chapter 2: TREES מבוסס על הספר : S. Even, "Graph Algorithms",
What is the next line of the proof? a). Let G be a graph with k vertices. b). Assume the theorem holds for all graphs with k+1 vertices. c). Let G be a.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
UMass Lowell Computer Science Analysis of Algorithms Prof. Karen Daniels Fall, 2001 Wednesday, 9/26/01 Graph Basics.
DAST 2005 Tirgul 11 (and more) sample questions. DAST 2005 Q.Let G = (V,E) be an undirected, connected graph with an edge weight function w : E→R. Let.
Is the following graph Hamiltonian- connected from vertex v? a). Yes b). No c). I have absolutely no idea v.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 10 Instructor: Paul Beame.
What is the next line of the proof? a). Assume the theorem holds for all graphs with k edges. b). Let G be a graph with k edges. c). Assume the theorem.
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:
Theory of Computing Lecture 10 MAS 714 Hartmut Klauck.
Orthogonal Drawings of Series-Parallel Graphs Joint work with Xiao Zhou by Tohoku University Takao Nishizeki.
Planar Graphs: Euler's Formula and Coloring Graphs & Algorithms Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.:
More Graphs, Subgraphs and Trees Planarity and Coloring.
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.
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.
Data Structures & Algorithms Graphs
Planar Graphs Graph Coloring
Introduction to Planarity Test W. L. Hsu. 2/21 Plane Graph A plane graph is a graph drawn in the plane in such a way that no two edges intersect –Except.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
Graph.
Unit – V Graph theory. Representation of Graphs Graph G (V, E,  ) V Set of vertices ESet of edges  Function that assigns vertices {v, w} to each edge.
Graph theory and networks. Basic definitions  A graph consists of points called vertices (or nodes) and lines called edges (or arcs). Each edge joins.
 Quotient graph  Definition 13: Suppose G(V,E) is a graph and R is a equivalence relation on the set V. We construct the quotient graph G R in the follow.
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.
COMPSCI 102 Introduction to Discrete Mathematics.
1 GRAPH Learning Outcomes Students should be able to: Explain basic terminology of a graph Identify Euler and Hamiltonian cycle Represent graphs using.
1 Lecture 5 (part 2) Graphs II (a) Circuits; (b) Representation Reading: Epp Chp 11.2, 11.3
Algorithms and Networks
Great Theoretical Ideas In Computer Science
Discrete Mathematics Graph: Planar Graph Yuan Luo
Characteristics of Planar Graphs
Graph theory Definitions Trees, cycles, directed graphs.
What is the next line of the proof?
Graph Algorithms Using Depth First Search
Planarity Testing.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
SPQR Tree.
MAT 2720 Discrete Mathematics
Graphs G = (V, E) V are the vertices; E are the edges.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 8th ed., by Kenneth H.
Simple Graphs: Connectedness, Trees
Discrete Mathematics for Computer Science
GRAPH THEORY Properties of Planar Graphs Ch9-1.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
Planarity.
Chapter 10.7 Planar Graphs These class notes are based on material from our textbook, Discrete Mathematics and Its Applications, 7th ed., by Kenneth H.
GRAPH THEORY Properties of Planar Graphs Ch9-1.
Presentation transcript:

Testing planarity part 1 Thomas van Dijk

Preface Appendix of Planar Graph Drawing Quite hard to read So we’ll try to explain it, not just tell you about it

Preface “There are a number of efficient algorithms for planarity testing, which are unfortunately all difficult to implement.”  (

Preface “There are a number of efficient algorithms for planarity testing, which are unfortunately all difficult to implement.”  ( Implementation in Mathematica was actually bugged until version (!)  (Also mathworld.com)

What is planarity testing? Whether a graph can be drawn on the plane without edge crossings Equivalently, whether a “planar embedding” of the graph exists

Embedding Adjacency-list representation of the graph Order in the list defines clockwise order of the edges

Embedding Adjacency-list representation of the graph Order in the list defines clockwise order of the edges

Embedding Adjacency-list representation of the graph Order in the list defines clockwise order of the edges

Overview “Vertex addition algorithm” First presented by Lempel et al (’67) Improved to linear time by Booth and Lüker (’76) We present this second algorithm

Main idea Start with one vertex Add vertices and their edges one by one  make sure we don’t break planarity If you can’t add the next vertex, graph is not planar  add the vertices in an order such that if we fail, we that know that using any other order wouldn’t have worked either

We need to know about Some general observations st-Numbering Bush forms / PQ-Trees

O(m) is O(n) for planar graphs Remember from Euler’s Theorem we have that m ≤ 3n-6 for simple plane graphs Algorithm can just reject graphs with too many edges. So from now on, O(m) is O(n)

Biconnected components Definition: A graph G is biconnected iff for every two distinct vertices there exist two internally disjoint paths between them Also iff G contains no cut-vertices  i.e.: cannot be made unconnected by removing a single vertex

Biconnected components Theorem: A graph is planar iff all its biconnected components are planar Proof: Induction on the number of biconnected components

Biconnected components If the graph is planar, clearly its biconnected components are planar A graph is planar iff its connected components are planar A connected graph with no biconnected components is a tree; trees are planar

Biconnected components If a graph has one biconnected component, then all vertices not in it are in trees. So the graph is planar iff the biconnected component is planar

Biconnected components Induction step: The next biconnected component is connected to the rest of the graph by a cut-vertex v.

Biconnected components Induction step: The next biconnected component is connected to the rest of the graph by a cut-vertex v. Since the biconnected component itself is planar, an embedding with v on the exterior exists. (As Hans showed us.)

Biconnected components The biconnected components of a graph can be found in linear time  (If you are interested, an exercise in Cormen et al explains it) So from now on, we can assume graphs are biconnected.

st-Numbering From the ‘main idea’ slide: “Add the vertices in an order such that if we fail, we that know using any other order wouldn’t have worked either”

st-Numbering Special nodes: source s (“1”) and sink t (“n”) “1” and “n” adjacent 1 8

st-Numbering Special nodes: source s (“1”) and sink t (“n”) “1” and “n” adjacent j V-{s,t}: i, k Adj(j) st(i)<st(j)<st(k) 1 8

st-Numbering Special nodes: source s (“1”) and sink t (“n”) “1” and “n” adjacent j V-{s,t}: i, k Adj(j) st(i)<st(j)<st(k) So 2 must be next to 1 and n-1 must be next to n

st-Numbering Special nodes: source s (“1”) and sink t (“n”) “1” and “n” adjacent j V-{s,t}: i, k Adj(j) st(i)<st(j)<st(k) So 2 must be next to 1 and n-1 must be next to n

Some st-numbering examples

st-Numbering Theorem: Every biconnected graph has an st- numbering Proof: We give an algorithm and show that it works if the graph is biconnected Our graph is biconnected, so an st-numbering exists.

Finding an st-numbering First step, standard DFS. Can visit children in any order Calculate and store per vertex:  Parent  “Depth first search number:” DFN  Low-point: the lowest DFN among nodes that can be reached by a path using any amount of tree edges followed by 1 back edge

G

DFS G

DFN DFS G

DFN LOW DFS G

Finding an st-numbering Push the vertices onto a stack and pop them off Four rules for what to push and pop Assign increasing numbers to the vertices when they are popped off for the last time Example follows

Initial setup The node with DFN 2 is called the ‘source’ The node with DFN 1 is called the ‘sink’ Stack with source on top of sink Source and sink are “old” c f d b e a acac

Rule “2” There is a “new” tree edge: follow it and take the path that leads to its low point Push the vertices on the path onto the stack Mark all as old. c f d b e a abcabc

No matches for vertex a There are now no rule matches for a. Pop it off the stack and give it the next available number This node is ready c f d b e 1 bcbc

Rule “3” There is a “new” back edge into this node: from the other end, go back up tree edges to an “old” vertex Push the vertices on the path onto the stack Mark all as old c f d b e 1 bfedcbfedc

No matches for vertex b So the vertex is ready and gets its number c f d 2 e 1 fedcfedc

No matches for vertex f So the vertex is ready and gets its number c 3 d 2 e 1 edcedc

Et cetera…

Correctness All vertices are numbered The numbering is indeed an st-numbering

Algorithm recap For linear complexity, we need that O(m) = O(n). For correctness, we need that the graph is biconnected

After the break … Ron will tell you about:  bush forms and PQ-trees  how it all fits together into a planarity testing algorithm

Any questions?