Recognizing hyperelliptic graphs in polynomial time
Jelco M. Bodewes, Hans L. Bodlaender, Gunther Cornelissen, Marieke van, der Wegen

TL;DR
This paper introduces an efficient method to recognize hyperelliptic graphs, which are multigraphs of gonality 2, using reduction rules that operate in near-linear time, advancing understanding in graph theory and algorithms.
Contribution
It provides a safe and complete set of reduction rules for identifying hyperelliptic graphs in polynomial time, specifically for three gonality variants.
Findings
Recognition algorithms run in O(n log n + m) time.
Hyperelliptic graphs can be characterized by specific reduction rules.
The approach advances graph recognition techniques for special multigraph classes.
Abstract
Recently, a new set of multigraph parameters was defined, called "gonalities". Gonality bears some similarity to treewidth, and is a relevant graph parameter for problems in number theory and multigraph algorithms. Multigraphs of gonality 1 are trees. We consider so-called "hyperelliptic graphs" (multigraphs of gonality 2) and provide a safe and complete sets of reduction rules for such multigraphs, showing that for three of the flavors of gonality, we can recognize hyperelliptic graphs in O(n log n+m) time, where n is the number of vertices and m the number of edges of the multigraph.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Recognizing Hyperelliptic Graphs in Polynomial Time111An extended abstract is published in Graph-Theoretic Concepts in Computer Science [11]
Jelco M. Bodewes
Gunther Cornelissen Department Informatica, Universiteit Utrecht, Postbus 80.089, 3508 TB Utrecht, Nederland, [email protected], [email protected] Instituut, Universiteit Utrecht, Postbus 80.010, 3508 TA Utrecht, Nederland, [email protected], [email protected]
Hans L. Bodlaender22footnotemark: 2
Marieke van der Wegen33footnotemark: 3
Abstract
Based on analogies between algebraic curves and graphs, Baker and Norine introduced divisorial gonality, a graph parameter for multigraphs related to treewidth, multigraph algorithms and number theory. Various equivalent definitions of the gonality of an algebraic curve translate to different notions of gonality for graphs, called stable gonality and stable divisorial gonality.
We consider so-called hyperelliptic graphs (multigraphs of gonality , in any meaning of graph gonality) and provide a safe and complete set of reduction rules for such multigraphs. This results in an algorithm to recognize hyperelliptic graphs in time , where is the number of vertices and the number of edges of the multigraph. A corollary is that we can decide with the same runtime whether a two-edge-connected graph admits an involution such that the quotient is a tree.
1 Introduction
Motivation
In this paper, we consider a graph theoretic problem that finds its origin in algebraic geometry, and can be formulated in terms of a specific type of graph search, namely monotone chip firing. The case with two chips is of special interest in the application, and we show that we can decide this case in time on a multigraph with vertices and edges.
In algebraic geometry, a special role is played by so-called hyperelliptic curves; these are smooth projective algebraic curves possessing an involution, i.e. an automorphism of order two, for which the quotient is the projective line. Such curves can be described by an affine equation , for some one-variable polynomial without repeated roots. They are widely studied and used, for example in the study of moduli spaces of abelian surfaces, invariants of binary quadratic forms, diophantine problems (finding integer or rational solutions to such equations), and in so-called hyperelliptic curve cryptography (see, e.g., [18] and [33]).
Recognizing hyperelliptic curves is an important, decidable problem in algorithmic algebraic geometry; an algorithm has been implemented when the curve is given by some set of polynomial equations, e.g., in the computer algebra package Magma [16]. No exact runtime analysis is available, but, the method being dependent on Gröbner basis computations, worst-case performance is expected to be more than exponential in the input size.
In recent work of Baker and Norine [7], the notion of a “hyperelliptic graph” was introduced, based on an analogy between algebraic curves and multigraphs. We show that the recognition problem for hyperelliptic graphs can be solved in quasilinear time. This can be applied to the recognition of certain hyperelliptic curves, since if an algebraic curve has a non-hyperelliptic stable reduction graph, the curve itself cannot be hyperelliptic (see [5, 3.5]).
Divisorial gonality
Hyperelliptic graphs are graphs with divisorial gonality at most two. The notion of divisorial gonality has several equivalent definitions; intuitively, we use a chip firing game: we have a graph and some initial configuration that assigns a non-negative number of “chips” to each vertex. We can fire a subset of vertices by moving a chip along each outgoing edge of the subset, if every vertex has sufficiently many chips. We say that an initial configuration reaches a vertex if a sequence of firings results in that vertex having at least one chip. The divisorial gonality of a graph is the minimum number of chips needed for an initial configuration to reach each vertex of the graph. It actually suffices to consider a ‘monotone’ variant of the chip firing procedure, in which the sequence of subsets that are fired to reach a vertex is increasing; this is similar to several other graph search games, where the optimal number of searchers does not increase when we require the search to be monotone, see e.g., [9, 30].
Different notions of graph gonality
An equivalent definition of the gonality of an algebraic curve is the minimal degree of a morphism onto the projective line. A good analogue of this notion for graphs is the so-called stable gonality introduced in [19] as the minimal degree of a harmonic morphism from a refinement of the graph onto a tree (cf. Section 2.2 infra). In contrast to the case of algebraic curves, the stable gonality of a graph is not always equal to its divisorial gonality. In [19], refinements of the graph arises from the theory of reductions of algebraic curves and tropical geometry [1], and it makes equal sense to consider the notion of stable divisorial gonality, defined as the minimal divisorial gonality of a refinement of the graph.
Known results
The termination of similar chip-firing games was discussed by Björner, Lovász and Shor [10]. A polynomial bound on the minimal number of required firings to terminate the Björner, Lovász and Shor-game was given by Tardos [35]. In the guise of “abelian sandpile model”, chip-firing games play an important role in the study of self-organized criticality in statistical physics [4, 21]. The chip firing game introduced by Baker and Norine is relevant for classical combinatorial problems about graphs, relating to spanning trees [17], the uniqueness of graph involutions [7], and potential theory on electrical network graphs [8].
In [24], a lower bound for the divisorial gonality of a graph is given in terms of its expansion. The gonality of a graph (in any sense) is larger than or equal to its treewidth [23]. Since treewidth is insensitive to the presence of multiple edges while gonality is not, the parameters are different; actually, they are not “tied” in the sense of Norin [32]; for example, there exists with but arbitrarily high [29]. The relation between the various notions of gonality is expounded in [25, Section 1 and 5].
We study the all three kinds of gonality of graphs from the point of view of computational complexity. The analogous problem of computing the gonality of an algebraic curve is decidable [34]. From the definition of divisorial gonality, it follows that divisorial gonality is computable. For stable gonality and stable divisorial gonality, this does not follow from the defintion, but both notions are computable as well [26], [15]. We know that treewidth is FPT, and that computing all three kinds of gonality is NP-hard and APX-hard [25]. Moreover, divisorial gonality is in XP [22, Section 5].
Our results
Our main result is the following.
Theorem A** (=Theorem 6.1).**
There is an algorithm that decides whether a graph is hyperelliptic in time.
To obtain our algorithm, we provide a safe and complete set of reduction rules. We do this for all three notions of gonality. Similar to recognition algorithms for graphs of treewidth or (see [2]), in our algorithm the rules are applied to the graph until no further rule application is possible; we decide positively if and only if this results in the empty graph. One novelty is that some of the rules introduce constraints on pairs of vertices, which we model by colored edges. To deal with the fact that some of the rules are not local, we use a data structure that allows us to find an efficient way of applying these rules, leading to the stated running time.
Application to detecting special involutions on graphs
There is no known polynomial time algorithm for the graph automorphism problem, the question whether a graph admits a non-trivial automorphism, a problem that is known to be in NP; recently, a quasi-polynomial time algorithm was given by Babai [3] (compare [28]).
The question of the computational complexity of the problem is know to be very sensitive to alterations of the question. For example, deciding whether a graph has a fixed point free automorphism of order two is NP-complete (see Lubiw [31]). Our main result implies the following result as corollary.
Corollary A** (=Corollary 6.4).**
There is an algorithm that, given a two-edge-connected graph , decides in time whether admits an involution such that the quotient is a tree.
Relation to number theory
We briefly elucidate the relevance of gonality for number theoretical problems. This paragraph can safely be skipped, but provides some motivation for the interest in computing gonality of graphs.
If an algebraic curve is defined over the rational numbers and has gonality , then we have a so-called “uniform boundedness” result for : the total number of points on with coordinates in any number field of degree , is finite. Now the gonality of is bounded below by the gonality of the dual graph of a reduction of the curve modulo a prime [19, §11]. We illustrate this with an example.
For a prime number , consider the algebraic curve in the -plane over the field of rational numbers . Reducing the curve modulo , the equation becomes a union of lines (see also Figure 1). The intersection dual graph is given by a vertex for each component of this reduction, where two vertices are connected by an edge if and only if the corresponding components intersect; in the example, it is the complete bipartite graph . The stable gonality of is (since and there is an obvious map of degree from to a tree, see Section 2.2). From [19, 4.5 & 11.1] one concludes that the set is finite, where runs over all the (infinitely many for ) number fields of degree bounded above by .
2 Preliminaries
Whenever we write “graph” we refer to a multigraph , where is the set of vertices and is a multiset of edges.
Let be a graph and and two vertices. Let be the connected component of that contains . By we denote the induced subgraph of on .
2.1 Divisorial Gonality
There is a number of different definitions of divisorial gonality. The one we use is shown to be equivalent to the chip firing procedure without the ‘monotonicity’ property by [22]. The definition given here allows us to prove correctness of the reduction rules in our algorithm, and avoids more heavy algebraic terminology.
A divisor in a graph is a mapping (a divisor represents a distribution of chips, see Section 1). We call a divisor effective (notation ) if for all . The degree, , of a divisor equals .
Given an effective divisor and a set of vertices , we call valid for , if for each , (i.e., has at least as many chips as it has neighbors in ). If is valid for , we can fire starting from , this yields another divisor: for , is decreased by the number of edges from to , and for , is increased by the number of edges from to . Intuitively, firing means moving a chip along all edges from to . Note that the divisor obtained by firing is effective as well.
We call two effective divisors and equivalent, in notation , if there is a sequence of subsets , such that for all the set can be fired when are fired starting from , and the divisor obtained by firing is . This defines an equivalence relation on the set of effective divisors [22, Chapter 3]. For two equivalent effective divisors and , we call the difference of functions the transformation from to , and the sequence the level set decomposition of this transformation. This level set decomposition is unique [22, Remark 3.8].
We say that an effective divisor reaches a vertex , if there exists a such that and . The divisorial gonality, , of a graph is the minimum degree of an effective divisor that reaches each vertex of .
Example 2.1**.**
Let be a tree. Then has divisorial gonality 1. Let be a vertex of and consider the divisor with and for all . This divisor has degree 1 and reaches each vertex of : Let be a vertex of . Let be the first edge on the unique path from to . Let be the component that contains of the cut induced by . Firing yields the divisor and for all , thus we moved a chip from to . Repeating this process yields a divisor with a chip on .
Example 2.2**.**
Let be a cycle, then has divisorial gonality 2. First note that every set of vertices of induces a cut of size at least 2. Hence for all degree 1 divisors, there are no valid sets. Hence a degree 1 divisor does not reach every vertex. To see that there is a divisor with 2 chips that reaches every vertex, number the vertices and consider the divisor with a chip on and a chip on . To reach a vertex with , fire the set for . Analogous for a vertex with .
Example 2.3**.**
Consider the graph in Figure 2. This graph has treewidth 1 and divisorial gonality 3. A divisor that reaches all vertices either has a chip on and 2 more chips to reach both and , or has at least 3 chips to move along the three edges from to . See also [19, Table 3].
Example 2.4**.**
Consider the graph in Figure 3. This graph has treewidth 2 and divisorial gonality 3. A divisor that reaches all vertices needs two chips to traverse the left cycle and 2 chips to traverse the right cycle. But we cannot move two chips from to , so these two chips on the left side cannot be the same as the two on the right side. Hence we need at least three chips.
For a disconnected graph, the divisorial gonality is equal to the sum of the divisorial gonalities of the connected components.
2.2 Stable Gonality
We define stable gonality as in [19, Definition 3.6].
Definition 2.5**.**
Let and be graphs. A finite morphism is a map such that
- (i)
, 2. (ii)
for all ,
together with, for every , an “index” .
Definition 2.6**.**
We call a finite morphism harmonic if for every it holds that for all
[TABLE]
We write for this sum.
Definition 2.7**.**
The degree of a finite harmonic morphism is
[TABLE]
for , . This is independent of the choice of or ([6], Lemma 2.4).
Example 2.8**.**
For a tree we can use the identity map , and assign index 1 to all edges, to obtain a finite harmonic morphism. This morphism has degree .
Example 2.9**.**
Consider the graph in Figure 4. Assign index 2 to the edge , and 1 to the other edges. Map this graph to a path on 4 vertices. This yields a finite harmonic morphism of degree .
We can now proof a lemma about finite harmonic morphisms, that we will need in Section 4.
Lemma 2.10**.**
Let be a graph, and a finite harmonic morphism of degree 2. If , then .
Proof.
Notice that . Let be an edge incident to . By harmonicity, there is exactly one edge such that is incident to and . On the other hand every edge that is incident to is mapped to an edge that is incident to . So we conclude that . Analogously we find that . Since , it follows that . ∎
Before we can define the stable gonality of a graph, we need one last definition: the notion of refinements.
Definition 2.11**.**
A graph is a refinement of if can be obtained by applying the following operations finitely many times to .
- (i)
Add a leaf, i.e. a vertex of degree 1; 2. (ii)
subdivide an edge by adding a vertex.
We call a vertex of from which there are two disjoint paths to vertices of , internal added vertices, we call the other vertices of external added vertices.
Definition 2.12**.**
The stable gonality of a graph is
[TABLE]
Example 2.13**.**
As we have seen in Example 2.8, for a tree . On the other hand, if is not a tree, then any refinement of contains a cycle. Such a cycle cannot be mapped to a tree injectively. Thus if is not a tree.
Since the graph in Figure 4 is not a tree and we have seen a morphism of degree in Example 2.9, we conclude that .
Example 2.14**.**
Consider the graph of Example 2.4, see Figure 3. This graph has stable gonality 2. Add a vertex to the edge , a vertex to left triangle and a vertex to the right triangle. This refinement can be mapped to a path on 7 vertices, where is mapped to the third vertex and to the fifth vertex of the path. If we assign index to all edges, this is a finite harmonic morphism of degree 2.
For a disconnected graph its stable gonality is defined to be the sum of the stable gonalities of its components.
2.3 Stable Divisorial Gonality
We can combine the previous two notion of gonality, first refine a graph and then consider the divisorial gonality, to obtain a third notion of gonality: stable divisorial gonality.
Definition 2.15**.**
The stable divisorial gonality of is
[TABLE]
Example 2.16**.**
Consider the graph of Example 2.4, see Figure 3. This graph divisorial gonality , but stable divisorial gonality 2. This is because we can refine to a graph with divisorial gonality 2: add a vertex to the edge (see Figure 6. A divisor with chips on vertex reaches all vertices.
For a disconnected graph its stable divisorial gonality is defined to be the sum of the stable divisorial gonalities of its components.
2.4 Reduction Rules, Safeness and Completeness
A reduction rule is a rule that can be applied to a graph to produce a smaller graph. Our final goal with the set of reduction rules is to show that it can be used to characterize the graphs in a certain class, that of the graphs with divisorial gonality two, that of the graphs with stable gonality two, and that of graphs with stable divisorial gonality two, by reduction to the empty graph. For this we need to make sure that membership of the class is invariant under our reduction rules.
Definition 2.17**.**
Let be a rule and be a set of reduction rules. Let be a class of graphs. We call safe for if for all graphs and such that can be produced by applying rule to it follows that . We call safe for if every rule in is safe for .
Apart from our rule sets being safe, we also need to know that, if a graph is in our class, it is always possible to reduce it to the empty graph.
Definition 2.18**.**
Let be a set of reduction rules and be a class of graphs. We call complete for if for any graph it holds that can be reduced to the empty graph by applying some finite sequence of rules from .
For any rule set that is both complete and safe for the rule set is suitable for characterizing : a graph can be reduced to the empty graph if and only if is in . Additionally it is not possible to make a wrong choice early on that would prevent the graph from being reduced to the empty graph: if and can be reduced to , then can be reduced to the empty graph.
These properties ensure that we can use the set of reduction rules to create an algorithm for recognition of the graph class.
2.5 Constraints
In the process of applying reduction rules to a graph, we will need to keep track of certain restrictions otherwise lost by removal of vertices and edges. We will maintain these restrictions in the form of a set of pairs of vertices, called constraints, and then extend the notions of gonality to graphs with constraints.
Definition 2.19**.**
Given a graph , a constraint on is an unordered pair of vertices , usually denoted as , where and can be the same vertex.
A graph with contraints consists of a graph and a set of constraints . Constraints are, like edges, pairs of vertices, so we can consider them as an extra set of edges. The conditions that a constaint places on the divisors and firing sets for divisorial gonality and the morphisms for stable gonality, are described in Sections 3 and 4, respectively.
3 Reduction Rules for Divisorial Gonality
We will now show that there exists a set of reduction rules that is safe and complete for the class of graphs with divisorial gonality at most two. We will assume that our graph is loopless and connected. Loops can simply be removed from the graph since they never impact the divisorial gonality and a disconnected graph has divisorial gonality two or lower exactly when it consists of two trees, which can easily be checked in linear time.
Constraints for Divisorial Gonality
Checking whether a graph has gonality two or lower is the same as checking whether there exists a divisor on our graph with degree two that reaches all vertices. Our constraints place restrictions on what divisors we consider, as well as what sets we are allowed to fire.
Definition 3.1**.**
Given a graph with set of constraints , and two equivalent effective divisors and . We call and -equivalent (in notation ), if for every set of the level set decomposition of and every constraint , either or .
Note that this defines a finer equivalence relation. Now we can extend the definition of reach using -equivalence: a divisor reaches a vertex , if there exists a such that and .
Definition 3.2**.**
Given a graph with a set of constraints . A divisor satisfies if for every constraint there is a divisor such that and if and if .
Definition 3.3**.**
Given a graph with constraints , we call a divisor suitable if it is effective, has degree , reaches all vertices using the -equivalence relation and satisfies all constraints in .
Definition 3.4**.**
We will say that a graph with constraints has divisorial gonality or lower if it admits a suitable divisor. Note that for a graph with no constraints this is equivalent to the usual definition of divisorial gonality or lower. We will denote the class of graphs with constraints that have divisorial gonality two or lower as .
Constraints & Cycles
It will be useful to determine when constraints are non-conflicting locally:
Definition 3.5**.**
Let be a cycle in a graph with constraints . Let be the subset of the constraints that contain a vertex in . We call the constraints compatible if the following hold.
- (i)
If then both and . 2. (ii)
For each and , the divisor given by assigning a chip to and must be equivalent to the one given by assigning a chip to and on the subgraph consisting of .
The Reduction Rules
We are given a connected loopless graph and a yet empty set of constraints . The following rules are illustrated in Figure 3, where a constraint is represented by a red dashed edge.
We start by covering the two possible end states of our reduction:
Rule .
Given a graph consisting of exactly one vertex, remove that vertex.
Rule .
Given a graph consisting of exactly two vertices, and , connected to each other by a single edge, and , remove both vertices.
Next are the reduction rules to get rid of vertices with degree one. These rules are split by what constraint applies to the vertex:
Rule .
Let be a leaf, such that has no constraints in . Remove .
Rule .
Let be a leaf, such that its only constraint in is . Let be its neighbor. Remove and add the constraint if it does not exist yet.
Rule .
Let be a leaf, such that its only constraint in is , where is another leaf, whose only constraint is also . Let be the neighbor of and be the neighbor of (these can be the same vertex). Then remove and and add the constraint if it does not exist yet.
Finally we have a set of reduction rules that apply to cycles containing at most vertices with degree greater than two. The rules themselves are split by the number of vertices with degree greater than two.
Rule .
Let be a cycle of vertices with degree two. If the set of constraints on is compatible, then replace by a new single vertex.
Rule .
Let be a cycle with one vertex with degree greater than two. If the set of constraints on plus the constraint is compatible, then remove all vertices except in and add the constraint if it does not exist yet.
Rule .
Let be a cycle with two vertices and of degree greater than two. If there exists a path from to that does not share any edges with and the set of constraints on plus the constraint is compatible, then remove all vertices of except and , remove all edges in and add the constraint if it does not exist yet.
The reference list from the paper itself. Each links out to its DOI / PubMed record.
- 1[1] Omid Amini, Matthew Baker, Erwan Brugallé, and Joseph Rabinoff. Lifting harmonic morphisms II: Tropical curves and metrized complexes. Algebra Number Theory , 9(2):267–315, 2015.
- 2[2] Stefan Arnborg and Andrzej Proskurowski. Characterization and recognition of partial 3 3 3 -trees. SIAM J. Algebraic Discrete Methods , 7(2):305–314, 1986.
- 3[3] László Babai. Graph isomorphism in quasipolynomial time [extended abstract]. In Proceedings of the Forty-eighth Annual ACM Symposium on Theory of Computing , STOC ’16, pages 684–697, 2016. Extended abstract of ar Xiv: 1512.03547 v 2.
- 4[4] Per Bak, Chao Tang, and Kurt Wiesenfeld. Self-organized criticality. Phys. Rev. A , 38(1):364, 1988.
- 5[5] Matthew Baker. Specialization of linear systems from curves to graphs. Algebra Number Theory , 2(6):613–653, 2008. With an appendix by Brian Conrad.
- 6[6] Matthew Baker and Serguei Norine. Riemann-Roch and Abel-Jacobi theory on a finite graph. Adv. Math. , 215(2):766–788, 2007.
- 7[7] Matthew Baker and Serguei Norine. Harmonic morphisms and hyperelliptic graphs. Int. Math. Res. Not. IMRN , 15:2914–2955, 2009.
- 8[8] Matthew Baker and Farbod Shokrieh. Chip-firing games, potential theory on graphs, and spanning trees. J. Combin. Theory Ser. A , 120(1):164–182, 2013.
