Download presentation

Presentation is loading. Please wait.

Published byLoren Petteway Modified over 2 years ago

1
Testing planarity part 1 Thomas van Dijk

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

3
Preface “There are a number of efficient algorithms for planarity testing, which are unfortunately all difficult to implement.” (www.mathworld.com)www.mathworld.com

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

5
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

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

7
Embedding Adjacency-list representation of the graph Order in the list defines clockwise order of the edges 1 4 2 3 2 4 3 4 3 1 3 1 21 2 4

8
Embedding Adjacency-list representation of the graph Order in the list defines clockwise order of the edges 1 4 2 3 2 4 3 4 3 1 3 1 21 2 4 1 2 3 4 2 4 3 3 4 1 1 4 2 1 2 3

9
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

10
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

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

12
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)

13
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

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

15
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

16
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

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

18
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.)

19
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.

20
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”

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

22
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)

23
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)

24
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)

25
Some st-numbering examples 12 1 11 2 10 3 9 4 8 5 7 6 3 1 5 2 4

26
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.

27
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

28
G

29
DFS G

30
1 2 3 4 5 6 DFN DFS G

31
1 2 3 4 5 6 DFN 1 1 1 1 3 3 LOW DFS G

32
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

33
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

34
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

35
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

36
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

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

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

39
Et cetera… 6 3 5 2 4 1

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

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

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

43
Any questions?

44
http://www.planarity.net/

Similar presentations

OK

Chapter 7 Planar Graphs 大葉大學 資訊工程系 黃鈴玲 2011.12. 7.2 Planar Embeddings 7.3 Euler’s Formula and Consequences 7.4 Characterization of Planar Graphs.

Chapter 7 Planar Graphs 大葉大學 資訊工程系 黃鈴玲 2011.12. 7.2 Planar Embeddings 7.3 Euler’s Formula and Consequences 7.4 Characterization of Planar Graphs.

© 2018 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on standing order act 1946 ford Ppt on mathematics use in daily life Ppt on total hip replacement Ppt on earth movements and major landforms in europe Ppt on total parenteral nutrition contraindications Ppt on acute coronary syndrome pathophysiology Ppt on indian textile industries in india Ppt on pollution of air and water Ppt on business plan example Ppt on data collection methods for research