Universal Slope Sets for Upward Planar Drawings

We prove that every set $\mathcal S$ of $\Delta$ slopes containing the horizontal slope is universal for $1$-bend upward planar drawings of bitonic $st$-graphs with maximum vertex degree $\Delta$, i.e., every such digraph admits a $1$-bend upward planar drawing whose edge segments use only slopes in $\mathcal S$. This result is worst-case optimal in terms of the number of slopes, and, for a suitable choice of $\mathcal S$, it gives rise to drawings with worst-case optimal angular resolution. In addition, we prove that every such set $\mathcal S$ can be used to construct $2$-bend upward planar drawings of $n$-vertex planar $st$-graphs with at most $4n-9$ bends in total. Our main tool is a constructive technique that runs in linear time.


Introduction
Let G be a graph with maximum vertex degree Δ. The k-bend planar slope number of G is the minimum number of slopes for the edge segments needed to construct a k-bend planar drawing of G, i.e., a planar drawing where each edge is a polyline with at most k ≥ 0 bends. Since no more than two edge segments incident to the same vertex can use the same slope, Δ/2 is a trivial lower bound for the k-bend planar slope number of G, irrespectively of k. Besides their theoretical interest, k-bend planar drawings with small slope number form a natural extension of two well-established graph drawing models: The orthogonal [5,23,25,44] and the octilinear drawing models [2,3,6,40], both having several applications, such as in VLSI and floor-planning [38,45], and in metro-maps and map-schematization [15,30,41,43], respectively. Orthogonal drawings use only two slopes for the edge segments (the horizontal one and the vertical one), while octilinear drawings use no more than four slopes (the horizontal, the vertical, and the two diagonal slopes). Consequently, they are limited to graphs with Δ ≤ 4 and Δ ≤ 8, respectively.
These two drawing models have been generalized to graphs with arbitrary maximum vertex degree Δ in [21,22]. Concerning planar graphs, Keszegh, Pach and Pálvölgyi [33] prove that every such a graph admits a 2-bend planar drawing using a set of Δ/2 equispaced slopes. (Intuitively, a set of slopes is equispaced if the angles formed by pairs of adjacent edges using consecutive slopes in this set are all the same; see also Sect. 2 for a formal definition.) As a witness of the tight connection between the two problems, the result by Keszegh et al. is built upon an older result for orthogonal drawings of degree-4 planar graphs by Biedl and Kant [5]. In the same paper, Keszegh et al. also study the 1-bend planar slope number and show an upper bound of 2Δ and a lower bound of 3 4 (Δ − 1) for this parameter. The upper bound has been progressively improved. Initially, Durocher and Mondal [24] establish 2 3 Δ and Δ as upper bounds for the 1-bend planar slope number of 2-trees and of planar 3-trees, respectively. Later, the upper bound for general planar graphs has been set to 3 2 (Δ − 1) by Knauer and Walczak [36] and subsequently to Δ − 1 by Angelini et al. [1]. Angelini et al. actually prove a stronger result: Given any set S of Δ − 1 slopes, every planar graph with maximum vertex degree Δ admits a 1-bend planar drawing whose edge segments use only slopes in S. Any such slope set is hence called universal for 1-bend planar drawings. This result simultaneously establishes the best-known upper bound on the 1-bend planar slope number of planar graphs and the best-known lower bound on the angular resolution of 1-bend planar drawings, i.e., on the minimum angle between any two edge segments incident to the same vertex. The second implication follows from the fact that if the slopes in S are equispaced, the resulting drawings have angular resolution of at least π Δ−1 . For the case k = 0, the best-known upper bound is 2 O(Δ) , while the corresponding best-known lower bound is 3Δ−6 [33]. The large gap between these bounds on the (0-bend) planar slope number motivated an array of results for subclasses of planar graphs, namely improved upper bounds (which are polynomial in Δ) have been proved for nested pseudo-trees [8], planar partial 3-trees [17,31], partial 2-trees [39], outerplanar graphs [37], while the planar slope number of planar graphs of maximum degree three is four [18]. In this paper we study slope sets that are universal for k-bend upward planar drawings of directed graphs (or digraphs for short). A drawing of a digraph G is upward if every oriented edge (u, v) is drawn as a y-monotone non-decreasing curve from u to v, while it is strictly upward, if (u, v) is a y-monotone increasing curve. It is known that G admits an upward planar drawing if and only if it is a subgraph of a planar st-graph [16,32]. Since such drawings are common for representing planar digraphs, they have been extensively studied in the literature (see, e.g., [4,9,20,25,29]). A preliminary result for this setting is due to Di Giacomo et al. [19], who prove that every series-parallel digraph (a subclass of the directed partial 2-trees) with maximum vertex degree Δ admits a 1-bend (not necessarily strictly) upward planar drawing that uses at most Δ slopes, and this bound on the number of slopes is worst-case optimal. Notably, their construction gives rise to drawings with optimal angular resolution π Δ (but it uses a predefined set of slopes). For the case k = 0, Czyzowicz [12] and Czyzowicz et al. [13] study 0-bend strictly upward drawings of posets with few slopes. Moreover, Klawitter and Mchedlidze [34] and Klawitter and Zink [35] have recently investigated the complexity of testing for the existence of a 0-bend upward planar drawing with the minimum number of slopes.
Contribution The focus of this paper is on the k-bend upward planar slope number of planar st-graphs, for the cases k = 1 and k = 2. A key ingredient of the presented techniques is a linear ordering of the vertices of a planar digraph introduced by Gronemann [27], called bitonic st-ordering (formally defined in Sect. 2), which is a special type of an st-ordering. Our contribution is twofold and can be summarized as follows.
-We show that any set S of Δ slopes containing the horizontal slope is universal for 1-bend upward planar drawings of degree-Δ planar digraphs having a bitonic stordering. Such graphs represent a notable subclass of planar st-graphs; for instance, they are exactly the graphs admitting a so-called upward planar L-drawing [7], and they have been used to obtain the best-known upper bound on the number of total bends for 1-bend upward planar drawings [27]. Furthermore, we remark that the size of S is worst-case optimal [19] and, if the slopes of S are chosen to be equispaced, the angular resolution of the resulting drawing is at least π Δ (that is, optimal); see Fig. 1a for an illustration.
-We then extend our construction to all planar st-graphs by using two bends on a restricted number of edges. More precisely, we show that, given a set S of Δ slopes containing the horizontal slope, every n-vertex upward planar digraph with maximum vertex degree Δ has a 2-bend upward planar drawing that uses only slopes in S and has at most 4n − 9 bends in total (that is, linearly many edges have less than two bends); see Fig. 1b for an illustration.
We note that, in the literature, the strictly upward planar and non-strictly upward planar models are usually not distinguished, because if a digraph admits an upward drawing, then it also admits a strictly upward drawing. However, our drawing technique makes use of the horizontal slope and hence leads to upward drawings that are not strict. On the positive side, it is always possible to make these drawings strictly upward by increasing the number of slopes by only one unit (see Corollaries 2 and 3).
Comparison with Previous Work Before entering into the technical details of our contribution, it is worth remarking some important differences and similarities with previous work. Angelini et al. [1] prove that any given set of Δ − 1 slopes is universal for 1-bend planar drawings of undirected graphs. One of the key intuitions in [1] lies in the fact that, in an incremental construction of the drawing, there exists a set of horizontal edges whose removal disconnects the drawing into two pieces. This set of edges can be used to modify the horizontal distance of the vertices along the drawing boundary, which in turn makes it possible to use any given set of slopes to draw the edges attached to such vertices. This intuition is exploited also in our work, in particular, Lemmas 3 and 4 mirror Lemmas 1 and 2 in [1], although they require adjusted proofs to deal with the upward setting. Besides this very useful tool borrowed from [1], our layout algorithm requires additional new ingredients, such as an enriched set of geometric invariants, the notion of upward canonical ordering and suitable augmentation techniques that yield such an ordering, the introduction of "fake" slopes to deal with those dummy edges added to augment the graph. Notably, this last idea of augmenting the graph and using "fake" slopes to draw the inserted edges avoids the usage of more complex data structures, such as SPQR-trees, which are instead used in [1], thus resulting in a simpler and more elegant algorithm.
Another paper linked to ours is the one of Keszegh et al. [33]. Recall that, among other results, they prove that planar graphs admit 2-bend planar drawings with Δ/2 equispaced slopes. In particular, their technique draws the vertices incrementally following an st-ordering (see Sect. 2 for definitions) computed on the undirected planar graph in input. Since each vertex is drawn above its predecessors in the ordering, the technique has the potential to produce upward drawings. However, the main objective of the technique in [33] is to minimize the number of slopes and consequently, some edges are not drawn as y-monotone curves. Nevertheless, it is not difficult to see that a simple adjustment would solve this issue, essentially providing Δ slopes to be used rather than Δ/2 . Thus, the algorithm in [33] yields 2-bend upward planar drawings of planar st-graphs using at most Δ slopes. On the other hand, the algorithm that we propose has two main advantages: (i) it computes drawings with 4n − 9 bends in total, whereas the technique of Keszegh et al. may lead to drawings with 5n − 11 bends, and (ii) it can use any set of Δ slopes with the horizontal one, whereas the technique of Keszegh et al. uses a fixed set of Δ slopes.
Paper Structure Section 2 contains basic definitions and notation. In Sect. 3 and in Sect. 4, we study universal slope sets for 1-bend and 2-bend upward planar drawings, respectively. Conclusions and open problems are in Sect. 5.

Preliminaries
We assume familiarity with basic graph-theoretic notions; for standard definitions, we point the reader to [28]. In this section, we give preliminary notions and notation that are used throughout this paper.

Drawings and Embeddings
We only consider simple graphs, i.e., graphs with neither loops nor multiple edges. A directed graph (or digraph for short) is a graph whose edges are oriented. A drawing Γ of a graph G is a mapping of the vertices of G to distinct points of the plane, and of the edges of G to Jordan arcs connecting their corresponding endpoints but not passing through any other vertex. A drawing is planar if no two edges intersect, except possibly at a common endpoint. A planar graph is a graph that admits a planar drawing. A planar drawing subdivides the plane into topologically connected regions, called faces. The infinite region is called the outer face; any other face is an inner face. A planar embedding of a planar graph is an equivalence class of topologically equivalent (i.e., isotopic) planar drawings of G. A planar embedding of a connected planar graph can be described by the clockwise circular order of the edges around each vertex together with the choice of the outer face. A planar graph with a given planar embedding is a plane graph. A plane graph is maximal (or triangulated) if the boundary of each face contains exactly three vertices.
An upward drawing of a digraph G is a drawing such that each edge of G is drawn as a curve monotonically non-decreasing in the y-direction from its source to its target. A drawing is strictly upward if its edges are monotonically increasing. It is easy to see that if a digraph admits an upward drawing, then it also admits a strictly upward drawing. A digraph is upward planar if it admits a drawing that is both upward and planar.
A plane acyclic digraph G with a single source s and a single sink t, such that s and t belong to the boundary of the outer face and the edge (s, t) belongs to G, is called planar st-graph [16] (note that, other works do not explicitly require the edge (s, t) to be part of G; see, e.g., [27]). It is well-known that a digraph is upward planar if and only if it is a subgraph of a planar st-graph [16].
The slope of a line is commonly defined as the angle α by which a horizontal line must be rotated counter-clockwise in order to make it overlap with . 1 If α = 0, we say that the slope of is horizontal. The slope of a segment is the slope of the line containing it. Let S = {α 1 , . . . , α h } be a set of h slopes such that α i < α i+1 . The slope set S is equispaced if α i+1 − α i = π h , for i = 1, . . . , h − 1. Consider a k-bend planar drawing Γ of a graph G, i.e., a planar drawing in which every edge is mapped to a polyline containing at most k + 1 segments. For a vertex v in Γ each line through v and having slope α defines two different rays that emanate from v. We say that these two rays have slope α. If α is horizontal, these rays are called left horizontal ray and right horizontal ray. Otherwise, one of them is the top and the other one is the bottom ray of v. We say that a ray r v of a vertex v is free if there is no edge incident to v through r v in Γ . We also say that r v is outer if it is free and the first face encountered when moving from v along r v is the outer face of Γ (note that, in general, there might exist several faces intersecting r v ).
The slope number of a k-bend drawing Γ is the number of distinct slopes used for the edge segments of Γ . The k-bend upward planar slope number of an upward planar digraph G is the minimum slope number over all k-bend upward planar drawings of G.

Orderings
An st-ordering of an n-vertex planar st- In particular, any st-ordering of G is a linear extension of the partial order defined by the edges of G, and therefore it holds that s = v 1 and t = v n . Every planar st-graph has an st-ordering, which can be computed in O(n) time (see, e.g., [11]). If u and v are two adjacent vertices of G such that σ (u) < σ(v), we say that v is a successor of u, and u is a predecessor of v.
Let e be an outgoing edge of a vertex u of G, let e and e be the next edges incident to u going counter-clockwise and clockwise around u from e, respectively (the circular order of the edges around u is defined by the planar embedding of G). We say that e is the leftmost outgoing edge of u if either e and e are both edges of the outer face or e is an incoming edge. Similarly, e is the rightmost outgoing edge of u if either e and e are both edges of the outer face or e is an incoming edge. Also, observe that if u has only one outgoing edge, then such an edge is both leftmost and rightmost. Denote by S(u) = (u 1 , u 2 , . . . , u q ) the sequence of successors of u such that, in the planar embedding of G, we have that: (i) edge (u, u 1 ) is the leftmost outgoing edge of u, and Fig. 2a for an illustration. Notice that when h = 1 or h = q, S(u) is actually a monotonic decreasing or increasing sequence (which is a special case of a bitonic sequence). A bitonic stordering of G is an st-ordering such that, for every vertex u ∈ V , S(u) is bitonic [26]. A planar st-graph G is a bitonic st-graph if it admits a bitonic st-ordering. Deciding whether G is bitonic can be done in linear time in both cases when we assume that a planar embedding is given as part of the input [27] and when we do not have such information and hence we search over all possible planar embeddings of G [7]. this angle. However, for simplicity reasons, and similarly as in previous papers (see, e.g., [17,21,22]), we refer to the angle of incline of as its slope.
there is a path from u i+1 to u i and a path from u j to u j+1 ; see Fig. 2b. If G is not bitonic, every st-ordering σ of G contains a forbidden configuration [27].
Let G = (V , E) be an n-vertex triangulated plane graph with vertices u, v, and w on the boundary of the outer face. A canonical ordering [14] of G is a linear ordering Computing a canonical ordering χ of G can be done in O(n) time [14]. When G is a digraph, a canonical ordering χ of G is called an upward canonical ordering if for every edge (u, v) of G, vertex u precedes vertex v in χ . It is worth observing that χ is a special st-ordering of G and hence a particular linear extension of the partial order defined by the edges of G.

1-Bend Upward Planar Drawings
Overview In this section, we first describe a constructive algorithm to compute 1-bend upward planar drawings of bitonic st-graphs with maximum vertex degree Δ using any set of Δ slopes that includes the horizontal one (Theorem 1). The section is concluded by discussing some interesting implications of this result (Corollaries 1 and 2 , and Theorem 2). An overview of our strategy to prove Theorem 1 is as follows. We first define a suitable augmentation technique for the input graph G, which leads to a triangulated planar st-graph G having an upward canonical ordering χ (Lemmas 1 and 2 ). We then describe a layout algorithm that takes G as input and computes the desired drawing. The algorithm incrementally adds a vertex per step according to χ , while maintaining a set of geometric invariants that guarantee the desired properties of the drawing (Lemmas 3-7).
The Augmentation Technique Let G = (V , E) be an n-vertex planar st-graph with a bitonic st-ordering σ = (v 1 , v 2 , . . . , v n ); see, e.g., Fig. 3a. We describe how to "transform" σ into an upward canonical ordering of a suitable supergraph G of G.
and c a planar st-graph G obtained by triangulating G , such that χ is an upward canonical ordering of G We start from a result by Gronemann [27], whose properties are summarized in the following lemma; for an illustration refer to Fig. 3b.

Lemma 1 (Gronemann [27]) Let G = (V , E) be an n-vertex planar st-graph that admits a bitonic st-ordering
(i) vertices v L and v R are on the boundary of the outer face of G , and (ii) every vertex of G with less than two predecessors in σ has exactly two predecessors in χ .
We call G a canonical augmentation of G. Observe that G always contains the edges (v L , v 1 ) and (v R , v 1 ) because of Property (ii) of Lemma 1. We proceed by inserting the edge (v L , v n ), which is required according to our definition of planar st-graph; this addition is always possible because v L and v n are both on the boundary of the outer face. The next lemma shows that any planar st-graph obtained by triangulating G admits an upward canonical ordering; for an illustration refer to Fig. 3c. We anticipate that, in order to construct a drawing of G, we will use a different set of "fake" slopes for the edges inserted by the triangulation procedure; such edges will be anyway removed at the end of the construction.

an st-ordering of G . Every triangulated planar st-graph G obtained by adding only edges to G has the following properties:
(a) graph G has no parallel edges, and (b) ordering χ is an upward canonical ordering.
Proof Concerning Property (a), suppose for a contradiction that G has two parallel edges e 1 and e 2 connecting u with v. Let C be the 2-cycle formed by e 1 and e 2 and let V C be the set of vertices distinct from u and v that are inside the topological region bounded by C in the embedding of G. Without loss of generality, we shall assume that C contains no further edge connecting u and v. Set V C is not empty, as otherwise C would be a non-triangular face of G contradicting either the fact that G is simple or the fact that G is obtained by triangulating G . Let w be the vertex with the lowest number in χ among those in V C . Since G is planar (in particular e 1 and e 2 are not crossed) and has a single source, it contains a directed path from u to every vertex in V C . Hence, G has an edge from u to w. Also, by assumption, there is no vertex z in V C such that χ(z) < χ(w), which implies that either u is the only predecessor of w in χ , or u and v are the only two predecessors of w in χ . The first case contradicts Property (ii) of Lemma 1. The second case implies the existence of a sink inside C, which contradicts the fact that G (and hence G) is an st-graph. It follows that graph G has no parallel edges.
Concerning Property (b), we first observe that if χ is a canonical ordering of G, then χ is actually an upward canonical ordering because it is also an st-ordering. To see that χ is a canonical ordering, observe first that vertices v L , v R and v n are on the boundary of the outer face of G by construction. In the following, we prove that χ satisfies Conditions C.1 and C.2 of canonical ordering.
Denote by G i the subgraph of G induced by v L , v R , v 1 , . . . , v i and let C i be the boundary of its outer face. We first prove by induction on i that G i is 2-connected (for i = 1, 2, . . . , n). In the base case i = 1, graph G 1 is a 3-cycle and therefore it is 2-connected. In the case i > 1, graph G i−1 is 2-connected by induction and v i has at least two predecessors in G i−1 by Property (ii) of Lemma 1, thus G i is 2-connected. We now prove that for each i = 1, 2, . . . , n, graph G i is internally triangulated, which concludes the proof of Condition C.1 of canonical ordering. Suppose, for a contradiction, that there exists an inner face f of G i that is not a triangle. Since G is triangulated, there exists a vertex v j , with j > i, that is embedded inside f in G j . We show that this is not possible. Namely, since χ is an st-ordering, there is no directed path from v j to any vertex of f . On the other hand, either v j = v n holds or there is a directed path from v j to v n . Both cases contradict the fact that v n belongs to the boundary of the outer face of G.
It remains to prove Condition C.2. Since we already proved that G i is triangulated, it suffices to show that v i belongs to C i , for i = 2, . . . , n. By the planarity of G i , there is a face f in G i−1 such that all the neighbors of v i in G i−1 belong to the boundary of f . Such a face is the outer face of G i . Indeed, if f were an inner face, then v i would be embedded inside f in G i and, as we proved above, this is not possible.
The Layout Algorithm Let G be an n-vertex bitonic st-graph with maximum vertex degree Δ; see Fig. 3a. We show that any set S of Δ slopes that contains the horizontal slope can be used to construct a 1-bend upward planar drawing of G. The algorithm first computes a triangulated canonical augmentation G of G; see Fig. 3b, c. An edge is dummy if it belongs to G but not to G and it is real otherwise. By Lemma 2, graph G admits an upward canonical ordering where χ is an st-ordering such that each vertex distinct from v L and v R has at least two predecessors. Let S = {ρ 1 , . . . , ρ Δ } be any set of Δ slopes, which we call real slopes. Let ρ * be the smallest angle between any two slopes in S and let Δ * be the maximum number of It follows that there are Δ * dummy slopes between any two consecutive real slopes. A ray emanating from a vertex is called real or dummy if its slope is real or dummy, respectively. We will use the real slopes to represent the real edges and the dummy slopes for the dummy edges of G.
In both cases, we denote by G − i the digraph obtained from G i by removing all the edges of G 2 that are not part of P. The algorithm constructs a drawing Γ i of G − i by incrementally adding the vertices according to χ , similarly as in the shift-method by de Fraysseix et al. [14] (the details about the actual construction will be given soon). Let C i be the boundary of the outer face of G i , and let P i be the path obtained by removing (v L , v R ) from C i . For a vertex v of P i , we denote by m r (v, i) and by m d (v, i) the number of real or dummy edges incident to v that are not in G i , respectively. We also denote by ρ j (v, i) (resp. ρ j (v, i)) the j-th outer real top ray in Γ i encountered in clockwise (resp. counterclockwise) order around v starting from the left (resp. right) horizontal ray. For dummy top rays, we define analogously η j (v, i) and η j (v, i). Drawing Γ i , for i = 2, 4, . . . , n − 1, will satisfy the following invariants: I.1: Γ i is a 1-bend upward planar drawing whose real edges use only slopes in S. When i = 2, Property (P.1) clearly holds and (P.2) follows from Invariant I.2. Assume that Properties (P.1) and (P.2) hold for Γ i−1 by induction (i > 2). Let u 1 , u 2 , . . . , u q be the neighbors of v i in P i−1 ; observe that P i is obtained from P i−1 by replacing the subpath u 1 , u 2 , . . . , u q with u 1 , v i , u q . Consider an edge (u, v) of P i . If (u, v) also belongs to P i−1 , then u 1 , u 2 , . . . , u q all belong to either satisfies Property (P.1), while (P.2) holds by induction (because the edges that cross the cut are the same as in On the other hand, there is a face of Γ i that contains both (u 1 , u 2 ) and (u 1 , v i ). Thus there exists a cut that is crossed by the edges that cross the cut (L i−1 (u 1 , u 2 ),  We construct the drawing Γ i from Γ i by increasing the length of the edges that cross the cut (L i (u, v), R i (u, v)) by λ units. In other words, we increase by λ units the x-coordinate of all vertices in R i (u, v) without changing the y-coordinate of any vertex. It is immediate to verify that Γ i is a 1-bend upward drawing whose real edges use only slopes in S and that Γ i satisfies Invariants I.2-I. 4.
In order to show that Invariant I.1 holds for Γ i , it remains to prove that Γ i is planar, that is, the operation of translating the subdrawing induced by R i (u, v) does not violate planarity. Suppose for a contradiction that Γ i is not planar. Then there exist two non-adjacent edges e L and e R of P i that intersect in a point p. Since e L and e R did not cross in Γ i , point p belongs to only one of the two edges in Γ i , say e L , and there exists a point p of e R in Γ i that has been translated to p when transforming Γ i into Γ i . This means that p is encountered before p when walking from left to right along the horizontal line passing through p and p . Since p has been translated and p has not, point p belongs to the subpath of P i that goes from v to v R , while p belongs to the subpath of P i from v L to v. In other words, when walking along P i from v L to v R , p is encountered before p . But this contradicts Invariant I.5 for Γ i , which means that Γ i is in fact planar.
We finally prove that Invariant I.5 holds for Γ i . Let be any horizontal line and let p and p be any two intersection points between and the polyline representing P i in Γ i , with p to the left of p along . If, in Γ i , the order of p and p along is reversed or p and p coincide, then p has been translated while p has been not. On the other hand, since Invariant I.5 holds for Γ i , p precedes p when walking along P i from v L to v R and therefore if p is translated, p is also translated. Thus, Invariant I.5 holds for Γ i . This completes the proof of the lemma.

Lemma 4 Let Γ i be a drawing of G − i that satisfies Invariants I.1-I.5. Let u be a vertex of P i , and let t u be any outer top ray of u that crosses an edge of G − i in Γ i . There exists a drawing Γ i of G − i that satisfies Invariants I.1-I.5 in which t u does not cross any edge of G
Proof The ray t u can cross the subpath of P i from v L to u and/or the subpath of P i from u to v R . Let v and w be the vertices that are encountered before and after u along P i when going from v L to v R , respectively. To remove the crossing(s) it is sufficient to apply Lemma 3 to (v, u) and/or to (u, w) for a sufficiently large λ; see Fig. 6a, b for an illustration.
(a) (b) Fig. 7 a, b Application of Lemma 3 to guarantee that all the intersection points along appear in the desired order, in the extreme case in which the initial order of the intersection points is reversed with respect to the desired order We now describe our drawing algorithm starting with the computation of We draw such a path along a horizontal segment. Clearly, drawing Γ 2 satisfies Invariants I.1, I.2, and I.:5. Since m r (v L , 2) = m r (v R , 2) = 0, Invariant I.3 trivially holds for v L and v R in Γ 2 . Vertices v 1 and v 2 are connected by a real edge in Γ 2 and therefore each of them has at most Δ − 1 real incident edges that are not in G 2 . Since there are Δ − 1 real top rays and they are all outer, Invariant I.3 holds also for v 1 and v 2 in Γ 2 . Finally, Invariant I.4 holds because all dummy top rays are outer. Hence, we can conclude that drawing Γ 2 satisfies Invariants I.1-I. 5. We can summarize this discussion as follows.
Assume now that we have constructed drawing Γ i−1 of G − i−1 satisfying Invariants I.1-I.5 for some 3 ≤ i < n. Let u 1 , . . . , u q be the neighbors of the next vertex v i along P i−1 . Let t 1 be either ρ 1 (u 1 Let t j (for 1 < j < q) be any outer real (resp. dummy) top ray emanating from u j , if (u j , v i ) is real (resp. dummy). By Invariants I. 3 and I.4 all such top rays exist and by Lemma 4 we can assume that none of them crosses Γ i−1 .
Let be a horizontal line above the topmost point of Γ i−1 . For j = 1, 2, . . . , q, let p j be the intersection point of t j and . We can assume that, for j = 1, 2, . . . , q − 1, point p j is to the left of p j+1 . If this is not the case, we can increase the distance between u j and u j+1 so to guarantee that p j and p j+1 appear in the desired order along ; this can be done by applying Lemma 3 to each edge (u j , u j+1 ) for a suitable choice of λ; see Fig. 7a, b for an illustration and also Fig. 8a, b for a complete running example.
We will place v i above using q − 2 bottom rays b 2 , b 3 , . . . , b q−1 of v i for the segments of the edges (u j , v i ) ( j = 2, 3, . . . , q − 1) incident to v i such that: (i) b j (1 < j < q) is real (resp. dummy) if (u j , v i ) is real (resp. dummy), and (ii) b j precedes b j+1 in the counterclockwise order around v i starting from b 2 .
This choice is possible for the real rays because v i has Δ − 1 real bottom rays and it has at least one incident real edge not in G i (otherwise it would be a sink of G, which is not possible because i < n). Concerning the dummy rays, we have at most Δ * dummy edges incident to v i and Δ * dummy bottom rays between any two consecutive real rays.
where p 1 = p 1 and p 2 , p 3 , . . . , p q−1 are the intersection points of the rays b 2 , b 3 , . . . , b q−1 with the line ; refer to Fig. 8c for an illustration.
Note that for a sufficiently large y-coordinate, point p can always be found. We now apply Lemma 3 to each of the edges (u 1 , u 2 ), (u 2 , u 3 ), . . . , (u q−2 , u q−1 ), in this order, choosing λ ≥ 0 so that each p j is translated to p j (for j = 2, 3, . . . , q − 1). We finally apply again the same procedure to (u q−1 , u q ) so that the intersection point between t q and the horizontal line H passing through v i is to the right of v i ; see Fig. 8d. After this translation procedure, we can draw the edge (u 1 , v i ) (resp. (u q , v i )) with a bend at the intersection point between t 1 (resp. t q ) and H and therefore using the slope of t 1 (resp. t q ) and the horizontal slope; see Fig. 8e. The edges (u j , v i ), for j = 2, 3, . . . , q − 1, are drawn with a bend point at p j = p j and therefore using the slopes of t j and b j . In the following lemma, we formally prove that the obtained drawing Γ i satisfies Invariants I.1-I.5.

Proof
The proof is by induction on i ≥ 3. By Observation 1, drawing Γ i−1 satisfies Invariants I.1-I.5 when i = 3. By induction we assume that, for some 3 < i < n − 1, drawing Γ i−1 satisfies Invariants I.1-I.5 and in the following we prove that drawing Γ i satisfies Invariants I.1-I.5, as well.
Invariant I.1: By construction, each edge (u j , v i ) ( j = 1, 2, . . . , q) is drawn as a chain of at most two segments that use real and dummy slopes. In particular, if (u j , v i ) is real, then it uses real slopes, i.e., slopes in S. By the choice of , the bend point of (u j , v i ) has y-coordinate strictly greater than that of u j and smaller than or equal to that of v i . Since each (u j , v i ) is oriented from u j to v i (as χ is an upward canonical ordering), the drawing is upward. Concerning planarity, we first observe that Γ i−1 is planar and it remains planar each time we apply Lemma 3. Also, by Lemma 4 each edge (u j , v i ), for j = 1, 2, . . . , q, does not intersect Γ i−1 (except at u j ). Further, the order of the bend points along guarantees that the edges incident to v i do not cross each other. and there are Δ * outer dummy top rays between η 1 (u 1 , i) and ρ 1 (u 1 , i) including η 1 (u 1 , i) (namely, all those between t 1 = ρ 1 (u 1 , i − 1) and in this case t 1 = η 1 (u 1 , i − 1) and therefore all the other m d (u 1 , i − 1) − 1 outer dummy top rays of u 1 , which by induction were between η 1 (u 1 , i − 1) and ρ 1 (u 1 , i − 1), remain outer in Γ i . Invariant I.5: Notice that the various applications of Lemma 3 to Γ i−1 preserve Invariant I.5. Let p and p be any two intersection points between a horizontal line and the polyline representing P i in Γ i , with p to the left of p along . If p and p belong to P i−1 , Invariant I.5 holds by induction. If both p and p belong to the path u 1 , v i , u q , Invariant I.5 holds by construction. If p belongs to P i−1 and p belongs to u 1 , v i , u q , then p belongs to the subpath of P i−1 that goes from v L to u 1 because the subpath from u q to v R is completely to the right of t q , hence Invariant I.5 holds also in this case. If p belongs to u 1 , v i , u q and p belongs to P i−1 , the proof is symmetric.
We now describe how to add the last vertex v n to the drawing Γ n−1 such that the obtained drawing is a 1-bend upward planar drawing Γ n of G − n that uses only slopes in S (recall that G is a subgraph of G − n ).

Lemma 6 Graph G admits a 1-bend upward planar drawing Γ using only slopes in S.
Proof By Lemma 5, drawing Γ n−1 satisfies Invariants I.1-I.5. We explain how to add the last vertex v n to obtain a drawing that satisfies Invariant I.1 . Let u 1 , . . . , u q be the predecessors of v n on P n−1 . Notice that, in this case u 1 = v L and u q = v R . Vertex v n is added to the drawing similarly to all the other vertices added in the previous steps of the algorithm. The only difference is that the number of real incoming edges incident to v n in Γ n−1 can be up to Δ. If this is the case, since the real bottom rays are Δ − 1, they are not enough to draw all the real edges incident to v n . Let h be the smallest index such that (u h , v n ) is a real edge. We ignore all the dummy edges (u j , v n ), for j = 1, 2, . . . , h − 1, and apply the construction used in the previous steps considering only u h , u h+1 , . . . , u q as predecessors of v n (notice that such predecessors are at least two because v n has at least two incident real edges). By ignoring these dummy edges, the segment of the real edge (u h , v n ) incident to v n will be drawn using the left horizontal slope. Denote by Γ n the resulting drawing. As in the proof of Lemma 5, we can prove that Invariant I.1 holds for Γ n and therefore Γ n is a 1-bend upward planar drawing whose real edges use only slopes in S. The drawing Γ of G is obtained from Γ n by removing all its dummy edges and the two dummy vertices v L and v R .
The next lemma establishes an upper bound for the time complexity of our algorithm. Similar ideas are used in [10], where a linear-time implementation of the algorithm by de Fraysseix et al. [14] is presented. On the other hand, differently from the result by de Fraysseix et al., the coordinates of the vertices of Γ may not be whole numbers and may be superpolynomial. To cope with the potential need for real numbers we adopt the real RAM model of computation, which is a standard model frequently used in computational geometry. To properly account for the cost of operations on large numbers we express the time complexity of our algorithm as a function of n and of the maximum number of bits b Γ required to store the coordinates of a vertex 2 . Clearly, the newly-added edges do not violate planarity and each face of the resulting digraph is triangular. By construction, for any edge (u, v) added to triangulate G there exists a directed path from u to v in G . Thus edge (u, v) does not create any directed cycle and G has a single source (namely, vertex v L ) and a single sink (namely, vertex v n ) that are the same as in G . Therefore, the triangulated digraph G is a planar st-graph. The construction of Γ i from Γ i−1 , for i = 3, 4, . . . , n, requires O(deg(v i ) To reduce the number of operations to linear, the algorithm can be implemented to work in two phases. In the first phase, the exact coordinates of the vertices are not computed, but we only store information on the edges to reconstruct these coordinates in the second phase. More precisely, in the first phase, we consider each vertex v i according to χ and assign to each edge e = (u, v) that is in G − i but not in G − i−1 two pairs of numbers (s(e, u), l(e, u)) and (s(e, v), l(e, v)). For each i = 2, 3, . . . , n, we aim at guaranteeing the following properties once vertex v i has been considered: P.1: s(e, u) (resp. s(e, v)) represents the slope of the segment of e incident to u (resp. v) in Γ i . P.2: l(e, u) (resp. l(e, v)) represents the length of the segment of e incident to u (resp. v) in Γ i if at least one of the following two conditions apply: (a) e is on the boundary of P i , or (b) s(e, u) = 0 (resp. s(e, v) = 0), i.e., the segment does not use the horizontal slope. For each edge e = (u, v) in Γ 2 , we set s(e, u) = s(e, v) = 0 and l(e, u) = l(e, v) = 1. It is immediate to verify that Properties P.1 and P.2 hold. Assume, by induction, that Properties P.1 and P.2 hold once vertex v i−1 has been considered and let v i be the next vertex, for some i > 2. Let u 1 , u 2 , . . . , u q be the neighbors of v i along P i−1 . Consider any edge e j = (u j , v i ), for j = 1, . . . , q. We choose the slopes for the two segments of e j as explained above and set s(e j , u j ) and s(e j , v i ) accordingly (the choice of the slopes can be done in O(1) time). In order to compute l(e j , u j ) and l(e j , v i ), it is sufficient to compute the positions of u 1 , u 2 , . . . , u q relative to u 1 . This can be done in O(deg(v i ) b Γ ) time, because, by Properties P.1 and P.2, we know both the slope and the length of each edge segment along P i−1 from u 1 to u q . We can then calculate, again in O(deg(v i ) b Γ ) time, the (relative coordinates of) the intersection points p 1 , p 2 , . . . , p q . Afterwards, we may need to (repeatedly) apply Lemma 3. Note that the application of this lemma does not modify the slope of any edge segment, and thus it preserves Property P.1 for all the edges of Γ i−1 . Instead, it changes the length of some horizontal segments. However, all the involved horizontal segments do not belong to P i . Finally, in order to set l(e j , u j ) and l(e j , v i ), it suffices to know the values of λ used in all the applications of Lemma 3, which can be computed by only looking at the intersection points p 1 , p 2 , . . . , p q . It follows that Properties P.1 and P.2 hold.
Once v n has been considered, we have information on all the edges of Γ n = Γ . In particular, by Properties P.1 and P.2, we know the slope and the length in Γ of all the edges that do not contain any horizontal segment. These edges form a tree 3 rooted at (a) (b) Fig. 9 a A graph that requires Δ slopes and angular resolution at most π Δ in every 1-bend upward planar drawing. b Illustration for the proof of Theorem 2 v n spanning the graph obtained by removing v L and v R from G. To see this, observe that, for j = 1, 2, . . . , n − 1, each vertex v j has been connected exactly once to a vertex v z , with j < z, with an edge that does not contain any horizontal segment, as otherwise v j would belong to the outer face of Γ . Hence, v z is the (only) parent of v j in the spanning tree. Furthermore, vertex v n is incident to at least one of these edges since it has degree at least three and exactly two of its edges contain a horizontal segment. Therefore, an assignment of valid coordinates to the vertices of G can be obtained through a pre-order visit of this spanning tree (recall that for all the edges of the spanning tree we know the slope and length of its two segments). Finally, all edges that contain a horizontal segment (including those that are incident to v L and v R ) can be drawn as we know the slopes of both segments and the y-coordinate of the bend point.
Lemmas 6 and 7 are summarized by Theorem 1.
Theorem 1 Let S be any set of Δ ≥ 2 slopes including the horizontal slope and let G be an n-vertex bitonic planar st-graph with maximum vertex degree Δ. Graph G has a 1-bend upward planar drawing Γ using only slopes in S, which can be computed in O(n b Γ ) time.

Implications and Extensions
We now discuss some consequences of Theorem 1. We start with Corollary 1, which follows from Theorem 1 and from a result in [19].

Corollary 1 Every bitonic st-graph with maximum vertex degree Δ ≥ 2 has 1-bend upward planar slope number at most Δ, which is worst-case optimal.
Proof Every bitonic st-graph has 1-bend upward planar slope number at most Δ by Theorem 1. Also, for every Δ ≥ 2 there is a bitonic st-graph (shown in Fig. 9a) that requires at least Δ slopes in any 1-bend upward planar drawing [19].
If S is equispaced, Theorem 1 implies a lower bound of π Δ on the angular resolution of the computed drawing, which is worst-case optimal [19]. Furthermore, we observe that an upward drawing constructed by the algorithm of Theorem 1 can be transformed into a strictly upward drawing that uses Δ + 1 slopes rather than Δ. It suffices to replace every horizontal segment oriented from its leftmost (rightmost) endpoint to its rightmost (leftmost) one with a segment having slope ε (−ε), for a sufficiently small value of ε > 0. Thus, the next corollary follows.
Finally, Theorem 1 can be extended to planar st-graphs with Δ ≤ 3, as any such digraph can be made bitonic by only rerouting the edge (s, t).
Theorem 2 Every planar st-graph with maximum vertex degree 3 has 1-bend upward planar slope number at most 3.
Proof Let G be a planar st-graph with maximum vertex degree 3. By Theorem 1, if G has a bitonic st-ordering, then the statement follows. If G is not bitonic, it contains a forbidden configuration (see Sect. 2). Recall that a forbidden configuration consists of at least three outgoing edges incident to the same vertex. Since the only vertex of G with three outgoing edges is the source vertex s of G, it follows that G contains exactly one forbidden configuration, which involves s and the edge (s, t). We can remove this forbidden configuration by mirroring the embedding of the subgraph obtained by removing (s, t) from G (see Fig. 9b for an illustration).

2-Bend Upward Planar Drawings
We now extend the result of Theorem 1 to non-bitonic planar st-graphs. Let G be an n-vertex non-bitonic planar st-graph. It is known that all forbidden configurations of G can be eliminated in linear time by subdividing at most n − 3 edges of G [27]. Let G b be the resulting bitonic st-graph, called a bitonic subdivision of G. Let u, d, v be a directed path of G b obtained by subdividing the edge (u, v) of G with the dummy vertex d. We call (u, d) the lower stub, and (d, v) the upper stub of (u, v). We prove the existence of an augmentation technique similar to that of Lemma 1, but with an additional property on the upper stubs. Note that a direct application of the algorithm of Theorem 1 to the graph in output from the next lemma would lead to a 3-bend drawing of G (by interpreting subdivision vertices as bends). Hence, the challenge will be to derive a drawing with at most 2 bends per edge (and 4n − 9 bends in total). Proof We construct G together with its embedding by adding a vertex per step according to χ . We start with the 3-cycle whose edges are Thus v i can be planarly connected to its neighbors in G i−1 . In order to guarantee Properties (i) and (ii) we may add dummy edges connecting v i to some vertex of the outer face of G i−1 that is not adjacent to v i in G b . Suppose first that v i has only one predecessor u in χ . We claim that all the edges connecting u to vertices that are after v i in χ appear consecutively either in clockwise or in counterclockwise order around u starting from (u, v i ) in the embedding of G b . If this were not the case, then there would exist two vertices v j and v h , with i < j and i < h, such that v j precedes v i and v h follows v i in the circular order around u. But this would imply that the vertices v j , v i and v k form a forbidden configuration for G b , which would contradict the fact that G b is bitonic. If all these edges appear after v i in clockwise (resp. counterclockwise) order, then we can add the edge (v i , w), where w is the vertex preceding (resp. following) u when walking clockwise along the boundary of G i−1 ; see Fig. 10a for an illustration.

Lemma 8 Let G = (V , E) be an n-vertex planar st-graph that is not bitonic. Let
Suppose now that v i has more than one predecessor in χ , but its leftmost (resp. rightmost) incoming edge (u, v i ) is an upper stub. This means that u is a dummy vertex and therefore it has no successor in σ other than v i . Then we can add the edge (v i , w), where w is the vertex preceding (resp. following) u when walking clockwise along the boundary of G i−1 ; see Fig. 10b for an illustration. Since G has O(n) vertices and edges, the above procedure can be implemented to run in O(n) time as claimed, which completes the proof of this lemma.
We are now ready to prove the main theorem of this section.
Theorem 3 Let S be any set of Δ ≥ 2 slopes including the horizontal slope and let G be an n-vertex planar st-graph with maximum vertex degree Δ. Graph G has a 2-bend upward planar drawing Γ using only slopes in S, which has at most 4n − 9 bends in total and which can be computed in O(n b Γ ) time.
Proof We compute a triangulated canonical augmentation G of G by applying Lemma 8 and by triangulating the resulting digraph. By Lemma 2, graph G has Fig. 11 Illustration for the proof of Theorem 3: Vertices u 2 and u 3 correspond to dummy vertices; thus, the edges (u 2 , v i ) and (u 3 , v i ) are drawn bendless an upward canonical ordering χ . As already mentioned, a direct application of the algorithm of Theorem 1 to G would lead to a 3-bend drawing of G (by interpreting subdivision vertices as bends). We explain how to modify it in order to construct a drawing Γ of G with at most 2 bends per edge and 4n − 9 bends in total.
Let v i the next vertex to be added according to χ and let u 1 , u 2 , . . . , u q its neighbors in P i−1 . Suppose that u j is a dummy vertex and that (u j , v i ) is an upper stub. To save one bend along the edge subdivided by u j , we draw (u j , v i ) without bends. By Property (iii) of Lemma 8, we have that 1 < j < q. The ray t j used to draw the segment of (u j , v i ) incident to u j can be any outer real top ray; we choose the ray with same slope as the real bottom ray b j used to draw the segment of (u j , v i ) incident to v i ; see Fig. 11. This is possible because all real top rays of u j are outer (since (u j , v i ) is the only real outgoing edge of u j ). Hence, edge (u j , v i ) has no bends.
The drawing Γ of G is obtained from Γ by removing dummy edges and by replacing dummy vertices (except v L and v R , which are removed) with bends. Since the upper stubs of subdivided edges have zero bends, each edge of Γ has at most 2 bends. Since, in the worst case, each edge in Γ can have at least one bend, the total number of bends is upper bounded by the total number of edges of G (which is at most 3n − 6) plus the corresponding number of edges with exactly two bends (which is at most n − 3). Hence, in total Γ has at most 4n − 9 bends, as desired.
To complete the proof, we remark that, by Lemma 8, graph G can be computed in O(n) time and the modified drawing algorithm still runs in time (n b Γ ). Hence, the proof of the theorem follows.
A planar st-graph with a source or a sink of degree Δ requires at least Δ − 1 slopes in any upward planar drawing; thus the gap with Theorem 3 is one unit. Similarly to Theorem 1, Theorem 3 implies a lower bound of π Δ on the angular resolution of Γ ; an upper bound of π Δ−1 can be proven with the same digraph used for the lower bound on the slope number.
The next theorem extends the result of Theorem 3 to every upward planar graph using one additional slope.
Theorem 4 Let S be any set of Δ + 1 slopes including the horizontal slope and let G be an upward planar graph with maximum vertex degree Δ ≥ 2. Graph G has a 2-bend upward planar drawing using only slopes in S.

Proof
Since G is upward planar, it is possible to augment G with dummy edges to a planar st-graph G st ; see, e.g., [16]. Let Δ st be the maximum vertex degree of G st .
If we apply the algorithm of Theorem 3 to G st , we obtain a 2-bend upward planar drawing using any set of Δ st slopes including the horizontal one. However, it is not immediate to augment G so that Δ st ≤ Δ + 1. On the other hand, the algorithm can be applied so to draw the dummy edges of G st using dummy slopes. In this case we should take into account the fact that a vertex v that is a source (resp. a sink) in G and not in G st may have Δ outgoing (resp. incoming) real edges. To cope with this issue it suffices to use any set of Δ + 1 real slopes that includes the horizontal one.
Similarly to Corollary 2, we can observe that any non-strictly upward drawing obtained by applying either Theorem 3 or Theorem 4 can be made strict by replacing the horizontal segments with nearly horizontal ones of the same slope. Hence, we conclude with the following corollary.

Corollary 3
The 2-bend strictly upward planar slope number of an upward planar graph G with maximum vertex degree Δ ≥ 2 is at most Δ + 1 if G is a planar st-graph, and it is at most Δ + 2 otherwise.

Conclusions and Open Problems
In this paper we extended the study of universal sets of slopes to upward planar drawings, and presented the first constructive technique that works for all planar stgraphs. One of the main ingredients of our algorithms was the recently introduced bitonic st-ordering. Using this new approach, we proved that any set S of Δ slopes containing the horizontal is universal for 1-bend upward planar drawings of planar st-graphs admitting such an ordering. This result implies a tight bound for the 1-bend upward planar slope number of bitonic st-graphs and gives rise to drawings with worst-case optimal angular resolution. We then extended the technique to prove that any such S is universal for 2-bend upward planar drawings of planar st-graphs.
Our research gives rise to interesting questions, among them: -Our technique exploits the existence of a bitonic st-ordering in order to augment the input graph to an st-planar triangulation that admits an upward canonical ordering. The upward canonical ordering is then utilized to compute the 1-bend upward planar drawing. A natural question is hence whether the existence of a bitonic st-ordering is a necessary condition to obtain an upward canonical ordering or it is only a sufficient condition. -More in general, the most intriguing question is whether every planar st-graph can be drawn with at most one bend per edge (or with at most two bends per edge and less than 4n − 9 bends in total) and Δ slopes. -Moreover, it remains open whether the 2-bend upward planar slope number of planar st-graphs is Δ or Δ − 1. -Our drawing technique produces drawings with large area, possibly superpolynomial; it would be interesting to derive lower bounds for the area requirement of 1-bend upward planar drawings with few slopes and good angular resolution. -Finally, the study of the 0-bend upward planar slope number of upward planar digraphs is also a challenging research direction.