1 / 51

Chapter 5

Chapter 5. Flow and Orthogonal Drawings. Nimrod Milo and Ilan Orlov. Final Example:. Goal:. Efficiently drawing of orthogonal graphs. Quality of a draw:. Minimal number of bends. 9 bends. 6 bends. Bend angle. Vertex angle. Every edge considered as two directed edges !!!.

efierro
Download Presentation

Chapter 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5 Flow and Orthogonal Drawings Nimrod Milo and Ilan Orlov

  2. Final Example:

  3. Goal: Efficiently drawing oforthogonal graphs

  4. Quality of a draw: Minimal number of bends 9 bends 6 bends

  5. Bendangle Vertex angle Every edge considered as two directed edges !!! Notations: Γ Orthogonal graph G Original graph

  6. Lemma 1: In a planner orthogonal drawing, the sum of the measures around a vertex is equal to 2Π

  7. Lemma 2.1: For each internal face of a planar orthogonal drawing. The sum of the measures of the vertex-angels and bend-angles insidef is equal to Π(p-2) where p is the number of such angels.

  8. Lemma 2.2: For each external face of a planar orthogonal drawing. The sum of the measures of the vertex-angels and bend-angles insidef is equal to Π(p+2) where p is the number of such angels

  9. Notations: a(f)– number of vertex-angles inf Counterclockwise edge with respect to face f f - face D(f) - Counterclockwise edge inside the face f

  10. Notations: α(u→v) ·Π/2 The angle at vertex uformed byedge (uv) and the nextcounterclockwise around u

  11. Notations: β(u→v) number of bends along(u→v) With theΠ/2angle on the left hand side.

  12. Notations: α = ? β = ?

  13. 1 ≤α≤ 4 0 ≤ β 4

  14. Flow Network Model A flow network N for a digraph G=(V,E) defined such that: • Each source v has a production σ(v). • Each sink u has a consume rate σ(u). • Total production = total consumption • For each edge (u,v) in E: • λ(u,v) – a lower bound of flow • μ(u,v) - Capacity of flow • χ(u,v) – Cost per unit of flow • A flow ϕ (ϕ: IN → IN) in Network N defined such that: • for each (u,v) in E : • λ(u,v) ≤ ϕ(u,v) ≤ μ(u,v) • The Cost of flow ϕ = ∑ϕ(u,v)∙ χ(u,v) • The objective is a Minimum cost of flow

  15. Building network from graph • One unit of flow = П/2 • The nodes of N are the vertices and faces of G • A vertex-node v in V(N) produced flow σ(v)=4 • A face-node f in V(N) consumes flow • σ (f)= 2∙a (f) – 4 if f is internal face • σ (f)= 2∙a (f) + 4 if f is external face

  16. Building network from graph • For each directed edge (u,v) in E with faces f, g on its left and right respectively we define to edges in E(N): • For edge (u,f): λ(u,f) = 1, μ(u,f) = 4 and χ(u,f)=0 (figure a) • For edge (f,g): λ(f,g) = 0, μ(f,g) = +∞ and χ(f,g )=1 (figure b)

  17. u f v Building network from graph (Contd.) Lemma 3: Let G an embedded planar graph with n vertices. The flow Network N built from G has O(n) nodes and edges, And can be built in O(n) time. 1 1 π u 2 1 1 1 (u,v) Theorem 1:: Let G an embedded planar graph and N be the flow Network built from G. for the edge (u,v), let (u,f) and (f,g) be the associated edges in N: • ϕ(u,f) = α(u,v) • ϕ(f,g) = β(u,v)

  18. Orthogonalize (algorithm 5.1) Input: planar Graph G with n vertices (Maximum degree of 4) The algorithm: • Construct the flow Network N from G • Compute Flow of minimum cost for N. • Compute the Orthogonal representation of G associated with the minimum cost flow. Output: orthogonal represntation of G with minimum number of bends Time Complexity: O(n²*log n) Space Complexity: O(n)

  19. Compacting of Orthogonal Representation • Goal: • Assign integer length to the segments • No crossing, no overlaps • Minimum area, fast algorithm • – our case • area: O((n+b)2) b – no. bends • time: O((n+b)) First, assumerectangular faces !!

  20. Rectangular faces • Each internal face has the shape of a rectangle • in the orthogonal representation H • H has at most 4 bends, placed at the corner of the external face. • Edge of G = edge of the H, excepts possibly for eight segments on the external face

  21. Tidy-Rectangle-Compact algorithm

  22. For each edge set Minimum flow = 1 Cost =1

  23. Run algorithm for finding flow with minimal cost flow = 1 flow = 2 flow = 3

  24. Setting: edge length = Flow on the corresponding edge in the flow network

  25. For each edge set Minimum flow = 1 Cost =1

  26. flow = 1 flow = 2 flow = 3

  27. Setting: edge length = Flow on the corresponding edge in the flow network

  28. Combining the new vertical and horizontal lengths Running time: O(n7/4 logn)

  29. Running time: O(n7/4 logn)

  30. Different compaction algorithm • Linear time • Minimizes the height, width, area of the drawing • Does not guarantee the minimum total edge length

  31. Different compaction algorithm 1. Replacing bends with fictitious vertices 2. Orienting the horizontal edges from left to right 3. Contracting maximal paths of vertical edges to a vertex

  32. compaction algorithm based on s-t-graph compaction algorithm We get a planer s-t-graph. Denote it as H*hor. Using same process we get H*ver. Assign unit weights to the edges to both s-t-graphs’ edges

  33. Compute optimal weighted topological numbering X and Y As in previous lesson

  34. Running time: O(n)

  35. General orthogonal representations • Add an isolated vertex 2. Insert a vertex along an edge H 3. Add an edge H’ G  H  H’  H’compactH’compact_without_extra edges/vertices

  36. Final Theorem 5.4: Given an embedded planar graph G with n vertices of degree at most 4, and an orthogonal representation H of G with b bends, a planar orthogonal drawing of G with integer coordinates and areaO( (n+b)2 ) can be constructed in O(n+b)time.

  37. Optimal-Orthogonal (algorithm 5.4) Input: planar Graph G with n vertices (Maximum degree of 4) The algorithm: • H ← Orthogononalize on graph G. • Refine H into an orthogonal representation H’ with rectengular faces. • D’ ← Fast-Orthogonal-Compact(H’) • D ← D’ while ignoring all the fictious edges and vertices. Output: planar orthogonal grid drawing D of G with area O(n²) and minimum number of bends Time Complexity: O(n²*log n) Space Complexity: O(n)

  38. Constrains We can easily modify algorithm 5.4 to include two types of constrains: • Vertex-angle constrains – by setting the lower / upper bound of α(u,v) • Bend Constrains – by setting the lower / upper bound of β(u,v)

  39. Minimizing number of bends Locally

  40. Minimizing number of bends Locally For a face-angle or a vertex angle we Define: π/2 – inflex π - flat 3π/2 - reflex For a given orthogonal representation Γ we define a curve C as an Elementary Transformation If the curve C intersect Γ only in inflex, flat or reflex angles. For each vertex traversed by Curve C the transformation subtract π/2 from the angle C enters, and adds π/2 to the angle where C exit.

  41. For a Curve C we define flat(C),inflex(C),reflex(C) as the number of flat, inflex and reflex angles in C respectively Δ(C) = flat(C) + inflex(C) – reflex(C)

  42. Theorem 5.6: an Orthogonal representation Γ has the minimum Numbers of bend iff for every cycle C in ΓΔ(C) ≥ 0 The proof of Theorem 5.6 is based on looking in the flow network Corresponding with Γ and flow in the cycle C. the result is that the flow can’t be a negative number.

  43. Elementary Transformation

  44. Elementary Transformation

  45. Elementary Transformation

More Related