Upward Planar Drawings with Three and More Slopes

The slope number of a graph $G$ is the smallest number of slopes needed for the segments representing the edges in any straight-line drawing of $G$. It serves as a measure of the visual complexity of a graph drawing. Several bounds on the slope number for particular graph classes have been established, both in the planar and the non-planar setting. Moreover, the slope number can also be defined for directed graphs and upward planar drawings. We study upward planar straight-line drawings that use only a constant number of slopes. In particular, for a fixed number $k$ of slopes, we are interested in whether a given directed graph $G$ with maximum in- and outdegree at most $k$ admits an upward planar $k$-slope drawing. We investigate this question both in the fixed and the variable embedding scenario. We show that this problem is in general NP-hard to decide for outerplanar graphs ($k = 3$) and planar graphs ($k \ge 3$). On the positive side, we can decide whether a given cactus graph admits an upward planar $k$-slope drawing and, in the affirmative, construct such a drawing in FPT time with parameter $k$. Furthermore, we can determine the minimum number of slopes required for a given tree in linear time and compute the corresponding drawing efficiently.


Introduction
One of the main goals in graph drawing is to generate clear drawings.Depending on the particular use case, we may request that a graph drawing has specific properties and use quality measures for evaluation.Classic examples are planarity or the number of crossings, the required drawing area, neighborhood preservation, or the stress of a drawing [16].When we visualize directed graphs (digraphs for short) that model hierarchical relations, we may represent edge directions explicitly by letting each edge point upward.Combining this with planarity, we get upward planar drawings.
Schulz [46] proposed the visual complexity as a quality measure, which is determined by the number of different geometric primitives used for the drawing.Experiments have shown that people tend to prefer a low visual complexity [33].Therefore, we may want to use few segments or arcs, or -as in our case -only few slopes for the edges.Using a limited number of slopes is common for schematic drawings: Various diagram types are orthogonal drawings and use only two different slopes.With three or four slopes we get hexalinear and octilinear drawings, respectively, which find applications in metro maps [42], visualization of chemical cyclic compounds [25], and VLSI [40].
In this paper, we are interested in a combination of these requirements, namely, we study upward planar straight-line drawings that use a fixed number of slopes; Fig. 1 shows an example with three slopes.In particular, given a digraph G and a fixed number k of slopes, we ask whether G admits an upward planar straight-line drawing with k slopes.Also, we have to distinguish whether G comes with an embedding in the plane or not.In the following, we define above drawing concepts formally, discuss related work, and introduce the precise problem we consider.
Upward Planarity.An upward planar drawing of a digraph G is a planar drawing of G where every edge uv is drawn as a monotonic upward curve from u to v. We call G upward planar if it admits an upward planar drawing and upward plane if it is equipped with an upward planar embedding.Note that an upward planar embedding, given by the edge order around each vertex, is necessarily bimodal, that is, each cyclic sequence of incident edges can be split into two contiguous subsequences of incoming edges and outgoing edges [16].Di Battista and Tamassia [17] have shown that if a digraph is upward planar, then it also admits an upward planar straight-line drawing.
When we are given a digraph G, we have to distinguish whether G comes with an upward planar embedding or not.In the latter case, we are required to find an upward planar embedding of G (if one exists) in order to draw G upward planar.However, Garg and Tamassia [26] have shown that upward planarity testing is an NP-complete problem for general digraphs.This even holds for digraphs with a bounded maximum degree ∆, where ∆ ≥ 2 [34].On the positive side, there exist several fixed-parameter tractable (FPT) algorithms for general digraphs [9,10,21,28] and polynomial-time algorithms for special graph classes such as single-source digraphs [5], outerplanar digraphs [44], series-parallel digraphs [21], and triconnected digraphs [4].If the embedding of a digraph is given, upward planarity can be tested in polynomial time [4].
k-Slope Drawings.A k-slope drawing of a (not necessarily directed) graph G is a straight-line drawing of G where every edge is drawn with one of at most k different slopes; see Fig. 1.Wade and Chu [48] defined the slope number of G as the smallest k such that G admits a k-slope drawing.If only (upward) planar drawings are allowed, the number is called the (upward) planar slope number of G.Both the slope number and the planar slope have been studied extensively in the past, mostly with the goal of finding upper bounds for particular graph classes [7, 18, 19, 22, 23, 30, 31, 35, 37-39, 43, 48].We give a few examples.While Pach and Pálvölgyi [43] have shown that graphs with bounded degree ∆ (∆ ≥ 5) can have arbitrarily large slope number, Keszegh, Pach, Pálvölgyi, and Tóth [32] have shown that five slopes suffice for cubic graphs.Later, Mukkamala and Szegedy [39] improved this to four slopes.Restricted to planar drawings, Dujmović, Eppstein, Suderman and Wood [22] showed, among other results, that all plane cubic graphs admit planar 3-slope drawings.In general, determining the planar slope number of a graph is hard in the existential theory of the reals (∃R), which was shown by Hoffmann [29].
Recently, the interest in upward planar drawings on few slopes has grown.Bekos, Di Giacomo, Didimo, Liotta, and Montecchiani [3] showed that every so-called bitonic st-graph G with maximum degree ∆ admits an upward planar 1-bend ∆-slope drawing.Complementarily, Di Giacomo, Liotta, and Montecchiani [20] proved the analogous result for series-parallel digraphs.We want to point out that both Bekos et al. and Di Giacomo et al. use horizontally drawn segments facing in both directions.Brückner, Krisam, and Mchedlidze [7] studied level-planar drawings with a fixed slope set, that is, upward planar drawings where each vertex is drawn on a predefined integer y-coordinate (its level).Older works include results by Czyzowicz, Pelc, and Rival [14] and Czyzowicz [13] on lattices and several results for trees [1,2,6,11].
In a companion paper to this one, Klawitter and Mchedlidze [34] show that it can be decided in linear time whether a given upward plane digraph admits an upward planar 2-slope drawing.For the variable embedding scenario and two slopes, they give a linear-time algorithm for single-source digraphs, a quartic-time algorithm for series-parallel digraphs, and an FPT algorithm for general digraphs.Quapil [45] recently also considered upward planar k-slope drawings.His results include an extension of Hoffman's ∃R-hardness from the planar slope number to the upward planar slope number, drawings of series-parallel graphs for k = 3, and area requirements of upward planar k-slope drawings for ordered trees, cacti, and series-parallel graphs.Contribution.In this paper, we aim to extend the results by Klawitter and Mchedlidze [34] to the case of three and more slopes.We study the problem of deciding whether a digraph admits an upward planar k-slope drawing for any given k with a special focus on the case k = 3. Broadly speaking, we show how the problem becomes harder with more complex graph classes and hence consider the following classes.First, we use the classes of ordered and unordered directed trees as an easy introduction to the problem (Section 3).In particular, the upward planar slope numbers of these trees is easy to determine and upward planar k-slope drawings can be constructed efficiently.Second, we show that for a given cactus digraph G (defined below) we can construct an upward planar k-slope drawing in polynomial time (Section 4).To this end, we devise a dynamic program on the block-cut tree of G and utilize a simple polygon drawing algorithm by Culberson and Rawlins [12].Third, we show that it is NP-hard to decide whether a given upward outerplanar digraph admits an upward planar 3-slope drawing (Section 5).We extend the NP-hardness to k > 3 but restrict the graph class to upward planar (except for k = 4 if no embedding is given).Prior to that, we introduce further notation and terminology in the next section.
Our findings and some known results are summarized in Table 1.

Notation and Terminology
All graphs in this paper are simple, that is, they do not contain parallel edges or self-loops.Note that a given digraph G may admit an upward planar k-slope drawing only if it has maximum inand out-degree at most k.Otherwise, there would not be enough slopes to represent all edges entering or leaving a vertex with too high in-or outdegree, respectively.Hence, we assume from now on that every input digraph has maximum in-and out-degree at most k.Given a graph G, a planar embedding can be specified by the order of the edges around each vertex as well as a designed outer face.We speak of the fixed embedding scenario, when besides G, we are also given a planar embedding (or, here, an upward planar embedding) as input.This embedding is then to be used also in the output drawing.In the variable embedding scenario, on the other hand, we are not given an embedding and have to find one prior or parallel to constructing a drawing.
Graph Classes.A directed tree is a digraph whose underlying graph is a tree, that is, a connected graph that does not contain a cycle.Note that directed trees are a superset of rooted trees, that is, a directed tree can have multiple sources (vertices with indegree 0) while a rooted tree has exactly one.While for general graphs the terms fixed and variable embedding are common, the following terms are used for trees: an unordered tree comes without planar embedding, while for an ordered tree, a planar embedding is specified.
A cactus graph is a planar graph where any two (simple) cycles share at most one vertex.For digraphs, we assume that the underlying graph is a cactus graph.
An outerplanar graph is a planar graph that admits an embedding where each vertex lies on the outer face.A drawing of an outerplanar graph is usually expected to maintain this property.We also assume this henceforth.For the directed case, we define an upward outerplanar digraph as a digraph that admits an upward planar drawing with each vertex on the outer face.
Note that every directed tree is a cactus digraph and that every cactus digraph is an outerplanar digraph.All of these three classes are subclasses of planar digraphs.Slope Sets.When constructing an upward planar k-slope drawing, we need a set of k distinct slopes.To obtain this slope set, we propose the following three settings, which are illustrated in Figs.1b to 1d, respectively.general setting Any set of k distinct slopes can be chosen.
uniform angles setting The slopes are distributed equally, that is, clockwise from the x-axis they have angles in {i regular grid setting Any set of k distinct slopes that connect points on the 2D grid is allowed.This may include the horizontal slope and then horizontally rightwards also counts as upwards.
We prefer to pick slopes that can be used by segments of roughly equal length; see for example Fig. 1d and Fig. 3.
Both the uniform angles and the regular grid setting have their own advantages and disadvantages.Uniform angles naturally lead to more balanced drawings with more rotational symmetry, which we find more visually appealing.Moreover, the drawings have a perfect angular resolution, which is also known as a quality measure of graph drawings [16,19].The downside of the uniform angles setting is that we cannot always use grid points of the regular 2D grid.For example, for k = 3, the first slope is tan(π/6) = 1/ √ 3, which is an irrational number.Henceforth, we assume for uniform angles a computational and representation model that can handle implicit coordinates or alternatively uses real numbers.On the other hand, while the regular grid setting naturally facilitates integer coordinates, it may also yield less balanced angles between edges and irrational edge lengths.Since all of these settings have their natural justification, we do not restrict our considerations to one of them.
Figure 2: Given a drawing using a set of any three slopes, we can (i) rotate, (ii) shear, and (iii) stretch it to a drawing with the slope set { , ↑, } (rotated here by 45 • clockwise for illustrative purposes to {↑, , →}).
Note that a 2-slope drawing can be sheared such that one slope changes and the other remains the same; see Fig. 2ii; we refer also to Klawitter and Mchedlidze [34].Moreover, observe that such a transformation only changes the length of segments with the changing slope, but not the others.The fact that this does not hold for three or more slopes introduces interesting new geometric aspects for these cases.However, note that k = 3 is a special case because no matter which three slopes we pick, they can be affinely transformed to the slopes of the angles {45 • , 90 • , 135 • } = { , ↑, }, as illustrated in Fig. 2. Hence, when referring to k = 3, we may assume the use of this slope set.(For illustrative purposes, we rotate drawings in Section 5 by 45 • clockwise and then use the slope set {↑, , →}.)In some cases we number k different slopes with the numbers 1 to k in counterclockwise order.
Slope Assignment.A k-slope assignment of a digraph G assigns each edge of G one of k slopes.If G is upward plane, we call a k-slope assignment of G consistent if the assignment complies with the cyclic edge order around each vertex; that is, for k = 3, if a vertex has three incoming edges, they need to be assigned the slopes , ↑, and in counterclockwise order.Clearly, if an upward plane embedding does not admit a consistent k-slope assignment, then it also does not admit an upward planar k-slope drawing.

Trees
In this section, we consider upward planar k-slope drawings of directed trees.While our trees are in general not rooted, results for rooted trees can be derived or are partially already known [2,6].Note that naturally every unordered tree is upward planar, while an ordered tree is upward planar if and only if its embedding is bimodal.

Unordered Trees
The planar slope number of an unordered undirected tree with maximum degree ∆ is ∆/2 [22].Therefore not surprisingly, the upward planar slope number of an unordered directed tree T equals the maximum in-and outdegree of T .To show this, we draw T as subgraph of a larger, regular tree T k,h for h ≥ 1 where every non-leaf vertex has in-and outdegree k and each leaf has distance h to a central vertex.To draw T k,h on a grid with k slopes, we adopt the strategy of Bachmaier, Brandenburg, Brunner, Hofmeier, Matzeder, and Unfried [1] for complete rooted trees; see Fig. 3.Alternatively, T k,h can be drawn with k uniform angles; see Fig. 4.
Theorem 1 Let T be an unordered directed tree on n vertices with maximum indegree and outdegree at most k.Then T admits an upward planar k-slope drawing in the regular grid setting and T  admits an upward planar k-slope drawing in the uniform angles setting.Moreover, the drawings can be computed in O(n) time.
Proof: Let be the number of vertices on a longest undirected path in T .We first describe how to construct an upward planar k-slope drawing of T = T k, /2 .Let ρ be the central vertex of T .Since T is a subgraph of T , a drawing for T could be obtained from the drawing of T straightforwardly.However, since T might be substantially larger than T , we describe at the end how to construct the drawing of T directly.
To draw T k, /2 on a grid we first place ρ at the center of an axis-aligned square that functions as the drawing region.We then partition this larger square into ( k/2 + 1) 2 smaller equal-sized squares.The neighbors of ρ are placed at the centers of the smaller squares that appear along the perimeter of the outer square.If k is even, then all smaller squares get occupied where the left central square gets a predecessor of ρ and the right central square gets a successor of ρ.If k is odd, then the left and right central squares stay unoccupied.For each neighbor v of ρ, we then proceed recursively within the square of v; see Fig. 3. Hence, the trees obtained from removing ρ in T are all drawn in disjoint regions and are thus non-overlapping.The recursive procedure ends at the leaves and with the smallest squares.The size of these smallest squares determines the final grid size.
Alternatively, to draw T with k slopes and uniform angles, we use a regular 2k-gon (instead of a square) as drawing region and place ρ at its center.For the subtrees, we then use appropriately smaller regular 2k-gons; see Fig. 4.More precisely, we pick the sizes such that one corner of each smaller 2k-gon is incident with a corner of the larger 2k-gon, and, for odd k, two small 2k-gons touch at a corner, as in Fig. 4a, while for even k, they touch at a side, as in Fig. 4b.The process continues recursively as before.
Lastly, we describe how to compute such drawings for T directly.First, find a longest path P in T in linear time [8] and determine a vertex ρ in the middle of P .Second, recursively construct a consistent k-slope assignment with ρ as start vertex.For the next step, note that the squares or 2k-gons are only used to find (and prove) appropriate edge lengths for each depth.However, we can also compute these lengths (and the grid size) directly in O(n) time.Finally, again recursively from ρ, draw the edges of T with their assigned slopes and the computed edge lengths.Overall, each step and thus the whole algorithm runs in O(n) time.
Note that the recursive drawing procedure from Theorem 1 requires an exponential-size drawing  area (or at least an exponential edge-length ratio).For an arbitrary number of slopes, Frati [24] showed that an area of size Θ(n log n) suffices to draw an n-vertex tree upward planar.As far as we know, it remains open whether an upward planar k-slope drawing of an unordered directed tree with maximum in-and outdegree k requires an exponential area.This is the case for ordered directed trees, which we consider next.

Ordered Trees
Let T be an ordered directed tree that admits an upward planar drawing.Hence, the vertices of T are bimodal.To determine the upward planar slope number of T , it suffices to find a consistent k-slope assignment for T with minimal k.We can then use the drawing algorithm from unordered trees.In this regard, note that the maximum in-and outdegree are natural lower bounds but that the choice of the (minimal) slope for an edge vw cannot be determined locally at v and w.For example, the edge vw in Fig. 5a is the third incoming edge at w but requires at least slope 4, since its preceding edge uw already requires slope 3 at u.This effect only appears along alternating intervals of incoming and outgoing edges.Hence we have the following observation; see also Figs. 5b  and 5c.

Observation 2
The upward planar slope number of ordered directed trees with n vertices, n ≥ 2, is bounded within 1 and n − 1 and these bounds are tight.
A consistent k-slope assignment for T minimizing k can be constructed with a simple greedy algorithm in linear time.
Theorem 3 The upward planar slope number k of an ordered directed tree on n vertices can be determined in O(n) time.Moreover, an upward planar k-slope drawing of T can be constructed in O(n) time.
Proof: Let T be an ordered directed tree on n vertices.We describe a greedy algorithm that computes a consistent k-slope assignment for T where k is minimal.The idea is that we assign the slopes 1, 2, . . . in counterclockwise (ccw) order around each vertex, but an edge uv receives a slope only if all outgoing edges at u that ccw precede uv and all incoming edges at v that ccw precede uv already got a sloped assigned.Therefore, an edge uv receives a mark when it has this property    at u or at v, and gets added to a queue as soon as it receives its second mark.To find the first edge in the queue, we mark the ccw first incoming and outgoing edge at each vertex; this can be done in overall O(n) time.Observe that after this initialization, there always exists an edge with two marks in a tree.
For an edge uv that we take from the head of the queue, we assign uv the lowest available slope, that is, one plus the maximum of the slope of its ccw preceding outgoing edge at u and its ccw preceding incoming edge at v; if there is no preceding edge, then slope 1 is available.We then mark the ccw succeeding edges of uv at u and v. Since T is a tree, there is (until the algorithm terminates) always at least one edge in the queue.
When the algorithm terminates, each edge is assigned a slope, which increase in ccw order for the incoming and for the outgoing edges of each vertex.Furthermore, the highest assigned slope is also the upward planar slope number of T with respect to its embedding.The running time of the algorithm is in O(n) since the algorithm considers each edge only a constant number of times.
Once we have computed the upward planar slope number k of T with respect to its embedding, we can use the drawing algorithm from Theorem 1 to compute an upward planar k-slope drawing of T again in O(n) time.
Corollary 4 Let T be an ordered directed tree on n vertices with maximum indegree and outdegree at most k.We can decide in O(n) time whether T admits an upward planar k-slope drawing.
Frati [24] showed that an alternating ordered directed path on n-vertices as in Fig. 5c requires Ω(2 n ) area.However, this path also requires n − 1 slopes.It is hence natural to ask whether there exist also ordered directed trees that require an exponential area in upward planar k-slopes drawings for a constant k.This question has recently been answered by Quapil [45] for k = 3 by giving a similar path with a spiral structure that requires exponential area; the example can be extended to higher k and, by adding a single triangle somewhere, to cactus digraphs.

Cactus Graphs
In this section, we show that deciding whether a given cactus digraph G admits an upward planar kslope drawing is fixed-parameter tractable (FPT) in k.This holds for both, the fixed and the variable embedding scenario.In particular, constructing an upward planar k-slope drawing of a cactus digraph can be done in polynomial time if k is constant.
Figure 6: Cactus digraph with maximum in-and outdegree 3, which admits even in the variable embedding scenario no upward planar 3-slope drawing as shown by Quapil [45].Roughly speaking, we use a dynamic program on the block-cut tree of G that computes combinable k-slope assignments for each block.Note that an acyclic cactus digraph G is always upward planar and if no upward planar embedding is specified, then the algorithm can compute one.However, as Quapil [45, Figure 4.3] pointed out, unlike directed trees, not every cactus digraph with maximum in-and outdegree at most k admits an upward planar k-slope drawing; see Fig. 6.
Recall that a block-cut tree T of a graph G has a vertex for each block (biconnected component) and each cut vertex of G and an edge between a block B and a cut vertex c if c is part of B; see Fig. 7b.Let G be a cactus digraph.Note that in a block-cut tree T of G each block vertex is either a cycle or an edge -we thus distinguish between cycle blocks and edge blocks.The block-cut tree of G can be computed in linear time [47].For a cactus digraph G to admit an upward planar k-slope drawing, each block of T must be drawable under constraints imposed by other blocks.Consider for an example the cactus G in Figs.7a to 7c under the given embedding.For k = 3, the two edges of the block B 1 incident to the cut vertex c 1 need the slopes ↑ and because of the blocks B 2 and B 3 .Our strategy is thus as follows.
Algorithm.In the first phase, we run a dynamic program (described below) on the blocks of T to find a consistent slope assignment for each block such that the blocks are combinatorially combinable.If successful, we enter the second phase, where we compute drawings of the blocks that are geometrically combinable.In the last phase we put all block drawings together.
Let G be a cactus with blocks B 1 , . . ., B and let T be the block-cut tree of G.We pick an arbitrary block vertex, say B , of T as root and direct all edges towards B .As a result, each block vertex B (except B ) has exactly one outgoing edge towards a cut vertex c in T .We then say c is the anchor of B. Let B be a cycle block with anchor c and suppose we have a slope assignment  We process T in a post-order traversal.For each block we compute a feasible set based on the feasible sets of its descendant blocks.
Combinatorial Realization.Computing the feasible set of a cycle block B with anchor c works as follows.Let B be the cycle (c = v 1 , e 1 , v 2 , e 2 , . . ., v |B| , e |B| , v 1 ) -if an embedding is given, let this order be cw around the inner face.Roughly speaking, in a dynamic programming approach, we find for each edge e i , i ∈ {1, . . ., |B|}, all possible slopes of e i based on the possible slopes of e i−1 .Furthermore, we also consider how far we have rotated along the boundary of B from v 1 to v i+1 to keep track of whether we have a total sum of inner (outer) angles around B of ±2π.More precisely, we walk around B once and store for each edge e i , i ∈ {1, . . ., |B|}, all tuples of (i) a possible slope s of e i and (ii) the corresponding sum α of rotation angles when traversing B from v 1 to v i+1 (consistently, along one side of B).We call the tuple s, α an edge tuple of e i .As a base for the sum of rotation angles, when considering e 1 , we use the angle a horizontal ray emanating at v 1 and pointing towards positive infinity would need to rotate to contain e 1 ; see Fig. 9a.
Next we describe how to compute all edge tuples of the edges of a block B. We start with computing the edge tuples of e 1 by considering all combinations of feasible block tuples of descendant blocks of B anchored at v 1 and v 2 .For each possible combination, we can test which slopes e 1 may get in O(k) time.The corresponding rotation angle can be computed in O(1) time.A descendant cycle block can have O(k 2 ) many feasible block tuples, while a descendant edge block can have O(k) many feasible block tuples.Together at v 1 and v 2 , there can be at most 2(k − 1) descendant cycle blocks and at most 4(k − 1) descendant edges.The total number of possible combinations of feasible block tuples of descendant blocks of B is thus at most O((k 2 ) 2k−2 ) = O(k 4k−4 ).(To see this, note that pairs of edge block descendants can be considered as cycle block descendants for this calculation.)Therefore, we can find all possible edge tuples of e 1 in O(k 4k−3 ) time.In the example of Fig. 9a for k = 3, assuming a fixed embedding, the edge e 1 can only have slope ↑ and we have thus rotated 90 • .For this edge tuple ↑, 90 • , the edge e 2 in Fig. 9b has also only one possible slope, namely , and the rotation increases by 135 • to a total of 225 • .However, in the variable embedding scenario, e 1 can also have slopes and , see Figs. 9c and 9d.In general, to compute the edge tuples of an edge e i , i ∈ {2, . . ., |B|}, we can use the same procedure to determine all possible slopes of e i as we have described for e 1 .The main difference is that we need to take into account also all edge tuples of e i−1 .We can treat the slope of an edge tuple of e i−1 like another descendant edge block.Additionally we update the sum of rotation angles for e i .The number of different edge tuples of e i−1 is in O(k|B|) because each edge tuple of e i−1 has one of k slopes, the sum of angles for each pair of edge tuples having the same slope differs by a multiple of 2π, and each of the O(|B|) previous edges adds a rotation of < 2π.Thus, since we have O(k|B|) edge tuples for e i−1 , O(k 4k−4 ) feasible block tuples of descendant blocks, and O(k) possible slopes for e i , we can compute all edge tuples of e i in O(k 4k−2 |B|) time.For all edges of B this takes O(k 4k−2 |B| 2 ) time.
Note that we may obtain the same edge tuple in multiple ways -the actual number of edge tuples for each e i is again O(k|B|).For each edge tuple t of e i , we store a pointer to t at the O(k) edge tuple(s) of e i−1 that t is based on.In other words, we build a digraph H on the edge tuples of the edges e 1 , . . ., e |B| .The digraph H has O(k|B| 2 ) vertices and O(k 2 |B| 2 ) edges.
When we handle e |B| , we discard all tuples that do not result in a 2π rotation if the embedding is given or with ±2π if no embedding is given.This ensures that the cycle has a geometric realization [12].To determine the feasible set for B, we start a breadth-first search (BFS) on H for each edge tuple of e 1 .For each edge tuple of e |B| we reach, we combine the slope of e 1 and e |B| as well as whether the rotation is +2π or −2π to get an anchor type of B at c.By backtracking from the edge tuple of e |B| within the BFS tree, we find a consistent slope assignment of B, which yields a feasible block tuple.
We 2 ) time.Over all blocks of G, this in O(k 4k n 2 ) since each vertex is in at most k blocks and, therefore, we have Finally, let us describe how to obtain a combinatorial realization for G.If the feasible set of the root block B is non-empty, then there is a combinatorial realization of G. To find one, we pick any feasible block tuple of B and try to combine it with the feasible block tuples of its descendant blocks.(We know that a consistent combination exists.)Since each feasible set has size O(k 2 ), we can find a consistent set of feasible block tuples of descendant blocks in O((k 2 ) k−1 ) time per vertex of B .Over all vertices of G this is in O(k 2k−2 n) time.
Geometric Realization.Suppose we have found a combinatorial realization in the form of a consistent k-slope assignment for every cycle and edge of G.In the variable embedding scenario, we now know whether and how cycles nest.We thus re-root T such that the root block lies on the outer face.In the following, we describe how to obtain a drawing of a cycle block B as a polygon that does not intersect the edges of its parent block B at its anchor point c.
We describe this only for the uniform angles setting and leave it as an open question for the regular grid setting.Given any sequence σ of rational angles (i.e., a rational number times π) that sum up to ±2π, Culberson and Rawlins [12] describe an algorithm that outputs a polygon with σ as turning angles.Their so-called Turtlegon algorithm works as follows.It defines a base angle α as the greatest common divisor of π and all angles in σ; in our case this is π/k (w.l.o.g.we can assume that our drawings are slightly rotated by π 2k ).Larger angles are split into sequences of ±α resulting in a new angle sequence σ .W.l.o.g.let σ contain more angles +α than −α.Using some of the αs, the Turtlegon algorithm draws a regular (2π/α)-gon (in our case 2k-gon).To accommodate additional angles in between, it inserts exponentially shrinking detours at the corners of the (2π/α)-gon; see Fig. 10b.In the end, we get the original larger angles from merging the smaller angles [12]; see Fig. 10c.
The difficulty for us when employing this O(k|B|) time algorithm, is to ensure that the edges of the parent block B can reach the anchor point c without intersecting the polygon of B. This might be impossible if c lies within a spiral inside a detour.However, we can avoid this if we let an incident edge of c be a side of the 2k-gon (this is always possible because we can pick an appropriate set of α angles of σ for the 2k-gon) and if we let each detour edge shrink by a sufficiently large factor (e.g., k|B|); see Fig. 10.
The running time of this step is in O(k|B|).Since each vertex is in at most k blocks, we have that i=1 |B i | ≤ kn and, hence, the total running time is in O(k 2 n).
Putting Blocks Together.We start with a drawing of the root block.We then recursively draw each child (in a BFS-like order) such that its anchor point coincides with the corresponding vertex of the parent polygon and scale down the drawing of the child block such that the appended polygon does not intersect the existing drawing.Note that it always suffices to scale down each child to the size of the minimum distance of any two vertices within in the parent polygon.We can determine vertex pairs of minimum and maximum distance for a block B in O(|B| log |B|) time and then place and scale each polygon in linear time.
The total running time is dominated by the dynamic program and thus in O(k 4k n 2 ).For a constant k, this is a quadratic time algorithm.
Theorem 5 Let G be an upward planar (or plane) cactus digraph with maximum in-and outdegree at most k.It can be constructively tested in O(k 4k n 2 ) time whether G admits an upward planar k-slope drawing in the uniform angles setting.In other words, constructing an upward planar k-slope drawing of a cactus digraph is fixed-parameter tractable in k.
For the regular grid setting, we cannot use the algorithm by Culberson and Rawlins [12] because we have irrational multiples of π as turning angles.For a sequence of general turning angles, the algorithm by Hartley [27] computes a polygon realizing that sequence.However, it is not immediately clear how to guarantee that the edges of the parent polygon at the anchor point are Figure 10: The Turtlegon algorithm by Culberson and Rawlins [12] realizes an angle sequence of a block B with anchor point c by first splitting large angles, constructing a 2k-gon with exponentially shrinking detours, and then merging small angles back together.When using the Turtlegon algorithm, we ensure that the anchor point c lies at a 2k-gon edge; here k = 3.
not intersected.For general polygons, we believe that we can iteratively shrink the spikes to resolve potential intersections.Since such a procedure involves some more technicalities, we leave it as an open question.

Outerplanar and Planar Graphs
In this section, we show that for any constant k ≥ 3 deciding whether an upward planar digraph admits an upward planar k-slope drawing is NP-hard.For k = 3, we show NP-hardness for this decision problem even for upward outerplanar digraphs.Except for k = 4, this hardness holds true regardless of whether we prescribe an embedding or not.However, it remains open if the problem is also NP-complete.Containment in NP is not immediately clear since it is open whether some digraphs require irrational (or super-polynomial precise) coordinates for any k-slope drawing.More precisely, if the problem was in NP, there would be small proof certificates for yes-instances that a verifier could use to decide the problem in polynomial time.Typically a combinatorial characterization or a drawing of the input graph could act as such a certificate.However in our case, we do not know whether there are digraphs that require irrational (or super-polynomial precise) coordinates and if so, how to treat them implicitly or, alternatively, how a combinatorial characterization would look like.
We first describe our NP-hardness reduction for embedded outerplanar digraphs for 3 slopes.Remember that for an arbitrary number of slopes, upward planarity for outerplanar digraphs can be decided in polynomial time [44] -if an embedding is given, even in linear time.Afterwards, we show how this NP-hardness reduction can be extended to the variable embedding scenario and, then, to larger k while using planar instead of outerplanar digraphs.
In this section, we consider drawings rotated by 45 • (upwards is to the top right) using the regular grid slope set {↑, , →}.This rotation facilitates the visualization of large orthogonal structures in our figures.

Outerplane Digraphs and k = 3
In this section, we show that it is NP-hard to decide whether a given upward outerplanar digraph with a given upward outerplanar embedding admits an upward outerplanar drawing using only three distinct slopes by reduction from Planar Monotone 3-SAT.
Planar Monotone 3-SAT (sometimes also known as Planar Monotone Rectilinear 3-SAT) is an NP-complete version of 3-SAT [15], where the three literals of each clause are all either negated or unnegated -from now on called negative and positive clauses, respectively.Moreover, the incidence graph1 has a planar drawing where the vertices are rectangles, the edges are vertical straight-line segments, the variables are arranged on a horizontal line, the positive clauses are above, and the negative clauses are below this line; see Fig. 12a.For our reduction, we can allow that a clause contains the same literal multiple times.Hence, we can also assume that all clauses contain exactly three literals (as otherwise we can fill up clauses by duplicating literals and obtain an equivalent formula).
For a given Planar Monotone 3-SAT formula F and a rectangular drawing of its incidence graph, we construct a corresponding upward outerplanar digraph G F , which can only be drawn upward planar with 3 slopes if F is satisfiable.Our construction follows ideas of Nöllenburg [41] and Kraus [36], and utilizes the fact that some digraphs can only be drawn in a way that they admit helpful properties arising in the upward planar drawing setting specifically for k = 3.We use them as building blocks in our reduction as subgraphs of G F .Let us describe these special (sub)graphs next.
We start with the digraph G with vertices s, x, y, and t, and edges st, su, ut, sv, and vt, as depicted in Fig. 11a.Observe that, up to scaling and mirroring along a diagonal axis, G admits an upward planar 3-slope drawing only as an outerplanar square as in Fig. 11b.We can attach multiple squares (and triangles) to each other as in Fig. 11c.The drawing of such a bigger digraph is unique up to scaling and mirroring diagonally.If the squares form a tree, the drawing is outerplanar.We refer to these squares as unit squares, since, once set, the side lengths for all attached squares are the same.
We also use G s to construct our next building block -the digraph G ↔ .To allow a certain small degree of freedom in our construction, we exploit the following property of G ↔ .
Lemma 1 In any upward planar 3-slope drawing of G ↔ (see Fig. 11d) • the edges e 1 and e 2 are parallel and have the same arbitrary length > 0, • all edges are oriented as in Fig. 11d      only an upward 3-slope drawing as square.By combining copies of G and triangles, we can build larger rigid structures.Then, all G s have the same size and we refer to them as unit squares.The digraph G ↔ admits only upward 3-slope drawings with one degree of freedom.only →.Thus, e 4 gets and the only remaining slope for e 1 is →.Note that e 3 is a unit square edge and the adjacent edges e 4 and e 5 form a triangle with e 3 that has the same size as half a unit square.Hence, e 4 (e 5 ) has the same length as all diagonal (resp.horizontal) edges.
The same argument as for the outgoing edges of v 2 applies to the incoming edges of v 4 .However, assume for contradiction, that the whole block on the right side of Fig. 11d is mirrored diagonally, i.e., v 1 and v 4 are on the same horizontal line and e 2 gets slope ↑.Then, v 4 , v 1 , and v 2 would be on the same horizontal line.This contradicts v 3 being vertically below its neighbors v 2 and v 4 .Hence, the right block has the same orientation as the left one, and e 2 gets slope → and is parallel to e 1 .This implies that the distances between v 2 and v 3 on the one hand, and v 1 and v 4 on the other hand are the same and the G s (and their attached triangles) have the size and orientation as in Fig. 11d.By the orientation of v 1 , v 2 , v 3 , v 4 , the edges e 1 and e 2 have an identical length .Only a value ≤ 0 would cause a non-planar drawing.
With this construction kit of useful (sub)graphs in hand, we build a digraph whose upward planar drawings represent the satisfying truth assignments for F .
The high-level construction is depicted in Fig. 12b.We construct, for each variable x i , a specific digraph -the variable gadget for x i (blue in Fig. 12b).Similarly, for each clause c j , there is a specific digraph -the clause gadget for c j (green and red in Fig. 12b).All gadgets mainly consist of chains of G s.For a drawing, this enforces a rigid frame structure built from unit squares.We glue all variable gadgets together in a row and connect variable and clause gadgets by edge gadgets (yellow in Fig. 12b) such that the composite digraph remains upward outerplanar and all G s are drawn as unit squares.
A variable gadget is depicted in Fig. 13.Its base structure is the (violet) frame composed of chains of unit squares.The core element is the (red) central chain of unit squares (with a few side-arms), which has one degree of flexibility, namely, moving as a whole to the left or to the right without leaving the frame structure of the gadget.It looks and behaves a bit like a pipe cleaning brush that is stuck inside the frame but can be moved a bit back and forth.Hence, we call it a brush.It is connected via a G ↔ to the brush of the previous variable gadget (see Fig. 13a/d) and the first brush is connected to the frame via a G ↔ (see on the left side of Fig. 12b).This allows only a horizontal shift of the brushes, but no vertical movement relative to its anchor point at the frame structure.Note that the horizontal position in any variable gadget is independent of those in all other gadgets.If the brush is positioned to the very left (right), the corresponding variable is set to false (true).
For each occurrence of a variable in a positive clause, we have a construction as depicted in Fig. 13b.There, a long chain of (green) G s -from now on called bolt -is attached to the frame structure via two G ↔ s, which allow only a vertical, but no horizontal shift.The bolt has on its left side an arm, which can only be placed in one of two pockets of the frame.It can always be placed in the upper pocket, which pushes the bolt outwards with respect to the variable gadget (into an edge gadget and a clause gadget).It can only be placed in the lower pocket if the brush is shifted to the very right (i.e.set to true) -then the bolt can "fall" into a cove of the brush.For each occurrence of a variable in a negative clause, we have this construction upside-down, such that the bolt can be pulled into the variable gadget only if the brush is shifted to the very left (i.e.set to false).
< 1 Figure 13: A variable gadget, which is contained in two positive and one negative clauses.The brush is positioned to the left and, thus, the variable is set to false.
Note that, to maintain outerplanarity of the whole construction, the frame structure is not contiguous, but connected by G ↔ s and the arms of the bolts.Hence, the frame structure decomposes into many components that have fixed relative horizontal positions and their unit squares have the same side lengths.However, the components can shift up and down relative to each other.To keep this vertical shift small enough not to affect the correct functioning of our reduction, we use, for each such component, the construction depicted in Fig. 13c.The chain of brushes has no vertical flexibility and serves as a base ground for an "anchor" of the frame.The frame can move less than one unit up or down unless it violates planarity.If the frame would be shifted up enough to be completely above the brush, it would get in conflict with the adjacent bolt.
An edge gadget consists of only three straight chains -two frame segments and a bolt in the middle.Their purpose is to synchronize the distance of the clause gadgets to the variable gadgets and to preserve the size of the unit squares.Several edge gadgets are depicted on yellow background color in Fig. 12b.
A clause gadget for a positive clause is depicted in Fig. 14.Within a frame, which is connected at six points to the frames of three edge gadgets, there is a horizontal (orange) bar, which is attached via two G ↔ s to the frame -one G ↔ allows a horizontal, the other allows a vertical shift.It resembles a crane that can move up and extend its arm, while it holds the horizontal bar on a vertical (orange) rope.The three bolts from the corresponding variable gadgets reach into the clause gadget.The lengths of these bolts is chosen such that, if they are pushed out of their variable gadget and into the clause gadget, they only slightly fit inside the gadget.Depending on whether each of the bolts is pushed into the clause gadget or pulled out of it, we have eight possible configurations (with sufficiently small vertical slack).They represent the eight possible truth assignments to a clause.In Fig. 14, we illustrate that in each configuration, we can accommodate the horizontal bar in an upward planar 3-slope drawing of the clause gadget -except for the case when all three bolts push into the clause gadget, which represents the truth assignment false to all contained variables.
A negative clause gadget uses the same construction, but mirrored vertically.There, three bolts pushing into the clause gadget means the contained variables are all set to true.
Putting our gadgets together, we conclude: Theorem 6 Deciding whether an upward outerplane digraph admits an upward planar 3-slope drawing is NP-hard.
Proof: To show NP-hardness, we use the reduction from Planar Monotone 3-SAT as described above.Let F be a given Planar Monotone 3-SAT formula with a rectangular drawing of the incidence graph of F and G F be the digraph obtained by our reduction.Each gadget in G F has only polynomial size and we can construct it in polynomial time.
If F is satisfiable, then there is a satisfying assignment T of truth values to the variables of F .Draw G F as illustrated in Fig. 12b, Fig. 13, and Fig. 14 such that the brush in a variable gadget has a distance of ε (for some sufficiently small ε > 0) to the frame on its left if the corresponding variable is set to false in T and has a distance of ε to the frame on its right if the corresponding variable is set to true.This drawing uses only three slopes and is upward planar.Observe that it is also outerplanar.On a chain of unit squares, the vertices on both sides are incident to the outer face.The drawings of the variable gadgets are open from one to the other and the drawing of the rightmost variable gadget is open to the outside.Moreover, the drawings of the positive (negative) clause gadgets are open on their top (bottom) right and on their whole bottom (top) sides, which also gives the "covered" clause gadgets and the outer sides of the variable gadgets access to the outer face.
On the other hand, if there is an upward planar 3-slope drawing of G F and it resembles the structure in Fig. 12b, we can read a satisfying truth assignment depending on the positions of the brushes (for the ones in intermediate position where no bolt can use the lower pocket, we can use any assignment for this variable).
In the remainder of this proof, we argue that any drawing resembles this structure.Consider the G of the frame structure which is connected via a G ↔ to the brush of the first variable gadget.Clearly, it is drawn as a unit square -it is our reference unit square having side length 1. Observe that all other unit squares are connected via chains of G s or G ↔ s to this reference unit square.By our observation and Lemma 1, they have the same side length.When ignoring the central parallel edges in the G ↔ s, the drawing decomposes to few rigid components.The first rigid frame component contains the reference unit square.The central edges of the incident G ↔ connecting it to the first brush can have only relatively small length as they would hit the "back wall" of, again, the first rigid frame component otherwise.Hence, the brush is indeed drawn inside the frame of the first variable gadget.Moreover, the first rigid frame component is connected via a G ↔ to a bolt, which in turn is connected to the next rigid frame components of the first variable gadget (see Fig. 13b).Since this bolt cannot escape the upper boundary of the clause gadget, which is also part of the first rigid frame component, the arm is in one of the two pockets.Then, the start point of the next rigid frame structure cannot be above the arm of the brush in Fig. 13c and the construction depicted there keeps the vertical slack of this rigid frame component within the range (−1, 1).This argument inductively propagates for all following rigid components.Hence, we have vertical slack of less than 1 for the frame structures and for the arms in the pockets.In the configuration false-false-false of the clause gadget, this would give us 2 − ε vertical gain if two frames move away from each other and 1 − ε gain if the arm is close to the bottom of its pocket.However, we would require a shift of the horizontal bar of more than 3 to be below or above the bulge of the left or the right bolt.Hence, this configuration is not drawable and all other positions of the horizontal bar correspond to one of the 7 other, satisfying configurations of Fig. 14.

Outerplanar Digraphs and k = 3
Note that in G F , we have used only connected G s and G ↔ s.By our observation on chains of unit squares and by Lemma 1, the planar embedding of G F is unique up to mirroring along a diagonal axis.Therefore, our reduction holds true also for the variable embedding scenario and we derive the following corollary from Theorem 6.
Corollary 7 Deciding whether an upward outerplanar digraph admits an upward planar 3-slope drawing is NP-hard in the variable embedding scenario.

Plane Digraphs and k ≥ 4
Next, we describe how to extend our NP-hardness reduction to more than 3 slopes.There, however, we use only upward planar instead of upward outerplanar digraphs.Observe that, if we fix the embedding and give up outerplanarity, we can add dummy leaves to each vertex to occupy all but the originally used slopes.Since any 3 slopes can be projected to {↑, , →} and we block all other slopes, our arguments work for all sets of k slopes and the reduction remains correct.The digraph remains upward planar, but it is not upward outerplanar any more.We formalize this statement in the following corallary derived from Theorem 6.
Corollary 8 Deciding whether an upward plane digraph (i.e., a bimodal embedding is given) with maximum in-and outdegree k admits an upward planar drawing with k slopes is NP-hard for k ≥ 3.This holds true for all choices of k slopes.

Planar Digraphs and k ≥ 5
Last, we consider the variable embedding scenario.We remark that, given a digraph, finding an upward planar embedding is already NP-hard [26] for all k ≥ 2 [34].This NP-hardness immediately propagates to our problem.However, we can show that the problem remains NP-hard even if we can find an embedding (or multiple different embeddings) efficiently.Hence, NP-hardness additionally comes from finding a concrete drawing when we are allowed to change any upward planar embedding arbitrarily 2 .
We show that our NP-hardness reduction remains applicable for k ≥ 5 by extending our digraph G F .We prove that for any upward planar embedding of G F , deciding whether G F admits a k-slope drawing remains NP-hard.This leaves k = 4 in the variable embedding scenario as the only open case.More precisely, we extend G F such that it has a unique planar embedding up to mirroring along a diagonal axis and up to swapping subgraphs only used to occupy the slopes we do not use for our original NP-hardness reduction with three slopes.
Assume for now that k is an odd number; thereafter, we consider the case that k is even.From the given k slopes, we pick the 3 middle slopes to host the digraph of the hardness construction described before.For simplicity, we visualize these 3 middle slopes again as {↑, , →} and the other slopes in quadrants II and IV around a vertex.The key idea is to occupy the unused slopes at each vertex by fans and beaters as depicted in Figs.15a and 15b instead of simple leaves.Fans are appended to the outside of each vertex v if the angle α that has been formed in the old construction is at least 180 • .More precisely, for each unoccupied slope spanned by α, we add a neighbor to v and then connect each consecutive pair of these new neighbors of v; edge directions are set appropriately.For each other remaining slope s at each vertex v, we add a beater.This is a digraph obtained from the wheel graph W 2k+1 as follows.The wheel graph W 2k+1 is the cycle C 2k = (v 1 , . . ., v 2k ) with an additional vertex c that is adjacent to all other vertices {v 1 , . . ., v 2k }.The edges of W 2k+1 on the cycle of the wheel are directed from a local source v k/2 to a local sink v k+ k/2 , the vertices v 1 , . . ., v k have outgoing edges towards c, and the vertices v k+1 , . . ., v 2k have incoming edges from c.  Furthermore, one spoke e = (c, v i ) (for a particular i ∈ {1, . . ., 2k}) is broken free and attached to v, that is, we remove the edges v i−1 v i and v i v i+1 (indices modulo 2k) and we identify v i as v; see Fig. 15b.This construction enforces an order on the spokes and, hence, we choose i such that we can prescribe the slope s of e .Note that the whole beater could be mirrored leaving two possible slopes for e .However, this is unproblematic since in our construction the "mirrored" slope of s is also occupied by a beater or a fan.For an illustration how to append fans and beater see Fig. 15c.
Next, we prove that this suffices to enforce a desired embedding and we describe how to extend the construction when k is an even number.Though we lost upward outerplanarity, note that the underlying undirected graph remains outerplanar for odd k.
Theorem 9 Deciding whether an upward planar digraph with maximum in-and outdegree k admits an upward planar drawing with k slopes is NP-hard for k ∈ N + \ {1, 2, 4} in the variable embedding scenario even if we can find an upward planar embedding efficiently.This holds true for all choices of k slopes.
Figure 16: Example for k = 6 illustrating how to occupy unused slopes such that our NP-hardness reduction with three slopes remains applicable.We add (red) dummy edges to connect the beaters to each other or an adjacent fan, which fixes the faces, in which the beaters end up, in the case k is even and greater than 4.
Proof: For k = 3, we use Corollary 7. Now assume that k ≥ 5 is an odd number.We will consider the case where k is even afterwards.We show next that the extended digraph can only be embedded in the previously described way up to mirroring along a diagonal axis and up to swapping beaters at a vertex.
Observe that the (pink) edges of each fan occupy neighboring slopes because their other endpoints are connected by (blue) edges.For every fan, the slope set it covers contains both incoming and outgoing edges.Therefore, there are at most two ways to add a fan to a vertex -either to its left or to its right side.In any case, it needs to be added to the outer face since otherwise neither a G nor a G ↔ can be drawn (any fan blocks ≥ k − 1 slopes, which corresponds to ≥ 180 • ).
The inner (green) edges of a beater occupy all but one slope, which remains for the (orange) edge e connecting the beater to its vertex.We next analyze the slope of e .Because of the outer edges of a beater, there is an order of the slopes of the inner edges (up to mirroring the whole beater) which determines the assignment of slopes within the beater.Hence, edge e uses one of two possible slopes -say the -th or the (k − + 1)-th slope.Since k is an odd number, the middle slope = k/2 is unique, which fixes the position of some beaters (e.g., in Fig. 15c, the beater in the outer face on the right side).For the other beaters, observe that we use the ( k/2 − 1)-th and the ( k/2 + 1)-th slope never for a beater, but always for the edges of the original construction or fans.For all other values of , the opposite (k − + 1)-th slope is always occupied by another beater or a fan.This means, the embedding of the subgraph used for the reduction is the same as in the digraph G F from the reduction of Theorem 6 up to mirroring, and the embedding of the whole digraph is unique up to mirroring and exchanging the positions of pairs of beaters.
It remains to consider the case when k ≥ 5 is even.Our goal is to use for the digraph from Theorem 6 always the same 3 middle slopes, e.g., the (k/2 − 1)-th, k/2-th, and (k/2 + 1)-th slope as in Fig. 16.This is automatically the case if all fans and beaters are drawn in the desired face.
We next describe how we can enforce in which face a beater or fan is drawn.At each vertex, we connect all incident beaters that shall share a common face by (thick red) dummy edges as depicted in Fig. 16.If there is only one beater at a vertex at a face, we connect it by a path of length 2 to a neighboring fan; see the one on the top right of Fig. 16.This latter case concerns only beaters on the outer face that block the slope .(Inside a G ↔ , we do not need beaters in between e 1 and e 2 .)In every other case, observe that within each bundle of connected beaters being adjacent to a vertex v, there is at least one beater being connected to v by an outgoing edge, and there is at least one beater being connected to v by an incoming edge.Hence, this bundle must be placed in the face being incident to v where the direction of (gray) bounding edges switches.This is either the opposite side of a fan or the opposite side of another bundle of beaters.In the latter case, the bundle of beaters cannot be exchanged since this would leave an incoming and an outgoing slope unused, which is not possible if v has in-and outdegree k.

Planar Digraphs and k = 4
We have shown that it is NP-hard to decide whether a given digraph admits an upward planar drawing with k slopes for all k ≥ 3 in the fixed and the variable embedding scenario except for k = 4 in the variable embedding scenario.The reason that we could not show NP-hardness for this specific setting is due to our extended hardness construction using beaters and fans.We use beaters and fans to block all but three designated slopes for the base hardness construction on three slopes.However, beaters can be drawn in two different ways (by mirroring) and hence potentially block two different slopes.The slopes blocked by the same beaters can be grouped into pairs.If we have an odd number of slopes, the central slope is not part of such a pair (a mirrored beater still blocks the central slope).We thus use the central slope and a pair of slopes for our three slopes in the base construction.
If k is even, we connect beaters in order to block a sequence of slopes at a vertex v -these are slopes for both incoming and outgoing edges incident to v. We exploit the property that at v, the incoming and outgoing edges form a contiguous sequence in any upward embedding and, hence, there are two turning points of edge directions at v. Choosing three neighboring slopes from an even number of available slopes leaves two sets of unused neighboring slopes (then blocked by beaters) whose cardinalities are off by one.Hence, at a vertex with degree 2k, the number of incident incoming and outgoing edges belonging to a group of connected beaters differs for the left and the right turning point.For k = 4 we use all but one slope for the base construction.This means, we cannot connect beaters and, thus, cannot cover these turning points at the vertices.Hence, a beater cannot reliably block the fourth slope but may use one of the three slopes of the base construction and an edge of the base construction may then use the fourth slope.

Concluding Remarks
We have investigated the problem of whether a digraph admits an upward planar k-slope drawing for a fixed set of k slopes.Roughly speaking, the boundary between polynomial-time solvability (for constant k) and NP-hardness lies somewhere between cacti and planar digraphs.In our analysis, we have somewhat sidestepped the issue of representing the coordinates of our drawings.This is also the reason why we only showed NP-hardness, but not NP-completeness for our problems.Like some other geometric problems, there is a chance that our problem is also ∃R-complete.(Remember that determining the (upward) planar slope number is ∃R-hard in general [29,45].)There remain several more open questions.Let us start with the question marks in Table 1.For planar digraphs, the only open case is k = 4 in the variable embedding scenario.It would be good to close this gap -in Section 5.5, we discuss why our current hardness construction fails.For outerplanar digraphs and k > 3, it is unclear whether deciding if there is an upward outerplanar k-slope drawing is also NP-hard.Supposed these cases were also NP-hard, where does it become polynomial-time solvable?Containment in P is not even clear for cacti and k ∈ ω(1), where we could only give an FPT algorithm.One may try to find an optimization to our dynamic program to get rid of the dependence on k in the exponent in the running time of the algorithm.Furthermore, one may extend the algorithm to the regular grid setting or to an arbitrary set of k slopes.
In general, area consumption and area requirement is a question worth investigating for many of our cases.In particular, it remains open whether an upward planar k-slope drawing of an unordered directed tree with maximum in-and outdegree k requires sometimes exponential area.
The segment number of a graph G is the smallest number of line segments needed for a planar straight-line drawing of G [22]; it serves as another quality measure of graph drawings, which also indicates the use few geometric primitives.As far as we know, the segment number of upward planar drawings has not been studied yet.So overall, we hope to see more research on upward planar drawings that use few slopes or that use few segments.

Figure 1 :
Figure 1: The upward planar straight-line line drawings of the digraph G realize different slope sets.In the remained of this paper, edges are drawn upward while arrow heads are omitted.

Figure 3 :
Figure 3: Upward planar k-slope drawings of unordered trees on the grid.

Figure 4 :
Figure 4: Upward planar k-slope drawings of unordered trees with uniform angles.

5 (
a) The third incoming edge vw of w cannot have slope 3.
A directed path with upward planar slope number n − 1.

Figure 5 :
Figure5: The upward planar slope number of an n-vertex ordered directed tree lies between 1 and n − 1, since it is not determined locally.Here the number represents different slopes.

Figure 7 :
Figure 7: The vertices (blocks) of the block-cut tree of a cactus digraph G correspond to the cycles and edges of G; we draw all blocks separately and then merge their drawings.

Figure 8 :
Figure 8: A subset of the anchor types of a cycle block for k = 3.

Figure 9 :
Figure 9: Computing a slope assignment for a cycle block B with anchor v 1 .The algorithm handles the edges of B one by one starting with e 1 .
have O(k) BFS runs, which take O(k 2 |B| 2 ) time each and O(k 3 |B| 2 ) time in total.Backtracking for all O(k 2 ) anchor types is in O(k 2 |B|) time in total.Hence, these steps are dominated by the computation of the edge tuples and we can compute a feasible set for B in O(k 4k−2 |B| description of a block B with angle sequence that contains large angles . . . . . . is converted to an angle sequence on base angle α and realized as 2k-gon with detours.c (c) Small angles originating from large angles are merged back together.
up to mirroring along a diagonal axis, and • all vertical and horizontal edges (excluding e 1 and e 2 ) have the same lengths, as well as all diagonal edges.Proof: As subgraphs, we have twice a pair of attached G s.As observed before, each pair can only be drawn as attached unit squares.Without loss of generality, let the first two squares (containing vertices v 2 , v 3 , v 5 ) be drawn vertically above each other as in Fig.11d.Since v 2 has outdegree 3 and e 3 = v 2 v 5 has slope ↑, we can argue that the edge e 1 gets slope →.If e 1 used , the edge e 5 would have no slope to close the triangle (e 3 , e 4 , e 5 ) because, at v 5 , the rightmost outgoing slope is of G s and triangles.

Figure 11 :
Figure 11: Building blocks used as subgraphs in our NP-hardness reduction.The digraph Gonly an upward 3-slope drawing as square.By combining copies of G and triangles, we can build larger rigid structures.Then, all G s have the same size and we refer to them as unit squares.The digraph G ↔ admits only upward 3-slope drawings with one degree of freedom.

2 v
k+ k/2 (c) We add fans and beaters to each vertex of the digraph such that all unused slopes are occupied.

Figure 15 :
Figure 15: Example for k = 5 illustrating how to occupy unused slopes such that our NP-hardness reduction with three slopes remains applicable.

Table 1 :
Complexity of constructing an upward planar k-slope drawing of a given digraph of the specified graph classes.P means polynomial-time solvable, FPT means fixed-parameter tractable, and NPh means NP-hard.Our findings contain a reference to a theorem (T) or a corollary (C).
slope assignment φ B of B and an anchor type t c (B) of c.A block tuple τ B is feasible if B has no descendant blocks or if B's descendant blocks admit a non-empty set of feasible block tuples that can be combined with τ B .A feasible set for B is a maximal set of feasible block tuples for B that have pairwise different anchor types.
8. For an edge block B with edge e, the anchor type t c (B) describes the slope of e and if e is incoming or outgoing at c.For cycle blocks and edge blocks, there are 2k • (2k − 1) and 2k different anchor types, respectively.For a block vertex B with anchor c, a block tuple τ B = φ B , t c (B) consists of a consistent k-