Extending Partial Orthogonal Drawings
EExtending Partial Orthogonal Drawings
Patrizio Angelini − − − , Ignaz Rutter − − − , andSandhya T P − − − John Cabot University, Rome, Italy [email protected] Universitt Passau, 94032 Passau, Germany { rutter, thekkumpad } @fim.uni-passau.de Abstract.
We study the planar orthogonal drawing style within theframework of partial representation extension. Let (
G, H, Γ H ) be a par-tial orthogonal drawing, i.e., G is a graph, H ⊆ G is a subgraph and Γ H is a planar orthogonal drawing of H .We show that the existence of an orthogonal drawing Γ G of G thatextends Γ H can be tested in linear time. If such a drawing exists, thenthere also is one that uses O ( | V ( H ) | ) bends per edge. On the other hand,we show that it is NP-complete to find an extension that minimizes thenumber of bends or has a fixed number of bends per edge. Keywords:
Planar Orthogonal Drawing · Partial Representation Ex-tension · Bend Minimization
One of the most popular drawing styles are orthogonal drawings , where verticesare represented by points and edges are represented by chains of horizontal andvertical segments connecting their endpoints. Such a drawing is planar if no twoedges share an interior point. An interior point of an edge where a horizontaland a vertical segment meet is called a bend . The main aesthetic criterion forplanar orthogonal drawings is the number of bends on the edges.A large body of literature is devoted to optimizing the number of bends inplanar orthogonal drawings. The complexity of the problem strongly depends onthe particular input. If the combinatorial embedding can be chosen freely, thenit is NP-complete to decide whether there exists a drawing without bends [16].If the input graph comes with a fixed combinatorial embedding, then a bend-optimal drawing that preserves the given embedding can be computed efficientlyby a classical result of Tamassia [25]. A recent trend has been to investigate underwhich conditions the variable-embedding case becomes tractable. For maxdeg-3graphs a bend-optimal drawing can be computed efficiently [9], which has re-cently been improved to linear time [11]. The problem is also FPT with respectto the number of degree-4 vertices [10], and if one discounts the first bend oneach edge, an optimal solution can be computed even for individual convex costfunctions on the edges [4,3]. We refer to the survey [12] for further references. a r X i v : . [ c s . D M ] A ug ) c)b) Fig. 1.
An instance of the partial representation extension problem (
G, H, Γ H ) is given.The graph H is solid black and the edges of E ( G ) \ E ( H ) are dashed red. (a) ( G, H, Γ H )admits a planar extension, but not an orthogonal extension. (b) ( G, H, Γ H ) admits anorthogonal extension with no bends (c) An orthogonal representation of G (the curvedpart of the dashed edge has no bends) that extends the description of the solid blackdrawing of H . There exists no drawing of G with this representation that extends thegiven drawing of H . In light of this popularity and the existence of a strongly developed theory,it is surprising that the planar orthogonal drawings have not been investigatedwithin the framework of partial representation extension. Especially so, since ithas been considered in the related context of simultaneous representations [1].In the partial representation extension problem, the input graph G comestogether with a subgraph H ⊆ G and a representation (drawing) Γ H of H . Onethen seeks a drawing Γ G of G that extends Γ H , i.e., whose restriction to H coincides with Γ H . The partial representation extension problem has recentlybeen considered for a large variety of different types of representations. Forplanar straight-line drawings, it is NP-complete [24], whereas for topologicaldrawings there exists a linear-time algorithm [2] as well as a characterizationvia forbidden substructures [17]. Moreover, it is known that, if a topologicaldrawing extension exists, then it can be drawn with polygonal curves such thateach edge has a number of bends that is linear in the complexity of Γ H [5]. Herethe complexity of Γ H is the number of vertices and bends in Γ H . Most recentlythe problem has been investigated in the context of 1-planarity [13]. Besidesclassical drawing styles, it has also been studied for contact representations [6]and for geometric intersection representations, e.g., for (proper/unit) intervalgraphs [20,18], chordal graphs [19], circle graphs [7], and trapezoid graphs [22].In this paper, we provide an in-depth study of partial representation ex-tension problems for the orthogonal drawing style. Since the aesthetics are ofparticular importance for the quality of such a drawing, we put a major empha-sis on extension questions in relation to the number of bends. It is worth notingthat even the seminal work of Tamassia [25] already mentions the idea of preserv-ing the shape of a given subgraph by maintaining its orthogonal representationvia modifications in his flow network. However, this approach only preserves theshape of the subgraph as described by an orthogonal representation, and notnecessarily its drawing. Fig. 1 shows that there are partial planar orthogonaldrawings that can be extended in a planar way, but not orthogonally (Fig. 1a)and that, even if an orthogonal representation O G of G preserves a given orthog-onal representation O H of a drawing Γ H of H , there does not necessarily exista drawing Γ G of G realizing O G that extends Γ H (Fig. 1b). ontribution and Outline. After presenting preliminaries in Section 2, we givea linear-time algorithm for deciding the existence of an orthogonal drawing ex-tension in Section 3. Then, we consider the realizability problem, where we aregiven an orthogonal extension in the form of a suitable planar embedding, andwe seek an orthogonal drawing extension that optimizes the number of bends.Along the lines of a result by Chan et al. [5], we show that there always exists anorthogonal drawing extension such that each edge has a number of bends thatis linear in the complexity of Γ H in Section 4. We complement these findings inSection 5 by showing that it is NP-hard to minimize the number of bends andNP-complete to test whether there exists an orthogonal drawing extension witha fixed number of bends per edge. For proofs of the results marked with a [ ∗ ],please refer to the Appendix. We call the circular clockwise ordering of the edges around a vertex v in anembedding the rotation at v . Let G = ( V, E ) be a simple undirected graph andlet H ⊆ G be a subgraph. We refer to the vertices and edges of H as H -vertices and H -edges , respectively. Similarly, we refer to the vertices of V ( G ) \ V ( H ) andto the edges of E ( G ) \ E ( H ) as G -vertices and G -edges , respectively.Let ( G, H, Γ H ) be a triple composed of a graph G , a subgraph H ⊆ G , andan orthogonal drawing Γ H of H . We denote by RepExt(ortho) ( RepExt stands for representation extension) the problem of testing whether G admitsan orthogonal drawing Γ G that extends Γ H . In Γ H , we say that an H -edge is attached to one of the four ports of its end vertices. If there is no H -edge attachedto a port of a vertex, then this port is free ; note that the free ports are thoseat which the G -edges can be attached in Γ G . For two edges e and e (cid:48) that areconsecutive in the rotation at a vertex v in Γ H , we denote by P H ( e, e (cid:48) ) = k the fact that there exist exactly k free ports of v when moving from e to e (cid:48) in clockwise order around their common endvertex. We call P H ( e, e (cid:48) ) = k a port constraint , and we denote by P H the set of all port constraints in Γ H .Note that, for a vertex v with rotation e , . . . , e h in Γ H , with h ≤
4, we have (cid:80) hi =1 P H ( e i , e i +1 ) = 4 − deg( v ) (defining e h +1 := e ).We now show that to solve an instance ( G, H, Γ H ) of the RepExt(ortho) problem, it suffices to only consider the port constraints determined by Γ H together with the embedding E H of H in Γ H . More specifically, we prove thefollowing characterization, which could also be deduced from [1]. Theorem 1 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Let E H be the embedding of H in Γ H , and let P H be the port constraints induced by Γ H . Then, ( G, H, Γ H ) admits an orthogonal drawing extension if and only if G admits a planar embedding E G that extends E H and such that, for every portconstraint P H ( e, e (cid:48) ) = k , there exist at most k G -edges between e and e (cid:48) in therotation at v in E G , where v is the common vertex of the H -edges e and e (cid:48) . n view of Theorem 1, we define a new problem, called RepExt(top+port) ,which is linear-time equivalent to
RepExt(ortho) . An instance of this prob-lem is a 4-tuple (
G, H, E H , P H ) and the goal is to test whether G admits anembedding E G that satisfies the conditions of Theorem 1. In order to unify theterminology, we also refer to the Partially Embedded Planarity problem studiedin [2] as
RepExt(top) ( top stands for topological drawing). Recall that aninstance of this problem is a triple (cid:104) G, H, E H (cid:105) , and the goal is to test whether G admits an embedding E G that extends E H . As proved in [2], RepExt(top) canbe solved in linear time.
In this section we show that
RepExt(ortho) can be solved in linear time. ByTheorem 1, it suffices to prove that
RepExt(top+port) can be solved in lineartime. The algorithm is based on constructing in linear time, starting from aninstance (
G, H, E H , P H ) of RepExt(top+port) , an instance ( G (cid:48) , H (cid:48) , E H (cid:48) ) of RepExt(top) that admits a solution if and only if (
G, H, E H , P ) does.In order to construct the instance ( G (cid:48) , H (cid:48) , E H (cid:48) ) of RepExt(top+port) , weinitialize G (cid:48) = G , H (cid:48) = H , and E H (cid:48) = E H . Then, for each vertex v such that1 < deg H ( v ) < deg G ( v ), we perform the following modifications; see Fig. 2.Case 1: Suppose first that deg H ( v ) = 3 and deg G ( v ) = 4, and let e = vw be the unique G -edge incident to v ; refer to Fig. 2(a). Since deg H ( v ) = 3, thereexist exactly two H -edges e and e such that e immediately precedes e in therotation at v in E H and P ( e , e ) = 1. Note that, to respect the port constraint,we have to guarantee that e is placed between e and e in the rotation at v in E G . For this, we subdivide e with a new vertex w (cid:48) , that is, we remove e from G (cid:48) ,and we add the vertex w (cid:48) and the edges vw (cid:48) and w (cid:48) w to G (cid:48) . Also, we add w (cid:48) and vw (cid:48) to H (cid:48) , and insert vw (cid:48) between e and e in the rotation at v in E H (cid:48) .Case 2: Suppose now that deg H ( v ) = 2 and deg G ( v ) ≥
3. Let e and e bethe two H -edges incident to v , and let e = vw and e ∗ = vz be the at most two G -edges incident to v . We distinguish two cases, based on whether P ( e , e ) = 2and P ( e , e ) = 0 (or vice versa), or P ( e , e ) = P ( e , e ) = 1.Case 2.a: If P ( e , e ) = 2, then we need to guarantee that both e and e ∗ (if itexists) are placed between e and e in the rotation at v in E G ; refer to Fig. 2(b).For this, we remove e and e ∗ from G (cid:48) , and we add a new vertex w (cid:48) and the edges vw (cid:48) , w (cid:48) w , and w (cid:48) z to G (cid:48) . Also, we add w (cid:48) and vw (cid:48) to H (cid:48) , and insert vw (cid:48) between e and e in the rotation at v in E H (cid:48) . Note that, if e ∗ does not exist, this is thesame procedure as in the previous case. Case 2.b: If P ( e , e ) = P ( e , e ) = 1,then we need to guarantee that e and e ∗ (if it exists) appear on different sidesof the path composed of the edges e and e ; refer to Fig. 2(c). Note that, if e ∗ does not exist, then e can be on any of the two sides of this path, and thus inthis case we do not perform any modification. If e ∗ exists, we subdivide e , e ∗ , e , and e with a new vertex each, that is, we remove these edges from G (cid:48) ( e and e also from H (cid:48) ), and we add four new vertices w (cid:48) , z (cid:48) , w (cid:48) , and w (cid:48) . Also, weadd to G (cid:48) the edges vw (cid:48) , vz (cid:48) , vw (cid:48) , and vw (cid:48) , and the edges w (cid:48) w , z (cid:48) z , w (cid:48) w , and ) b) c) v v ve e e e w w (cid:48) w e e ww ∗ v e e w (cid:48) w z v e e w w w w (cid:48) w w (cid:48) w w vw (cid:48) z (cid:48) z z Fig. 2.
Gadgets for H -vertices w (cid:48) w , where w and w are the endpoints of e and e , respectively, differentfrom v . Further, we add the edges w (cid:48) w (cid:48) , w (cid:48) z (cid:48) , z (cid:48) w (cid:48) , and w (cid:48) w (cid:48) to G (cid:48) . Finally, weadd the edges vw (cid:48) , w (cid:48) w , vw (cid:48) , and w (cid:48) w also to H (cid:48) ; in E H (cid:48) , we place w (cid:48) w and w (cid:48) w in the rotations at w and at w , respectively, in the same position as e and e , respectively, in E H . The rotations at v , w (cid:48) , z (cid:48) , w (cid:48) , and w (cid:48) in E H (cid:48) do notneed to be set, since each of these vertices has at most two incident H (cid:48) -edges.The above construction leads to the following lemma, whose full proof is in theAppendix. Lemma 1 ( (cid:63) ). The instance ( G (cid:48) , H (cid:48) , E H (cid:48) ) has an embedding extension if andonly if ( G, H, E H , P ) has an embedding extension satisfying the port constraints. Theorem 2.
The
RepExt(top+port) problem can be solved in linear time.Proof.
Given an instance I = ( G, H, E H , P ) of RepExt(top+port) , we con-struct the instance I (cid:48) = ( G (cid:48) , H (cid:48) , E H (cid:48) ) of RepExt(top) that has linear size asdescribed above. This takes O (1) time per vertex, and hence total linear time.By Lemma 1, I has a solution if and only if I (cid:48) has one. Since the existence of asolution of I (cid:48) can be tested in linear time [2], the statement follows.As a consequence of Theorems 1 and 2, we conclude the following. Theorem 3.
The
RepExt(ortho) problem can be solved in linear time.
In this section we prove that, if there exists an orthogonal drawing extension foran instance (
G, H, Γ H ) of RepExt(ortho) , then there also exists one in whichthe number of bends per edge is linear in the complexity of the drawing Γ H .By subdividing H at the bends of Γ H , we can assume that Γ H is a bend-freedrawing of H . To achieve the desired edge complexity, it then suffices to showthat O ( | V ( H ) | ) bends per edge suffice. This result can be considered as thecounterpart for the orthogonal setting of the one by Chan et al. [5] for the polylinesetting. In their work, in fact, they show that a positive instance ( G, H, Γ H ) of the RepExt(top) problem can always be realized with at most O ( | V ( H ) | ) bendsper edge when Γ H is a planar straight-line drawing of H .Our approach follows the algorithm given in [5], with a main technical dif-ference which is due to the peculiar properties of orthogonal drawings. Their ( a ) ( b ) W W W W W W ( c ) Fig. 3. (a) A face with outer walk W and, inner facial walks W and W . (b) Anapproximation F (cid:48) of F . (c) A face and a corresponding tree T algorithm first constructs a planar supergraph G (cid:48) of G that is Hamiltonian us-ing a method of Pach et al. [23, Lemma 5]. The main step of the algorithm ofChan et al. [5] involves the contraction of some edges of G (cid:48) [5, Lemma 3]). Thisoperation identifies the two end-vertices of the contracted edge and merges theiradjacency lists. However, both the construction of the supergraph G (cid:48) and thecontractions may produce vertices of degree greater than 4, which implies thatthe resulting graph does not admit an orthogonal drawing any longer. As such,these operations are not suitable for the realization of orthogonal drawings. Inorder to overcome this problem, we consider instead the Kandinsky model [15],which extends the orthogonal drawing model to also allow for vertices of largedegree. Once the drawing has been computed, we remove the previously addedparts and by adding a small amount of additional bends on the G -edges, wearrive at a orthogonal drawing of the initial graph G . More specifically, we provethe following theorem: Theorem 4 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Supposethat G admits an orthogonal drawing Γ G that extends Γ H , and let E G be theembedding of G in Γ G . Then we can construct a planar Kandinsky drawing of G in O ( n ) -time, where n is the number of vertices of G , that realizes E G , extends H , and has at most | V ( H ) | bends per edge. An overview of the algorithm to construct the desired Kandinsky orthogonaldrawing Γ ∗ G of G , whose main steps follow the method in [5], is given below.Step 1: Consider a face F of Γ H with facial walks W , W , . . . , W k . Constructan ε -approximation of F and let W (cid:48) i be the orthogonal polygon thatapproximates W i , 1 ≤ i ≤ k . Let F (cid:48) be the face bounded by the approx-imated boundary components of F ; refer to Lemma 2, and to Fig. 10 inthe Appendix.Step 2: Partition F (cid:48) into rectangles [14] and construct a graph K by placinga vertex at the center of each rectangle and by joining the vertices ofadjacent rectangles. Let T be a spanning tree of K . For each facial walk W i , add a new vertex near to W i as a leaf of T (see Fig. 3). p p p p p p p p p p p p p p ( a ) ( b ) ( c ) Fig. 4. (a) An orthogonal drawing of a tree T together with approximations along T (b) An orthogonal drawing of the Hamiltonian cycle C with respect to T (c) The edge p p is drawn using approximations of T u u u u u u Fig. 5.
Re-routing the edges incident to a vertex u in the Kandinsky drawing Γ KG toobtain the orthogonal drawing Γ G . Step 3: Construct the multigraph G F induced by the vertices lying inside or onthe boundary of F and by contracting each facial walk of F to a singlevertex. Then draw G F along T . Now, reconstruct the edges of G \ H and the edges between G F and other components of G inside F . Referto Lemma 6 in the Appendix and to Fig. 4.We then transform Γ ∗ G into an orthogonal drawing Γ G of G with O ( | V ( H ) | )bends per edge that extends Γ H . An illustration is given in Fig. 5. Theorem 5 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Supposethat G admits an orthogonal drawing Γ G that extends Γ H , and let E G be theembedding of G in Γ G . Then we can construct a planar orthogonal drawing of G in O ( n ) -time, where n is the number of vertices of G , that realizes E G , extends H , and has at most | V ( H ) | bends per edge. In this section we study the problem of computing an orthogonal drawing ex-tension of an instance I = ( G, H, Γ H ) of RepExt(ortho) with the minimumnumber of bends. Observe that, if H is empty, this is equivalent to computing b c dc = a ∨ b ∨ cc = a ∨ c ∨ dc = b ∨ c ∨ dc = a ∨ b ∨ d ∆ c ∆ c ∆ c ∆ c a) b) Fig. 6.
A representation of an instance of monotone planar 3-SAT with four variables a, b, c, d and four clauses c , c , c , c (a). Image of the vertically-stretched version of(a) under the mapping Φ (b). a bend-minimal drawing of G , which is NP-complete if the embedding of G isnot fixed. We thus assume that G comes with a fixed planar embedding E G thatsatisfies the port constraints of Γ H , and we study the complexity of computinga bend-optimal drawing Γ G of G with embedding E G that extends Γ H .Here, we specifically focus on the restricted case where V ( H ) = V ( G ) and E ( H ) = ∅ , which we call orthogonal point set embedding with fixed mapping . Weshow that, even in this case, it is NP-hard to minimize the number of bendson the edges. On the positive side, we show that in this case the existence of adrawing that uses one bend per edge can be tested in polynomial time. Theorem 6.
Given an instance ( G, H, Γ H ) of RepExt(ortho) , a planar em-bedding E G of G that satisfies the port constraints of Γ H , and a number k ∈ N ,it is NP-complete to decide whether G admits an orthogonal drawing Γ G withembedding E G that extends H and has at most k bends. This holds even if V ( G ) \ V ( H ) = ∅ , E ( H ) = ∅ , and E ( G ) is a matching.Proof. We give a reduction from the NP-complete problem monotone planar 3-SAT [8]. In this variant of 3-SAT, the variable–clause graph is planar and hasa layout where the variables are represented by horizontal segments on the x -axis, the clauses by horizontal segments above and below the x -axis, and eachvariable is connected to each clause containing it by a vertical segment, theclauses above the x -axis contain only positive literals and the clauses belowcontain only negative literals; see Fig. 6a.A box is an axis-aligned rectangle whose bottom-left and the top-right cornerscontain two H -vertices, connected by a G -edge. We consider non-degenerateboxes, and thus this G -edge requires at least one bend; when this edge is drawnwith one bend, there is a choice whether it contains the top-left or the bottom-right corner of the box. In these cases we say that the box is drawn top and drawnbottom , respectively. We now describe our variable , pipe , and clause gadgets .A variable gadget consists of h > R , . . . , R h that are 3 × R i lies at b + (2( i − , i − ) b) c) d) Fig. 7.
Variable gadget with h = 4 boxes (a,b). In (a) the even boxes are drawn topand the odd boxes are drawn bottom, (b) shows the opposite. Pipe gadget (c,d). In (c)all boxes are drawn bottom, in (d) they are all drawn top. In all cases the base pointis marked. base point b ; see Fig. 7a-b. The crucial property is that in a one-bend drawingof the gadget, R i is drawn bottom if and only if R i +1 is drawn top for i =1 , . . . , h −
1. Thus, in such a drawing, either all the odd boxes (those with oddindices) are drawn top and all the even boxes (those with even indices) are drawnbottom, or vice versa. This will be used to encode the truth value of a variable.A (positive) pipe gadget works similarly; see Fig. 7c-d. For a base point b , itconsists of h > R , . . . , R h that are 3 × R i lies at b + ( − i − , i − R , that is, either all bottom (see Fig. 7c) or all top (see Fig. 7d).Negative pipe gadgets are symmetric with respect to the line y = x and behavesymmetrically.The last gadget we describe is the (positive) clause gadget ; negative clausegadgets are symmetric with respect to the line y = x and behave symmetrically.The positive clause gadget has three input boxes R , R , R , whose corners lieon a single line with slope 1; we assume that R lies left of R , which in turnlies left of R . To simplify the description, we assume that the left lower cornersof these rectangles lie at ( x, x ) , ( y, y ), and ( z, z ), respectively. Refer to Fig. 8a.We create three literal boxes L , L , L that are 3 × L is ( x − , y + 2), the lower left corner of L if ( y − , y + 2), and thelower left corner of L is ( y, z + 3). Note that the interiors of L and R intersectin a unit square, and therefore, if R is drawn top, then L must be drawn top.To obtain the same behavior for the other input and literal rectangles, we addtwo transmission boxes T and T . The lower left corner of T is ( x − , x + 2)and its upper right corner is ( x + 1 , y + 4). The bottom-left and top-right cornerof T are ( y + 2 , z + 2) and ( z + 1 , z + 4), respectively. This guarantees that, alsofor i = 1 ,
3, if R i is drawn top, then T i and L i are drawn top. We finally havea blocker box B , with corners at ( x − , z + 1) and ( x + 1 , z + 4); and a clausebox , whose corners are in the centers of L and L , respectively.Note that the G -edge connecting the two corners of the clause box, which wecall the clause edge , requires at least two bends, as any one-bend drawing cutshorizontally through either the blocker B or the literal square L ; see Fig. 8a.The following claim shows that the possibility of drawing it with exactly two y z ∆ C R R R T T L L L B a) L L B L b) L L B L c) Fig. 8.
Clause gadget with input rectangles R , R , R . The bottom-left and top-rightcorner of the clause box are drawn as crosses (a). The image of the triangle ∆ C underthe mapping ( x, y ) (cid:55)→ ( x − y, x + y ) is drawn gray. The possibilities of routing the clauseedge with two bends, if L is drawn bottom (b) and if L is drawn top and L is drawnbottom (c). bends depends on the drawings of the literal boxes of the clause gadget, andthus on the truth values of the literals; see the Appendix and Fig. 8b-c. Claim 1 ( (cid:63) ). If the other edges are drawn with one bend, then the clause edgecan be drawn with two bends if and only if not all literal boxes are drawn top.
We are now ready to put the construction together. Consider the layout ofthe variable–clause graph, where each variable x is represented by a horizontalsegment s x on the x -axis, and each clause C = ( c , c , c ) with only positive (onlynegative) literals by a horizontal segment s C above (below) the x -axis. Further,the occurrence of a variable x in a clause C is represented by a vertical visibilitysegment s x,C that starts at an inner point of s x and ends at an inner point of s C ;see Fig. 6a. We call these points attachment points . By suitably stretching thedrawing horizontally, we may assume that all segments start and end at pointswith integer coordinates divisible by 8. We also stretch the whole constructionvertically by a factor of n , which guarantees that for each clause segment s C theright-angled triangle ∆ C , whose long side is s C and that lies above s C (below s C if C consists of negative literals) does not intersect any other segments in itsinterior. Note that the initial drawing fits on a grid of polynomial size [21], andthe transformations only increase the area polynomially. For the constructionit is useful to consider this representation rotated by 45 ◦ in counterclockwisedirection and scaled by a factor of √ Φ : ( x, y ) (cid:55)→ ( x − y, x + y ); see Fig. 6b.For each variable segment s x with left endpoint ( a,
0) and right endpoint( b,
0) we create a variable gadget with h = ( b − a ) / a, a ). For each clause segment s C above the x -axis with attachment points( a , b ) , ( a , b ) , ( a , b ), we create a positive clause gadget with input boxes at( a i − b, a i + b ). For each vertical segment s x,C above the x -axis with attachmentpoints ( a,
0) and ( a, b ), we create a positive pipe gadget of h = ( b/ − a − , a − x at ( a, a ) and the input box of C at ( a − b, a + b ), the newly placed boxes forma pipe gadget that consists of h + 2 boxes. Since distinct vertical segments on thesame side of the x -axis have horizontal distance at least 8, the boxes of distinctpipes do not intersect, and the placement is such that only the first and last boxof each pipe gadget intersect boxes that belong to the corresponding variable orclause gadget. Finally note that for each clause C , except for the input boxes,the clause gadget lies inside the image of the triangle ∆ C under the mapping Φ ,since the attachment points are interior points of s C , and the x -coordinates ofits endpoints are divisible by 8. Hence, the only interaction of the clause gadgetwith the remainder of the construction is via the input variables The proof ofthe following claim, in the Appendix, is based on showing that we can draw eachbox with exactly one bend and each clause edge with exactly two bends, if andonly if the original instance of monotone planar 3-SAT is satisfiable. Claim 2 ( (cid:63) ). Let ϕ be an instance of monotone planar 3-SAT, with γ clauses.Also, let β be the number of boxes in the instance ( G, H, Γ H ) of RepExt(ortho) constructed as described above. Then, the formula ϕ is satisfiable if and only ifthe instance ( G, H, Γ H ) admits an extension with at most k = β + γ bends. Since the construction has polynomially many vertices and edges on a poly-nomial size grid, it can be executed in polynomial time. Moreover, by construc-tion, V ( H ) = V ( G ), E ( H ) = ∅ , and E ( G ) is a matching. The statement of thetheorem follows.By subdividing each non-clause edge with a G -vertex, and each clause edgewith two G -vertices, we get the following corollary. Corollary 1.
It is NP-complete to decide whether a partial orthogonal drawing ( G, H, Γ H ) admits an extension without bends. Similarly, we can ask whether an instance (
G, H, Γ H ) admits an extensionwith at most k bends per edge for a fixed number k . The construction depictedin Fig. 9 shows how to force an edge to use k bends for any fixed number k .By making the part that enforces the first k − Corollary 2.
For any fixed k ≥ , it is NP-complete to decide whether aninstance ( G, H, Γ H ) of RepExt(ortho) admits an extension that uses at most k bends per edge, even if V ( G ) = V ( H ) . On the positive side, if all vertices are predrawn, the existence of an extensionwith at most k bends per edge can be tested efficiently for k = 0 and k = 1. ig. 9. Gadget for forcing an edge to use k = 4 bends. All vertices and the thinsolid black lines are H -vertices. Up to minor geometric adjustments, the thick blue anddotted red lines show the only two ways to draw the G -edge between the two H -vertices u and v with k bends. Scaling the lower left part to make it sufficiently small resultsin a construction that behaves like a box. Theorem 7.
Let ( G, H, Γ H ) be an instance of RepExt(ortho) with V ( G ) = V ( H ) and let k ∈ { , } . It can be tested in polynomial time whether ( G, H, Γ H ) admits an extension with at most k bends per edge.Proof. For k = 0 we simply draw each G -edge as the straight-line segment be-tween its endpoints, and check whether this is a crossing-free orthogonal drawing.For k = 1 we proceed as follows. While there exists a G -edge e = uv whoseendpoints have the same x - or the same y -coordinates, we do the following. If e must be drawn as a straight-line (if u and v have the same x - or the same y -coordinates), the instance ( G, H, Γ H ) is equivalent to the instance ( G, H (cid:48) , Γ (cid:48) H ),where H (cid:48) is obtained from H by adding e , and Γ (cid:48) H is obtained from inserting e asa straight-line segment. By applying this reduction rule, we eventually arrive atan instance ( G (cid:48)(cid:48) , H (cid:48)(cid:48) , Γ (cid:48)(cid:48) H ) such that the endpoints of each G -edge have distinct x -and distinct y -coordinates. Now for each such edge, there are precisely two waysto draw them with one bend. It is then straightforward to encode the existenceof choices that lead to a planar drawing into a 2-SAT formula. In this paper we studied the problem of extending a partial orthogonal drawing.We gave a linear-time algorithm to test the existence of such an extension, andwe proved that if one exists, then there is also one whose edge complexity islinear in the size of the given drawing. On the other hand, we showed that, ifwe also restrict to a fixed constant the total number of bends or the number ofbends per edge, then deciding the existence of an extension is NP-hard.Concerning future work we feel that the most important questions are thefollowing: 1) The complexity of 270 | V ( H ) | bends per edge resulting from thetransition to orthogonal drawings is significantly worse than the one of 72 | V ( H ) | bends per edge in the case of arbitrary polygonal drawings [5]. Can this num-ber be significantly reduced to, say, less than 100 | V ( H ) | ? 2) As mentioned inhe introduction, Tamassia [25] already observed that an orthogonal represen-tation of H can be efficiently extended to an orthogonal representation of G .However, drawing such an extension may require to modify the drawing Γ H ofthe given subgraph. Is it possible to efficiently test whether a given orthogonalrepresentation can be drawn such that it extends a given drawing Γ H ? References
1. Angelini, P., Chaplick, S., Cornelsen, S., Da Lozzo, G., Di Battista, G., Eades,P., Kindermann, P., Kratochv´ıl, J., Lipp, F., Rutter, I.: Simultaneous orthog-onal planarity. In: Hu, Y., N¨ollenburg, M. (eds.) Proceedings of the 24th In-ternational Symposium on Graph Drawing and Network Visualization (GD’16).Lecture Notes in Computer Science, vol. 9801, pp. 532–545. Springer (2016).https://doi.org/10.1007/978-3-319-50106-2 412. Angelini, P., Di Battista, G., Frati, F., Jel´ınek, V., Kratochv´ıl, J., Patrignani, M.,Rutter, I.: Testing planarity of partially embedded graphs. ACM Trans. Algorithms (4), 32:1–32:42 (2015). https://doi.org/10.1145/26293413. Bl¨asius, T., Lehmann, S., Rutter, I.: Orthogonal graph draw-ing with inflexible edges. Comput. Geom. , 26–40 (2016).https://doi.org/10.1016/j.comgeo.2016.03.0014. Bl¨asius, T., Rutter, I., Wagner, D.: Optimal orthogonal graph drawingwith convex bend costs. ACM Trans. Algorithms (3), 33:1–33:32 (2016).https://doi.org/10.1145/28387365. Chan, T.M., Frati, F., Gutwenger, C., Lubiw, A., Mutzel, P., Schaefer, M.: Drawingpartially embedded and simultaneously planar graphs. J. Graph Algorithms Appl. (2), 681–706 (2015). https://doi.org/10.7155/jgaa.003756. Chaplick, S., Dorbec, P., Kratochv´ıl, J., Montassier, M., Stacho, J.: Contact repre-sentations of planar graphs: Extending a partial representation is hard. In: Kratsch,D., Todinca, I. (eds.) Graph-Theoretic Concepts in Computer Science. pp. 139–151.Springer International Publishing, Cham (2014)7. Chaplick, S., Fulek, R., Klav´ık, P.: Extending partial representationsof circle graphs. Journal of Graph Theory (4), 365–394 (2019).https://doi.org/10.1002/jgt.224368. de Berg, M., Khosravi, A.: Optimal binary space partitions for segments in theplace. International Journal of Computational Geometry & Applications (3),187–205 (2012)9. Di Battista, G., Liotta, G., Vargiu, F.: Spirality and optimal or-thogonal drawings. SIAM J. Comput. (6), 1764–1811 (1998).https://doi.org/10.1137/S009753979426284710. Didimo, W., Liotta, G.: Computing orthogonal drawings in a variable embeddingsetting. In: Chwa, K.Y., Ibarra, O.H. (eds.) Algorithms and Computation, 9thInternational Symposium, ISAAC ’98, Taejon, Korea, December 14-16, 1998, Pro-ceedings. Lecture Notes in Computer Science, vol. 1533, pp. 79–88. Springer (1998).https://doi.org/10.1007/3-540-49381-6 1011. Didimo, W., Liotta, G., Ortali, G., Patrignani, M.: Optimal orthogonal drawingsof planar 3-graphs in linear time. In: Chawla, S. (ed.) Proceedings of the 30thACM-SIAM Symposium on Discrete Algorithms (SODA’20). pp. 806–825. SIAM(2020). https://doi.org/10.1137/1.9781611975994.492. Duncan, C.A., Goodrich, M.T.: Planar orthogonal and polyline drawing algo-rithms. In: Tamassia, R. (ed.) Handbook on Graph Drawing and Visualization,pp. 223–246. Chapman and Hall/CRC (2013)13. Eiben, E., Ganian, R., Hamm, T., Klute, F., N¨ollenburg, M.: Extending Par-tial 1-Planar Drawings. In: Czumaj, A., Dawar, A., Merelli, E. (eds.) 47th In-ternational Colloquium on Automata, Languages, and Programming (ICALP2020). Leibniz International Proceedings in Informatics (LIPIcs), vol. 168, pp.43:1–43:19. Schloss Dagstuhl–Leibniz-Zentrum f¨ur Informatik, Dagstuhl, Ger-many (2020). https://doi.org/10.4230/LIPIcs.ICALP.2020.43, https://drops.dagstuhl.de/opus/volltexte/2020/12450
14. Eppstein, D.: Graph-theoretic solutions to computational geometry problems. In:Paul, C., Habib, M. (eds.) Graph-Theoretic Concepts in Computer Science. pp.1–16. Springer Berlin Heidelberg, Berlin, Heidelberg (2010)15. F¨oßmeier, U., Kaufmann, M.: Drawing high degree graphs with low bend num-bers. In: Brandenburg, F.J. (ed.) Graph Drawing. pp. 254–266. Springer BerlinHeidelberg, Berlin, Heidelberg (1996)16. Garg, A., Tamassia, R.: On the computational complexity of upwardand rectilinear planarity testing. SIAM J. Comput. (2), 601–625 (2001).https://doi.org/10.1137/S009753979427712317. Jel´ınek, V., Kratochv´ıl, J., Rutter, I.: A Kuratowski-type theorem for pla-narity of partially embedded graphs. Comput. Geom. (4), 466–492 (2013).https://doi.org/10.1016/j.comgeo.2012.07.00518. Klav´ık, P., Kratochv´ıl, J., Otachi, Y., Rutter, I., Saitoh, T., Saumell, M., Vyskocil,T.: Extending partial representations of proper and unit interval graphs. Algorith-mica (4), 1071–1104 (2017). https://doi.org/10.1007/s00453-016-0133-z19. Klav´ık, P., Kratochv´ıl, J., Otachi, Y., Saitoh, T.: Extending partial representa-tions of subclasses of chordal graphs. Theor. Comput. Sci. , 85–101 (2015).https://doi.org/10.1016/j.tcs.2015.02.00720. Klav´ık, P., Kratochv´ıl, J., Otachi, Y., Saitoh, T., Vyskocil, T.: Extending par-tial representations of interval graphs. Algorithmica (3), 945–967 (2017).https://doi.org/10.1007/s00453-016-0186-z21. Knuth, D.E., Raghunathan, A.: The problem of compatible representatives. SIAMJ. Discret. Math. (3), 422–427 (1992). https://doi.org/10.1137/040503322. Krawczyk, T., Walczak, B.: Extending partial representations of trapezoid graphs.In: Bodlaender, H.L., Woeginger, G.J. (eds.) Proceedings of the 43rd Interna-tional Workshop on Graph-Theoretic Concepts in Computer Science (WG’17).Lecture Notes in Computer Science, vol. 10520, pp. 358–371. Springer (2017).https://doi.org/10.1007/978-3-319-68705-6 2723. Pach, J., Wenger, R.: Embedding planar graphs at fixed vertex locations. Graphsand Combinatorics , 717–728 (2001)24. Patrignani, M.: On extending a partial straight-line drawing. Int. J. Found. Com-put. Sci. (5), 1061–1070 (2006). https://doi.org/10.1142/S012905410600426125. Tamassia, R.: On embedding a graph in the grid with the minimum number ofbends. Journal on Computing (3), 421–444 (1987) ppendix: Omitted Proofs Theorem 1 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Let E H be the embedding of H in Γ H , and let P H be the port constraints induced by Γ H . Then, ( G, H, Γ H ) admits an orthogonal drawing extension if and only if G admits a planar embedding E G that extends E H and such that, for every portconstraint P H ( e, e (cid:48) ) = k , there exist at most k G -edges between e and e (cid:48) in therotation at v in E G , where v is the common vertex of the H -edges e and e (cid:48) .Proof. One direction is trivial; namely, if there exists an orthogonal drawing Γ G of G that extends Γ H , then the embedding of G in Γ G satisfies the twoproperties by construction. Suppose now that there exists an embedding E G of G that satisfies the two properties. Since E G is planar and extends E H , we canroute each G -edge uv as an arbitrary curve, while respecting the rotation at u and v in E G , without crossing any other edge. Also, the fact that E G satisfiesthe port constraints in P H implies that, for each G -edge uv , we can assign freeports of u and v to uv , in such a way that no port is assigned to more thanone edge. Thus, by approximating the curve representing each G -edge uv withan orthogonal polyline, it is possible to construct an orthogonal drawing of G extending Γ H . Note that in Theorem 5 we will prove that this can even be doneby using orthogonal polylines with a limited number of bends. Lemma 1 ( (cid:63) ). The instance ( G (cid:48) , H (cid:48) , E H (cid:48) ) has an embedding extension if andonly if ( G, H, E H , P ) has an embedding extension satisfying the port constraints.Proof. Suppose that ( G (cid:48) , H (cid:48) , E H (cid:48) ) admits an embedding extension, and let E G (cid:48) be the corresponding embedding of G (cid:48) . We construct an embedding E G of G that determines an embedding extension of ( G, H, E H , P ) that satisfies the portconstraints, as follows. Let v be any vertex of G . By construction, v is also avertex of G (cid:48) .Suppose first that all the neighbors of v in G (cid:48) also belong to G . By con-struction, we have that in ( G, H, E H , P ) either there exists no G -edge incidentto v , or there exists at most one H -edge incident to v . Also, in the former case,the rotation at v in E H (cid:48) is the same as the one in E H , and there exists no portconstraint at v . In the latter case, on the other hand, every rotation at v in E G trivially extends the rotation at v in E H and satisfies the (at most one) portconstraint at v in P . Thus, in this case, we set the rotation at v in E G to be thesame as the one in E G (cid:48) .Suppose then that there exists exactly one neighbor of v in G (cid:48) that doesnot belong to G . Then, by construction, this neighbor of v is the vertex w (cid:48) thatwe introduced in one of the first two cases we described above. Namely, eitherit holds that deg H ( v ) = 3 and deg G ( v ) = 4, or it holds that deg H ( v ) = 2,deg G ( v ) ≥ P ( e , e ) = 2, and P ( e , e ) = 0, where e and e are the H -edgesincident to v . In both cases, we obtain the rotation at v in E G by contracting theedge vw (cid:48) , and by merging the rotations at v and at w (cid:48) in E G (cid:48) . This guaranteesthat the rotation at v in E G extends the rotation at v in E H and that the portonstraint P ( e , e ) = 1 (resp. P ( e , e ) = 2) at v is satisfied, since the edge vw (resp. the edges vw and vz ) appear between e and e in E G .Suppose finally that there exists more than one neighbor of v in G (cid:48) that doesnot belong to G . Then, by construction, deg G (cid:48) ( v ) = 4, and the four neighbors of v in G (cid:48) are the ones that we introduced in the last case we described above. Namely, v is incident to two H -edges e and e , and P ( e , e ) = P ( e , e ) = 1. Observethat, since the subgraph of G (cid:48) induced by the vertices v, w (cid:48) , z (cid:48) , w (cid:48) , and w (cid:48) istriconnected, the vertices w (cid:48) , w (cid:48) , z (cid:48) , w (cid:48) appear in the rotation at v in E G (cid:48) eitherin this order or in its reverse. In the former case (the latter being analogous), weset the rotation at v in E G so that w, w , z, w appear in this order. This triviallyextends the rotation at v in E H , since deg H ( v ) = 2, and guarantees that the portconstraints at v are satisfied, since w and z use non-consecutive ports of v .We further observe that, due to our transformation, the cycles in H bijectivelycorrespond to the cycles in H (cid:48) , and that a vertex lies inside a cycle in E H if andonly if it lies inside the corresponding cycle in E H (cid:48) . Together with the abovediscussion, this implies that E G extends E H , since E G (cid:48) extends E H (cid:48) . Finally, since G (cid:48) contains G as a minor, the fact that E G (cid:48) is a planar embedding implies that E G is a planar embedding, which concludes the proof of this direction.The proof for the other direction is analogous. In fact, given a planar em-bedding E G of G that is a solution for the instance ( G, H, E H , P ), we can con-struct a planar embedding E G (cid:48) of G (cid:48) that determines an embedding extension of( G (cid:48) , H (cid:48) , E H (cid:48) ), as follows.Let v be any vertex of G (cid:48) . If v is also a vertex of G and the all the neighborsof v in G (cid:48) also belong to G , then we can set the rotation at v in E G (cid:48) to be thesame as the one E G , as discussed above. To cover all the other cases (either v orat least one of its neighbors is not a vertex of G ), it is enough to consider thethree cases in the construction we described above.In the first two cases, the fact that E G satisfies the port constraint P ( e , e ) =1 (resp. P ( e , e ) = 2) implies that vw (resp. both vw and vz ) appears between e and e in the rotation at v in E G . Thus, inserting vw (cid:48) in the rotation at v in E G (cid:48) in the same position as vw (resp. both vw and vz ) in the rotation at v in E G yields a rotation at v in E G (cid:48) that extends the one at v in in E H (cid:48) . The sametrivially holds for the rotation at w (cid:48) , since deg H (cid:48) ( w (cid:48) ) = 1.In the last case, when v is incident to two H -edges e and e , and P ( e , e ) = P ( e , e ) = 1, the fact that E G satisfies the port constraints implies that thevertices w, w , z, w appear in the rotation at v in E G either in this order or inits reverse. In both cases, it is possible to set the rotations at v , w (cid:48) , w (cid:48) , z (cid:48) , w (cid:48) in E G (cid:48) so that the triconnected subgraph induced by these vertices is embeddedaccording to its unique planar embedding, and all the vertices of G (cid:48) , except for v , lie outside of the cycle induced by w (cid:48) , w (cid:48) , z (cid:48) , w (cid:48) . Note that each of these fivevertices is incident to at most one H (cid:48) -edge, and thus every of its rotations in E G (cid:48) trivially extends the one in E H (cid:48) . This concludes the proof of the lemma. W W F (cid:48) ( a ) ( b ) Fig. 10. (a) A face with outer walk W and, inner facial walks W and W . (b) Anapproximation F (cid:48) of F . Complete Proof of Theorem 4Theorem 4 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Supposethat G admits an orthogonal drawing Γ G that extends Γ H , and let E G be theembedding of G in Γ G . Then we can construct a planar Kandinsky drawing of G in O ( n ) -time, where n is the number of vertices of G , that realizes E G , extends H , and has at most | V ( H ) | bends per edge. To prove Theorem 4, we first need a couple of tools and we present thosetools as lemmas before delving into the actual proof of the theorem.Since the embedding of G is fixed, it is enough to consider a face F of Γ H and prove Theorem 4 for that particular face. We first show how to constructan inner ε -approximating orthogonal polygon for each facial walk of F using atechnique similar to the on from [5]. Lemma 2.
Let W be a facial walk in a face F of an orthogonal drawing of agraph G in the plane. A inner ε -approximating orthogonal polygon P ε of W canbe constructed in O ( | W | ) time so that P ε has at most max { , | W | + l } vertices,where l is the number of degree-1 vertices in W .Proof. If W is an isolated vertex v , then approximate W with a square of side-length 2 ε centered at v . Next, assume that W contains more than one vertex.We consider each vertex of degree 1 in W as a sequence of two degree-2 verticesthat are connected by an infinitely short edge that forms a 270 ◦ -angle with thesingle edge incident to v inside F . Consider a corner e, v, f of W , where e and f are two consecutive edges and v is their shared vertex. Let α denote the angleformed by e and f inside F . If α is a 180 ◦ -angle, then we choose v (cid:48) as the pointon the angular bisector of α at distance ε from v . Otherwise, we choose v (cid:48) asthe point on the angular bisector of α at distance √ ε from v . If ( v i ) ki =1 is thesequence of vertices in W , then by joining ( v (cid:48) i ) ki =1 , we get an orthogonal polygonthat ε -approximates W .We now prove two auxiliary lemmas, which follow the structure of Lemmas5 and 6 in [5]. Assume that G is a Hamiltonian graph with Hamiltonian cycle C .emma 3 provides a method to draw the edges of C , assuming that the vertexlocations are fixed. Lemma 4 explains how to draw the remaining edges of G . Lemma 3.
Let C be a cycle with fixed vertex locations, and suppose we are givenan orthogonal planar drawing of a tree T , in which the vertices of C are leavesof T at their fixed locations and each edge of T has at most k bends. Then forevery ε > there is a planar Kandinsky drawing of C with at most k | E ( T ) | bends per edge and ε -close to T .Proof. Let p , . . . , p n be the vertices of the cycle C in order. To construct a planarpoly-line drawing of C , Lemma 5 of [5] explains a method as follows. First ofall, n ε -approximations θ i (1 ≤ i ≤ n ) of the given drawing of T are constructed,using Lemma 2. Then another poly-line polygonal curve θ (cid:48) i is constructed from θ i by ignoring the parts of θ i corresponding to the vertices v i +1 , . . . , v n . Theedge p i p i +1 is routed through θ (cid:48) i . In order to draw the edges of C , we follow thesame method explained above by constructing ( iε/n + 1)-approximation θ i ofthe given orthogonal drawing of T using Lemma 2, for 1 ≤ i ≤ n , and by routingthe edges of C through corresponding θ (cid:48) i ’s. An example is given in Fig. 11. p p p p p θ θ p p p p p p p p p p ( a ) ( b ) ( c ) Fig. 11. (a) An orthogonal drawing of a tree T together with approximations θ i . (b)The edge p p is drawn in green color and θ (cid:48) is drawn in orange color. (c) Completeorthogonal drawing of C with respect to T Here, note that each edge of C is replaced with a part of an approximationof θ i and θ i has at most 3 k | E ( T ) | edges. Hence each edge of C is replaced withan orthogonal arc that has at most 3 k | E ( T ) | bends. Lemma 4.
Let G be a Hamiltonian multigraph with a given planar embeddingand fixed vertex locations. Suppose we are given an orthogonal drawing of a tree T whose leaves include all the vertices of G at their fixed locations and each edgeof T has at most k bends. Then for every ε > there is a planar Kandinskydrawing of G so that. the drawing is ε -close to T,2. the drawing realizes the given embedding,3. the vertices of G are at their fixed locations,4. every edge has at most k | E ( T ) | bends, and5. every edge comes close to any leaf of T at most twice, and only does so byterminating at or bending near the leaf.Proof. We closely follow Lemma 6 of [5] to construct a planar poly-line drawingof G that works as follows. Using Lemma 5 of [5], a planar poly-line drawingof C with respect to the given drawing of T is constructed. Next, m approxi-mations ∆ i,k of θ (cid:48) i are constructed for each 1 ≤ i ≤ n and 1 ≤ k ≤ m , where m = | E ( G ) | . To route an edge p i p j , the path concatenating the straight-linepolygons ∆ i,k and ∆ j,k is used. To construct a planar Kandinsky drawing of G ,we continue in a similar manner. First, we route the edges of the Hamiltoniancycle C using Lemma 3 and then route the remaining edges by creating addi-tional approximations of the curves θ (cid:48) i . Here, corresponding to an edge at most k × E ( T )) = 6 kE ( T ) bends are introduced, since an edge p i p j is a concatena-tion of two approximations ∆ i,k and ∆ j,k . An example is illustrated in Fig. 12. p p p p p ∆ ,k ∆ ,k p p p p p ∆ ,k ∆ ,k (a) (b) Fig. 12.
The edge p p is drawn. (a) The polygons ∆ ,k and ∆ ,k are drawn in graycolor. (b) The edge p p is drawn in red color using parts of ∆ ,k and ∆ ,k . Now, in order to make the given graph Hamiltonian, we use the followingresult by Pach and Wenger [23]. emma 5 (Pach, Wenger [23]).
For a planar graph G a Hamiltonian planargraph G (cid:48) with | E ( G (cid:48) ) | ≤ | E ( G ) | − can be constructed from G by subdividingand adding edges in linear time. The construction is such that each edge of G issubdivided by at most two new vertices. Next, we assume that a planar embedding of the graph G together with a setof vertices U ⊆ V ( G ) is given, where every element of U has a fixed location.The next lemma shows a method to route the edges of G by converting it intoa Hamiltonian graph and then contracting the edges if at least one of its endpoint is not U . Finally, we undo the edge contractions to obtain a drawing ofthe original graph G . Lemma 6.
Let G be a multigraph with a given planar embedding and fixed loca-tions for a subset U of its vertices. Suppose we are given an orthogonal drawingof a tree T whose leaves include all the vertices in U at their fixed locations andeach edge of T has at most k bends. Then for every ε > there is a planarKandinsky drawing of G so that1. the drawing is ε -close to T ,2. the drawing realizes the given embedding,3. the vertices in U are at their fixed locations, and4. each edge has at most k | V ( T ) | bends and comes close to each vertex u in U at most times, where coming close to u means intersecting an ε -neighborhood of u . Furthermore, any edge that comes close to u will eitherterminate at u or enter the ε -neighborhood of u , bend at a point in this ε -neighborhood, and then leave it.Proof. From a given graph G , construct a Hamiltonian graph G (cid:48) with a Hamil-tonian cycle C by subdividing each edge of G at most twice, and by addingsome edges using Lemma 5. We traverse through C and whenever we encounteran edge e that has at least one endpoint not in U , then we contract e . Con-tinue this process to get a multigraph G (cid:48)(cid:48) with a Hamiltonian cycle C (cid:48) such that V ( G (cid:48)(cid:48) ) = U . Now, using Lemma 4, find an orthogonal drawing Γ (cid:48)(cid:48) for G (cid:48)(cid:48) withrespect to T . Fix a vertex u ∈ V ( G (cid:48)(cid:48) ) and let V u be the vertices of G that havebeen contracted into u . Next, we have to reconstruct the subgraph G u = G (cid:48) [ V u ]and route the edges that connect vertices from V u to V ( G (cid:48) ) \ V u . To reconstruct G u , construct a small disk around u in Γ (cid:48)(cid:48) . Since Γ (cid:48)(cid:48) is an orthogonal drawing,we can cover N G (cid:48)(cid:48) ( u ) into four sets ( V u i ) i =1 depending on the side of v to whichits edge attaches.Now, let G (cid:48) u = ( V, E ) with V = V u ∪ N G (cid:48)(cid:48) ( u ) ∪ { u , u , u , u } and E = E ( G u ) ∪{ u u , u u , u u , u u }∪{ u i x : x ∈ V u i for 1 ≤ i ≤ }∪{ yu i :there exists an edge yx in G (cid:48) with x ∈ V u i and y ∈ V u } .Note that G (cid:48) u is a planar multigraph and hence it has a Kandinsky draw-ing Γ u with at most two bends on each edge that can be computed in lineartime [15]. Using Γ u we can route the edges that connect V u and V u i by ignoringthe vertex u i . Thus we get a Kandinsky drawing of G (cid:48) with at most 6 | E ( T ) | + 2bends per edge (using Lemma 4 and the two extra bends that are added while u u u u u V u V u V u V u Fig. 13.
The graph G (cid:48) u . reconstructing G u ). Since each edge of G is subdivided at most twice to get G (cid:48) ,each edge of G has 3(6 k | E ( T ) | + 2) = 18 k | E ( T ) | + 6 < k | V ( T ) | bends. Inaddition, since each edge of G (cid:48) comes close to a leaf of T at most twice, an edgeof G comes close to a vertex of U at most six times.Now, we have all the required tools to prove Theorem 4. Proof of Theorem 4:
Let F be a face of Γ H . Let W i : 1 ≤ i ≤ a be facial walksinside F with isolated vertices and let W i : a + 1 ≤ i ≤ a + b be facial walksinside F that involve more than one vertex. Construct an inner ε -approximation F (cid:48) of F using Lemma 2. Let W (cid:48) i be the orthogonal polygon that approximates W i : 1 ≤ i ≤ a + b . Since | W (cid:48) i | ≤ max { , | W i | + l } , we have | F (cid:48) | ≤ a + b (cid:80) i =1 | W i | + a + b .Now, partition F (cid:48) into rectangles using at most n/ h − O ( n / log n ) [14], where n is the number of vertices and h is the number of holes.So in our case, the number of rectangles will be | F (cid:48) | + a − ≤ a + b (cid:80) i =1 | W i | + a + b + a − ≤ a + b (cid:80) i =1 | W i | + a + b −
1. Place a vertex at the center of each rectangle. Construct agraph K by joining the vertices of adjacent rectangles (we call two rectanglesadjacent if they share one side) if the line segment joining the respective centerslies inside F (cid:48) and the edge joining them has at most one bend. Note that G (cid:48) is aconnected graph. Let T be a spanning tree of G (cid:48) . Then T has a + b (cid:80) i =1 | W i | + a + b − T has at most four bends. Now, for each facial walk i : 1 ≤ i ≤ a , add the corresponding isolated vertex as a leaf to T . For eachfacial walk W i : a + 1 ≤ i ≤ a + b , add a new vertex near to W i as a leafof T . This adds a + b vertices to T and now, the number of vertices of T is | V ( T ) | = a + b + a + b (cid:80) i =1 | W i | + a + b − a + b (cid:80) i =1 | W i | + a +3 b − G F induced by the vertices lying inside or on theboundary of F , by contracting each facial walk of F to a single vertex. Draw G F along T using Lemma 6. Note that the vertices corresponding to facial walks(inside F ) are drawn at fixed locations. Here, each edge of G F has at most18 k | V ( T ) | = 18 ∗ ∗ | V ( T ) | = 72 bends.Now, we reconstruct the edges between G F and the non-isolated boundarycomponents of F , following the same method as in Theorem 1, [5]. That is, bycreating a buffer zone in between F (cid:48) and F , the above mentioned edges arerouted through the zone. This adds at most | W i | + 5 bends for each edge.Next, we have to add the edges of G \ H that belong to F according to thegiven embedding E G of G . By Lemma 4, an edge can come close at most six timesto a vertex in U and thus an edge needs at most 6( | W i | + 5) = 6 | W i | + 30 bendsto go around W i . So altogether there are at most 6 a + b (cid:80) i = a +1 | W i | + 30 b bends alongthe whole edge to go around all the W (cid:48) i s. Since we started with 18 × | V ( T ) | =72 | V ( T ) | bends (Lemma 4) for each edge, this number increased to at most6 a + b (cid:80) i = a +1 | W i | + 30 b + 72 | V ( T ) | . Thus the total number of bends per edge can becalculated as follows.6 a + b (cid:88) i = a +1 | W i | + 30 b + 72 | V ( T ) | ≤ a + b (cid:88) i = a +1 | W i | + 30 b + 72 a + b (cid:80) i =1 | W i | a + 3 b − ≤ a + b (cid:88) i = a +1 | W i | + 180 a + 138 b − | W i | = 1 for 1 ≤ i ≤ a ≤ × | V ( H ) | + 180 × | V ( H ) | since a + b (cid:88) i = a +1 | W i | ≤ | V ( H ) | and a + 2 b ≤ | V ( H ) | [5] ≤ | V ( H ) | Theorem 5 ( (cid:63) ). Let ( G, H, Γ H ) be an instance of RepExt(ortho) . Supposethat G admits an orthogonal drawing Γ G that extends Γ H , and let E G be theembedding of G in Γ G . Then we can construct a planar orthogonal drawing of G in O ( n ) -time, where n is the number of vertices of G , that realizes E G , extends H , and has at most | V ( H ) | bends per edge.roof. We first create a planar Kandinsky drawing Γ KG of the given graph G using Theorem 4. Let u be a vertex of G . Since G has an orthogonal drawing, wehave that deg( u ) ≤
4. Note that, in Γ KG , some of the edges incident to u may beattached to the same port. Our goal is to change the port to which some of theedges are attached, in such a way that every edge is attached to a different port,while respecting the rotation at u in E G . Note that we only reroute G -edges,as H -edges have a fixed drawing and can therefore no two H -edges can attachto the same port of a vertex. Since Γ G is an orthogonal drawing extension, E G satisfies the port constraints, and such a rerouting can be achieved as illustratedin Fig. 5. Note that this adds at most four bends per edge.Applying this operation to all the vertices of G yields a planar orthogonaldrawing Γ G of G that realizes E G , extends H , and has at most 270 | V ( H ) | bendsper edge (at most twice four additional bends on each edge). Complete Proofs for the Claims in Theorem 6Claim 1 ( (cid:63) ). If the other edges are drawn with one bend, then the clause edgecan be drawn with two bends if and only if not all literal boxes are drawn top.Proof.