Journal of Graph Algorithms and Applications on the Complexity of the Planar Slope Number Problem

The planar slope number of a planar graph G is defined as the minimum number of slopes that is required for a crossing-free straight-line drawing of G. We show that determining the planar slope number is hard in the existential theory of the reals. We discuss consequences for drawings that minimize the planar slope number.


Introduction
The slope number of a non-degenerate straight-line drawing D of a graph G is defined to be the number of distinct slopes that is used to draw the edges of G in D. The minimum slope number of all straight-line drawings of G is the slope number of G. Similarly, the planar slope number of a planar graph G is the minimum slope number over all planar straight-line drawings of G.
In this paper, we consider the computational complexity of computing the planar slope number.In Section 2, we show that computing the planar slope number of a graph is hard in the existential theory of the reals, i.e., as hard as deciding the solvability of a polynomial inequality system over the reals.Furthermore, it is complete in the existential theory of the rationals (and thus possibly undecidable) to decide whether a planar graph has a drawing on the grid that minimizes the planar slope number.However, for each fixed k, deciding whether the (planar) slope number is at most k is in NP.A consequence of this result is that deciding if the planar slope number of a bounded degree graph is at most k is in NP.Afterwards, in Section 3, we point out consequences for drawings that minimize the slope number: There are planar graphs such that each drawing that minimizes the planar slope number requires irrational coordinates for the vertices and slopes of the edges.In Section 4 we point out open problems in connection to the slope number.

Background
The slope number of a graph has mainly been studied for the relation between the maximum degree of a graph and the slope number: A simple lower bound for the slope number of a graph G is ∆(G)/2 , where ∆(G) denotes the maximum degree of G, since at most two edges of the same slope are incident to one vertex.The main work in this area deals with the question, whether the slope number of a graph is also bounded from above by a function in the maximum degree.This was answered negatively [1,21,6] by examples of families of graphs of maximum degree 5 with arbitrarily large slope number.In contrast, Keszegh, Pach, and Pálvölgyi have shown that the planar slope number is bounded by an exponential function in the maximum degree [13].For partial planar 3-trees [12] this bound has been improved to a polynomial upper bound of O(∆ 5 ) and for outerplanar graphs [14] and partial 2-trees [16] to a linear upper bound.For planar graphs of maximum degree three the planar slope number is known to be at most four [5].
From the computational point of view, it is known to be NP-complete to decide whether a graph has slope number 2 [7], and it is NP-complete to decide whether a planar graph has planar slope number 2 [8].Thus both problems, computing the slope number and the planar slope number, are NP-hard.We characterize the planar slope number problem as hard in the existential theory of the reals.
The existential theory of the reals (∃R) is a complexity class defined by the following complete problem: Given a quantifier-free formula F (x 1 , . . ., x n ) that contains logic connections of polynomial equalities and inequalities in the variables x 1 , . . ., x n with integer coefficients, is there an assignment of real values to the variables such that the formula is satisfied?This problem can be reduced to deciding the solvability of a polynomial inequality system over the reals.Starting with Mnëv's universality theorem [20] many geometric problems have been shown to be hard in ∃R.Mnëv's universality theorem states that for each semialgebraic set V there exists an order type (or by duality, a line arrangement) whose realization space is stably equivalent to V .From a computational point of view it is important that the realization space is empty if and only if V is empty.
The existential theory of the rationals (∃Q) is defined similarly to ∃R, but restricted to rational solutions.When asking for geometric representations on the integer grid for ∃R-hard problems it turns out that ∃Q is the right complexity class because of scaling arguments.It is an open problem if ∃Q is decidable.The class ∃R is decidable in PSPACE [2], while the existential theory of the integers is undecidable by the negative answer to Hilbert's tenth problem due to Matiyasevich [18].
We want to point out that the problem of deciding if the (planar) slope number is at most k is contained in ∃R.This can be easily shown by encoding the coordinates as well as the k allowed slopes in variables.The same holds for drawings on the grid and ∃Q.In the following we only mention hardness results because we consider optimization problems and not decision problems.
Our hardness proofs are based on the problem of pseudoline stretchability: Given a collection of x-monotone curves that extend infinitely in positive and negative x-direction such that any two curves intersect pairwise exactly once, is there a homeomorphism of the plane that maps the curves onto lines?Or in other words, is there a collection of lines with the same intersection pattern as the collection of curves.We call the collection of curves a pseudoline arrangement; it is stretchable if the described homeomorphism exists.We call the stretched collection of curves a line arrangement.A (pseudo)line arrangement is simple if no three lines/curves intersect in a common point.The stretchability of simple pseudoline arrangements is also hard in ∃R.For a good overview on the ∃R-reduction for the stretchability problem we refer to [19].We point out that stretchability of non-simple pseudoline arrangements with rational coordinates is complete in ∃Q [25], while simple line arrangements can always be perturbed onto rational coordinates.

Computational complexity
In this section we consider the computational complexity of computing the planar slope number problem.In Subsection 2.1, we show that deciding if a planar graph has planar slope number ∆/2 is complete in the existential theory of the reals.We complement this result in Subsection 2.2, where we show that deciding the if the planar slope number can be achieved by a drawing of the vertices on the grid is complete in ∃Q.In contrast, if the maximum degree ∆ is bounded by a constant, we show that the planar slope number problem is in NP.

∃R-hardness
In this subsection, we show that computing the planar slope number is ∃R-hard.The general idea is to construct an (almost) 3-connected planar graph G L that contains the edges and vertices of a pseudoline arrangement L. Consequently, the pseudoline arrangement L can be found in each planar drawing of G L by drawing the pseudolines on the corresponding edges.The degree of each vertex of the arrangement in G L is equal to the even maximum degree ∆.Any two consecutive edges of one pseudoline are opposite edges at some vertex of the arrangement.By the following proposition, the existence a drawing of G L with slope number ∆/2 implies that L is stretchable.
Proposition 1 Let G be a planar graph with even maximum degree ∆, and let D be a planar straight-line drawing of G with slope number ∆/2.Each pair of opposite edges of a vertex of degree ∆ in D has the same slope.Proof: Let v be a vertex of degree ∆.Each slope of the drawing D appears exactly twice among the edges that are incident to v. The edges with the same slope are opposite in D.
For the proof of the following theorem we proceed to construct such a graph G L from a pseudoline arrangement L that has a drawing D with ∆/2 slopes if and only if L is stretchable.
Theorem 1 Deciding if the planar slope number of a planar graph with even maximum degree ∆ is ∆/2 is complete in ∃R.
Proof: We prove the theorem by reducing the stretchability of a pseudoline arrangement to the problem of deciding whether the planar slope number of a graph is ∆/2.Therefore, let L be an arrangement of n pseudolines.We note that we can determine the order of slopes of the lines in a stretched realization of L from the pseudoline arrangement, namely as the order in which the lines appear while traversing the adjacent unbounded faces.We use this observation to speak about the slope of a pseudoline and apply it in the following construction (see Figure 2): In the pseudoline arrangement L we draw a star of pseudolines on each vertex of the arrangement, i.e., for each pseudoline that is not incident to a vertex v of the arrangement we draw a pseudosegment that indicates which faces around v a pseudoline of the slope of through v intersects.
Now, we cut the pseudolines in the unbounded faces and define a planar graph by placing a vertex on each endpoint of a pseudosegment.We can already observe that the embedding we constructed can be drawn straight-line with n slopes if and only if the arrangement is stretchable.We modify this construction to obtain a 3-connected graph as shown in Figure 3: In addition to the pseudosegment of each slope of a pseudoline of L we add a star of intermediate slopes, one slope between each two consecutive slopes of pseudolines.We connect the leaf vertices of the stars in each face (including the one unbounded face) such that they form a cycle.We pick one edge per face cycle that connects two leaves of different stars and subdivide these edges.We call this planar graph G L .After contracting the subdivision vertices the graph G L is 3-connected.Thus Proposition 1 implies that the opposite edges, which originate from one pseudoline lie on one line, and thus a drawing with n slopes gives a realization of the line arrangement by drawing the lines along the edges.
So it remains to show that there exists a drawing D with slope number n if L is stretchable.Therefore, we consider a realization R of L as a line arrangement.We draw the vertices and edges of G L on the corresponding edges and vertices  of R. We choose the intermediate slopes and place a star containing all the 2n slopes on each vertex of the arrangement.The cycle in an inner face f is realized by drawing a polygon with sides parallel to the boundary of f such that on each corner of a polygon lies a vertex of the cycle.This can be done in the following way.We draw the polygon in the face clockwise, starting from one point close to the boundary on the counterclockwise first ray of one vertex v 1 .We draw the first edges of the cycle following parallel to the boundary of the face in clockwise order and place a vertex of the cycle on the intersection point of the segments of the star and the polygon.When we reach the counterclockwise last ray of the vertex v 2 we continue with a line parallel to the second boundary edge.We follow this procedure until we reach the counterclockwise last ray of the last vertex.To close the last edge of the polygon we have drawn in the face we use the subdivision vertex as shown in Figure 5.The cycle surrounding the outer face can be drawn with the same method as indicated in Figure 4.This concludes the proof that there exists a drawing of G L with n slopes if and only if L is stretchable.

Drawings on the grid.
Lemma 1 The graph G L constructed in the proof of Theorem 1 has a drawing with slope number ∆/2 with rational coordinates if and only if L has a realization with rational coordinates.
Proof: In the proof of Theorem 1 we have shown that we can realize L on a subset of vertices and edges of a slope minimizing drawing.Thus L has a rational realization if and only if there is a drawing of G L with slope number ∆/2, where the vertices and edges of the arrangement graph lie on rational coordinates.Thus, to conclude this proof, we only have to show that we can draw the cycles in the inner faces on rational coordinates.This is simply done by choosing rational intermediate slopes and a rational coordinate for the first vertex we draw in the polygon.Then all vertices of the cycle lie on the intersection points of rational lines, and thus have rational coordinate.
From the lemma above and the fact that deciding the realizability of a nonsimple line arrangement is complete in ∃Q [25] we obtain the following theorem.
Theorem 2 Deciding whether a planar graph G with even maximum degree ∆ has a drawing on the grid with slope number ∆/2 is complete in ∃Q.

Bounded slope number and bounded degree.
In contrast to the previous results, we show that we can decide for a fixed k in non-deterministic polynomial time whether a graph can be drawn with at most k slopes.Note that this is also true for the (non-planar) slope number and non-planar graphs.
Theorem 3 For each fixed k the decision problem whether a graph G has planar slope number or slope number at most k is in NP.
Proof: We give a proof based on the NP membership of the problem of recognizing segment intersection graphs that can be represented by at most k slopes for the segments [15][Theorem 1.1.ii.c] by Kratochvíl and Matoušek.They show that deciding the realizability of an arrangement of segments using at most k slopes can be decided in polynomial time.
To show that deciding whether the planar slope number is at most k is in NP we non-deterministically guess the embedding of the graph and which of the edges use the same slope.With this information we can use the result of Kratochvíl and Matoušek to decide in polynomial time whether the arrangement of edges can be realized using at most k slopes.
For the non-planar slope number we guess the complete arrangement of edges and the partition of the edges into common slopes.
Let G ∆ be the set of planar graphs with maximum degree at most ∆.We use the theorem above to show that deciding if a graph in G ∆ has slope number at most k is in NP.
Theorem 4 Deciding whether a planar graph G ∈ G ∆ has planar slope number at most k is in NP.
Proof: By [13] there exists a function f (∆), such that each graph in G ∆ has planar slope number at most f (∆).To decide whether the graph G has planar slope number k we return true if k ≥ f (∆).Otherwise, if k < f (∆), we can decide if the planar slope number is at most k by Theorem 3, since k is bounded by the constant f (∆).

Consequences of the hardness
In this section we point out consequences of ∃R-hardness of computing the planar slope number and ∃Q-hardness of deciding whether there is a drawing on the grid that achieves this slope number.
The fact that there are non-simple line arrangements that are known to have irrational coordinates in each representation [10] directly translates into the following result.
Corollary 1 There are planar graphs such that each planar drawing that minimizes the planar slope number has at least one vertex with an irrational coordinate.
Even if a line arrangement is stretchable with rational coordinates, there are arrangements that require a doubly exponential representation size [9].By the observation that the graph G L has |L| 3 vertices, we obtain the following corollary.
Corollary 2 For each n ∈ N, there is a planar graph G n on n vertices such that each planar drawing of G n on a grid that minimizes the slope number requires a grid of size 2 2 Ω( 3 We want to point out that giving a reasonable (a.k.a.computable) upper bound on the grid size in the corollary above, is strongly connected with the decidability of ∃Q. and check whether a straight-line drawing with those vertex coordinates gives a drawing of the given slope number.This procedure finds a drawing on the grid that minimizes the planar slope number by the assumption that f gives an upper bound on the grid size of such a drawing.Thus we have just given an algorithm that finds such a drawing of minimum planar slope number on the grid if it exists, which is contradiction to the assumed undecidability of ∃Q by Theorem 2.

Conclusion and open problems.
We have settled the computational complexity of determining the planar slope number.It is an open problem whether the (non-planar) slope number is also ∃R-hard.A further open problem is to give a better bound on the function f (∆) that bounds the planar slope number of graphs of degree ∆.The bound on f (∆) in [13] is exponential in ∆ and uses the non-constructive proof for a touching disc representation, where the radii of touching discs are bounded by a constant factor by [17].They give the idea of a non-deterministic algorithm to obtain a planar drawing using f (∆) slopes.It is open whether the bound can be improved and can be turned in a polynomial algorithm.

Figure 1 :
Figure 1: Opposite edges of a degree 8 vertex in drawing of slope number 4 have the same slope.

Figure 2 :
Figure 2: Adding a star (brown) on each vertex of the black arrangement.

Figure 3 :
Figure 3: Constructing the graph G L from the stars, including the grey intermediate slopes and the red subdivision vertices.

Figure 4 :
Figure 4: A drawing with slope number 8 of G L of the arrangement L in Figure 2.

Figure 5 :
Figure 5: Using the subdivision vertex (red) to close the face cycle with few slopes.

Theorem 5
Assume ∃Q is undecidable.Then there is no computable function f such that every graph G, that has a slope number minimizing drawing on the grid, can be drawn with this slope number on a grid of size f (|V (G)|)×f (|V (G)|).Proof: Assume the function f exists.Then compute f (|V (G)|) and try each combination of coordinates of vertices of G on a grid of size f (|V (G)|)×f (|V (G)|)