1 Orthogonal Drawing (continued)  Sections 8.3 – 8.5 from the book  Bert Spaan

Click here to load reader

  • date post

    01-Jan-2016
  • Category

    Documents

  • view

    220
  • download

    0

Embed Size (px)

Transcript of 1 Orthogonal Drawing (continued)  Sections 8.3 – 8.5 from the book  Bert Spaan

  • Orthogonal Drawing (continued) Sections 8.3 8.5 from the book Bert Spaan

  • Orthogonal Drawing (continued)Linear AlgorithmWithout Bad CyclesWith Bad Cycles Orthogonal Grid Drawing Orthogonal Drawings without Bends

  • Linear Algorithm for Bend-Optimal DrawingLinear time algorithm for graphs with the following properties:3-connected 3Four or more outer edges

  • k-ConnectivityA graph G is connected if for any distinct vertices u and v there is a path between u and v in G.A graph is k-connected if the minimum number of vertices whose removal results in a disconnected graph is k.

  • Examples

    1-connected:

    2-connected:

    3-connected:

  • Bad CyclesA graph has no bad cycles and thus a rectangular drawing if and only ifAny 2-legged cycle contains two or more cornersAny 3-legged cycle contains one or more cornersA bad cycle is a 2-legged cycle which contains at most one corner, or a 3-legged cycle which contains no corners.

  • Maximal Bad CyclesA bad cycle C in G is defined to be maximal if C is not contained in any other bad cycle in G

  • Linear AlgorithmAlgorithm Orthogonal-Draw(G)beginAdd four dummy vertices of degree two on four distinct outer edges as the corners;Let G be the resulting graph;Let C1, C2 , , Cl, be the maximal bad cycles in G;for each i, 1 i l, construct a genealogical tree TCi and determine green paths and red paths for every cycle in TCi;for each i, 1 i l, find an orthogonal drawing D(G(Ci)) of G(Ci) feasible for an arbitrary green path of Ci by Feasible-Draw;Let G be a plane graph derived from G by contracting each for each G(Ci), 1 i l, to a single vertex vi;Find a rectangular drawing D(G) of G by Rectangular-Draw;Patch the drawings D(G(C1, D(G(C2 )) , , D(G(Cl )) into D(G) to get an orthogonal drawing D(G) of G.Obtain an orthogonal drawing D(G) of G by replacing the four dummy vertices a, b, c and d in D(G) with bendsend.

  • Linear Algorithm Without Bad CyclesAlgorithm Orthogonal-Draw(G)beginAdd four dummy vertices of degree two on four distinct outer edges as the corners;Let G be the resulting graph;Obtain an orthogonal drawing D(G) of G by replacing the four dummy vertices a, b, c and d in D(G) with bendsend.

  • ExampleStart:

    Step 2:

    Step 1:

    Step 3:

  • Linear Algorithm With Bad Cycles, same AlgorithmStart:

    Step 2:

    Step 1:

    Step 3: Doesnt lead to orthogonal drawing due to bad cycle

  • Bad Cycles in GG is 3-connected and thus has no 2-legged cyclesG has four 2-legged cycles, but none of those are bad cyclesEvery bad cycle in G is a 3-legged cycle containing no corner

  • Genealogical TreeTree of cycles in G, TCIn algorithm: tree of 3-legged bad cyclesTC can be found in linear time

  • Example3-legged cycles in C and genealogical tree TCC2, C3, C4 and C5 are the maximal bad cycles in CC7 is the maximal bad cycle in C4

  • Assignment & LabelingFor each 3-legged cycle C in graph G we define the following terms in a recursive manner, based on a genealogical tree.C is divided into three contour paths P1, P2, and P3 by the three leg-vertices x, y and zEach contour path is classified as either a green path or a red pathC is assigned an integer bc(C), the bend-count of C

  • Three casesC has no child-cycle, that is, l = 0

    C has child-cycles C1, C2 , , Cl , l 1, but none of them has a green path on COtherwise

  • Case 1C has no child-cycles:TC consists of a single vertexClassify all the three contour paths of C as green pathsSet bc(C) = 1

  • Case 2C has one or more child-cycles, none of them with a green path on C:Classify all the three contour paths of C as green pathsSet bc(C) = 1 + the sum of the bend-counts of all child-cycles

  • Case 3Otherwise:Classify the contour paths in which a child-cycle has a green path as green pathsClassify the other contour paths (if any) as red pathsSet bc(C) = the sum of the bend-counts of all child-cycles

  • PropertiesEach cycle has at least one green contour pathAssignment & Labeling can be done in linear time

  • Feasible-DrawFind an orthogonal drawing G(C) for a 3-legged cycle CFeasible if the drawing has the following properties:Drawing has bc(C) bendsAt least one bend appears on the green pathThe drawing is bound by six open halflines, two at each point x, y and z

  • Case 1C has no child-cycles:bc(C) = 1Insert a dummy vertex t of degree two on an arbitrary edge on the green path in CNow there are four corners:Dummy vertex tVertices x, y and zNo bad cycles, algorithm Rectangular-Draw can be used to find a rectangular drawingAfter replacing t with a bend, an orthogonal drawing is created

  • Case 2C has one or more child-cycles, none of them with a green path on C:Recursion: first find an orthogonal drawing for each child-cycleConstruct a plane graph J from G(C) by contracting each child-cycle to a single vertexAdd a dummy vertex tNow, with Rectangular-Draw and removal of t, an orthogonal drawing can be foundReplace the contracted vertices with the original child-cycles. This is always possible, there are 12 distinct embeddings, depeding on the three legs x, y and z and the chosen green path

  • Case 3OtherwiseConstruct a plane graph J from G(C) by contracting each child-cycle to a single vertexReplace one of the contracted cycles with a quadrangle (x1, t, y1, z1) where t is a dummy vertext of degree twoRecursion: find an orthogonal drawing for each child-cycleNow, with Rectangular-Draw and removal of t, an orthogonal drawing can be foundReplace the contracted vertices with the original child-cycles and the quadrangle with its corresponding cycle.

  • Linear AlgorithmAlgorithm Orthogonal-Draw(G)beginAdd four dummy vertices of degree two on four distinct outer edges as the corners;Let G be the resulting graph;Let C1, C2 , , Cl, be the maximal bad cycles in G;for each i, 1 i l, construct a genealogical tree TCi and determine green paths and red paths for every cycle in TCi;for each i, 1 i l, find an orthogonal drawing D(G(Ci)) of G(Ci) feasible for an arbitrary green path of Ci by Feasible-Draw;Let G be a plane graph derived from G by contracting each for each G(Ci), 1 i l, to a single vertex vi;Find a rectangular drawing D(G) of G by Rectangular-Draw;Patch the drawings D(G(C1, D(G(C2 )) , , D(G(Cl )) into D(G) to get an orthogonal drawing D(G) of G.Obtain an orthogonal drawing D(G) of G by replacing the four dummy vertices a, b, c and d in D(G) with bendsend.

  • Orthogonal Grid DrawingAn orthogonal drawing is called an orthogonal grid drawing if all vertices and bends are located on integer grid points.

    DgDg

  • CompactDg is compact:There is at least one vertical line segment of x-coordinate i for each integer i, 0 i W (W is the width of the grid)There is at least one horizontal line segment of y-coordinate j for each integer j, 0 j H (H is the height of the grid)

  • Bend-count and grid size relationLet Dg be a compact orthogonal grid drawing of a plane graph G with b bends. Then W + H b + 2 * |E| |V| 2

  • Orthogonal Drawings without BendsPlane graphs with 3 may have an orthogonal drawing without bends

  • ConditionsAssume that G is a plane 2-connected graph with 3 and four or more outer vertices of degree two. G has an orthogonal drawing without bends if and only ifEvery 2-legged cycle contains at least two vertices of degree twoEvery 3-legged cycle contains at least one vertex of degree two

  • Example2-legged cycles:

    3-legged cycles: