Stable divisorial gonality is in NP

Divisorial gonality and stable divisorial gonality are graph parameters, which have an origin in algebraic geometry. Divisorial gonality of a connected graph $G$ can be defined with help of a chip firing game on $G$. The stable divisorial gonality of $G$ is the minimum divisorial gonality over all subdivisions of edges of $G$. In this paper we prove that deciding whether a given connected graph has stable divisorial gonality at most a given integer $k$ belongs to the class NP. Combined with the result that (stable) divisorial gonality is NP-hard by Gijswijt, we obtain that stable divisorial gonality is NP-complete. The proof consist of a partial certificate that can be verified by solving an Integer Linear Programming instance. As a corollary, we have that the number of subdivisions needed for minimum stable divisorial gonality of a graph with $n$ vertices is bounded by $2^{p(n)}$ for a polynomial $p$.

). Baker and Norine introduced divisor theory on graphs in [3]. The notion of divisorial gonality was introduced by Baker [4], under the name gonality. As there are several different notions of gonality in use (cf. [4][5][6]), we add the term divisorial, following [5]. See [6,Appendix A] for an overview of the different notions.
Divisorial gonality and stable divisorial gonality have definitions in terms of a chip firing game. In this chip firing game, played on a connected multigraph G = (V , E), each vertex has a number of chips. When we fire a vertex v ∈ V , we move a chip from vertex v over each edge with v as endpoint. Vertex v has its number of chips decreased by the degree of v, and each neighbour u of v has its number of chips increased by the number of edges from v to u. The divisorial gonality of a connected graph G can be defined as the minimum number of chips in an initial assignment of chips (called divisor) such that for each vertex v ∈ V , there is a sequence of firing moves resulting in at least one chip on v and a non-negative number of chips on the other vertices. See Section 2 for precise definitions.
A variant of divisorial gonality is stable divisorial gonality. The stable divisorial gonality of a graph is the minimum of the divisorial gonality over all subdivisions of a graph; we can subdivide the edges of the graph any nonnegative number of times. (In the application in algebraic geometry, the notion of refinement is used. Here, we can subdivide edges but also add new degree-one vertices to the graph in a refinement, but as this never decreases the number of chips needed, we can ignore the possibility of adding leaves. Thus, we use subdivisions instead of refinements.) It is known that treewidth is a lower bound for stable divisorial gonality [7]. The stable divisorial gonality of a graph is at most the divisorial gonality, but this inequality can be strict, see for example [8,Figure 2].
In this paper, we study the complexity of computing the stable divisorial gonality of graphs: i.e., we look at the complexity of the STABLE DIVISORIAL GONALITY problem: given an undirected graph G = (V , E) and an integer k, decide whether the stable divisorial gonality of G is at most k. It was shown in [9] that divisorial gonality is NP-complete. The same reduction gives that stable divisorial gonality is NP-hard. However, membership of stable divisorial gonality in NP is not trivial: it is unknown how many subdivisions are needed to obtain a subdivision with minimum divisorial gonality. In particular, it is open whether a polynomial number of edge subdivisions are sufficient.
In this paper, we show that stable divisorial gonality belongs to the class NP. We use the following proof technique, which we think is interesting in its own right: we give a partial certificate that describes some divisors. Checking whether those divisors are equivalent is non-trivial, but can be done by solving an integer linear program. Membership in NP follows by adding a certificate for the derived ILP instance to the partial certificate that describes the divisors. As a corollary, we have that the total number of subdivisions needed for minimum stable divisorial gonality of a graph with m edges is at most m O(mn) .
We finish this introduction by giving an overview of the few previously known results on the algorithmic complexity of (stable) divisorial gonality. Bodewes et al. [8] showed that deciding whether a graph has (stable) divisorial gonality at most 2 can be done in O(n log n + m) time. From [10] and [11], it follows that divisorial gonality belongs to the class XP, i.e. there is an algorithm that decides in time It is open whether stable divisorial gonality is in XP. NP-hardness of the notions was shown in [9].

Preliminaries
In this paper, we assume that each graph is a connected undirected multigraph, i.e., we allow parallel edges. In the algebraic number theoretic application of (stable) divisorial gonality, graphs can also have selfloops (edges with both endpoints at the same vertex), but as the (stable) divisorial gonality of graph does not change when we remove selfloops, we assume that there are no selfloops (see the end of this section). For a graph G, we will denote by n its number of vertices and by m the number of edges.
A divisor D is a vector in Z V (G) . We can consider a divisor D as a function D : V (G) → Z, which is an assignment of chips to vertices, each vertex v having D(v) chips. The degree of a divisor is the total number of chips on the graph: We will define an equivalence relation on the set of divisors. The Laplacian matrix L is defined as follows: An equivalent definition can be given using a notion of firing vertices. When we fire a vertex v, we move chips from v to its neighbours along its incident edges: starting from a divisor D, we obtain a new divisor, where D(v) is decreased by the degree of v and for all neighbours u of v the value D(u) is increased by the number of edges from v to u. Two divisors D and D are equivalent if D can be transformed into D by firing vertices. This is indeed equivalent to the definition above: f describes how often every vertex is fired.
The divisorial gonality dgon(G) of a graph G is the minimum number k such that there exists a divisor D with degree k that reaches all vertices of G. Since D is equivalent to an effective divisor, we can assume D to be effective.
A subdivision of a graph G is a graph H obtained from G by applying the following operation a nonnegative number of times: take an edge between two vertices v and w and replace this edge by two edges to a new vertex x.
The stable divisorial gonality sdgon(G) of a graph G is the minimum number k such that there exist a subdivision H of G and a divisor D on H with degree k that reaches all vertices of H . That is, the stable divisorial gonality of a graph G is the minimum divisorial gonality over all subdivisions of G.
Instead of subdivisions, we can use refinements where we allow that we add subdivisions and trees, i.e., we can repeatedly add new vertices of degree one. But since the stable divisorial gonality does not change when adding a vertex with degree one, we only consider subdivisions.
As mentioned before, we remove selfloops of a graph, as that will not change the stable divisorial gonality. Now that we have seen the definition of stable divisorial gonality we can give a short argument why this holds. Notice that there will never be chips fired along a selfloop, so removing a selfloop will not change the divisorial gonality of a graph. A loop can be subdivided into a cycle however, but this will not decrease the divisorial gonality of the graph. Suppose that G has a loop at vertex v, and that H is the refinement of G at which the stable divisorial gonality is attained by a divisor D. If the selfloop is subdivided, let D ∼ D be a divisor with as few chips on the subdivisions of the loop as possible, that is, with at most 1 chip in total on the vertices that are added to the selfloop. Notice that D reaches all vertices of H . If we remove the subdivided selfloop from H , firing the same vertices will yield the same result, with possibly some more chips on vertex v. Hence, D still reaches all vertices. We conclude that the stable divisorial gonality does not increase by removing the selfloops of G.

Equivalence
In this section we will discuss a condition for two divisors to be equivalent. This section is based on a result in [7, Section 4], but given its relevance for this paper, we will explain it here.
Recall that two divisors are equivalent if there exists a vector f ∈ Z V (G) such that D − D = Lf . We can consider f as a function V (G) → Z; f describes for every vertex the number of times this vertex is fired. In this section we will show that we can find an equivalent definition using a function g : E(G) → Z, which describes for every edge how many chips are moved along that edge.
For an edge uv, we will need to know whether g(uv) describes the number of chips that moves from u to v, or the other way around. For this, we need an orientation of the edges.
Let G = (V , E) be a graph. Assign to every edge e of G an arbitrary orientation σ (e). For every cycle C, and every edge e ∈ E let Analogously, we define σ P (e) for every path P . If a path P consists of a single edge uv, we write σ uv (e) for σ P (e). So, The following lemma is know as Kirchhoff's potential law, see [12, pages 40, 297]. We include a proof, so that this paper is more self-contained. Proof We define a function f as follows: Pick a vertex v ∈ V , and set f (v) = a for some a ∈ Z. For u ∈ V , let P be a path from v to u and set Notice that for f holds that This function f is well-defined if and only if for all paths P and Q from v to u, it holds that Hence, if and only if e∈P g(e)σ P (e) + e∈Q g(e) · −σ Q (e) = 0.
Since P followed by Q is reversed order forms a cycle, f is well-defined if and only if for every cycle C: e∈C g(e)σ C (e) = 0. (1) Since every cycle is the sum of some fundamental cycles, we conclude that f is well-defined if and only if (1) holds for every fundamental cycle C.
Now we can provide an equivalent definition for two divisors to be equivalent.  We now define the function g , this will describe how many chips move over edge e in the forward direction. Let e ∈ E(H ) and suppose that edge e is directed from u to v, set g (e) = f (u) − f (v). Notice that −k ≤ g (e) ≤ k, since there can move at most k chips along each edge. By Lemma 3.1, it follows that for every fundamental cycle C it holds that e∈C g (e)σ C (e) = 0.
Let e = uv be an edge of G, that is subdivided in e 1 , e 2 , . . . , e r edges in H . Let w ∈ V \ V be a vertex that is added to this edge, and let e i and e i+1 be its incident edges. Since D and D are divisors on G, we see that D (w) = D(w) = 0. It follows that g (e i ) = g (e i+1 ). So for every edge e of G, that is subdivided in e 1 , e 2 , . . . , e r edges in H , it holds that g (e 1 ) = g (e 2 ) = . . . = g (e r ). Define the function g : By the definition of g and the cycle condition (4) for g , it follows that for every fundamental cycle C it holds that e∈C g(e)l(e)σ C (e) = 0.
For the other direction, suppose that there exists a function g : E(G) → Z, that satisfies the conditions (2)

It remains to check that
For v ∈ V (G), we see that (uv).
. We conclude that D and D are equivalent in H .

A Certificate
Assume that we are given a yes-instance (G, k) of the problem. Without loss of generality, we assume that k ≤ n. There exists a subdivision H and an effective divisor D on H with k chips that reaches all vertices. We do not know whether the number of subdivisions in H is polynomial in the size of the graph, i.e. in the number of vertices and edges of the graph, so we cannot include H in a polynomial certificate for this instance. But the chips in D can be placed on added vertices of H , so we cannot include D in our certificate either. However, we can include a polynomial subdivision of G. We will choose a subdivision that allows us to include D as well.

Lemma 4.1 Let G be a graph with n vertices and stable divisorial gonality at most
k. There exists a subdivision G of G, such that 1. The number of vertices of G is at most n + k(n + 1), i.e., G is obtained from G by adding at most k(n + 1) subdivision vertices.

There is a subdivision H of G , such that there is an effective divisor D on H with k chips that reaches all vertices and has only chips on vertices of G . Moreover, for all vertices v ∈ V (G), there is an effective divisor D v on H with D ∼ D v with at least one chip on v and only chips on vertices of G .
Proof Since G has stable divisorial gonality at most k, there exists a subdivision H and an effective divisor D on H with k chips that reaches all vertices. For every vertex v ∈ V (G), let D v be an effective divisor on H such that D v ∼ D and that has a chip on vertex v. Now define U ⊆ V (H ) as Let G be the subdivision of G that contains all the vertices of U . Notice that H is a subdivision of G , and that the divisors D and D v only have chips on G .
Notice that U contains at most (n + 1)k vertices, since we take the union over n + 1 divisors, which each have k chips. So the number of vertices of G is at most n + k(n + 1).

Remark 4.2
Notice that the divisor D could be chosen to be equal to one of the divisors D v . In that case, U would contain at most kn vertices, and the number of vertices of G would be improved to n + kn.
This subdivision G is the first ingredient of our polynomial certificate. The second ingredient is the divisor D, and the third ingredient all divisors D v .
We now need to extend the certificate so that we can check in polynomial time whether there is a subdivision H of G such that for all v it holds that D ∼ D v in H . To this end, we will check whether the conditions (2) and (3)  Since integer linear programming is in NP, we know that if there is a solution to I, then there is a certificate D for the ILP instance that is polynomial in the size of I. Since I is polynomial in the size of G , this certificate is polynomial in the size of G as well. In order to obtain a certificate for the STABLE DIVISORIAL GONALITY problem, we include this certificate for I in the certificate for STABLE DIVISORIAL GONALITY.
To conclude, a certificate for the STABLE DIVISORIAL GONALITY problem consists of • a subdivision G of G, • an orientation σ of the edges of G , • a function g v for every v ∈ V (G), and • a certificate for the integer linear program I.
We can check the correctness of the certificate by checking whether the integer linear program I is satisfied and whether for every v ∈ V (G) and w ∈ V (G ) the equation (uw) holds. This can be done in polynomial time, since there is a polynomial number of equations to check.

Correctness
It remains to prove that there exists a certificate C if and only if sdgon(G) ≤ k. Choose an arbitrary orientation σ of the edges of G . Since D ∼ D v for every vertex v ∈ V (G), by Lemma 3.2 there exist functions g v : E(G ) → Z such that for every w ∈ V (G ) holds (D v − D)(w) = u∼w g v (uw)σ wu (uw) and for every fundamental cycle C holds e∈C g v (e)l(e)σ C (e) = 0. Now consider the integer linear program I with a variable l e for every edge e ∈ E(G ), and inequalities l e ≥ 1 and for every fundamental cycle C of G equations e∈C g v (e)l e σ C (e) = 0 for all v ∈ V (G). Notice that the number of equations is polynomial, since there are m−n+ 1 fundamental cycles. We know that l(e) is a solution to this integer linear program. As ILP's have certificates with polynomially many bits (see e.g., [13]), there exists a polynomial certificate for this program. This yields a polynomial certificate for STABLE DIVISORIAL GONALITY.
We illustrate this proof with an example. Fig. 1a. Consider the subdivision in Fig. 1b and the divisor D with 5 chips on u. This divisor is equivalent to the divisors D v and D w in Fig. 1a and f. The graph G in the certificate is the graph in Fig. 1e. Orient e 1 from u to y, e 2 from y to v, e 3 from u to v and e 4 from v to w. The corresponding functions are: g u (e 1 ) = 0, g u (e 2 ) = 0, g u (e 3 ) = 0, g u (e 4 ) = 0

Example 5.2 Consider the graph in
The only cycle in G is e 1 , e 2 , e 3 , so the integer linear program I is: l e 4 ≥ 1 0 · l e 1 + 0 · l e 2 + 0 · l e 3 = 0 3 · l e 1 + 3 · l e 2 + −2 · l e 3 = 0 2 · l e 1 + 1 · l e 2 + −1 · l e 3 = 0 A solution to this program is l e 1 = l e 2 = l e 4 = 1 and l e 3 = 3. This completes the certificate. Let w ∈ V (H ) be a vertex which is added to an edge uv of G. Either a chip is fired along e to go from D u to D v , or there is a divisor D uv ∼ D with a chip on u and a chip on v. In both cases we see that D reaches w. So D reaches all vertices of H . We conclude that sdgon(G) ≤ k.
By Lemmas 5.1 and 5.3, the problem whether a given graph has divisorial gonality at most a given integer k has a polynomial certificate, which gives our main result.

Theorem 5.4 STABLE DIVISORIAL GONALITY belongs to the class NP.
Combined with the NP-hardness of STABLE DIVISORIAL GONALITY by Gijswijt et al. [9], this yields the following result.

A Bound on Subdivisions
In this section, we give as corollary of our main result a bound on the number of subdivisions needed. We use the following result by Papadimitriou [13]. Proof Let n be the number of vertices in G and m the number of edges in G . We have n ≤ n + k(n + 1), and m ≤ m + k(n + 1), with n the number of vertices of G and m the number of edges of G.
By Lemma 5.1, we know that there is a certificate whose corresponding ILP has a solution. The values l e in this solution give the number of subdivisions of edges in G . If we have an upper bound on the number of subdivisions per edge needed to obtain H from G , say α, then (k(n + 1) + 1)α + k(n + 1) is an upper bound on the number of subdivisions per edge to obtain H from G. Applying Theorem 6.1 to the ILP gives such a bound, as described below.
The ILP has at most m variables of the form l e . The number of inequalities in the ILP is linear in the number of variables. An inequality can be replaced by an equation by adding one variable. This gives a total of 2m = O(m + kn) variables. For every edge of G we have an equation. In addition, for every vertex v ∈ V (G) and every fundamental cycle of G , we have an equation. So, the total number of equations is m +n(m−n+1). Note that m +n(m−n+1) = O(mn); as G is connected, n ≤ m+1 and k ≤ n. Also, note that all values in matrix A and vector b are between −k and k, i.e., we can set a = k in the application of Theorem 6. We know that there is at least one certificate with a solution, so we can bound the number of subdivisions of G by m O(mn) . This gives that the number of subdivisions per edge of G is at most

Conclusion
In this paper, we showed that the problem to decide whether the stable divisorial gonality of a given graph is at most a given number k belongs to the class NP. Together with the NP-hardness result of Gijswijt et al. [9], this shows that the problem is NP-complete. We think our proof technique is interesting: we give a certificate that describes some of the essential aspects of the firing sequences; whether there is a subdivision of the graph for which this certificate describes the firing sequences and thus gives the subdivision that reaches the optimal divisorial gonality can be expressed in an integer linear program. Membership in NP then follows by adding the certificate of the ILP to the certificate for the essential aspects.
As a byproduct of our work, we obtained an upper bound on the number of subdivisions needed to reach a subdivision of G whose divisorial gonality gives the stable divisorial gonality of G. Our upper bound still is very high, namely exponential in a polynomial of the size of the graph. An interesting open problem is whether this bound on the number of needed subdivisions can be replaced by a polynomial in the size of the graph. Such a result would give an alternative (and probably easier) proof of membership in NP: first guess a subdivision, and then guess the firing sequences.
There are several open problems related to the complexity of computing the (stable) divisorial gonality of graphs. Are these problems fixed parameter tractable, i.e., can they be solved in O(f (k)n c ) time for constant c and some function f that depends only on k? Or can they be proven to be W [1]-hard, or even, is there a constant c, such that deciding if stable divisorial gonality of a given graph G is at most c is already NP-complete? Also, how well can we approximate the divisorial gonality or stable divisorial gonality of a graph?