1 Introduction
A pioneering paper by Storer [21] asks whether a crossingfree orthogonal drawing with the minimum number of bends can be computed in polynomial time. The question posed by Storer is in the fixed embedding setting, i.e., the input is a plane 4graph (an embedded planar graph with vertex degree at most four) and the wanted output is an embeddingpreserving orthogonal drawing with the minimum number of bends. Tamassia [22] answers Storer’s question in the affirmative by describing an time algorithm. The key idea of Tamassia’s result is the equivalence between the bend minimization problem and the problem of computing a mincost flow on a suitable network. To date, the most efficient known solution of the bendminimization problem for orthogonal drawings in the fixed embedding setting is due to Cornelsen and Karrenbauer [6], who show a novel technique to compute a mincost flow on an uncapacitated network and apply this technique to Tamassia’s model achieving time complexity.
A different level of complexity for the bend minimization problem is encountered in the variable embedding setting, that is when the algorithm is asked to find a bendminimum solution over all planar embeddings of the graph. For example, the orthogonal drawing of Fig. 1 has a different planar embedding than the graph of Fig. 1 and it has no bends, while the drawing of Fig. 1 preserves the embedding but it is suboptimal in terms of bends.
Garg and Tamassia [12] prove that the bendminimization problem for orthogonal drawings is NPcomplete for planar 4graphs, while Di Battista et al. [8] show that it can be solved in time for planar 3graphs. Generalizations of the problem in the variable embedding setting where edges have some flexibility (i.e., they can bend a few times without cost for the optimization function) have also been the subject of recent studies by Bläsius et al. [2].
Improving the time complexity of the algorithm by Di Battista et al. [8] has been an elusive open problem for more than a decade (see, e.g., [3]), until a paper by Chang and Yen [4] has shown how to compute a bendminimum orthogonal drawing of a planar 3graph in the variable embedding setting in time, which can be read as time for a positive constant .
Similar to [8], the approach in [4] uses an SPQRtree to explore all planar embeddings of a planar 3graph and combines partial solutions associated with the nodes of this tree to compute a bendminimum drawing. Both in [8] and in [4], the computationally most expensive task is computing mincost flows on suitable variants of Tamassia’s network. However, Chang and Yen elegantly prove that a simplified flow network where all edges have unit capacity can be adopted to execute this task. This, combined with a recent result [5] about mincost flows on unitcapacity networks, yields the improved time complexity.
Contribution and outline. This paper provides new algorithms to compute bendminimum orthogonal drawings of planar 3graphs, which improve the time complexity of the stateoftheart solution. We prove the following.
Theorem 1.1 ()
Let be an vertex planar 3graph. A bendminimum orthogonal drawing of can be computed in time. If either a distinguished edge or a distinguished vertex of is constrained to be on the external face, a bendminimum orthogonal drawing of that respects the given constraint can be computed in time. Furthermore, the computed drawings have at most two bends per edge, which is worstcase optimal.
As in [8] and in [4], the algorithmic approach of Theorem 1.1 computes a bendminimum orthogonal drawing by visiting an SPQRtree of the input graph. However, it does not need to compute mincost flows at any steps of the visit, which is the fundamental difference with the previous techniques. This makes it possible to design the first quadratictime algorithm to compute bendminimum orthogonal drawings of planar 3graphs in the variable embedding setting.
The second part of the statement of Theorem 1.1 extends previous studies by Nishizeki and Zhou [26], who give a first example of a lineartime algorithm in the variable embedding setting for planar 3graphs that are partial twotrees. The bendminimum drawings of Theorem 1.1 have at most two bends per edge, which is a desirable property for an orthogonal representation. We recall that every planar 4graph (except the octahedron) has an orthogonal drawing with at most two bends per edge [1, 16], but minimizing the number of bends may require some edges with a bends [8, 23]. It is also proven that every planar 3graph (except ) has an orthogonal drawing with at most one bend per edge [15], but the drawings of the algorithm in [15] are not bendminimum. Finally, a nonflow based algorithm having some similarities with ours is given in [11]; it neither computes bendminimum drawings nor guarantees at most two bends per edge.
The paper is organized as follows. Preliminary definitions and results are in Sec. 2. In Sec. 3 we prove key properties of bendminimum orthogonal drawings of planar 3graphs used in our approach. Sec. 4 describes our drawing algorithms. Open problems are in Sec. 5. Some (full) proofs are moved to the appendix.
2 Preliminaries
We assume familiarity with basic definitions on graph connectivity and planarity (see Appendix 0.A). If is a graph, and denote the sets of vertices and edges of . We consider simple graphs, i.e., graphs with neither selfloops nor multiple edges. The degree of a vertex , denoted as , is the number of its neighbors. denotes the maximum degree of a vertex of ; if (), is an graph. A graph is rectilinear planar if it admits a planar drawing where each edge is either a horizontal or a vertical segment (i.e., it has no bend). Rectilinear planarity testing is NPcomplete for planar graphs [12], but it is polynomially solvable for planar graphs [4, 8] and lineartime solvable for subdivisions of planar triconnected cubic graphs [17]. By extending a result of Thomassen [24] on those graphs that have a rectilinear drawing with all rectangular faces, Rahman et al. [20] characterize rectilinear plane graphs. For a plane graph , let be its external cycle ( is simple if is biconnected). Also, if is a simple cycle of , is the plane subgraph of that consists of and of the vertices and edges inside . An edge is a leg of if exactly one of the vertices and belongs to ; such a vertex is a legvertex of . If has exactly legs and no edge embedded outside joins two of its vertices, is a klegged cycle of .
Theorem 2.1
[20] Let be a biconnected plane graph. admits an orthogonal drawing without bends if and only if: contains at least four vertices of degree 2; each legged cycle contains at least two vertices of degree 2; each legged cycle contains at least one vertex of degree 2.
As in [20], we call bad any legged and any legged cycle that does not satisfy Condition and of Theorem 2.1, respectively.
SPQRtrees of Planar 3Graphs. Let be a biconnected graph. An SPQRtree of represents the decomposition of into its triconnected components and can be computed in linear time [7, 13, 14]. Each triconnected component corresponds to a node of ; the triconnected component itself is called the skeleton of and denoted as . A node of can be of one of the following types: Rnode, if is a triconnected graph; Snode, if is a simple cycle of length at least three; Pnode, if is a bundle of at least three parallel edges; Qnodes, if it is a leaf of ; in this case the node represents a single edge of the graph and its skeleton consists of two parallel edges. Note that, neither two  nor two nodes are adjacent in . A virtual edge in corresponds to a tree node adjacent to in . If is rooted at one of its Qnodes , every skeleton (except the one of ) contains exactly one virtual edge that has a counterpart in the skeleton of its parent: This virtual edge is the reference edge of and of , and its endpoints are the poles of and of . The edge of corresponding to the root of is the reference edge of , and is the SPQRtree of with respect to . For every node of , the subtree rooted at induces a subgraph of called the pertinent graph of , which is described by in the decomposition: The edges of correspond to the Qnodes (leaves) of . Graph is also called a component of with respect to the reference edge , namely is a P, an R, or an Scomponent depending on whether is a P, an R, or an Scomponent, respectively.
The SPQRtree rooted at a Qnode implicitly describes all planar embeddings of with the reference edge of on the external face. All such embeddings are obtained by combining the different planar embeddings of the skeletons of P and Rnodes: For a Pnode , the different embeddings of are the different permutations of its nonreference edges. If is an Rnode, has two possible planar embeddings, obtained by flipping minus its reference edge at its poles. See Fig.2 for an illustration. The child node of and its pertinent graph are called the root child of and the root child component of , respectively. An inner node of is neither the root nor the root child of . The pertinent graph of an inner node is an inner component of . The next lemma gives basic properties of when .
Lemma 1 ()
Let be a biconnected planar graph and let be the SPQRtree of with respect to a reference edge . The following properties hold:
T1 Each Pnode has exactly two children, one being an Snode and the other being an S or a Qnode; if is the root child, both its children are Snodes.
T2 Each child of an Rnode is either an Snode or a Qnode.
T3 For each inner Snode , the edges of incident to the poles of are (real) edges of . Also, there cannot be two incident virtual edges in .
3 Properties of BendMinimum Orthogonal Representations of Planar 3Graphs
We prove relevant properties of bendminimum orthogonal drawings of planar graphs that are independent of vertex and bend coordinates, but only depend on the vertex angles and edge bends. To this aim, we recall the concept of orthogonal representation [22] and define some types of “shapes” that we use to construct bendminimum orthogonal representations.
Orthogonal Representations. Let be a plane graph. If and if and are two (possibly coincident) edges incident to that are consecutive in the clockwise order around , we say that is an angle at of or simply an angle of . Let and be two embeddingpreserving orthogonal drawings of . We say that and are equivalent if: For any angle of , the geometric angle corresponding to is the same in and , and for any edge of , the sequence of left and right bends along moving from to is the same in and in . An orthogonal representation of is a class of equivalent orthogonal drawings of ; can be described by the embedding of together with the geometric value of each angle of (, , degrees)^{1}^{1}1Angles of degrees only occur at 1degree vertices; we can avoid to specify them. and with the sequence of left and right bends along each edge. Figure 3 shows a bendminimum orthogonal representation of the graph in Fig. 2.
Let be a path between two vertices and in . The turn number of is the absolute value of the difference between the number of right and the number of left turns encountered along moving from to (or vice versa). The turn number of is denoted by . A turn along is caused either by a bend on an edge of or by an angle of degrees at a vertex of . For example, for the path in the orthogonal representation of Fig. 3. We remark that if is a bendminimum orthogonal representation, the bends along an edge, going from an endvertex to the other, are all left or all right turns [22].
Shapes of Orthogonal Representations. Let be a biconnected planar graph, be the SPQRtree of with respect to a reference edge , and be an orthogonal representation of with on the external face. For a node of , denote by the restriction of to a component . We also call a component of . In particular, is a P, an R, or an Scomponent depending on whether is a P, an R, or an Scomponent, respectively. If is the root child of , then is the root child component of . Denote by and the two poles of and let and be the two paths from to on the external boundary of , one walking clockwise and the other walking counterclockwise. These paths are the contour paths of . If is an Snode, and share some edges (they coincide if is just a sequence of edges). If is either a P or an Rnode, and are edge disjoint; in this case, we define the following shapes for , depending on and and where the poles are external corners:
is Cshaped, or shaped, if and , or vice versa;
is Dshaped, or shaped, if and , or vice versa;
is Lshaped, or shaped, if and , or vice versa;
is Xshaped, or shaped, if .
For example, in Fig. 3 is shaped, while in Fig. 3 is shaped. Concerning Scomponents, the following lemma rephrases a result in [8, Lemma 4.1], and it is also an easy consequence of Property T3 in Lemma 1.
Lemma 2
Let be an inner Scomponent with poles and and let and be any two paths connecting and in . Then .
Based on Lemma 2, we describe the shape of an inner Scomponent in terms of the turn number of any path between its two poles: We say that is spiral and has spirality if . The notion of spirality of an orthogonal component was introduced in [8]. Differently from [8], we restrict the definition of spirality to inner Scomponents and we always consider absolute values, instead of both positive and negative values depending on whether the left turns are more or fewer than the right turns. For instance, in the representation of Fig. 3 the two series with poles (the two filled Snodes in Fig. 2) have spirality three and one, respectively; the series with poles (child of the Rnode) has spirality zero, while the series with poles has spirality two.
We now give a key result that claims the existence of a bendminimum orthogonal representation with specific properties for any biconnected planar graph. This result will be used to design our drawing algorithm. Given an orthogonal representation , we denote by the orthogonal representation obtained from by replacing each bend with a dummy vertex: is the rectilinear image of ; a dummy vertex in is a bend vertex. Also, if is a degree vertex with neighbors and , smoothing is the reverse operation of an edge subdivision, i.e., it replaces the two edges and with the single edge .
Lemma 3 ()
A biconnected planar graph with a distinguished edge has a bendminimum orthogonal representation with on the external face such that:
O1 Every edge of has at most two bends, which is worstcase optimal.
O2 Every inner Pcomponent or Rcomponent of is either  or shaped.
O3 Every inner Scomponent of has spirality at most four.
Proof (sketch)
We prove in three steps the existence of a bendminimum orthogonal representation that satisfies O1O3. We start by a bendminimum orthogonal representation of with on the external face, and in the first step we prove that it either satisfies O1 or it can be locally modified, without changing its planar embedding, so to satisfy O1. In the second step, we prove that from the orthogonal representation obtained in the first step we can derive a new orthogonal representation (still with same embedding) that satisfies O2 in addition to O1. Finally, we prove that this last representation also satisfies O3.
Step 1: Property O1. Suppose that is a bendminimum orthogonal representation of with on the external face and having an edge (possibly ) with at least three bends. Let be the rectilinear image of , and let be the plane graph underlying . Since has no bend, satisfies Conditions of Theorem 2.1. Let , , be three bend vertices in that correspond to three bends of in . Assume first that is an internal edge of and let be the plane graph obtained from by smoothing . We claim that still satisfies Conditions of Theorem 2.1. Indeed, if this is not the case, there must be a bad cycle in that contains both and . This is a contradiction, because no bad cycle can contain two vertices of degree two. Hence, there exists an (embeddingpreserving) representation of without bends, which is the rectilinear image of an orthogonal representation of with fewer bends than , a contradiction. Assume now that is on the external cycle of . If contains more than four vertices of degree two, we can smooth and apply the same argument as above to contradict the optimality of (note that, such a smoothing does not violate Condition of Theorem 2.1). Suppose vice versa that contains exactly four vertices of degree two (three of them being , , and ). In this case, just smoothing violates Condition of Theorem 2.1. However, we can smooth and subdivide an edge of (such an edge exists since has at least three edges and, by hypothesis and a simple counting argument, at least one of its edges has no bend in ). The resulting plane graph still satisfies the three conditions of Theorem 2.1 and admits a representation without bends; the representation of which is the rectilinear image is a bendminimum orthogonal representation of with at most two bends per edge. To see that two bends per edge is worstcase optimal, just consider a bendminimum representation of the complete graph .
Step 2: Property O2. Let be a bendminimum orthogonal representation of that satisfies O1 and let be its rectilinear image. The plane underlying graph of satisfies the three conditions of Theorem 2.1. Rhaman, Nishizeki, and Naznin [20, Lemma 3] prove that, in this case, has an embeddingpreserving orthogonal representation without bends in which every legged cycle is either shaped or shaped, where the two poles of the shape are the two legvertices of . On the other hand, if is an inner P or Rcomponent, the external cycle is a legged cycle of , where the two legvertices of are the poles of . Hence, the representation of whose rectilinear image is satisfies O2, as is either shaped or shaped. Also, the bends of are the same as in , because the bend vertices of coincide with those of . Hence, still satisfies O1 and has the minimum number of bends.
Step 3: Property O3. Suppose now that is a bendminimum orthogonal representation of (with on the external face) that satisfies both O1 and O2. More precisely, assume that is the orthogonal representation obtained in the previous step, where its rectilinear image is computed by the algorithm of Rhaman et al. [20]. By a careful analysis of how this algorithm works, we prove that each series gets spirality at most four in (see Appendix 0.B).
4 Drawing Algorithm
Let be a biconnected 3planar graph with a distinguished edge and let be the SPQRtree of with respect to . Sec. 4.1 gives a lineartime algorithm to compute bendminimum orthogonal representations of the inner components of . Sec. 4.2 handles the root child of to complete a bendminimum representation with on the external face and it proves Theorem 1.1. Lemma 3 allows us to restrict our algorithm to search for a representation satisfying Properties O1O3.
4.1 Computing Orthogonal Representations for Inner Components
Let be the SPQRtree of with respect to reference edge and let be an inner node of . A key ingredient of our algorithm is the concept of ‘equivalent’ orthogonal representations of . Intuitively, two representations of are equivalent if one can replace the other in any orthogonal representation of . Similar equivalence concepts have have been used for orthogonal drawings [8, 10]. As we shall prove (see Theorem 4.1), for planar graphs a simpler definition of equivalent representations suffices. If is a P or an Rnode, two representations and are equivalent if they are both shaped or both shaped. If is an inner Snode, and are equivalent if they have the same spirality.
Lemma 4 ()
If and are two equivalent orthogonal representations of , the two contour paths of have the same turn number as those of .
Suppose that is an inner component of with poles and , and let and be the contour paths of . Replacing in with an equivalent representation means to insert in in place of , in such a way that: if and are shaped, the contour path of for which is traversed clockwise from to on the external boundary of (as for on the external boundary of ); in all cases, the external angles of at and are the same as in . This operation may require to mirror (see Fig. 4). The next theorem uses arguments similar to [8].
Theorem 4.1 ()
Let be an orthogonal representation of a planar 3graph and be the restriction of to , where is an inner component of the SPQRtree of with respect to a reference edge . Replacing in with an equivalent representation yields a planar orthogonal representation of .
We are now ready to describe our drawing algorithm. It is based on a dynamic programming technique that visits bottomup the SPQRtree with respect to the reference edge of . Based on Lemma 3 and Theorem 4.1, the algorithm stores for each visited node of a set of candidate orthogonal representations of , together with their cost in terms of bends. For a Qnode, the set of candidate orthogonal representations consists of three representations, with 0, 1, and 2 bends, respectively. This suffices by Property O1. For a P or an Rnode, the set of candidate representations consists of a bendminimum shaped and a bendminimum shaped representation. This suffices by Property O2. For an Snode, the set of candidate representations consists of a bendminimum representation for each value of spirality . This suffices by Property O3. In the following we explain how to compute the set of candidate representations for a node that is a P, an S, or an Rnode (computing the set of a Qnode is trivial). To achieve overall lineartime complexity, the candidate representations stored at are described incrementally, linking the desired representation in the set of the children of for each virtual edge of .
Candidate Representations for a Pnode. By property T1 of Lemma 1, has two children and , where is an Snode and is an Snode or a Qnode. The cost of the shaped representation of is the sum of the costs of and both with spirality one. The cost of the shaped representation of is the minimum between the cost of with spirality two and the cost of with spirality two. This immediately implies the following.
Lemma 5
Let be an inner Pnode. There exists an time algorithm that computes a set of candidate orthogonal representations of , each having at most two bends per edge.
Candidate Representations for an Snode. By property T3 of Lemma 1, without its reference edge is a sequence of edges such that the first edge and the last edge are real (they correspond to Qnodes) and at most one virtual edge, corresponding to either a P or an Rnode, appears between two real edges. Let be the sum of the costs of the cheapest (in terms of bends) orthogonal representations of all Pnodes and Rnodes corresponding to the virtual edges of . By Property O2, each of these representations is either  or shaped. Let be the number of edges of that correspond to Qnodes and let be the number of edges of that correspond to P and Rnodes whose cheapest representation is shaped. Obviously, any bendminimum orthogonal representation of satisfying O2 has cost at least . We have the following.
Lemma 6 ()
An inner Scomponent admits a bendminimum orthogonal representation respecting Properties O1O3 and with cost if its spirality and with cost if .
Note that the possible presence in of virtual edges corresponding to P and Rnodes whose cheapest representation is shaped does not increase the spirality reachable at cost by the Snode. Lemma 6 also provides an alternative proof of a known result ([8, Lemma 5.2]), stating that for a planar graph the number of bends of a bendminimum spiral representation of an inner Scomponent does not decrease when increases. Moreover, since for an inner Scomponent , a consequence of Lemma 6 is Corollary 1. It implies that every bendminimum spiral representation of an inner Scomponent does not require additional bends with respect to the bendminimum representations of their subcomponents when .
Corollary 1
For each , every inner Scomponent admits a bendminimum orthogonal representation of cost with spirality .
Lemma 7 ()
Let be an inner Snode and be the number of vertices of . There exists an time algorithm that computes a set of candidate orthogonal representations of , each having at most two bends per edge.
Candidate Representations for an Rnode. If is an Rnode, its children are S or Qnodes (Property T2 of Lemma 1). To compute a bendminimum orthogonal representation of that satisfies Properties O1O3, we devise a variant of the lineartime algorithm by Rahman, Nakano, and Nishizeki [18] that exploits the properties of inner Scomponents.
Lemma 8 ()
Let be an inner Rnode and be the number of vertices of . There exists an time algorithm that computes a set of candidate orthogonal representations of , each having at most two bends per edge.
Proof (sketch)
Let be the poles of . Our algorithm works in two steps. First, it computes an shaped orthogonal representation and a shaped orthogonal representation of , with a variant of the recursive algorithm in [18]. Then, it computes a bendminimum shaped representation and a bendminimum shaped representation of , by replacing each virtual edge in each of and with the representation in the set of the corresponding Snode whose spirality equals the number of bends of . Every time the algorithm needs to insert a degree vertex along an edge of a bad cycle, it adds this vertex on a virtual edge, if such an edge exists. By Corollary 1, this vertex does not cause an additional bend in the final representation when the virtual edge is replaced by the corresponding Scomponent.
4.2 Handling the Root Child Component
Let be the SPQRtree of with respect to edge and let be the root child of . Assuming to have already computed the set of candidate representations for the children of , we compute an orthogonal representation of and a bendminimum orthogonal representation of (with on the external face) depending on the type of .
Algorithm Prootchild. Let be a Pnode with children and . By Property T1 of Lemma 1, both and are Snodes. Let () be the maximum spirality of a representation () at the same cost () as a spiral representation. W.l.o.g., let . We have three cases:
Case 1: . Compute a shaped by merging a spiral and a spiral representation of and , respectively; add with bends to get (Fig. 6).
Case 2: . Compute an shaped by merging a spiral and a spiral representation of and , respectively; add with bend to get (Fig. 6).
Case 3: or . Compute a shaped by merging a spiral and a spiral representation of and , respectively; add with bends to get (Figs. 6 6).
Lemma 9 ()
Prootchild computes a bendminimum orthogonal representation of with on the external face and at most two bends per edge in time.
Algorithm Srootchild. Let be an Snode. if starts and ends with one edge, we compute the candidate orthogonal representations of as if it were an inner Snode, and we obtain by adding with zero bends to the spiral representation of (Fig. 6). Else, if only starts or ends with one edge, we add to the other end of , compute the candidate representations of as if it were an inner Snode, and obtain by adopting the representation of with spirality and by identifying the first and last vertex (Fig. 6). Finally, if starts and ends with an R or a Pnode, we add two copies , of at the beginning and at the end of , compute the candidate representations of as if it were an inner Snode, and obtain from the representation of with spirality , by identifying the first and last vertex of and by smoothing the resulting vertex (Fig. 6).
Lemma 10 ()
Srootchild computes a bendminimum orthogonal representation of with on the external face and at most two bends per edge in time, where is the number of vertices of .
Algorithm Rrootchild. Let be an Rnode and let and be the two planar embeddings of obtained by choosing as external face one of those incident to . For each , compute an orthogonal representation of by: finding a representation of (included ) with the variant of [18] given in the proof of Lemma 8, but this time assuming that all the four designated corners of the external face in the initial step must be found; replacing each virtual edge that bends times in with a minimumbend spiral representation of its corresponding Scomponent. is the cheapest of and . Since the variant of [18] applied to still causes at most two bends per edge, with the same arguments as in Lemma 8 we have:
Lemma 11
Rrootchild computes a bendminimum orthogonal representation of with on the external face and at most two bends per edge in time, where be the number of vertices of .
Proof of Theorem 1.1. If is biconnected, Lemmas 5, 7, 8, 911 yield an time algorithm that computes a bendminimum orthogonal representation of with a distinguished edges on the external face and at most two bends per edge. Call BendMinRefEdge this algorithm. An extension of BendMinRefEdge to a simplyconnected graph , which still runs in time, is easily derivable by exploiting the blockcutvertex tree of (see Appendix 0.C). Running BendMinRefEdge for every possible reference edge, we find in time a bendminimum orthogonal representation of over all its planar embeddings. If is a distinguished vertex of , running BendMinRefEdge for every edge incident to , we find in time a bendminimum orthogonal representation of with on the external face (recall that ). Finally, an orthogonal drawing of is computed in time from an orthogonal representation of [7].
5 Open Problems
We suggest two research directions related to our results: (i) Is there an time algorithm to compute a bendminimum orthogonal drawing of a 3connected planar cubic graph, for every possible choice of the external face? (ii) It is still unknown whether an time algorithm for the bendminimization problem in the fixed embedding setting exists [9]. This problem could be tackled with nonflow based approaches. A positive result in this direction is given in [19] for plane 3graphs.
References

[1]
Biedl, T.C., Kant, G.: A better heuristic for orthogonal graph drawings. Comput. Geom.
9(3), 159–180 (1998). https://doi.org/10.1016/S09257721(97)000266  [2] Bläsius, T., Rutter, I., Wagner, D.: Optimal orthogonal graph drawing with convex bend costs. ACM Trans. Algorithms 12(3), 33:1–33:32 (2016). https://doi.org/10.1145/2838736
 [3] Brandenburg, F., Eppstein, D., Goodrich, M.T., Kobourov, S.G., Liotta, G., Mutzel, P.: Selected open problems in graph drawing. In: Liotta, G. (ed.) Graph Drawing, 11th International Symposium, GD 2003, Perugia, Italy, September 2124, 2003, Revised Papers. Lecture Notes in Computer Science, vol. 2912, pp. 515–539. Springer (2003). https://doi.org/10.1007/9783540245957_55
 [4] Chang, Y., Yen, H.: On bendminimized orthogonal drawings of planar 3graphs. In: Aronov, B., Katz, M.J. (eds.) 33rd International Symposium on Computational Geometry, SoCG 2017, July 47, 2017, Brisbane, Australia. LIPIcs, vol. 77, pp. 29:1–29:15. Schloss Dagstuhl  LeibnizZentrum fuer Informatik (2017). https://doi.org/10.4230/LIPIcs.SoCG.2017.29, http://www.dagstuhl.de/dagpub/9783959770385
 [5] Cohen, M.B., Madry, A., Tsipras, D., Vladu, A.: Matrix scaling and balancing via box constrained newton’s method and interior point methods. In: Umans, C. (ed.) 58th IEEE Annual Symposium on Foundations of Computer Science, FOCS 2017, Berkeley, CA, USA, October 1517, 2017. pp. 902–913. IEEE Computer Society (2017). https://doi.org/10.1109/FOCS.2017.88, http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=8100284
 [6] Cornelsen, S., Karrenbauer, A.: Accelerated bend minimization. J. Graph Algorithms Appl. 16(3), 635–650 (2012). https://doi.org/10.7155/jgaa.00265
 [7] Di Battista, G., Eades, P., Tamassia, R., Tollis, I.G.: Graph Drawing: Algorithms for the Visualization of Graphs. PrenticeHall (1999)
 [8] Di Battista, G., Liotta, G., Vargiu, F.: Spirality and optimal orthogonal drawings. SIAM J. Comput. 27(6), 1764–1811 (1998). https://doi.org/10.1137/S0097539794262847
 [9] Di Giacomo, E., Liotta, G., Tamassia, R.: Graph drawing. In: Goodman, J., O’Rourke, J., Toth, C. (eds.) Handbook of Discrete and Computational Geometry, Third Edition, pp. 1451–1477. Chapman and Hall/CRC (2017)
 [10] Didimo, W., Liotta, G., Patrignani, M.: On the complexity of HVrectilinear planarity testing. In: Duncan, C., Symvonis, A. (eds.) Proc. 22nd International Symposium on Graph Drawing (GD ’14). Lecture Notes in Computer Science, vol. 8871, pp. 343–354 (2014). https://doi.org/10.1007/9783662458037_29
 [11] Garg, A., Liotta, G.: Almost bendoptimal planar orthogonal drawings of biconnected degree3 planar graphs in quadratic time. In: Kratochvíl, J. (ed.) Graph Drawing, 7th International Symposium, GD’99, Stirín Castle, Czech Republic, September 1999, Proceedings. Lecture Notes in Computer Science, vol. 1731, pp. 38–48. Springer (1999). https://doi.org/10.1007/3540466487_4
 [12] Garg, A., Tamassia, R.: On the computational complexity of upward and rectilinear planarity testing. SIAM J. Comput. 31(2), 601–625 (2001). https://doi.org/10.1137/S0097539794277123
 [13] Gutwenger, C., Mutzel, P.: A linear time implementation of SPQRtrees. In: Marks, J. (ed.) Graph Drawing, 8th International Symposium, GD 2000, Colonial Williamsburg, VA, USA, September 2023, 2000, Proceedings. Lecture Notes in Computer Science, vol. 1984, pp. 77–90. Springer (2000). https://doi.org/10.1007/3540445412_8
 [14] Hopcroft, J.E., Tarjan, R.E.: Dividing a graph into triconnected components. SIAM J. Comput. 2(3), 135–158 (1973). https://doi.org/10.1137/0202012
 [15] Kant, G.: Drawing planar graphs using the canonical ordering. Algorithmica 16(1), 4–32 (1996). https://doi.org/10.1007/BF02086606
 [16] Liu, Y., Morgana, A., Simeone, B.: A linear algorithm for 2bend embeddings of planar graphs in the twodimensional grid. Discrete Applied Mathematics 81(13), 69–91 (1998). https://doi.org/10.1016/S0166218X(97)000760
 [17] Rahman, M.S., Egi, N., Nishizeki, T.: Nobend orthogonal drawings of subdivisions of planar triconnected cubic graphs. IEICE Transactions 88D(1), 23–30 (2005)
 [18] Rahman, M.S., Nakano, S., Nishizeki, T.: A linear algorithm for bendoptimal orthogonal drawings of triconnected cubic plane graphs. J. Graph Algorithms Appl. 3(4), 31–62 (1999), http://www.cs.brown.edu/publications/jgaa/accepted/99/SaidurNakanoNishizeki99.3.4.pdf
 [19] Rahman, M.S., Nishizeki, T.: Bendminimum orthogonal drawings of plane 3graphs. In: Kucera, L. (ed.) GraphTheoretic Concepts in Computer Science, 28th International Workshop, WG 2002, Cesky Krumlov, Czech Republic, June 1315, 2002, Revised Papers. Lecture Notes in Computer Science, vol. 2573, pp. 367–378. Springer (2002). https://doi.org/10.1007/3540363793_32
 [20] Rahman, M.S., Nishizeki, T., Naznin, M.: Orthogonal drawings of plane graphs without bends. J. Graph Algorithms Appl. 7(4), 335–362 (2003), http://jgaa.info/accepted/2003/Rahman+2003.7.4.pdf

[21]
Storer, J.A.: The node cost measure for embedding graphs on the planar grid (extended abstract). In: Miller, R.E., Ginsburg, S., Burkhard, W.A., Lipton, R.J. (eds.) Proceedings of the 12th Annual ACM Symposium on Theory of Computing, April 2830, 1980, Los Angeles, California, USA. pp. 201–210. ACM (1980).
https://doi.org/10.1145/800141.804667  [22] Tamassia, R.: On embedding a graph in the grid with the minimum number of bends. SIAM J. Comput. 16(3), 421–444 (1987). https://doi.org/10.1137/0216030
 [23] Tamassia, R., Tollis, I.G., Vitter, J.S.: Lower bounds for planar orthogonal drawings of graphs. Inf. Process. Lett. 39(1), 35–40 (1991). https://doi.org/10.1016/00200190(91)90059Q
 [24] Thomassen, C.: Plane representations of graphs. In: Bondy, J., Murty, U. (eds.) Progress in Graph Theory, pp. 43–69 (1987)
 [25] Vijayan, G., Wigderson, A.: Rectilinear graphs and their embeddings. SIAM Journal on Computing 14(2), 355–372 (1985)
 [26] Zhou, X., Nishizeki, T.: Orthogonal drawings of seriesparallel graphs with minimum bends. SIAM J. Discrete Math. 22(4), 1570–1604 (2008). https://doi.org/10.1137/060667621
Appendix 0.A Additional Material for Section 2
is connected, or simplyconnected, if there is a path between any two vertices. is connected, for , if the removal of vertices leaves the graph connected. A connected (connected) graph is also called biconnected (triconnected).
A planar drawing of is a geometric representation in the plane such that: each vertex is drawn as a distinct point ; each edge is drawn as a simple curve connecting and ; no two edges intersect in except at their common endvertices (if they are adjacent). A graph is planar if it admits a planar drawing. A planar drawing of divides the plane into topologically connected regions, called faces. The external face of is the region of unbounded size; the other faces are internal. A planar embedding of is an equivalence class of planar drawings that define the same set of (internal and external) faces, and it can be described by the clockwise sequence of vertices and edges on the boundary of each face plus the choice of the external face. Graph together a given planar embedding is an embedded planar graph, or simply a plane graph: If is a planar drawing of whose set of faces is that described by the planar embedding of , we say that preserves this embedding, or also that is an embeddingpreserving drawing of .
See 1
Proof
We prove the four properties separately.

Proof of T1. By definition, a Pnode has at least two children. Also, since has no multiple edges, has at most one child that is a Qnode. At the same time, since , has neither three children nor a child that is an Rnode, as otherwise at least one of its poles would have degree greater than in . Finally, if is the root child of , its poles coincides with the endvertices of the reference edge ; if a child of is a Qnode, has multiple edges, a contradiction.

Proof of T2. Let be a child of an Rnode; if is a Pnode or an Rnode, the poles of have degree greater than one in , which implies that these vertices have degree greater than three in , a contradiction.

Proof of T3. Let be an inner Snode of and let be a pole of . The parent of in is either a Pnode or an Rnode. If it is a Pnode, then the edge incident to in cannot be a virtual edge, as otherwise has degree at least two in and it has at least two edges outside ; this would contradict the fact that . If the parent node of is an Rnode, then has exactly three incident edges in the skeleton of this Rnode, thus it must have degree one in . Finally, two virtual edges cannot be incident in , as they would imply a vertex of degree four in the graph.
Appendix 0.B Additional Material for Section 3
See 3
Proof
We prove in three steps the existence of a bendminimum orthogonal representation that satisfies O1O3. We start by a bendminimum orthogonal representation of with on the external face, and in the first step we prove that it either satisfies O1 or it can be locally modified, without changing its planar embedding, so to satisfy O1. In the second step, we prove that from the orthogonal representation obtained in the first step we can derive a new orthogonal representation (still with same embedding) that satisfies O2 in addition to O1. Finally, we prove that this last representation also satisfies O3.
Step 1: Property O1. Suppose that is a bendminimum orthogonal representation of with on the external face and having an edge (possibly coincident with ) with at least three bends. Let be the rectilinear image of , and let be the plane graph underlying . Since has no bend, satisfies Conditions of Theorem 2.1. Denote by , , and three bend vertices in that correspond to three bends of in . Assume first that is an internal edge of (i.e., does not belong to the external face). Let be the plane graph obtained from by smoothing . We claim that still satisfies Conditions of Theorem 2.1. Indeed, if this is not the case, there must be a bad cycle in that contains both and . This is a contradiction, because no bad cycle can contain two vertices of degree two. It follows that there exists an (embeddingpreserving) orthogonal representation of without bends, which is the rectilinear image of an orthogonal representation of with fewer bends than , a contradiction. Assume now that is on the external cycle of . If contains more than four vertices of degree two, then we can smooth vertex and apply the same argument as above to contradict the optimality of (note that, such a smoothing does not violate Condition of Theorem 2.1). Suppose vice versa that contains exactly four vertices of degree two (three of them being , , and ). In this case, just smoothing violates Condition of Theorem 2.1. However, we can smooth and subdivide an edge of (such an edge exists because has at least three edges and, by hypothesis and a simple counting argument, at least one of its edges has no bend in ). The resulting plane graph still satisfies the three conditions of Theorem 2.1 and admits a representation without bends; the orthogonal representation of which is the rectilinear image is a bendminimum orthogonal representation of with at most two bends per edge. To see that two bends per edge is worst case optimal, just consider the complete graph on four vertices. Every planar embedding of has three edges on . By Condition of Theorem 2.1, a bendminimum orthogonal representation of has four bends on the external face and thus two of them are on the same edge.
Step 2: Property O2. Let be a bendminimum orthogonal representation of that satisfies O1 and let be its rectilinear image. The plane underlying graph of satisfies the three conditions of Theorem 2.1. Rhaman, Nishizeki, and Naznin [20, Lemma 3] prove that, in this case, has an embeddingpreserving orthogonal representation without bends in which every legged cycle is either shaped or shaped, where the two poles of the shape are the two legvertices of . On the other hand, if is an inner Pcomponent or an inner Rcomponent, the external cycle is a legged cycle of , where the two legvertices of are the poles of . Indeed, is a simple cycle and each pole has exactly one incident edge not belonging to . It follows that, the orthogonal representation of whose rectilinear image is satisfies O2, as is either shaped or shaped. Also note that the bends of are the same as in , because the bend vertices of coincide with those of . Hence, still satisfies O1 and has the minimum number of bends.
Step 3: Property O3. Suppose now that is a bendminimum orthogonal representation of (with on the external face) that satisfies both O1 and O2. More precisely, assume that is the orthogonal representation obtained in the previous step, where its rectilinear image is computed by the algorithm of Rhaman et al. [20], which we simply call NoBendAlg. This algorithm works as follows (see also Fig. 5). In the first step, it arbitrarily designates four degree2 vertices on the external face. A 2legged cycle (resp. 3legged cycle) of the graph is bad with respect to these four vertices if it does not contain at least two (resp. one) of them; a bad cycle is maximal if it is not contained in for any other bad cycle . The algorithm finds every maximal bad cycle (the maximal bad cycles are independent of each other) and it collapses into a supernode . Then it computes a rectangular representation of the resulting coarser plane graph (i.e., a representation with all rectangular faces) where each of (or a supernode containing it) is an external corner. Such a representation exists because the graph satisfies a characterization of Thomassen [24]. In the next steps, for each supernode , NoBendAlg recursively applies the same approach to compute an orthogonal representation of ; if is 2legged (resp. 3legged), then two (resp. three) designated vertices coincide with the legvertices of . The representation of each supernode is then “plugged” into .
Suppose now that is an inner Scomponent of and let and be its poles. Let be the biconnected components of that are not single edges. We call each a subcomponent of (if is a sequence of edges, it has no subcomponents). Consider a generic step of NoBendAlg, in which it has to draw , for some cycle (possibly the external cycle of ) such that . We distinguish between three cases.
Case 1  is not contained in any maximal bad cycle. If all the edges of are internal edges of , the external cycle of each is a maximal bad 2legged cycle (as it contains no designated vertices). In this case each is collapsed into a supernode, and in the rectangular drawing of the resulting graph all the degree2 vertices and supernodes of the series will belong to the same side of a rectangular face. Thus, when all subcomponents of are drawn and plugged into , gets spirality zero. If has some edges on the external face, some might not be a maximal bad cycle (in which case it contains at least two designated vertices); in this case the spirality of will be equal to the number of designated vertices on its external edges, which is at most four.
Case 2  is contained in a maximal bad cycle that passes through both and . In this case, is collapsed into a supernode before the computation of a rectangular drawing . The two legs of that are incident to and will form at in either two flat angles or a right angle: In the former case, will have spirality zero, while in the latter case it will have spirality one.
Case 3  is contained in a maximal bad cycle that does not passes through both and . In this case, is still collapsed into a supernode before the computation of a rectangular drawing , and in one of the subsequent steps of the recursive algorithm on we will fall in Case 1 or in Case 2.
Figure 5 shows an example of how NoBendAlg works. The input plane graph is in Fig. 5, and it is the same graph of Fig. 2, with the addition of some degree2 vertices (small squares), needed to satisfy the properties of Theorem 2.1. The external face of contains exactly four degree2 vertices, which are assumed to be the four designated vertices in the first step of NoBendAlg. In the figure, the bad cycles with respect to the designated vertices are highlighted in red; the two cycles with thicker boundaries are maximal, and therefore they are collapsed as shown in Fig. 5. Note that, one of the two maximal cycles includes a designated vertex; once this cycle is collapsed, the corresponding supernode becomes the new designated vertex. Figure 5 depicts a rectangular representation of the graph in Fig. 5, and it also shows the representations of the subgraphs in the supernodes, computed in the recursive procedure of NoBendAlg; these representations are plugged in the rectangular representation, in place of the supernodes, yielding the final representation of Fig. 5.
Appendix 0.C Additional Material for Section 4
See 4
Proof
The proof is trivial if is a Pnode or an Rnode since, in order to be equivalent, and must be both shaped or shaped, which, by definition, implies that their contour paths have the same turn numbers. If is an Snode, then and have the same spirality and, by Lemma 2, their contour paths have the same turn number as any path from one pole of to the other pole.
See 4.1
Proof
The statement easily follows from Lemma 4 and from a characterization of orthogonal representations first stated in [25]. Let be a biconnected embedded planar graph and let be a function that assigns: (i) a value in to each pair of consecutive edges in the circular order around each vertex of and (ii) a sequence of left and right turns to each edge of . Denote by the turn number of a face , that is, the difference between the number of right and the number of left turns encountered while clockwise traversing the border of , where a angle counts as zero, a angle (resp., angle) counts as one if is an internal face (resp., if is the external face), and a angle (resp., angle) counts as if is an internal face (resp., if is the external face). Then corresponds to an orthogonal representation of if and only if the turn number of each face is four.
Hence, an orthogonal representation of induces an assignment satisfying the above mentioned property. Let be the restriction of to the internal faces of . Let be an orthogonal representation of equivalent to and let be the assignment corresponding to . We now prove that replacing with yields a new orthogonal representation by showing that the corresponding function satisfies the above characterization. In the following, assuming that and are the two poles of and that and are the two contour paths of , we call the contour path of such that and the contour path of such that (if a mirroring of is needed in the replacement, the two contour paths of are renamed). Also, let be the face of to the left of while moving along from to , and let be the face of to the left of while moving along from to . The faces and are defined symmetrically. Assignment is such that: (a) Each face of whose boundary is exclusively composed of edges not belonging to has the same shape as in and for the angles and edges of we have , hence . (b) Each face whose boundary is exclusively composed of edges of has the same shape as in and for the angles and edges of we have , hence . (c) The remaining two faces of are and . The boundary of is composed of path plus another path . By construction, the boundary of is composed of path plus . Also, again by construction, the two angles at and in are the same as the two angles at and in . Since the turn number of in equals the turn number of in . The same for .
See 6
Proof
The proof is by induction on the number of children of that are not Qnodes. Suppose that has only Qnode children (). It is trivial that , which is a path, can be drawn with cost zero and with spirality in , while has increasing costs for higher values of spirality. For the inductive case, note that inserting an shaped child in between two Qnodes does not increase nor decrease the spirality of an orthogonal drawing of . Instead, a shaped child inserted in between two Qnodes can be used as if it were an additional Qnode to increase the spirality of one unit without additional costs.
See 7
Proof
By virtue of Lemma 6 we can sum up the cheapest costs of the representations of all P and Rnode children of to obtain the cost of a bendminimum orthogonal representation of with spirality in . If we are done. Otherwise, by Property O2 of Lemma 3, we can optimally increase the spirality of by inserting bends into the Qnodes of . Since and the needed extra bends are at most three (because ), if we evenly distribute the extra bends among the real edges of , we end up with at most two bends per edge, satisfying Property O1 of Lemma 3.
See 8
Proof
We first briefly recall the algorithm in [18], which we call MinBendCubicAlg and which is conceptually similar to NoBendAlg (described in the proof of Lemma 3). MinBendCubicAlg takes as input an embedded planar triconnected cubic graph and computes an embeddingpreserving bendminimum orthogonal representation of . It initially inserts four dummy vertices of degree two on , by suitably subdividing some external edges; these vertices act as the four designated vertices of NoBendAlg. Note that, since is triconnected, each maximal bad cycle with respect to is a legged cycle. For each such cycle , the algorithm collapses into a supernode , thus obtaining a coarser graph, which admits a rectangular representation [24]. In the successive steps, for each supernode , MinBendCubicAlg recursively applies the same approach to compute an orthogonal representation of , where three of the four designated vertices coincide with the legvertices of . The representation of is then plugged into . All designated vertices added throughout the algorithm are bends of the final representation. Crucial to the bendminimization process of MinBendCubicAlg is the insertion of the designated vertices along edges that are shared by more than one bad cycles (if any). For example, let and be two bad cycles such that is maximal, belongs to , and and share a path ; since both and need a bend, MinBendCubicAlg inserts a designated vertex along to save bends. At any step of the recursion, a red edge is an edge for which placing a designated vertex along it leads to a suboptimal solution; the remaining edges are green. As it is proven in [18], every bad cycle has at least one green edge. A bad cycle is a corner cycle if it has at least one green edge on the external face and there is no other bad cycle inside having this property. In order to save bends when placing the four designated vertices on , MinBendCubicAlg gives preference to the green edges of the corner cycles, if they exist. We remark that, algorithm MinBendCubicAlg produces orthogonal drawings with at most one bend per edge, with the possible exception of one edge in the outer face, which is bent twice if the external boundary is a 3cycle.
We now describe our algorithm, called RsetAlg. Let be the poles of . RsetAlg consists of two steps. In the first step it computes an shaped orthogonal representation and a shaped orthogonal representation of , using a variant of MinBendCubicAlg. In the second step, a bendminimum shaped orthogonal representation and a bendminimum shaped orthogonal representation of are constructed, by replacing each virtual edge in each of and with the representation in the set of the corresponding Snode whose spirality equals the number of bends of . Every time the algorithm needs to insert a designated vertex that subdivides an edge of the graph (either to break a bad cycle or to guarantee four external corners in the initial step), it adds this vertex on a virtual edge, if such an edge exists. Indeed, by Corollary 1, this vertex does not cause an additional bend in the final representation when the virtual edge is replaced by the corresponding Scomponent. To find , where and are two of the four designated vertices on the external face of , RsetAlg has to find a further designated vertex on each of the two contour paths and of from to . To do this, RsetAlg first computes the corner cycles as in MinBendCubicAlg, assuming that and are vertices of degree three, that is, attached with an additional leg to the rest of the graph. Since