Presentation is loading. Please wait.

Presentation is loading. Please wait.

Flow and Upward Planarity

Similar presentations


Presentation on theme: "Flow and Upward Planarity"— Presentation transcript:

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

2 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

3 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

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

5 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

6 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

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

8 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′′

9 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

10 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 λ

11 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

12 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

13 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

14 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

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

16 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

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

18 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

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

20 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

21 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

22 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

23 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

24 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

25 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 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

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

27 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

28 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

29 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

30 Algorithm 6.2 – Saturate Face

31 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’

32 Splitting – Additional Examples

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

34 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

35 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

36 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

37 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

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

39 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 “if” and O(n) : Lemma 6.9 and Theorem 6.1

40 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

41 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

42 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:

43 Example a.

44 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

45 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

46 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

47 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

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

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

50 Thank you!


Download ppt "Flow and Upward Planarity"

Similar presentations


Ads by Google