\section{Gonality Sequences}

We define the \textbf{gonality sequence} of a graph to be its complete set of $k$-th gonalities for $k \in \mathbb{Z}_{>0}$. In this section, we first show that, using no more than the tools we have already developed, we can completely determine all possible gonality sequences for graphs of low genus. We then provide the complete gonality sequence for graphs of first gonality 1 and 2, as well as a conjecture regarding the gonality sequence for graphs of first gonality 3. 

\subsection{Classification by Genus}

All graphs of genus $g(G) = 0$ are trees. We have shown that $\gon_k(G) = k$ for all of these graphs. Note that this result also comes as a direct consequence of Lemma \ref{genus}.

\begin{proposition}
All graphs of genus $1$ have gonality sequence
\[
\gon_k(G) = k + 1.
\]
\end{proposition}

\begin{proof}
This is an immediate corollary of Lemma \ref{genus}.
\end{proof}

Note that Corollary \ref{cycle} can be immediately deduced from this result.

\begin{proposition}
All graphs of genus $2$ have gonality sequence
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
k + 2 \quad &\text{otherwise.}
\end{cases}
\]
\end{proposition}

\begin{proof}
By Riemann-Roch, every genus $2$ graph has a canonical divisor $K$ with $\deg(K) = 2$ and $r(K) = 1$. Hence, $\gon_1(G) \leq 2$, and \sout{by} {\color{red}using} Lemma \ref{tree}, we know that $\gon_1(G) = 2$. The higher gonalities follow as a consequence of Lemma \ref{genus}.
\end{proof}

\begin{proposition}
All graphs of genus $3$ have one of the two following gonality sequences:
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
k + 3 \quad &\text{otherwise,}
\end{cases}
\qquad \text{or} \qquad 
\gon_k(G) = \begin{cases}
3 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
k + 3 \quad &\text{otherwise}.
\end{cases}
\]
\end{proposition}

\begin{proof}
Clearly, $\gon_1(G) \geq 2$. By Corollary \ref{brillnoether}, the first gonality is bounded above by $\left\lfloor \frac{g+3}{2} \right\rfloor = 3$. Notice that all gonalities starting with $\gon_3(G)$ and onwards are determined by Lemma \ref{genus}. Using Lemma \ref{sum}, we can eliminate the following possibilities: $\gon_1(G) = 2$ and $\gon_2(G) = 3$, and $\gon_1(G) = 2$ and $\gon_2(G) = 5$. {\color{red}Flush out more...} Furthermore, we \sout{can also} eliminate the case where $\gon_1(G) = 3$ and $\gon_2(G) = 5$, using the fact that {\color{red}by Reimann-Roch \ref{RR}?} the canonical divisor $K$ has $\deg(K) = 4$ and $r(K) = 2$. Hence, we are left with the two aforementioned gonality sequences.
\end{proof}

{\color{red}Use remark environment?}
\textit{Note.} To see that both of these two gonality sequences can actually occur in graphs of genus $3$, note that the first is the gonality sequence of the complete bipartite graph $K_{2,4}$ and the second is the gonality sequence of the complete graph $K_4$ (see Figure \ref{highergen3}).

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.2]{highergongenus3-2.png}
    \caption{Genus $3$ graphs with two different gonality sequences}
    \label{highergen3}
\end{figure}

\begin{proposition}
All graphs of genus $4$ have one of the two following gonality sequences:
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
6 \quad &\text{if $k = 3$} \\
k + 4 \quad &\text{otherwise}
\end{cases}
\qquad \text{or} \qquad 
\gon_k(G) = \begin{cases}
3 \quad &\text{if $k = 1$} \\
5 \quad &\text{if $k = 2$} \\
6 \quad &\text{if $k = 3$} \\
k + 4 \quad &\text{otherwise}.
\end{cases}
\]
\end{proposition}

\begin{proof}
Notice that for $k \geq 4$, it is clear that $\gon_k(G) = k + 4$ by Lemma \ref{genus}. We also note that by Corollary \ref{brillnoether}, the first gonality is at most $\lfloor \frac{g+3}{2} \rfloor = 3$. \sout{Using}{\color{red}In light of} Lemma \ref{strict}, we can enumerate all possible sequences of the first three terms satisfying these conditions:

\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
$2,3,4$ & $2,3,5$ & $2,3,6$ & $2,3,7$ \\
\hline
$2,4,5$ & $2,4,6$ & $2,4,7$ & $2,5,6$ \\
\hline
$2,5,7$ & $2,6,7$ & $3,4,5$ & $3,4,6$ \\
\hline
$3,4,7$ & $3,5,6$ & $3,5,7$ & $3,6,7$ \\
\hline
\end{tabular}
\end{center}
Notice that we can immediately rule out all sequences with $\gon_2(G) = 3$ because, by Lemma \ref{sum}, this would mean $\gon_4(G) \leq 6$ {\color{red}contradicting that by our first statement, $\gon_4(G)=8$.} We can also rule out all sequences with $\gon_1(G) = 2$ and $\gon_2(G) \geq 5$ by a similar argument. {\color{red} which is...} Furthermore, since the canonical divisor $K$ has $\deg(K) = 6$ and $r(K) = 3$ {\color{red}by Reimann-Roch? \ref{RR}}, we can rule out all sequences with $\gon_3(G) > 6$. Finally, we can use Theorem \ref{coppensclif} to show that the sequences with $\gon_1(G) = 3$ and $\gon_2(G) = 4$ are impossible. This leaves us with the two sequences noted above.
\end{proof}

{\color{red}Use remark environment?}
\textit{Note.} Again, we provide examples of each gonality sequence. The graph $K_{2,5}$ satisfies the first gonality sequence and the graph $K_{3,3}$ satisfies the second gonality sequence (see Figure \ref{highergen4}).

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.2]{highergongenus4.png}
    \caption{Genus $4$ graphs with two different gonality sequences}
    \label{highergen4}
\end{figure}

\subsection{Classification by First Gonality}

All graphs of gonality $1$ are trees so their gonality sequences are completely determined by Lemma \ref{tree}.

\begin{proposition}
If $\gon_1(G) = 2$, then $G$ has the following gonality sequence:
\[
\gon_k(G) = \begin{cases}
2k \quad &\text{if $k < g(G)$} \\
k + g(G) \quad &\text{if $k \geq g(G)$}.
\end{cases}
\]
\end{proposition}

\begin{proof}
By Lemma \ref{genus}, we know $\gon_k(G) = k + g(G)$ for $k \geq g(G)$. We also know that, by Lemma \ref{sum}, if $k < g(G)$, then $\gon_k(G) = \gon_{k-1}(G) + 1$ or $\gon_k(G) = \gon_{k-1}(G) + 2$. Notice that between $\gon_1(G)$ and $\gon_{g(G)}(G)$, we have an increase of $k + g(G) - 2$. This means that we cannot have $\gon_k(G) = \gon_{k-1}(G) + 1$ because this would require that $\gon_\ell(G) > \gon_{\ell-1}(G)$ for some $\ell \neq k$. Hence, we must have $\gon_k(G) = \gon_{k-1}(G) + 2$ for all $k \in \{1,\dots,g(G) - 1\}$.
\end{proof}

Based on results from classical algebraic geometry (see, for example, Remark 4.5 in \cite{trigonal}), we also make the following conjecture for graphs of first gonality $3$.

\begin{conjecture}
If $\gon(G) = 3$ then
\[
\gon_k(G) = 
\begin{cases}
3k \quad &\text{if $1 \leq k \leq \left\lfloor \frac{g-1}{3} \right\rfloor$} \\
g + k - 1 - \left\lfloor \frac{g-k-1}{2} \right\rfloor \quad &\text{if $\left\lfloor \frac{g-1}{3} \right\rfloor < k \leq g - 1$} \\
g + k \quad &\text{if $k \geq g$}.
\end{cases}
\]
\end{conjecture}

We begin with the following lemma, derived from Riemann-Roch:
\begin{lemma}\label{lemma:RRbounds}
If $\gon_k(G) \leq \gamma$, then $\gon_{k+g-1-\gamma}(G) \leq 2g - 2 - \gamma$.  Moreover, if $\gon_k(G) \geq \gamma$ then for $\delta \geq 2g - \gamma$, $\gon_{k-g+\delta}(G) \geq \delta$, and in particular, $\gon_{k+g-\gamma} \geq 2g - \gamma$.
\end{lemma}
\begin{proof}
Suppose $\gon_k(G) \leq \gamma$. Then there exists a divisor $D$ satisfying $\deg(D) = \gamma$ and $r(D) \geq k$.  Then $\deg(K-D) = 2g - 2 - \gamma$ and $r(K-D) \geq k + g - 1 - \gamma$, so $K-D$ provides an upper bound on $\gon_{k+g-1-\gamma}(G)$.

On the other hand, suppose $\gon_k(G) \geq \gamma$, and let $D'$ satisfy $\deg(D') = \delta - 1$.  Then $\deg(K-D') = 2g - \delta {\color{red}+} 1 < \gamma$, so $r(K-D') = r(D') + g - \delta < k$, implying $r(D') < k - g + \delta$, so $\delta$ provides a lower bound on $\gon_{k-g+\delta}(G)$.  
\end{proof}

We can now prove the following weaker result.
\begin{theorem}
If $G$ satisfies $\gon_k(G) = 3k$ whenever $1 \leq k \leq \floor{(g-1)/3}$ then $\gon_{\ell}(G) = g + \ell - 1 - \floor{(g-\ell-1)/2}$ whenever $\floor{(g-1)/3} < \ell \leq g-1$.
\end{theorem}
\begin{proof}
Let $\gamma_k = \gon_k(G)$.  By Lemma \ref{lemma:RRbounds}, \sout{if $1 \leq k < \floor{(g-1)/3}$ then?} since $\gamma_k \leq 3k$, $\gamma_{g-1+2k} \leq 2g - 2 - 3k$, and since $\gamma_{k+1} \geq 3k$, taking $\delta = 2g - 3k + 1$ we get $\gamma_{g-1+2k} \geq 2g - 2 - 3k$.  If we take $\ell = g - 1 + 2k$ in the statement of the theorem, a quick computation shows that this is the desired value.

Allowing $k$ to assume the value $\floor{(g-1)/3}$, \textcolor{red}{shouldn't we be determining what happens when $l= g-1$? Are we not assuming that when $k=\floor{(g-1)/3}$ that $\gon_k=3k$?} again by Lemma \ref{lemma:RRbounds}, since $\gamma_k \geq 3k$, taking $\delta = 2g - 3k$ we get $\gamma_{g-2k} \geq 2g - 3k$.  Moreover, $\gamma_{g-2k} < \gamma_{g+1-2k} = 2g - 3k + 1$ by the preceding paragraph, which establishes that $\gamma_{g-2k} = 2g - 3k$.  Again, a quick computation establishes that this is as desired.
\end{proof}
\textcolor{red}{It's really not clear what is going on here. It would also be helpful to clean up the statement of Lemma 3.7.}

{\color{red}\section{Second Gonality for Graph Families}

In this section, we argue the second gonality for two families of graphs: the complete bipartite graph and generalized banana graphs.

\subsection{Complete Bipartite Graphs}}

\sout{In this section,} We compute the second gonality of the complete bipartite graph $K_{m,n}$, for all values of $m$ and $n$. Note that $\gon_1(K_{m,n}) = \min \{m,n\}$, as determined by de Bruyn in \cite{db}. Our main result is summarized in the following theorem. 

\begin{theorem}\label{2gonKmn} The second gonality of $K_{m,n}$ is
$$\gon_2(K_{m,n})=\begin{cases} 2 &\text{if }m=n=1\\2m-1 &\text{if }1<m=n
\\2\min\{m,n\}&\text{if }m\neq n\end{cases}.$$
\end{theorem}

We will assume without loss of generality that $m\leq n$.  The result in the cases where $m=1$ or $m=2$ follows immediately from our classification of gonality sequences for trees and for graphs of first gonality $2$.  {\color{red}Thus, for the purposes of the proof,} we will now assume $m\geq 3$.

The following lemma will be useful in proving that certain divisors are $v$-reduced.

\begin{lemma}\label{lemma:inequality}  
Suppose $3\leq m$, $3\leq n$, $2\leq k_1\leq m$, $2\leq k_2\leq n$, and
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2$$
Then either $k_2=n-1$ or $k_2=n$.
\end{lemma}

\begin{proof} 

Expanding and rearranging our inequality, we have
$$(k_2-2)m\leq 2k_1k_2-k_1n-2<k_1(2k_2-n).$$
Since both sides are nonnegative and $k_1\leq m$, we may divide the left side by $m$ and the right side by $k_1$ and still preserve inequality:
$$k_2-2<2k_2-n.$$
Rearranging gives us
$$n<k_2-2, $$
which combined with $k_2\leq n$ implies $k_2=n-1$ or $k_2=n$.

\end{proof}

We will also use the following lemma to show that we may assume divisors on $K_{m,n}$ don't have too many chips on any one vertex.

\begin{lemma}  
\label{bipartite}
Let $G=K_{m,n}$, and let $D$ be an effective divisor on $G$.

\begin{enumerate}
\item If $m<n$ and $\deg(D)=2m-1$, then $D\sim D'=\sum a_v(v)$, where $0\leq a_v<\deg(v)$ for all vertices $v$.
\item If $m=n$ and $\deg(D)=2m-2$, then $D\sim D'=\sum a_v(v)$, where $0\leq a_v<\deg(v)$ for all vertices $v$.
\end{enumerate}
\end{lemma}

\begin{proof}  First we prove (1).  Let $v$ be a vertex of valence $m$, and let $E=\sum b_w(w)$ be the $v$-reduced divisor obtained from $D$. Since $D$ is effective, so is $E$. Since no vertex besides $v$ can fire, we have $b_w<\val(w)$ for all $w\neq v$.  If $b_v<m$, we can take $D'=E$ and we're done.  Otherwise, we have $m\leq b_v\leq 2m-1$, so we fire $v$ exactly once; we claim the resulting divisor is our desired $D'$.  To see this, note that $v$ will now have at most $m-1$ chips, and $\val(v)=m$; and since $m\leq b_v$, the most chips another vertex could have had would be $m-1$.  After firing $v$, this might change to $m$; but the degree of such a vertex is $n>m$.  Thus we have our desired $D'$.

The claim in (2) is proved in a similar fashion: choose a $v$, $v$-reduce, then fire $v$ if necessary.  If $v$ cannot fire, we're done.  If it can fire, then there are between $m$ and $2m-2$ chips on $v$, so the most chips another vertex could have is $m-2$.  After firing $v$ once, no chip will have more than $m-1$ vertices, giving us our desired divisor.
\end{proof}

We now handle the case of Theorem \ref{2gonKmn} where $m$ and $n$ are distinct.

\textcolor{red}{I feel like figures may help with understanding these proofs?}

\begin{proposition}  
\label{mncase}
If $3\leq m<n$, then
$$\gon_2(K_{m,n})=2m.$$
\end{proposition}


\begin{proof}  To distinguish vertices based on whether they are in the vertex class with $m$ vertices or the class with $n$ vertices, we will refer to the $m$-class and the $n$-class of $K_{m,n}$. We already know $\gon_2(K_{m,n})\leq 2\gon_1(K_{m,n})=2m$ by Lemma \ref{sum}. To show that $\gon_2(K_{m,n})\geq 2m$, we will show that for any divisor $D$ with $\deg(D)=2m-1$, we have $r(D)<2$.

Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) = 2m-1$. If any vertex in the $m$-class has $n$ or more chips, we fire it. If any vertex in the $n$-class has $m$ or more chips, we fire it. By Lemma \ref{bipartite}, this process eventually terminates. Thus, we may assume that every vertex in the $m$-class has fewer than $n$ chips and every vertex in the $n$-class has fewer than $m$ chips.

Since there are $n+m\geq 2m+1$ vertices, there are at least two vertices with zero chips. We consider the following two possible cases.

\begin{enumerate}
\item Both the $m$-class and the $n$-class have exactly one vertex with zero chips.
\item One class has at least two vertices with zero chips.
\end{enumerate}

In case (1), there are $n+m-2$ vertices with at least one chip each. Since $\deg(D)=2m-1$, we have $2m-1\geq n+m-2\geq 2m-1$, implying that $n=m+1$. Hence, we have $(m+1)+m - 2 = 2m-1$ vertices with at least one chip, which in turn implies that every vertex with at least one chip has exactly one chip. Thus, $D$ must be the divisor with one chip on every vertex, except for one vertex in each class. Let $v_1$ be a vertex in the $m$-class with one chip, and \textcolor{red}{let $v_2$ be the vertex in the $n$-class with exactly one chip} \textcolor{blue}{should this be the vertex with no chip? otherwise $D-(v_1) - (v_2)$ is effective}. Then by Dhar's burning algorithm, $D-(v_1) - (v_2)$ is $v_2$-reduced: lighting $v_2$ on fire burns $v_1$ and another vertex in the $n$-class. From here, all vertices in the $m$-class burn, causing the entire graph to burn. Since $D-(v_1) - (v_2)$ is not effective, we find that $r(D) < 2$ in this case.

Now consider case (2), where one class has at least two vertices with zero chips. We claim that the other class must have at least one vertex with no more than one chip. Otherwise, each vertex on that side would have at least two chips, so our divisor would be of degree $2m$ or $2n$. If this vertex has exactly one chip, subtract one chip from this vertex. If this vertex has no chips, then there exists at least one other vertex in the same class with no more than two chips (otherwise, there would be at least $3(m-1)=3m-3=2m-1+(m-2)>2m-1$ chips). If it has one or two chips, subtract one chip from it. Otherwise, subtract a chip from any vertex of the graph with a positive number of chips. Finally, subtract a chip from one of the original (at least) two vertices with zero chips. Call this vertex $v$ and the resulting divisor $D'$. \textcolor{red}{What 2 chips are being removed here? You talk about three locations?}

We deal with one special sub-case separately: it is possible that the divisor $D'$ now has a vertex class where every vertex has at least two chips except for a single vertex with zero chips This would only arise in the case where the $m$-class originally had all the chips, with one vertex having a single chip and all other vertices in this class having exactly two chips. However, in this case, $D'$ is already reduced with respect to any given vertex in the $n$-class. Running Dhar's burning algorithm from from the vertex in the $n$-class with $-1$ chips causes the one vertex with zero chips in the $m$-class to burn, causing every vertex in the $n$-class to burn. Since $n \geq 3$, the whole graph burns.

Outside of this case, one vertex class has a vertex $v$ with $-1$ chips and one with zero chips, and the other class has a vertex with zero chips and another with at most one chip. We \sout{will} show that this non-effective divisor $D'$ is $v$-reduced. Run Dhar's burning algorithm with this divisor. All four vertices mentioned above will burn \sout{by construction} \textcolor{red}{immediately?}. Continue burning until the process stabilizes, say with $k_1$ vertices burned in the $m$-class and $k_2$ vertices burned in the $n$-class.  We know that $2\leq k_1\leq m$, and $2\leq k_2\leq n$. Our goal is to show that $k_1=m$ and $k_2=n$, since this will imply that $D'$ is reduced.

Since the process has stabilized, we know that every unburnt vertex in the $m$-class has at least $k_2$ chips and every unburnt vertex in the $n$-class has at least $k_1$ chips. This means that there are at least $k_2(m-k_1)+k_1(n-k_2)$ chips on the unburnt vertices. Notice that $V(G) - \{v\}$ has a total of $2m-2$ chips, meaning
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2.$$  By Lemma \ref{lemma:inequality}, we know $k_1=n-1$ or $k_1=n$.  Since $m< n$, we also have
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2,$$
we have $k_1=m-1$ or $k_1=m$.
\textcolor{red}{the above two statements are exactly the same?}

In other words, each vertex class has at most one unburnt vertex.  Note that if one class has all vertices burning, so does the other:  this follows from our assumption that, in our original divisor, each vertex in the $m$-class has at most $n$ chips and each vertex in the $n$-class has at most $m$ chips. Suppose for the sake of contradiction that each class has exactly one unburnt vertex. Then the unburnt vertex in the $m$-class has at least $n-1$ chips and the unburnt vertex in the $n$-class has at least $m-1$ chips. But $n-1+m-1=n+m-2>2m-2$, which is a contradiction. Thus $k_1=m$ and $k_2=n$, so every vertex is burning. This implies that $D'$ is $v$-reduced, and since it is not effective, $r(D)<2$.  This completes the proof.
\end{proof}

A similar argument allows us to compute $\gon_2(K_{m,m})$.

\begin{proposition}
If $m \geq 2$, then
\[
\gon_2(K_{m,m}) = 2m-1.
\]
\end{proposition}

\begin{proof}
First, we exhibit a divisor on $K_{m,m}$ of rank at least $2$ and degree $2m-1$. Then we will show that any divisor of degree $2m-2$ has rank at most $1$.

Fix $v \in K_{m,m}$, and let $D$ be the divisor consisting of one chip on every vertex besides $v$. Clearly, $\deg(D)=2m-1$. To show that $r(D)\geq 2$, we consider the possible degree $2$ divisors that can be subtracted from $D$:

\begin{enumerate}
\item $D' = D - 2 (v)$
\item $D' = D - (v) - (v')$ where $v'$ is a vertex in the same vertex class as $v$
\item $D' = D - (v) - (v')$ where $v'$ is a vertex in the opposite vertex class.
\end{enumerate}
In cases (1) and (2), we fire all vertices except for $v$. Then, $v$ has at least zero chips, all vertices in the same class as $v$ have the same number of chips as they started with, and all vertices in the opposite class from $v$ now have zero chips. In case (3), suppose $w$ is the vertex in the opposite class that now has zero chips. Fire all vertices except for $v$ and $w$. After firing, $v$ has at least zero chips, $w$ has $m-1$ chips, and all other vertices have zero chips. \textcolor{red}{Thus,} in each \textcolor{red}{of these} case\textcolor{red}{s}, we win the chip-firing game so $r(D) \geq 2$. 

Now, suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) = 2m-2$. If any vertex has $m$ or more chips, fire it. Continue until each vertex has fewer than $m$ chips. By Lemma \ref{bipartite}, this process terminates. Since there are $2m$ vertices, at least two vertices have zero chips on them. We have two cases:
\begin{enumerate}
\item Both vertex classes have exactly one vertex with zero chips.
\item One vertex class has at least two vertices with zero chips.
\end{enumerate}
In case (1), $D$ must be the divisor with a single chip on each vertex except for two vertices $v,w$ in opposite vertex classes with zero chips \textcolor{red}{why?}. Let $D' = D - (v) - (w')$ where $w'$ is any vertex in the opposite vertex class except $w$. Then, by Dhar's burning algorithm, $D'$ is $v$-reduced, and since it is not effective, we have $r(D)<2$.

Now, suppose we are in case (2). Let $A$ and $B$ denote the two vertex classes of the graph. Suppose that $A$ is the vertex class with at least two vertices, each with zero chips. Pick a vertex $v$ from these two on which to place a $-1$ chip. Since there are only $2m-2$ chips on the graph, there are at least two vertices on $B$ with no more than two chips between them. Otherwise, there would be at least $2(m-2) + 3 = 2m-1$ chips on the graph. If both of these vertices have zero chips, place a $-1$ chip on any other vertex in $B$ with a positive number of chips. If not, place a $-1$ chip on one of the two vertices so that one vertex now has zero chips and the other vertex has at most one chip. Call the resulting divisor $D'$.

We will show that this non-effective divisor $D'$ is $v$-reduced, implying that $r(D)<2$.  Run Dhar's burning algorithm. By construction, all four vertices mentioned above will burn. Continue burning until the process stabilizes, say with $k_1$ vertices burned in $A$ and $k_2$ vertices burned in $B$. We know that $2\leq k_1\leq m$, and $2\leq k_2\leq m$. Our goal is to show that $k_1=k_2=m$, since this will imply that $D'$ is $v$-reduced.

Since the process has stabilized, every unburnt vertex in $A$ has at least $k_2$ chips and every unburnt vertex in $B$ has at least $k_1$ chips. Hence, there are at least $k_2(m-k_1)+k_1(m-k_2)$ chips on the unburnt vertices. Notice that $V(G) - \{v\}$ has a total of $2m-3$ chips so 
$$k_2(m-k_1)+k_1(m-k_2)\leq 2m-3.$$ 

At this point, we can apply the exact same argument from the proof of Proposition \ref{mncase} to conclude that $k_1=k_2=m$, so that the entire graph is burnt and the non-effective divisor $D'$ is $v$-reduced. Hence, $r(D)<2$, implying that $\gon_2(K_{m,m}) = 2m-1$.
\end{proof}


\subsection{Banana Graphs}
We define the \textit{single banana graph} $B_n$ as a graph with two vertices and $n$ edges connecting them. It is clear that for $n \geq 2$, $\gon_1(B_n) = 2$, since $\gon_1(G)\leq |V(G)|$. \textcolor{red}{to me but... maybe cite the $|V(G)|$ bound?} \textcolor{blue}{maybe we can add a ``trivial'' upper bound on the kth gonality being $k|V(G)|$ in prelim results section? not sure this is worth a lemma/corollary}

\begin{lemma}\label{higherbn}
Let $k\in\mathbb{Z}$, with $1\leq k \leq n-1$. Then $\gon_k(B_n)=2k$.
\end{lemma}

\begin{proof}
Note that by Lemma \ref{sum}, $\gon_k(B_n) \leq 2k$. Suppose we have a divisor $D \in \Div_+(B_n)$ such that $\deg(D) = 2k-1$. Then $D$ has exactly $h$ chips on one vertex and $\ell$ chips on the other, where $h + \ell = 2k-1$. Without loss of generality, suppose $h < k$. The opponent can subtract $h+1$ chips from the first vertex and $k - (h+1)$ chips from the other vertex. Notice that we now have one vertex with $-1$ chips and another vertex with $\ell - (k - h - 1) = k$ chips. Since $k < n$, we cannot fire the chips to win so $r(D) < 1$. We conclude that $\gon_k(B_n) = 2k$. 
\end{proof}

We now define the \textit{generalized banana graph} denoted $B_{n,e}$ as the graph with $n$ vertices $\{v_1,\dots,v_n\}$ and each pair of vertices $v_i, v_{i+1}$ connected by $e$ edges. Since, for any graph $G$, $\gon_1(G) \geq \min \{ \eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$ \textcolor{red}{CITE (perhaps add in the background info section)} \textcolor{blue}{not sure where this would naturally fall within background} where $\eta(G)$ denotes the \textit{edge-connectivity} of the graph, it is clear that $\gon_1(B_{n,e}) = \min \{e, n\}$.

It is stated in \cite{liyau} and proved in \cite{gonthree} that, for any graph $G$, $\gon_1(G)\geq \min\{\eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$, where $\eta(G)$ denotes the \textit{edge-connectivity} of the graph. Thus, it is clear that $\gon_1(B_{n,e})=\min\{e,n\}$.

\begin{example}
The generalized banana graphs $B_{4,2}$ and $B_{5,5}$ are illustrated in Figure~\ref{fig:genbananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{genbanana.pdf}
\caption{The generalized banana graphs $B_{4,2}$ and $B_{5,5}$.}
\label{fig:genbananas}
\end{center}
\end{figure}

\begin{lemma}
If $n<e$, then $\gon_2(B_{e,n})=2n$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2\min\{n, e\} = 2n$. Now, suppose that we have a divisor $D \in \Div_+(B_{n,e})$ with $\deg(D) = 2n-1$. We have the following cases:
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, then there exists at least one vertex $v_i$ with $D(v_i) = 1$. Furthermore, for all other vertices $v_j$, $D(v_j) \leq n < e$. Hence, the divisor $D - 2 (v_i)$ is $v_i$-reduced, implying that $r(D) < 2$.
    \item[(2)] If exactly one vertex $v_i$ has zero chips and all other vertices have at least one chip, then there are two cases.
    \begin{itemize}
        \item[(i)] There exists exactly one vertex $v_j$ with $e$ chips. Note that since $2n - 1 - e \leq n - 2$, $v_j$ clearly cannot have more than $e$ chips and since $2n - 1 - 2e < 0$, we cannot have more than one vertex with $e$ chips. If $v_j$ has $e$ chips, then every other vertex (except for $v_i$ and $v_j)$ must have exactly one chip. Hence, the divisor $D - (v_i) - (v_j)$ is $v_i$-reduced.
        \item[(ii)] All vertices have fewer than $e$ chips. Notice that in this case, $D - 2(v_i)$ is $v_i$-reduced.
    \end{itemize}
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with $D(v_i)=0=D(v_j)$, then there is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists, and consider the divisor $D'=D-v_i-v_j$. Then we fire subsets of vertices in order to move $e$ chips from $v_k$ to either $v_i$ or $v_j$ (the closer of the two to $v_k$). Then, we can run Dhar's burning algorithm on this new configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is already no way to fire on any subset of vertices without inducing debt. 
\end{itemize}
Thus, $\gon_2(B_{n,e})=2n$.
\end{proof}

\begin{lemma}
If $e<n$, then $\gon_2(B_{n,e})=2e$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2 \min \{n, e \} = 2e$. Suppose that we have a divisor $D \in \Div_+(B_{n,e})$ such that $\deg(D) = 2e - 1$.
Again, we proceed by cases:
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, at least one vertex $v_i$ has exactly one chip. Furthermore, suppose some vertex $v_j$ has at least $e$ chips. Then, we have $2e - 1 - e = e - 1 < n-1$ chips remaining for the $n-1$ vertices, which is a contradiction. Thus, if we run Dhar's burning algorithm on the divisor $D - 2(v_i)$, then the entire graph burns because $D(v) < e$ for all vertices $v$.
    \item[(2)] If there is exactly one vertex $v_i$ satisfying $D(v_i)=0$, we have two cases.
    \begin{itemize}
        \item[(i)] If there exists a vertex $v_j$ such that $D(v_j) \geq e$, we know that $v_j$ must have exactly $e$ chips because $2e - 1 - (e + 1) = e - 2 < n - 2$, which is a contradiction. Furthermore, all other vertices except for $v_i$ and $v_j$ must have exactly one chip. This is because we have $e - 1 \leq n-2$ chips remaining for $n-2$ vertices. Run Dhar's burning algorithm on the the divisor $D - (v_i) - (v_j)$ beginning at the vertex $v_i$. Notice that in this divisor, no vertex has more than $e-1$ chips so the whole graph burns.
        \item[(ii)] All vertices have fewer than $e$ chips, in which case we can run Dhar's burning algorithm on the divisor $D - 2(v_i)$, beginning at the vertex $v_i$, which burns the whole graph.
    \end{itemize}
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with zero chips, then consider the divisor $D-(v_i)-(v_j)$. There is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists. Then we can fire subsets of vertices in order to move $e$ chips from $v_k$ to $v_i$, without loss of generality. Then, we can run Dhar's burning algorithm on this configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is no way to fire on any subset of vertices without inducing debt.
\end{itemize}
Thus, $\gon_2(B_{n,e})=2e$.
\end{proof}

\begin{lemma}
If $n=e$, then $\gon_2(B_{n,e})=2n-1.$
\end{lemma}

\begin{proof}
First note that the divisor $n(v_1)+(v_2)+\cdots +(v_n)$ wins the 2-gonality game. If the opponent were to take away two chips from a vertex that currently has one, then we could fire $v_1$, and then increasingly larger subsets, in order to move the $n$ chips and reach an effective divisor. Now suppose that divisor $D$ wins the 2-gonality game, with $\deg(D)<2n-1$. We proceed by cases.
\begin{itemize}
\item[(i)] $\supp(D)=V(B_{n,e})$, in which case, there exist at least two vertices, $v_i$ and $v_j$, such that $D(v_i)=1=D(v_j)$.
\item[(ii)] There exists some vertex $v_i$ such that $D(v_i)=0$, and $V-\left\{v_i\right\}=\supp(D)$.
\item[(iii)] There exist at least two vertices $v_i$ and $v_j$ such that $D(v_i)=0=D(v_j)$, with $i<j$.
\end{itemize}

\textcolor{red}{Can we make the enumerates match? I kinda like the i's, but we should then change all the proofs.}
If we are in case (i), then consider the divisor $D-2(v_i)$. Notice that no vertex has greater than $n-1$ chips, so if we run Dhar's burning algorithm with respect to $v_i$, then the entire graph burns. If we are in case (ii), then the maximum number of chips a vertex has is $n$. If no vertex has more than $n$ chips, then if we consider the divisor $D-2(v_i)$ and burn with respect to $v_i$, the entire graph burns. If a vertex, $v_j$ has $n$ chips, then consider the divisor $D-(v_i)-(v_j)$; now no vertex has at least $n$ chips, so burning with respect to $v_i$ burns the entire graph. Finally, if we are in case (iii), then the maximum number of chips a vertex has is $n+1$. If no vertex has at least $n$ chips, then we can consider the divisor $D-2(v_i)$, and burning with respect to $v_i$ burns the entire graph. If a vertex, $v_k$, has at least $n$ chips, then there are no other vertices with at least $n$ chips. We can then consider the divisor $D-(v_i)-(v_j)$. Notice that we can fire subsets of vertices to move $n$ chips to $v_i$; then, $D(v_i)=n-1$ and no vertex has at least $n$ chips. If we burn with respect to $v_j$, the entire graph burns. Thus, a winning divisor cannot have less than $2n-1$ chips, and $\gon(B_{n,e})=2n-1$.

\end{proof}




For $a\leq b$, let $B^*_{a,b}$ be the generalized banana graph on $a$ vertices, $V(B^*_{a,b})=\left\{v_1,\dots,v_a\right\}$. The number of edges between $v_i$ and $v_{i+1}$ for $1\leq i\leq a-1$ is $b-a+i+1$. In other words, there are $b$ edges in the last banana, and one less edge in each subsequent banana from the end. 

\begin{example}
The generalized bananas graphs $B^*_{6,8}$ and $B^*_{4,5}$ are illustrated in Figure~\ref{fig:banananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{bstarex.pdf}
\caption{The generalized banana graphs $B^*_{6,8}$ and $B^*_{4,5}$.}
\label{fig:banananas}
\end{center}
\end{figure}

\begin{lemma}\label{firstgonbanana}
$\gon_1(B^*_{a,b})=a$.
\end{lemma}

\begin{proof}
We mimic the proof of Lemma 5 given in \cite{ccNewtonPolygons}, in which they prove that $\gon_1(B^*_{a,a})=a$. Notice that $\gon_1(B^*_{a,b})\leq a$, since the divisor $(v_1)+\cdots +(v_a)$ wins the gonality game. Suppose there exists a divisor $D$ such that $\deg(D)<a$ and $D$ wins the gonality game. We can also assume that $D$ is $v_1$-reduced, so $D(v_1)\geq 1$. There exists some other vertex with zero chips on it; let $i$ be the maximal index for which $D(v_i)=0$. We can then perform Dhar's burning algorithm with respect to $v_i$. The chips on the vertices $v_{i+1},\dots,v_m$ do not move, because $D$ is already $v_1$ reduced and fire from $v_1$ would pass through $v_i$. If $m$ is the number of edges between $v_{i-1}$ and $v_{i}$, then there needs to be at least $m$ chips on the subgraph induced by the vertices $\left\{v_1,\dots,v_{i-1}\right\}$ in order for the entire graph to not burn. However, $m\geq i$, and $D(v_{i+1}),\dots,D(v_a)\geq 1$, so $\deg(D)=m+(a-i)\geq a$; hence, a contradiction.
\end{proof}

\begin{lemma}\label{bananapairs}
Let $a\leq b\leq 2a-1$, $a\geq 2$. Then, $\gon_2(B^*_{a,b})=b+1$.
\end{lemma}

\begin{proof}
First notice that the divisor $(b+1)v_a$ wins the 2-gonality game, so $\gon_2(B^*_{a,b})\leq b+1$. Now suppose that divisor $D$ wins the 2-gonality game, with $\deg(D)=k\leq b$. We proceed by cases.
\begin{itemize}
    \item[(i)]If $D(v_a)=1$, then $D$ is equivalent to a divisor $E$ such that the number of chips on $v_i$ is less than the number of edges between $v_i$ and $v_{i+1}$, for $1\leq i\leq a-1$. Then, we can run Dhar's burning algorithm on the divisor $E-2(v_a)$ with respect to $v_a$ and burn the entire graph. 
    \item[(ii)]If $D(v_a)=0$, then $D$ is equivalent to a divisor $E$ such that the number of chips on $v_i$ is less than the number of edges between $v_i$ and $v_{i+1}$, for $1\leq i\leq a-1$, and $D(v_{a-1})\leq b$. If we consider $E-2(v_a)$, then there is no way to fire any subset of vertices $A\subset\left\{v_1,\dots,v_{a-1}\right\}$ to get the vertex $v_a$ out of debt.
    \item[(iii)]If $D(v_a)=k$, then running Dhar's burning algorithm on the divisor $D-(v_{a-1})-(v_a)$ with respect to $v_{a-1}$ burns the entire graph.
    \item[(iv)]If $D(v_a)=\ell$, $2\leq\ell\leq k-1$, we induct on $a$ to show that $D$ cannot win the 2-gonality game. Consider $B^*_{3,b}$, $3\leq b\leq 5$; since $k-1<b$, we might as well place only 2 chips on $v_3$, because placing any more does not allow us to chip fire from $v_3$ anyways. We can then consider the second gonality of the subgraph induced by $\left\{v_1,\right\}$, or the banana graph $B_b$. Notice that $\gon_2(B_2)=3$ and $\gon_2(B_3)=4=\gon_2(B_4)$. Thus, no divisor $D$ with degree $\deg(D)\leq b$ can win the 2-gonality game if $2\leq D(v_3)\leq b-1$.
    
    Now suppose that for $B^*_{a,b}$, if a divisor $D$ has degree $\deg(D)=k\leq b$ and $2\leq D(v_a)\leq k-1$, then $D$ cannot win the 2-gonality game. Consider the graph $B^*_{a+1,b'}$, and divisor $D'$, with degree $\deg(D')\leq b'\leq 2a+1$. Again, we can assume that $D'(v_{a+1})=2$. If we consider subgraph $G'$, induced by vertices $\left\{v_1,\dots,v_a\right\}$, then the degree of $D'$ on $G'$ is $\deg(D')\leq 2a-1=b$. From the cases above, as well as the inductive hypothesis, we know that $D'$ cannot win the 2-gonality game on $G'$. Thus, $D$ cannot win the 2-gonality game on $B^*_{a+1,b'}$.
\end{itemize}
Therefore, $\gon_2(B^*_{a,b})=b+1$.
\end{proof}

\sout{A natural question to ask is: given $(m,n) \in \mathbb{Z}^2$, when does there exist a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$?}
\textcolor{red}{We can also use banana graphs to prove the following neat result about gonality sequences.} \textcolor{blue}{We can also use banana graphs to prove the following result about possible second gonalities given a first gonality.}

\begin{theorem}
Given $(m,n)\in\mathbb{Z}^2$ and $m+1\leq n\leq 2n$, there always exists a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$.
\end{theorem}

\begin{proof}
To achieve the gonality pair $(m,n)$, we can consider the graph $B^*_{m,n-1}$. From Lemma \ref{firstgonbanana}, $\gon_1(B^*_{m,n-1}=m$. Notice that if $m+1\leq n\leq 2m$, then $m\leq n-1\leq 2m-1$, which is exactly our bounds for $a,b$ in Lemma~\ref{bananapairs}. Thus, given $(m,n)$ within our constraints, the graph $G=B^*_{m,n-1}$ has first gonality $\gon_1(G)=m$ and second gonality $\gon_2(G)=n$.
\end{proof}














\section{Extending the Burning Algorithm}
Recall that our method for computing the first gonality of a graph relies on being able to check whether the rank of a divisor $D$ is at least one.  The burning algorithm also provides a method for checking if the rank of $D$ is at least $k$.
\begin{enumerate}
\item For each of the finitely many $E \in \Div_+^k(G)$, take $D - E$.
\item Choose some $v \in V(G)$, and semi-reduce $D-E$ with respect to $v$.  Then, use the burning algorithm to compute $\Red_v(D-E)$, and check if it is effective.  If so, continue; if not, $r(D) < k$.
\end{enumerate}

This approach has many downfalls.  First of all, it requires that we use an algorithm to semi-reduce our divisors at every intermediate step.  What is more, the burning algorithm actually does too much work, in a way.  We don't \textcolor{red}{do not} need to compute all the way to $\Red_v(D-E)$, we just need to compute until the value at $v$ is nonnegative. \textcolor{red}{change sentence structure}

We can get around these issues by extending the burning algorithm \textcolor{red}{for our purposes}.  We start by noting that in general, $r(D) \geq k$ if and only if for each $E \in \Div_+^k(G)$ there exists $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ such that $D' \geq E$.  Thus, we would like to generalize the burning algorithm to detect the existence of such divisors $D'$.  This is exactly what is accomplished by Algorithm \ref{alg:burn_ext}.

\begin{algorithm}
\caption{Extended Burning Algorithm}
\label{alg:burn_ext}
\begin{algorithmic}
\Require Divisors $D,E \in \Div_+(G)$
\Ensure A divisor $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq E$, or NONE if none exists
\If{$E=0$}
	\State \Return $D$ \Comment{any effective divisor will do}
\EndIf
\State $F \coloneqq \sum_{v\in V} \min\set{D(v),E(v)}\cdot (v)$ 
\If{$F > 0$}
	\State $\widetilde{D} \coloneqq \mathbf{Alg}(D-F,E-F) + F$ \Comment{remove chips from circled vertices}
    \State \Return $\widetilde{D}$
\EndIf
\State $W \coloneqq V \setminus \supp(E)$
\While{$W \neq \varnothing$}
	\If{$D(v) < \outdeg_W(v)$ for some $v \in W$}
    	\State $W \coloneqq W \setminus \set{v}$ \Comment{$v$ burns}
    \Else
    	\State $D' \coloneqq D - Q\mathbbm{1}_W$ \Comment{fire from $W$}
        \State \Return $\mathbf{Alg}(D',E)$
    \EndIf
\EndWhile
\Return NONE \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

We think of starting off with putting $E(v)$ circles on each $v \in \supp(E)$.  Then, we begin to burn from each vertex with a circle on it, following the same rules as in the usual burning algorithm.  Then, either the entire graph burns or we find some subset $W$ which we can fire from, and then we repeat.  If we ever end up with a chip on a circled vertex, we remove one chip and one circle from that vertex until we no longer have chips on circled vertices.  We must remember that the chips are there, since later we need to output a divisor of the correct degree, but the rest of the algorithm runs as if they weren't.  Another way to view this step is to change slightly our burning condition: we instead start to burn any vertex with fewer chips than it has circles, and if a vertex has more burning edges and circles combined than it has chips, then it catches fire.

To get at the workings of this algorithm, we return to our $\vartheta$ vectors, but now we will examine a collection of them.  Let $U \subset V$, and consider the collecton $\set{\vartheta^u(D)}_{u \in U}$.  We can provide a partial order on such collections by saying $\set{\vartheta^u(D')}_U \geq \set{\vartheta^u(D)}_U$ if for all $u \in U$ we have $\vartheta^u(D') \geq \vartheta^u(D)$, where the latter is again taken with respect to the lexicographic ordering. It is worth remarking that this is similar to the partial order defined on divisors.
\begin{proposition}\label{algprop}
If we obtain the divisor $D' = D - Q\mathbbm{1}_W$ after one cycle of Algorithm \ref{alg:burn_ext}, then $\set{\vartheta^u(D')}_{\supp(E)} > \set{\vartheta^u(D)}_{\supp(E)}$.
\end{proposition}
\begin{proof}
Notice that the argument for the burning algorithm still holds here, so for each $u \in \supp(E)$ we have $\vartheta^u(D') > \vartheta^u(D)$ lexicographically.  The claim follows immediately.
\end{proof}

We notice that \textcolor{red}{Proposition \ref{algprop}} implies that Algorithm \ref{alg:burn_ext} will terminate and return NONE only if $D(u) = 0$ for all $u \in \supp(E)$ and there is no way to fire without decreasing one of the $\vartheta^u(D)$.
\begin{proposition}
Let $D$ be such that $D(u) = 0$, and suppose there exists $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq E$.  Let $D = D_0, D_1,\dots,D_n = D'$ be the divisor sequence of the equivalence, then $\set{\vartheta^u(D_i)}_{\supp(E)} \geq \set{\vartheta^u(D)}_{\supp(E)}$.
\end{proposition}
\begin{proof}
Take $u \in \supp(E)$, 
\end{proof}
\section{Introduction}

{\color{red}This stuff might be better labeled "Background" to be preceded by an Introduction}

\subsection{Definitions and Terms}

In this paper, all graphs $G = (V, E)$ will be finite, loopless, combinatorial multigraphs. The set of vertices of a graph $G$ are denoted $V(G)$ and the set of edges, $E(G)$.  The \textbf{genus} of a graph is defined as $g(G) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(G)} - \@ifstar{\oldabs}{\oldabs*}{V(G)} + 1$.  If a vertex $v \in V(G)$ is an endpoint of an edge $e \in E(G)$, we will use the notation $v \in e$.  We denote $E(v) \coloneqq \{ e \in E(G) \colon e \ni v \}$ and $E(u, v) \coloneqq E(u) \cap E(v)$.  Moreover, for $U, W \subset V(G)$, we denote $E(U, W) \coloneqq \displaystyle{\bigcup \set{E(u,w) \colon u \in U, w \in W}}$. The \textbf{valence} of a vertex is the total number of edges incident with the vertex, $\val(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(v)}$.

Given a graph $G$, we define a \textbf{divisor} $D$ on $G$ as a $\mathbb{Z}$-linear sum of the vertices $V(G)$, denoted
\[
D=\sum_{v \in V(G)} a_v(v).
\]
For a divisor $D$ and a vertex $v \in V(G)$, we will use the notation $D(v)$ to denote the value of $D$ at $v$. Notice that the set of all divisors on a graph $G$, denoted $\Div(G)$, forms an abelian group under component-wise addition.


The \textbf{degree} of a divisor $D$ is defined as the sum of its coefficients,
\[
\deg(D) \coloneqq \sum_{v \in V(G)} D(v). 
\]
The set of divisors on $G$ of a given degree $k$ is denoted $\Div^k(G)$. {\color{red}Do we need to define the partial order?}  \g{I don't think so, because we don't end up using it} \textcolor{red}{except to define effective...} A divisor $D$ is said to be \textbf{effective} if $D(v) \geq 0$ for all $v \in V(G)$. We use $\Div_+(G)$ to denote the set of all effective divisors on a graph $G$. The support of an effective divisor $D \in \Div(G)$ is defined as
\[
\supp(D) \coloneqq \{ v \in V(G) \colon D(v) > 0 \}.
\]

The \textbf{Laplacian} matrix of a graph $G$ is defined as the matrix with entries
\[
\mathcal{L}_{v,w} = 
\begin{cases}
\val(v) \quad &\text{if $v = w$} \\
-\@ifstar{\oldabs}{\oldabs*}{ E(v,w) } \quad &\text{if $v \neq w$}.
\end{cases}
\]

The Laplacian operator $\Delta \colon \Div(G) \to \Div(G)$ is the map induced by the Laplacian matrix. We call a divisor \textbf{principal} if it is in the image of $\Delta$. The set of all principal divisors on a graph $G$ is denoted $\Prin(G)$. Since the columns of $\mathcal{L}(G)$ sum to zero, $\Prin(G) \subset \Div^0(G)$. We can define an equivalence relation $\sim$ on divisors where $D \sim D'$ if and only if $D - D' \in \Prin(G)$. If this is the case, then $D$ and $D'$ are said to be \textbf{linearly equivalent} divisors. It is clear that the degree of a divisor is invariant under linear equivalence. Given a divisor $D$, the \textbf{linear system} associated to $D$ consists of all effective divisors linearly equivalent to $D$: 
\[
\@ifstar{\oldabs}{\oldabs*}{D} \coloneqq \{ D' \in \Div_+(G) \colon D' \sim D \}.
\]

We define the \textbf{rank} $r(D)$ of a divisor $D$ as $r(D) = -1$ if $\@ifstar{\oldabs}{\oldabs*}{D} = \varnothing$ and 
\[
r(D) = \max \{ k \in \mathbb{Z}^+ \colon \@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \varnothing \; \text{for all} \; D' \in \Div_+^k(G) \}
\]
otherwise. It can be easily shown that rank of a divisor is also preserved under linear equivalence.




\subsection{Riemann-Roch for Combinatorial Graphs}

In \cite{bn}, Baker and Norine prove a Riemann-Roch theorem for combinatorial graphs, analogous to the classical Riemann-Roch theorem for algebraic curves. We re-state this result here. First, for a graph $G$, define the \textbf{canonical divisor} $K$ to be
\[
K \coloneqq \sum_{v \in V(G)} (\val(v) - 2) \cdot (v).
\]

\begin{theorem}[Riemann-Roch for graphs]\label{RR}
For a divisor $D \in \Div(G)$, 
\[
r(D) - r(K - D) = \deg(D) + 1 - g(G).
\]
\end{theorem}

As a corollary, Baker and Norine also prove a version of Clifford's theorem for graphs. Note that a \textbf{special} divisor $D$ is one for which $r(K - D) \geq 0$. 

\begin{theorem}
Let $D$ be an effective, special divisor on a graph $G$. Then
\[
r(D) \leq \frac{1}{2}\deg(D).
\]
\end{theorem}

In \cite{coppens}, Coppens proves a similar result, which he also calls Clifford's theorem on graphs. 

\begin{theorem}
\label{coppensclif}
If a graph $G$ has a divisor of rank $r$ and degree $2r$ for $2 \leq r \leq g(G) - 2$, then $G$ has a divisor of rank $1$ and degree $2$.
\end{theorem}

\subsection{Chip-Firing Games and Graph Gonality}

We define the \textbf{gonality} $\gon(G)$ of a graph $G$ to be
\[
\gon(G) \coloneqq \min \{ \deg(D) \colon r(D) \geq 1, D \in \Div_+(G) \}.
\]

More intuitively, for a divisor $D$ and a vertex $v$, we can regard $D(v)$ as representing a number of chips sitting on $v$, with $D(v) < 0$ indicating that $v$ is ``in debt''. Thus, a divisor $D$ represents some configuration of chips on the graph, allowing us to present an alternative definition of gonality in terms of the \textbf{Baker-Norine chip-firing game}.


In this game, the only legal moves are \textbf{chip-firing} moves{\color{red}:} Given a vertex $v \in V(G)$, in order to chip-fire from $v$, we subtract $\val(v)$ chips from $v$ and to each $u$ adjacent to $v$ add $\@ifstar{\oldabs}{\oldabs*}{E(v,u)}$ chips. The Baker-Norine chip firing game is \sout{played} {\color{red}defined} \g{I think "played" fits better here, or we could say something like "is played with the following rules?", "played in the following way"?} as follows:

\begin{enumerate}
    \item The player places $k$ chips on the vertices $V(G)$ of a graph $G$.
    \item An opponent chooses a vertex $v \in V(G)$ from which to subtract a chip.
    \item The player attempts to reach a configuration of chips where no vertex is in debt via a sequence of chip-firing moves.
\end{enumerate}


If the player can achieve a configuration of chips where every vertex is out of debt, then they win. It is proven in \cite{db} that chip-firing moves correspond to subtracting principal divisors, implying that the gonality of a graph is equivalent to the minimum number of chips $k$ that must initially be placed on the graph in order to guarantee a winning strategy.

However, even with{\color{red}in} this {\color{red}intuitive} framework, computing the gonality of a graph is difficult. For a given graph $G$, to show that $\gon(G) = k$, we must show that both of the following hold:

\begin{enumerate}
	\item There exists a divisor $D$ with $\deg(D) = k$ and $r(D) \geq 1$. That is, no matter where the opponent subtracts a chip, the player can always reach an effective chip configuration.
    \item For \textit{all} divisors $D'$ with $\deg(D') < k$, we have $r(D) < 1$. That is, no configuration of fewer chips wins the chip-firing game.
\end{enumerate}


Fortunately, \sout{we have a few tools to aid us in this process} {\color{red}there exist tools to aid in computing gonality}. 

{\color{red}\subsection{Subset Firing and $v$-Reduced Divisors}}

In \cite{db}, de Bruyn develops a theory of subset-firing and $v$-reduced divisors, along with several useful associated theorems. We provide a brief summary here. For a subset $A \subset V(G)$ and a vertex $v \in A$, we define the \textbf{outdegree} of $A$ at $v$ as
\[
\outdeg_A(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(\set{v},V\setminus A)}.
\]
The total outdegree of a subset $A$ is $\outdeg_A(A) \coloneqq \sum_{v \in A} \outdeg_A(v)$. Notice that because chip-firing moves are commutative, we can fire out from \textit{subsets} of vertices, rather than just single vertices. In order to fire out from a subset $A \subset V(G)$, we send one chip along each edge incident with a vertex in the subset and a vertex not in the subset. Hence, {\color{red}the net result is that} \g{hmmm...I think the previous sentence is actually describing the net result} each vertex in $A$ loses $\outdeg_A(v)$ chips. The following result is proven by de Bruyn.

\begin{lemma}
Given two effective divisors $D$ and $D'$ such that $D \sim D'$, there exists a finite sequence of subset-firing moves which transforms $D$ into $D'$ without inducing debt in any vertex of the graph.
\end{lemma}

Given a vertex $v$, a \textbf{$v$-reduced} divisor $D$ satisfies:

\begin{enumerate}
\item for each $v' \in V(G) - \{v\}$, $D(v') \geq 0$
\item for any nonempty $A \subset V(G) - \{v\}$, there exists some $v' \in A$ such that $D(v') < \outdeg_{v'}(A)$.
\end{enumerate}

If $D$ only satisfies the first condition, then we say that $D$ is \textbf{$v$-semi-reduced}. The following two results about $v$-reduced divisors are proven in \cite{db}.

\begin{lemma}
Given a divisor $D \in \Div(G)$ and a vertex $v \in V(G)$, there exists a unique $v$-reduced divisor $D'$ such that $D' \sim D$.
\end{lemma}

We use $\Red_v(D)$ to denote this unique $v$-reduced divisor equivalent to $D$.

\begin{lemma}
For a divisor $D \in \Div(G)$, $r(D) \geq 1$ if and only if $\Red_v(D)(v) \geq 1$ for each $v \in V(G)$.
\end{lemma}

This lemma provides us with a framework for checking if a divisor is a ``winning divisor'' (i.e., a divisor with $r(D) \geq 1$). To do so, we simply need to check that for all $v \in V(G)$, $v \in \supp(\Red_v(D))$.

\subsection{Dhar's Burning Algorithm}

Given a $q$-semi-reduced divisor $D$, Algorithm \ref{originaldhars} computes $\Red_q(D)$. This algorithm is called \textbf{Dhar's burning algorithm} after the physicist who developed it for use in the study of sandpile models (see \cite{dhar}).  For algorithms to $q$-semi-reduce a divisor $D$ with respect to a vertex $q$, see \cite{db,bs}.

We now provide an intuitive description of Algorithm \ref{originaldhars}.  Given a divisor $D$, we can represent the algorithm in terms of a fire spreading through our graph with the chips of the divisor representing firefighters.  The fire starts at $q$, the vertex we are reducing with respect to.  Whenever a vertex burns, the fire spreads to all edges incident with that vertex.  If a vertex has at least as many chips (firefighters) as it has incident burning edges, then the vertex is protected.  Otherwise, \sout{the fire overpowers the firefighters and} that vertex burns as well.  The fire spreads until no new vertices catch fire, at which point we chip-fire all the unburnt vertices and begin this process again.

\begin{algorithm}
\caption{Dhar's Burning Algorithm}
\label{originaldhars}
\begin{algorithmic}
	\Require vertex $q \in V(G)$, and $q$-semi-reduced divisor $D \in \Div(G)$
	\Ensure $\Red_q(D)$
	\State $W \coloneqq V\setminus\set{q}$
	\While{$W \neq \varnothing$} 
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$} 
	    \State $W = W\setminus{v}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(q, D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	return $D$ \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

It is an easy exercise to show that the entire graph burns only if the final configuration is $q$-reduced, and to show that each firing set delivered by the algorithm preserves $q$-semi-reducedeness.  To see that the algorithm will eventually terminate, suppose we are given the divisor $D$ – effective except perhaps at $q$ – and let $D_q$ denote the (unique) $q$-reduced divisor of $D$.  Let $\@ifstar{\oldabs}{\oldabs*}{V} = n$. We consider $\mathbb{Z}^{n-1}$ under the lexicographic order $>$.  Denote by $d(v,u)$ the length of the shortest path from $v$ to $u$.  Now, corresponding to the divisor $D$ we construct the vector $\vartheta^q(D) \in \mathbb{Z}^{n-1}$ given by
\[\vartheta_i^q(D) = \sum_{\substack{v\in V\\d(v,u)=i}} D(v).\]
That is, the $i$th component of $\vartheta^q(D)$ is the number of chips in the configuration $D$ that are distance $i$ from $q$.  What we will show is that if after one iteration of the burning algorithm we arrive at the new divisor $D'$ then $\vartheta^q(D_q) \geq \vartheta(D') > \vartheta(D)$.

{\color{red}Where does the superscript go? Franny is confused by notation.}

The first inequality follows since for any $q$-semi-reduced divisor $D$, $D_q(q) \geq D(q)$, and the Burning Algorithm preserves $q$-semi-reducedness.  To show the second inequality, let $W$ be the firing set provided by the algorithm, and let $w \in W$ minimize $d(q,w)$.  Then $\outdeg_W(w) > 0$, as $w$ must have a neighbor with lesser distance to $q$.  For an edge $e = (u,v)$, define $d(q,e) = \min\set{d(q,u),d(q,v)}$, and take some ordering on $E$ such that $e < f$ whenever $d(q,e) < d(q,f)$.  Then, during the burning algorithm, light available edges according to whichever comes first in this ordering.  The first burning edge to reach $w$ must come from a vertex closer to $q$, and so after firing one chip will be closer to $q$.  This corresponds exactly to $\vartheta(D')$ being greater in the lexicographic ordering.

Since the burning algorithm computes reduced divisors, it provides for us a polynomial time method for checking if the rank of a divisor $D$ is at least 1: for each $v \in V(G)$ we compute $\Red_v(D)$ with the burning algorithm, then check that $\Red_v(D)(v) \geq 1$.  This in turn provides us with a way to compute the gonality of a graph, since there are finitely many effective divisors of degree at most $\@ifstar{\oldabs}{\oldabs*}{V(G)}$, we can simply check them one-by-one until we find the smallest one with positive rank.  In section 3, we will discuss the shortcomings of using the burning algorithm to try to compute higher gonalities of graphs, and present an algorithm better suited to the task.

\subsection{Higher Gonalities}

Up until this point, we have defined the gonality of a graph in terms of divisors for which $r(D) \geq 1$. However, this definition extends naturally to what we call the \textbf{higher gonalities} of a graph. For fixed $k \in \mathbb{Z}^+$, let $\gon_k(G)$ denote the $k$-th gonality of $G$, defined as
\[
\gon_k(G) = \min \{ \deg(D) \colon D \in \Div(G), r(D) \geq k \}.
\]

Thus, the $k$-th gonality of $G$ is equivalent to the minimum number of chips required to win \sout{a version of} the Baker-Norine chip-firing game where the opponent is allowed to initially subtract $k$ chips arbitrarily.

In \cite{baker}, Baker conjectures the following result as a natural extension of Brill-Noether theory on algebraic curves.

\begin{conjecture}
Fix $g, r, d \in \mathbb{Z}_{\geq 0}$. Let $\rho(g, r, d) \coloneqq g - (r+1)(g - d + r)$. If $\rho(g, r, d) \geq 0$, then every graph of genus $g$ admits a divisor $D$ with $r(D) = r$ and $\deg(D) \leq d$. 
\end{conjecture}

It is proven in \cite{brill} that this conjecture holds for all graphs of genus $g \leq 5$. Hence, we have the following result.

\begin{corollary}
\label{brillnoether}
For all graphs of genus $g \leq 5$, $\gon_1(G) \leq \left\lfloor \frac{g+3}{2} \right\rfloor$.
\end{corollary}

The higher gonalities of graphs have been studied previously, but not extensively. For example, in \cite{panizzut}, the higher gonalities of the family of complete graphs $K_n$ are completely enumerated. Our goal is to provide a broader survey of the various bounds known on higher gonalities as well as explicitly determine the higher gonalities of certain families of graphs.
\section{Introduction}

In \cite{bn} and \cite{bn2}, Baker and Norine introduced a theory of divisors on finite graphs, analogous to the theory of divisors on algebraic curves.  Intuitively, a divisor on a graph can be viewed as a placement of integer numbers of chips on the vertices, with two placements equivalent if they differ by certain redistributions of chips called chip-firing moves.  This theory has been extended to metric graphs \cite{gk,mz}, and has been successfully applied to prove many results on algebraic curves \cite{cdpr}.

Two important numbers associated to a divisor $D$ on a graph (or on a curve) are the \emph{degree} $\deg(D)$, which is the total number of chips; and the \emph{rank} $r(D)$.  The rank of $D$ is an integer that, in the language of chip-firing, measures the extent to which the divisor $D$ can eliminate added debt to the graph.  The \emph{divisorial gonality}, or simply the \emph{gonality}, of a graph $G$ is the minimum degree of a divisor of positive rank. For algebraic curves, gonality is defined similarly; furthermore, in this setting, an equivalent definition of gonality is the minimum degree of a map from the curve to a line.

For both graphs and curves, we can also consider higher gonalities.  For $r\geq 1$, the $r^{\text{th}}$ gonality of a graph (or curve) is the minimum degree of a rank $r$ divisor:
\[\gon_r(G)=\min\{\deg(D)\,|\,\textrm{ $D\in\textrm{Div}(G)$ and $r(D)=r$}\}.\]
These higher gonalities are intimately related to one of the most significant open problems for divisor theory on graphs.

\begin{conjecture}[Brill-Noether Conjecture for Graphs, \cite{baker}]\label{conjecture:bn}  Choose $g,r,d\geq 0$, and let $\rho(g,r,d)=g-(r+1)(g-d+r)$.  If $\rho(g,r,d)\geq 0$, then every graph of genus $g$ has a divisor $D$ with $r(D)=r$ and $\deg(D)\leq d$.
\end{conjecture}
In the language of higher gonalities, this conjecture can be rephrased as saying that if $G$ is a graph of genus $g$ and we have $\rho(g,r,d)\geq 0$, then $\gon_r(G)\leq d$.  This conjecture has been verified for graphs of genus at most $5$ \cite{brill}. In the special case of $r=1$, the conjecture is an upper bound on the first gonality of a graph.


\begin{conjecture}[Gonality Conjecture for Graphs, \cite{baker}]\label{conjecture:gonality} If $G$ is a graph of genus $g$, then $\gon_1(G)\leq\floor{\frac{g+3}{2}}$.
\end{conjecture}

In this paper, we study the \emph{gonality sequence} of a graph $G$, which is the sequence of $r^{\text{th}}$ gonalities of $G$ as $r$ ranges from $1$ to $\infty$:
\[\gon_1(G),\gon_2(G),\gon_3(G),\gon_4(G),\cdots\]
Recent progress has been made towards determining the gonality sequences of various families of graphs, including the complete graphs $K_n$ \cite{panizzut} and the complete bipartite graphs $K_{m,n}$ \cite{bipartite}.  Work has also been done to study higher gonalities of Erd\"{o}s-Renyi random graphs \cite{higher_gonality_random}. A very ambitious program would be to answer the following question.
\begin{question}\label{question:main}
Which integer sequences are the gonality sequence of some graph?
\end{question}
We will see in Corollary \ref{corollary:determined_genus} that the genus of a graph can be read from its gonality sequence, so an answer to Question \ref{question:main} would furnish an answer to Conjecture \ref{conjecture:bn}; because of this, we believe a complete answer would be very difficult to obtain.  In this paper, we answer the question up to genus $5$; it turns out that for such graphs, the first gonality and the genus suffice to determine the gonality sequence.

\begin{theorem}\label{theorem:gonality_sequences}
Let $G$ be a graph of genus $g$.  If $g\leq 5$, then the gonality sequence of $G$ is determined by $g$ and $\gon_1(G)$. This no longer holds if $g\geq 6$ depending on the value of $\gon_1(G)$.
\end{theorem}

All possible gonality sequences of graphs of genus at most $5$, along with an example graph for each specified gonality sequence, appear in Table \ref{table:sequences}.  That table also contains the same for graphs of genus $6$, under the assumption that Conjecture \ref{conjecture:gonality} holds for such graphs.

We also prove that any ``reasonable'' pair of first and second gonalities are achieved by some graph.


\begin{theorem}\label{theorem:first_two}
Let $m,n\in \mathbb{Z}$ with $1\leq m< n\leq 2m$. There exists a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$.
\end{theorem}

Our paper is organized as follows.  In Section \ref{section:background}, we present general background and results for chip-firing on graphs.  In Section \ref{section:preliminary}, we present some preliminary results on gonality sequences of graphs, many arising as nice corollaries of the Riemann-Roch theorem for graphs.  In Section \ref{section:small_genus}, we prove Theorem \ref{theorem:gonality_sequences}, and also consider the possible gonality sequences of graphs of genus $6$.  In Section \ref{section:bananas}, we construct a family of graphs to prove Theorem \ref{theorem:first_two}.  We close in Section \ref{section:modified_dhars} with a modified version of Dhar's burning algorithm tailored to studying higher gonalities.

\section{Background and Notation}\label{section:background}


In this paper, all graphs will be finite, loopless, combinatorial multigraphs. The set of vertices of a graph $G$ is denoted $V(G)$, and the multiset of edges $E(G)$.  The \emph{genus} of a graph is defined as $g(G) := \@ifstar{\oldabs}{\oldabs*}{E(G)} - \@ifstar{\oldabs}{\oldabs*}{V(G)} + 1$.  If a vertex $v \in V(G)$ is an endpoint of an edge $e \in E(G)$, we use the notation $v \in e$.  We denote $E(v) \coloneqq \{ e \in E(G) \colon e \ni v \}$ and $E(u, v) \coloneqq E(u) \cap E(v)$.  Moreover, for $U, W \subset V(G)$, we denote $E(U, W) \coloneqq \displaystyle{\bigcup \set{E(u,w) \colon u \in U, w \in W}}$. The \emph{valence} of a vertex is the total number of edges incident to the vertex: $\val(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(v)}$.


\subsection{Divisor theory on graphs}

Given a graph $G$, a \emph{divisor} $D$ on $G$ is a $\mathbb{Z}$-linear sum of the vertices $V(G)$, and can be written as
\[
D=\sum_{v \in V(G)} D(v) \cdot v,
\]
where $D(v)\in\mathbb{Z}$ for all $v$. The set of all divisors on a graph $G$, denoted $\Div(G)$, forms an abelian group under coefficient-wise addition, namely the free abelian group generated by $V(G)$.

The \emph{degree} of a divisor $D$ is defined as the sum of its coefficients:
\[
\deg(D) \coloneqq \sum_{v \in V(G)} D(v). 
\]
The set of divisors on $G$ of a given degree $k$ is denoted $\Div^k(G)$. A divisor $D$ is said to be \emph{effective} if $D(v) \geq 0$ for all $v \in V(G)$. We use $\Div_+(G)$ to denote the set of all effective divisors on a graph $G$. The \emph{support} of an effective divisor $D \in \Div(G)$ is defined as
\[
\supp(D) \coloneqq \{ v \in V(G) \colon D(v) > 0 \}.
\]

The \emph{Laplacian matrix} of a graph $G$ is the $|V(G)|\times|V(G)|$ matrix with entries
\[
\mathcal{L}_{v,w} = 
\begin{cases}
\val(v) \quad &\text{if $v = w$} \\
-\@ifstar{\oldabs}{\oldabs*}{ E(v,w) } \quad &\text{if $v \neq w$}.
\end{cases}
\]
The Laplacian operator $\Delta \colon \Div(G) \to \Div(G)$ is the map induced by the Laplacian matrix. We call a divisor \emph{principal} if it is in the image of $\Delta$. The set of all principal divisors on a graph $G$ is denoted $\Prin(G)$. Since the columns of $\mathcal{L}(G)$ sum to zero, $\Prin(G) \subset \Div^0(G)$. We can define an equivalence relation $\sim$ on divisors where $D \sim D'$ if and only if $D - D' \in \Prin(G)$. If this is the case, then $D$ and $D'$ are said to be \emph{linearly equivalent} divisors. It is clear that the degree of a divisor is invariant under linear equivalence. Given a divisor $D$, the \emph{linear system} associated to $D$ consists of all effective divisors linearly equivalent to $D$: 
\[
\@ifstar{\oldabs}{\oldabs*}{D} \coloneqq \{ D' \in \Div_+(G) \colon D' \sim D \}.
\]

We define the \emph{rank} $r(D)$ of a divisor $D$ as $r(D) = -1$ if $\@ifstar{\oldabs}{\oldabs*}{D} = \emptyset$ and 
\[
r(D) = \max \{ r \in \mathbb{Z}^+ \colon \@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \emptyset \; \text{for all} \; D' \in \Div_+^r(G) \}
\]
otherwise. It can be easily shown that rank of a divisor is also preserved under linear equivalence.  We define the \emph{gonality} $\gon(G)$ of a graph $G$ to be
\[
\gon(G) \coloneqq \min \{ \deg(D) \colon r(D) \geq 1, D \in \Div_+(G) \}.
\]


More generally, for fixed $r \in \mathbb{Z}_{>0}$, we define the $r^{th}$ gonality of $G$, denoted $\gon_r(G)$, as the minimum degree of a rank $r$ divisor:
\[
\gon_r(G) = \min \{ \deg(D) \colon D \in \Div(G), r(D) \geq r \}.
\]

Recall Conjecture \ref{conjecture:bn}, which says that if $G$ is a graph of genus $g$ and $\rho(g,r,d)\geq 0$, then $\gon_r(G)\leq d$. (Here $\rho(g, r, d) \coloneqq g - (r+1)(g - d + r)$.) It is proven in \cite{brill} that this conjecture holds for all graphs of genus $g \leq 5$. Hence, we have the following result, which will be useful in Section \ref{section:small_genus}.



\begin{corollary}
\label{brillnoether}\label{theorem:up_to_5}
For all graphs of genus $g \leq 5$, we have $\gon_1(G) \leq \left\lfloor \frac{g+3}{2} \right\rfloor$.
\end{corollary}






In \cite{bn}, Baker and Norine prove a Riemann-Roch theorem for combinatorial graphs, analogous to the classical Riemann-Roch theorem for algebraic curves. We restate this result here. For a graph $G$, define the \emph{canonical divisor} $K$ to be
\[
K \coloneqq \sum_{v \in V(G)} (\val(v) - 2) \cdot (v).
\]

\begin{theorem}[Riemann-Roch for graphs]\label{RR}
For a divisor $D \in \Div(G)$, 
\[
r(D) - r(K - D) = \deg(D) + 1 - g(G).
\]
\end{theorem}

As a corollary, Baker and Norine also prove a version of Clifford's theorem for graphs. We say a divisor $D$ is \emph{special} if $r(K - D) \geq 0$. 

\begin{theorem}
Let $D$ be an effective, special divisor on a graph $G$. Then
\[
r(D) \leq \frac{1}{2}\deg(D).
\]
\end{theorem}

In \cite{coppens}, Coppens proves a similar result, which he also calls Clifford's theorem on graphs. 

\begin{theorem}
\label{coppensclif}
Let $G$ be a graph of genus $g$, and assume that there exists a divisor $D$ of rank $r$ with $2\leq r\leq g-2$ such that $\deg(D)=2r$.  Then $G$ has a divisor of rank $1$ and degree $2$.
\end{theorem}

\subsection{Chip-Firing Games and Graph Gonality}


We now present an intuition for divisors in the language of chip configurations and chip-firing. For a divisor $D$ and a vertex $v$, we can regard $D(v)$ as representing an integer number of chips sitting on $v$, with $D(v) < 0$ indicating that $v$ is ``in debt.'' Thus, a divisor $D$ represents some configuration of chips on the graph. This will allow us to present an alternative definition of gonality in terms of the \emph{Baker-Norine chip-firing game}.

In this game, the only legal moves are \emph{chip-firing} moves. Given a vertex $v \in V(G)$, in order to chip-fire from $v$, we subtract $\val(v)$ chips from $v$ and to each $u$ adjacent to $v$ add $\@ifstar{\oldabs}{\oldabs*}{E(v,u)}$ chips. The Baker-Norine chip firing game is played in the following way:

\begin{enumerate}
    \item The player places $k$ chips on the vertices $V(G)$ of a graph $G$.
    \item An opponent chooses a vertex $v \in V(G)$ from which to subtract a chip.
    \item The player attempts to reach a configuration of chips where no vertex is in debt via a sequence of chip-firing moves.
\end{enumerate}

If the player can achieve a configuration of chips where every vertex is out of debt, then they win.  As discussed in \cite{bn}, chip-firing moves correspond to subtracting principal divisors, implying that the gonality of a graph is equivalent to the minimum number of chips $k$ that must initially be placed on the graph in order to guarantee a winning strategy for the first player.  Similarly, the $r^{\text{th}}$ gonality of $G$ is the minimum number of chips required to win the Baker-Norine chip-firing game if the opponent is allowed to subtract $r$ chips of their choice instead of just $1$.


Computing the gonality of a graph is difficult. For a given graph $G$, to show that $\gon(G) = k$, one must show that both of the following conditions hold:

\begin{enumerate}
	\item There exists a divisor $D$ with $\deg(D) = k$ and $r(D) \geq 1$. That is, there exists a chip configuration with $k$ chips such that no matter where the opponent subtracts a chip, the player can always reach an effective chip configuration.
    \item For \textit{all} divisors $D'$ with $\deg(D') < k$, we have $r(D') < 1$. That is, no configuration of fewer chips wins the chip-firing game.
\end{enumerate}


There are some techniques that can be used to bound the gonality of a graph. For example, one can use other invariants of the graph, such as edge-connectivity. The following lower bound on gonality is stated in \cite{liyau} and proved in \cite{gonthree}.
\begin{lemma}\label{lemma:lower_bound}
Let $\eta(G)$ denote the edge-connectivity of a graph $G$.  Then $\gon_1(G)\geq \min\{\eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$.
\end{lemma}






In addition, there are techniques to determine if a chip configuration is ``winning'' (that is, has positive rank). In \cite{db}, van Dobben de Bruyn presents a theory of subset-firing, along with several useful associated results. We provide a brief summary here. For a subset $A \subset V(G)$ and a vertex $v \in A$, we define the \emph{outdegree of $A$ at $v$} as
\[
\outdeg_A(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(\set{v},V(G) - A)}.
\]
The total outdegree of a subset $A$ is $\outdeg_A(A) \coloneqq \sum_{v \in A} \outdeg_A(v)$. Notice that because chip-firing moves are commutative in the Baker-Norine chip-firing game, one can fire \textit{subsets} of vertices, rather than just single vertices. In order to fire a subset $A \subset V(G)$, we send one chip along each edge $e \in E(A, V(G)-A)$. Hence, each vertex in $A$ loses $\outdeg_A(v)$ chips. The following result is proven in \cite{db}.

\begin{lemma}
Given two effective divisors $D$ and $D'$ such that $D \sim D'$, there exists a finite sequence of subset-firing moves which transforms $D$ into $D'$ without introducing debt in any vertex of the graph.
\end{lemma}





\subsection{Dhar's Burning Algorithm}
\label{subsection:usual_dhars}

Given a vertex $v$, we say a divisor $D$ is \emph{$v$-reduced} if it satisfies two properties:
\begin{enumerate}
\item for each $v' \in V(G) - \{v\}$, $D(v') \geq 0$; and
\item for any nonempty $A \subset V(G) - \{v\}$, there exists some $v' \in A$ such that $D(v') < \outdeg_{A}(v')$.
\end{enumerate}
If $D$ only satisfies the first condition, then we say that $D$ is \emph{$v$-semi-reduced}.

It is proven in \cite[Proposition 3.1]{bn}
that given a divisor $D \in \Div(G)$ and a vertex $v \in V(G)$, there exists a unique $v$-reduced divisor $D'$ such that $D' \sim D$. Let $\Red_v(D)$ denote this unique $v$-reduced divisor. It follows that for a divisor $D \in \Div(G)$, $r(D) \geq 1$ if and only if $\Red_v(D)(v) \geq 1$ for each $v \in V(G)$.


Perhaps the most famous algorithm in chip-firing games is \emph{Dhar's burning algorithm}, named after the physicist who developed it for use in the study of sandpile models \cite{dhar}.  Given a semi-reduced divisor $D$ and a vertex $q$, this algorithm checks whether or not $D$ is $q$-reduced, and if not, outputs a subset of vertices $W\subset V(G)\setminus\{q\}$ that can be fired without introducing new debt.  By firing $W$ and iterating this algorithm, one can compute the unique $q$-reduced divisor equivalent to the semi-reduced divisor $D$; we refer to this iterated algorithm as the \emph{iterated Dhar's burning algorithm}, presented here as Algorithm \ref{originaldhars}.  For algorithms to $q$-semi-reduce a divisor $D$ with respect to a vertex $q$, see \cite{bs, db}.


\begin{algorithm}
\caption{Iterated Dhar's Burning Algorithm}
\label{originaldhars}
\begin{algorithmic}
	\Require vertex $q \in V(G)$, and $q$-semi-reduced divisor $D \in \Div(G)$
	\Ensure $\Red_q(D)$
	\State $W \coloneqq V(G) \setminus\set{q}$
	\While{$W \neq \emptyset$} 
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$} 
	    \State $W = W\setminus \{v\}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(q, D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	return $D$ \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

Given a divisor $D$, we can describe Algorithm \ref{originaldhars} in terms of a fire spreading through our graph with the chips of the divisor representing firefighters, each of whom can fight off one incoming fire. The fire starts at $q$, the vertex we are reducing with respect to.  Whenever a vertex burns, the fire spreads to all edges incident with that vertex. If a vertex has at least as many chips (firefighters) as it has incident burning edges, then the vertex is protected. Otherwise, that vertex burns as well. The fire spreads until no new vertices catch fire, at which point we chip-fire all the unburned vertices and begin this process again.  If the whole graph burns, then the divisor is $q$-reduced.



We now present an argument that this algorithm terminates and is correct; we will use similar arguments for Algorithm \ref{algorithm:modified_dhars} later in this paper. Each firing set $W$ delivered by the algorithm preserves $q$-semi-reducedness, since $D(v)\geq \outdeg_W(v)$ whenever $W$ is fired, so no new debt is ever introduced.  To see that the algorithm will eventually terminate, suppose we are given the divisor $D$, effective except perhaps at $q$, and let $D_q$ denote the (unique) $q$-reduced divisor of $D$. For $u,v\in V(G)$, denote by $d(v,u)$ the length of the shortest path from $v$ to $u$.  Let $d$ be the diameter of the graph $G$, defined as the greatest length of a shortest path between two vertices of $G$: $d=\textrm{diam(G)}:= \max_{v,u \in V(G)} d(v,u)$.  For $0 \leq i \leq d$, let $S_i = \set{v \in V(G): d(v,q) = i}$.  We define the function $\beta_q\colon \Div(G) \to \mathbb{Z}^{d+1}$ by
\[\beta_q(D) = \@ifstar{\oldparen}{\oldparen*}{\sum_{v \in S_0} D(v), \sum_{v \in S_1} D(v),\dots, \sum_{v \in S_d} D(v)}.\]
That is, the $i^{th}$ component of $\beta_q(D)$ is the number of chips in the configuration $D$ that are distance $i$ from $q$.

Note that each recursive call made by Algorithm \ref{originaldhars} involves firing a (nonempty) subset $W \subset V(G)$. Use $W_0, W_1, W_2, \dots$ to denote the consecutive subsets and label the resulting divisors $D = D_0, D_1, D_2, \dots$ such that $D_{i+1} = D_i - \Delta \mathbbm{1}_{W_i}$. We claim that if $W_i$ is nonempty, then $\beta_q(D_i) < \beta_q(D_{i+1})$ with respect to the lexicographic ordering. Pick some $w \in W_i$ such that $d(q, w)$ is minimized. Then $w$ has a neighbor $u$ such that $d(q, u) < d(q, w)$ and $u \notin W_i$ (note that we might have $u = q$). But this directly corresponds to $\beta_q(D_{i+1})$ being strictly greater than $\beta_q(D_i)$.

If Algorithm \ref{originaldhars} does not terminate, this means that there exists an infinite sequence of divisors $\{D_i\}_{i \geq 0}$ such that $\beta_q(D_i) < \beta_q(D_{i+1})$.  However, note that $\beta_q(D)$ is bounded for general $D$; in particular, each component is bounded between $\min\{0,D(q)\}$ and $\max\{\deg(D)+D(q), \deg(D)\}$.  Hence, such an infinite strictly increasing sequence cannot exist, so Algorithm \ref{originaldhars} must terminate.



We also need to check that the output of the algorithm is correct, i.e. that the entire graph burns only if the final configuration is $q$-reduced.  Given a divisor $D$ which is $q$-semi-reduced but not $q$-reduced,  there exists a subset $A$ not containing $q$ such that $D(v) \geq \outdeg_A(v)$ for all $v \in A$.  But  such a subset will not burn, so in particular the burning algorithm will find a subset $W$ to fire.  Thus, the whole graph burns only if the final divisor is $q$-reduced.

Since the iterated burning algorithm computes reduced divisors, it provides us with a polynomial time method for checking if the rank of a divisor $D$ is at least $1$: for each $v \in V(G)$ we compute $\Red_v(D)$ with the burning algorithm, then check that $\Red_v(D)(v) \geq 1$.  This in turn provides us with a way to compute the gonality of a graph: since there are finitely many effective divisors of degree at most $\@ifstar{\oldabs}{\oldabs*}{V(G)}$, we can simply check them one-by-one until we find the smallest one (as measured by degree) with positive rank.  In Section \ref{section:modified_dhars}, we will discuss the shortcomings of using the burning algorithm to try to compute higher gonalities of graphs and present an alternate algorithm designed for this setting.




\section{Preliminary Results}\label{section:preliminary}

We now consider the \emph{gonality sequence} of a graph $G$, the sequence of its $r^{\text{th}}$ gonalities for all $r\in\mathbb{Z}_{>0}$:
\[\gon_1(G),\gon_2(G),\gon_3(G),\ldots\]
We begin by providing some basic results on higher gonalities and gonality sequences, including bounds for the $r^{\text{th}}$ gonality of a graph based on lower gonalities. Some of results were previously known, appearing in papers such as \cite{higher_gonality_random} or as widely known corollaries of the Riemann-Roch theorem for graphs; we include them here for completeness.


Our first result shows that gonality sequences are strictly increasing.


\begin{lemma}
\label{strict}
If $n > m$, then $\gon_n(G) > \gon_m(G)$.
\end{lemma}

\begin{proof}  
We first show that, for any given divisors $D, E \in \Div_+(G)$, 
\[
r(D - E) \geq \max \{r(D) - \deg(E), -1\}.
\]
Suppose that $r(D) - \deg(E) > -1$. (Otherwise, this inequality is clearly true.) Let $r(D) = k$. By the definition of rank, we know that $\@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \emptyset$ for all $D' \in \Div_+^{k}(G)$. Hence, $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} \neq \emptyset$ for all $E' \in \Div_+^{k - \deg(E)}(G)$ as $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} = \@ifstar{\oldabs}{\oldabs*}{D - (E + E')}$ where $E + E' \in \Div_+^k(G)$. It follows that $r(D - E) \geq k - \deg(E) = r(D) - \deg(E)$.

Now let $\gon_n(G) = \gamma$. This means that there exists some divisor $D \in \Div_+^\gamma(G)$ such that $r(D) = n$. For any $E \in \Div_+^{n-m}(G)$, we have $r(D - E) \geq r(D) - \deg(E) = r(D) - (n-m) = m$. Since $\deg(D - E) = \gamma - (n-m) < \gamma$, we have
\[
\gon_m(G) \leq \deg(D - E) < \gon_n(G).
\]
\end{proof}

Our next result provides an upper bound on a higher gonality in terms of lower gonalities.

\begin{lemma}
\label{sum}
If $a = a_1 + \cdots + a_n$ with $a_i \in \mathbb{Z}_{>0}$, then $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$.
\end{lemma}

\begin{proof}
Let $\gamma_{a_i} = \gon_{a_i}(G)$ for each $i$. There exists a divisor $D_{a_i} \in \Div_+^{\gamma_{a_i}}(G)$ such that $r\left(D_{a_i}\right) = a_i$ for each $i$. This implies that $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E} \neq \emptyset$ for all $E \in \Div_+^{a_i}(G)$. Let $D = D_{a_1} + \cdots + D_{a_n}$. Notice that for each $E \in \Div_+^a(G)$, there exists some decomposition $E = E_{a_1} + \cdots + E_{a_n}$ where $E_{a_i} \in \Div_+^{a_i}(G)$. 

Pick $F_i \in \Div_+(G)$ for $i \in \{1,\dots,n\}$. We now show that if $\@ifstar{\oldabs}{\oldabs*}{F_i} \neq \emptyset$ for all $i$, then $\@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n F_i} \neq \emptyset$. Notice that, for each $F_i$, there exists $F_i' \in \Div_+(G)$ such that $F_i' \sim F_i$. We note that $\sum_{i=1}^n F_i \sim \sum_{i=1}^n F_i'$ and that $\sum_{i=1}^n F_i' \in \Div_+(G)$, which implies that $\@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n F_i } \neq \emptyset$.

As a consequence, we see that
\[
\@ifstar{\oldabs}{\oldabs*}{D - E} = \@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n D_{a_i} - \sum_{i=1}^n E_{a_i} } = \@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n \@ifstar{\oldparen}{\oldparen*}{D_{a_i} - E_{a_i} } } \neq \emptyset,
\]
because for each $i$, we have $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E_{a_i}} \neq \emptyset$. We conclude that $r(D) \geq a$ which implies that $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$. 
\end{proof}

We now prove a straightforward lower bound on the $k^{\text{th}}$ gonality of a graph.


\begin{proposition}
\label{tree}
 For a graph $G$ and $k \in \mathbb{Z}_{>0}$, we have $\gon_k(G) \geq k$, with equality if and only if $G$ is a tree.
\end{proposition}

\begin{proof} 
Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) < k$. Then, for all $D' \in \Div_+^k(G)$, we have $|D - D'| = \emptyset$ because $\deg(D - D') < 0$ and the degree of a divisor is preserved under linear equivalence. Hence, $r(D) < k$.  This shows that $\gon_k(G) \geq k$.

Now we show $\gon_k(G)=k$ if and only if $G$ is a tree. First we remark that $\gon_1(G)=1$ if and only if $G$ is a tree; this follows immediately from \cite[Lemma 1.1]{bn2}.  Assume that $G$ is a tree. Then $\gon_k(G)\leq k\gon_1(G)=k$ by Lemma \ref{sum}.  Combined with our lower bound of $k$, we have that $\gon_k(G)=k$.

Now assume $\gon_k(G)=k$.  Then the first $k$ terms of the gonality sequence of $G$ are
\[\gon_1(G),\gon_2(G),\cdots,\gon_{k-1}(G),k.\]
By Lemma \ref{strict}, this is a strictly increasing sequence of $k$ positive integers ending in $k$.  The only such sequence is
\[1,2,\cdots,k-1,k,\]
meaning that $\gon_1(G)=1$.  We conclude that $G$ is a tree.
\end{proof}








We now present a few well-known corollaries of Theorem \ref{RR}, the Riemann-Roch theorem for graphs.

\begin{lemma}\label{genus}  Let $G$ be a graph of genus $g$.
\begin{itemize}
    \item[(a)] We have $\gon_1(G)\leq g+1$.
    \item[(b)]
    If $g\geq 2$, then $\gon_{g-1}(G)=2g-2$.
    \item[(c)] If $k \geq g$, then $\gon_k(G) = g + k$.
\end{itemize}
\end{lemma}

\begin{proof}

To prove part (a), let $D$ be any divisor of degree $g+1$ on $G$.  By the Riemann-Roch theorem, we have
\[r(D)=\deg(D)+1-g+r(K-D)= 2+r(K-D)\geq 1\]
since $r(K-D)\geq -1$.  As $D$ has positive rank and degree $g+1$, we have $\gon_1(G)\leq g+1$.  (We remark that this is essentially the proof of part 1 of \cite[Theorem 1.9]{bn}.)


For part (b), note that $\deg(K)=2g-2$, and $r(K)=\deg(K)-g+1+r(K-K)=2g-2-g+1+0=g-1$.  Thus $\gon_{g-1}(G)\leq 2g-2$.  Suppose for the sake of contradiction that there exists a divisor $D$ of degree $2g-3$ and rank $g-1$ or more.  Then $r(K-D)=r(D)+g-\deg(D)-1\geq g-1+g-(2g-3)-1=1$, and $\deg(K-D)=1$.  The only way $G$ can have a positive rank divisor of degree $1$ is for $G$ to be a tree, but $g\geq 1$, a contradiction.  Thus $\gon_{g-1}(G)= 2g-2$.


We now prove part (c).  Let $k \geq g$. Choose a divisor $D \in \Div_+^{g+k}(G)$. By the Riemann-Roch theorem for graphs, we know that
\begin{align*}
r(D) &= \deg(D) + 1 - g + r(K - D) \\
&= k + 1 + r(K - D) \geq k. 
\end{align*}
Hence, $\gon_k(G) \leq g + k$. Now, suppose that we have a divisor $D \in \Div_+^{g+k-\ell}(G)$ with $\ell \geq 1$ such that $r(D) \geq k$. Then, by Riemann-Roch, we see that
\begin{align*}
r(K - D) &= r(D) - (\deg(D) + 1 - g) \\
&\geq k - (g +k-\ell + 1 - g) \\
&= \ell - 1.
\end{align*}
Since $r(K - D) \geq \ell - 1$, we know that $\deg(K - D) \geq \ell - 1$. Hence,
\begin{align*}
\deg(K - D) = 2g - 2 - (g+k-\ell) &\geq \ell - 1,
\end{align*}
which implies $g - 1 \geq k$, contradicting our original assumption that $k \geq g$. We conclude that $\gon_k(G) = g + k$.
\end{proof}

This lemma helps us prove the following corollary.

\begin{corollary}\label{corollary:determined_genus}
The genus of a graph is determined by its gonality sequence.
\end{corollary}

\begin{proof}
A graph has genus zero if and only if its gonality sequence is $1,2,3,4,\ldots$ by Proposition \ref{tree}.  Moreover, we claim that a graph has genus $1$ if and only if its gonality sequence is $2,3,4,5,\ldots$. The forward direction comes from a combination of Proposition \ref{tree} and parts (a) and (c) of Lemma \ref{genus}.  For the backward direction, any graph with genus $g\geq 2$ must have $\gon_g(G) = \gon_{g-1}(G) + 2$ by parts (b) and (c) of Lemma 3.4.


Now suppose $g\geq 2$.  By Lemma \ref{genus}, we know that $\gon_g(G) = \gon_{g-1}(G) + 2$ and $\gon_k(G) = \gon_{k-1}(G) + 1$ for all $k > g$. Thus, the genus of $G$ is the index of the last gonality that is more than one greater than the preceding gonality. We conclude that the genus of a graph is determined by its gonality sequence.
\end{proof}

Our next result says that if a graph has first gonality $2$, then its gonality sequence is determined by its genus.

\begin{proposition}\label{prop:hyperelliptic}
If $\gon_1(G) = 2$, then
\[
\gon_k(G) = \begin{cases}
2k \quad &\text{if $k < g(G)$} \\
k + g(G) \quad &\text{if $k \geq g(G)$}.
\end{cases}
\]
\end{proposition}

\begin{proof}
By part (c) of Lemma \ref{genus}, we know $\gon_k(G) = k + g(G)$ for $k \geq g(G)$. By Lemma \ref{sum}, we know that $\gon_k(G) \leq \gon_{k-1}(G) + 2$ for $2 \leq k \leq g(G)$. Since $\gon_{g(G)}(G) = 2g(G)$, this implies that $\gon_k(G) = \gon_{k-1}(G) + 2$ for $2 \leq k \leq g(G)$ so $\gon_k(G) = 2k$. 
\end{proof}

We will refer to graphs of gonality $2$ as \emph{hyperelliptic} graphs, matching the terminology used for algebraic curves. For such a graph of genus $g$, we will call its gonality sequence the hyperelliptic gonality sequence of genus $g$. We close this section with a corollary of Theorem \ref{coppensclif}.

\begin{corollary}\label{corollary:g-2}
Let $G$ be a graph of genus $g\geq 4$ with $\gon_1(G)\geq 3$.  We have $\gon_{g-2}(G)=2g-3$.
\end{corollary}

\begin{proof}
By part (b) of Lemma \ref{genus}, we know $\gon_{g-1}(G)=2g-2$, which is strictly larger than $\gon_{g-2}(G)$, so $\gon_{g-2}(G)\leq 2g-3$.  Suppose $\gon_{g-2}(G)\leq 2g-4$. Then there exists a divisor of degree $2g-4$ and rank $g-2$.  Since $g\geq 4$, we have $2\leq g-2$, so by Theorem \ref{coppensclif} it follows that $G$ has a divisor of rank $1$ and degree $2$, a contradiction to $\gon_1(G)\geq 3$.  We conclude that $\gon_{g-2}(G)=2g-3$.
\end{proof}




\section{Gonality Sequences for Graphs of Small Genus}\label{section:small_genus}


In this section, we will determine all possible gonality sequences for graphs of low genus. Moreover, we will show that for low genus, the genus of the graph combined with first gonality is enough information to determine the entire gonality sequence. 


We first present the following lemma, which handles the $g\geq 6$ part of Theorem \ref{theorem:gonality_sequences}.

\begin{lemma}\label{lemma:G_and_H}
For $g\geq 6$, there exist graphs $G$ and $H$ of genus $g$ with $\gon_1(G)=\gon_1(H)=3$, $\gon_2(G)=5$, and $\gon_2(H)=6$.
\end{lemma}

\begin{proof}
We explicitly construct our graphs as follows.  Let $G$ have $g$ vertices $v_1,\cdots,v_g$, with three edges connecting $v_1$ and $v_2$ and two edges connecting $v_i$ and $v_{i+1}$ for $2\leq i\leq g-1$.  Let $H$ have $g-1$ vertices $w_1,\cdots,w_{g-1}$, with three edges connecting $w_1$ and $w_2$, three edges connecting $w_2$ and $w_3$, and two edges connecting $w_i$ and $w_{i+1}$ for  $3\leq i\leq g-2$.  These graphs are illustrated in Figure \ref{figure:G_and_H} in the case of $g=6$, along with certain divisors.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=1]{G_and_H.pdf}
    \caption{The graphs $G$ and $H$ for $g=6$, along with divisors of ranks $1$ and $2$}
    \label{figure:G_and_H}
\end{figure}

We first remark that neither graph has first gonality $2$: if a rank $1$ divisor has only $2$ chips, then it must place $1$ chip on the leftmost divisor since no chips can be moved there without introducing debt. But this only leaves one chip for the rest of the graph, which is not sufficient. The illustrated divisors of degree $3$, namely $3\cdot (v_1)$ on $G$ and $3\cdot (w_1)$ on $H$, do each have rank $1$, so $\gon_1(G)=\gon_2(H)=3$. Moreover, we claim that the divisor $5\cdot (v_2)$ of degree $5$ on $G$ has rank $2$. To see this, we note that for any $i,j\geq 2$ the divisor $5\cdot(v_2)$ is equivalent to the divisors $3\cdot(v_1)+2\cdot(v_i)$ and $(v_2)+2\cdot(v_i)+2\cdot(v_j)$.  This means that for any effective divisor of degree $2$, $5(v_2)$ is equivalent to some divisor greater than it, meaning that $r(5\cdot(v_2))\geq 2$.
Since $G$ is not hyperelliptic, we have $\gon_2(G)\neq 4$ by Theorem \ref{coppensclif}, so $\gon_2(G)=5$.  Although we have assumed that $g\geq 6$, note that this same argument works to argue that $\gon_2(G') = 5$ for any graph $G'$ constructed in the same manner as $G$ with $g(G') \geq 3$. 

It remains to show that $\gon_2(H)=6$.  Certainly $\gon_2(H)\leq 2\gon_1(H)=6$; indeed, we obtain a rank $2$ divisor $6\cdot(w_1)$ of degree $6$ by doubling our rank $1$ divisor $3\cdot(w_1)$.  Suppose for the sake of contradiction that there exists a rank $2$ divisor $D$ of degree $5$ on $H$.  Without loss of generality, since $D$ has rank $2$, we may assume that $D(w_1)\geq 2$.  We will now deal with several cases, where all chip-firing moves we consider are subset-firing moves that do not introduce debt.

\begin{itemize}
    \item Suppose $D(w_1)=2$.  Since $\val(w_1) > 2$, these two chips cannot be moved from $w_1$. Hence, we are left with three chips for the rest of the graph, which is equivalent to a copy of $G$ with genus $g-2\geq 4$. But as we have already shown, such a graph needs at least $5$ chips to win the second gonality game.
    
    
    \item Suppose $D(w_1)=3$, so that it has two chips elsewhere on the graph. If we remove one chip from $w_1$, the remaining two chips on $w_1$ are now isolated. We are now in the situation of playing the first gonality game on a copy of $G$ with genus $g-2\geq 4$ and only two chips.  However, we need at least three chips to win the first gonality game on $G$.
    
    \item Suppose $D(w_1)\in\{4,5\}$. Chip-fire $w_1$ to produce a linearly equivalent divisor where any chips remaining on $w_1$ are isolated and the rest of the graph has at most four chips. We are now back in the same situation as in the first case.
\end{itemize}
In all cases we have reached a contradiction, so we must have $\gon_2(H)=6$, as desired.
\end{proof}

We are now ready to prove Theorem \ref{theorem:gonality_sequences}.

\begin{proof}[Proof of Theorem \ref{theorem:gonality_sequences}]  Let $G$ be a graph with $g(G)\leq 5$.  We will prove genus by genus that $\gon_1(G)$ determines the gonality sequence of $G$.

For $g\leq 2$, we will see that the gonality sequence is determined by $g$ alone without needing to know $\gon_1(G)$.  If $g(G)=0$, then $G$ is a tree, and so has gonality sequence given by $\gon_k(G)=k$ by Proposition \ref{tree}.  If $g=1$, then $\gon_k(G) = k+1$ by the proof of Corollary \ref{corollary:determined_genus}. If $g = 2$, then by part (b) of Lemma \ref{genus}, $\gon_1(G) = 2$ so the gonality sequence of $G$ is the hyperelliptic sequence of genus $2$ given by Proposition \ref{prop:hyperelliptic}.

Now suppose $g=3$.  Since $G$ is not a tree, we know $\gon_1(G)>1$, and by Theorem \ref{theorem:up_to_5}, we have $\gon_1(G)\leq\floor{\frac{g+3}{2}}=3$.  If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $3$ by Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)=3$, then for $k\geq 3$ we have $\gon_k(G)=k+3$ by part (c) of Lemma \ref{genus}.  By part (b) of Lemma \ref{genus}, $\gon_2(G) = 4$. We conclude that the gonality sequence for a graph is genus $3$ is either
\[2,4,6,7,8,9,\ldots\qquad\text{or}\qquad3,4,6,7,8,9,\ldots\]

Now suppose $g=4$.  Again we have $1 < \gon_1(G) \leq 3$. If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $4$ by Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)=3$, then by Lemma \ref{genus} we have $\gon_k(G)=k+4$ for $k\geq 4$, and $\gon_3(G)=2g-2=6$.  Moreover, we can apply Corollary \ref{corollary:g-2} to deduce that $\gon_2(G)=2g-3=5$.  We conclude that the gonality sequence of a graph of genus $4$ is either
\[2,4,6,8,9,10,\ldots\qquad\text{or}\qquad3,5,6,8,9,10,\ldots\]


Finally, suppose $g=5$.  We have $\gon_1(G)>1$ and $\gon_1(G)\leq\floor{\frac{g+3}{2}}=4$.   If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $4$ by Proposition \ref{prop:hyperelliptic}. Now assume $\gon_1(G)\geq 3$. We know $\gon_4(G)=8$ by part (b) of Lemma \ref{genus}, and since $G$ is not hyperelliptic, we have $\gon_3(G)=7$ by Theorem \ref{corollary:g-2}, so only the first two gonalities are yet to be determined. Since $G$ is not hyperelliptic, we know that $\gon_2(G) > 4$. By applying the Riemann-Roch theorem, we find that $G$ has a divisor $D$ of degree $3$ and rank $1$ if and only if it also has a divisor $K-D$ of degree $5$ and rank $2$. Combined with the fact that $5\leq \gon_2(G)<\gon_3(G)=7$, we have that if $\gon_1(G)=3$, then $\gon_2(G)=5$; and if $\gon_1(G)=4$, then $\gon_2(G)=6$.  We conclude that the only possible gonality sequences for a graph of genus $5$ are
\[2,4,6,8,10,11,\ldots,\qquad3,5,7,8,10,11,\ldots,\qquad\text{and}\qquad4,6,7,8,10,11,\ldots\]
Hence for all $g\leq 5$, the genus and the first gonality of a graph determine the gonality sequence. As shown in Lemma \ref{lemma:G_and_H}, this does not hold for $g\geq 6$.  This completes the proof.
\end{proof}

\begin{remark}
We remark that each possible gonality sequence discussed in the proof of Theorem \ref{theorem:gonality_sequences} is indeed the gonality sequence of some graph; see Table \ref{table:sequences} for examples corresponding to each sequence. For $g \leq  2$, any graph of genus $g$ will suffice since there is a unique possible gonality sequence for that genus.  For $g \geq 3$, the hyperelliptic gonality sequence of genus $g$ is achieved by the \emph{banana graph}, comprised of $2$ vertices connected by $g+1$ edges. The graphs $K_4$ and $K_{3,3}$ both have first gonality $3$ and thus achieve the remaining possible gonality sequences for graphs of genus $3$ and $4$, respectively. Finally, for genus $5$, the gonality sequence beginning with first gonality $3$ is achieved by the genus $5$ version of the graph $G$ used in Lemma \ref{lemma:G_and_H}. The final gonality sequence beginning with first gonality $4$ is achieved by the graph illustrated in Table \ref{table:sequences} (this graph has first gonality $4$ by \cite[Proposition 4.5]{gonthree}). This table also includes all known gonality sequences for graphs of genus $6$, as computed in the following example. Assuming the gonality conjecture holds for graphs of genus $6$, this is a complete enumeration of the gonality sequences of graphs of genus $6$.
\end{remark}

\begin{example}\label{example:g6}
In this example, we determine all possible gonality sequences of graphs of genus $6$, under the assumption that any such graph has gonality at most $\floor{\frac{g+3}{2}}=4$.  First if $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $6$ from Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)\geq 3$, then by Lemma \ref{genus} and Corollary \ref{corollary:g-2}, the gonality sequence of the graph is of the form
\[\gon_1(G),\gon_2(G),\gon_3(G),9,10,12,13,14,\ldots\]
Since $\gon_1(G) \geq 3$, we have $5 \leq \gon_2(G) < \gon_3(G)$ and $7 \leq \gon_3(G) < 9$. By the Riemann-Roch theorem for graphs, a graph of genus $6$ has a divisor of degree $3$ and rank $1$ if and only if it has a divisor of degree $7$ and rank $3$. Thus, if $\gon_1(G) = 3$, we have $\gon_3(G) = 7$ and so our gonality sequence has the form
 \[3,\gon_2(G),7,9,10,12,13,14,\ldots\]
 where $\gon_2(G)\in\{5,6\}$.  The example graphs $G$ and $H$ of genus $6$ from Lemma \ref{lemma:G_and_H} have first gonality $3$ and second gonalities $5$ and $6$, respectively, so both sequences are achieved by some graph.
 
 On the other hand, if $\gon_1(G)=4$, we have $\gon_3(G)=8$, so the gonality sequence is of the form
  \[4,\gon_2(G),8,9,10,12,13,14,\ldots\]
By the Riemann-Roch theorem for graphs, a graph of genus $6$ has a divisor of degree $4$ and rank $1$ if and only if it has a divisor of degree $6$ and rank $2$, so $5\leq \gon_2(G)\leq 6$.  By \cite[Theorem 1]{panizzut}, the complete graph $K_5$ has genus $6$, first gonality $4$, and second gonality $5$. We can also construct a genus $6$ graph $G$ with first gonality $4$ and second gonality $6$ as follows:  start with four vertices $v_1,v_2,v_3,v_4$, and connect $v_1$ and $v_2$ by two edges, $v_2$ and $v_3$ by five edges, and $v_3$ and $v_4$ by two edges.  A similar argument to that of Lemma \ref{lemma:G_and_H} shows that $\gon_1(G)=4$ and $\gon_2(G)=6$.  Thus both sequences are achieved by some graph.

These sequences and example graphs achieving them appear in Table \ref{table:sequences}.  If we do not assume the gonality conjecture holds, then conceivably
\[5,7,8,9,10,12,13,14,\ldots\qquad\text{and}\qquad6,7,8,9,10,12,13,14,\ldots\]
could be gonality sequences for graphs of genus $6$.  No other sequence would be possible, since $\gon_1(G)>4$ implies $\gon_2(G)>6$, and since the sequences must be increasing and stabilize at $9,10,12,13,14,\ldots$.  Thus, to prove that the gonality conjecture holds for graphs of genus $6$, it would suffice to show that neither of the above sequences is realized as the gonality sequence of a graph of genus $6$.

We also remark that the Brill-Noether conjecture in the case of $g=6$, $r=2$, and $d=6$ says that any graph of genus $g = 6$ should have $\gon_2(G)\leq 6$.  Thus the gonality conjecture for genus $6$ (i.e. the Brill-Noether conjecture for $g=6$, $r=1$, and $d=4$) is equivalent to the Brill-Noether conjecture for $g=6$, $r=2$, and $d=6$.
\end{example}


\begin{table}
\begin{center}
\begin{tabular}{|c|c|c|}
    \hline
    Genus & Gonality sequence & Example graph\\
    \hline
    $0$ & $1,2,3,4,5,6,\ldots$ & \includegraphics{table_g0_1.pdf} \\ \hline
    $1$ & $2,3,4,5,6,7,\ldots$ & \includegraphics{table_g1_1.pdf} \\ \hline
    $2$ & $2,4,5,6,7,8,\ldots$ & \includegraphics{table_g2_1.pdf} \\
    \hline
    \multirow{2}{*}{$3$}&$2,4,6,7,8,9,\ldots$&\includegraphics{table_g3_1.pdf}\\
    \cline{2-3}
    &$3,4,6,7,8,9,\ldots$&\includegraphics{table_g3_2.pdf}\\
    \hline
    \multirow{2}{*}{$4$}&$2,4,6,8,9,10,\ldots$&\includegraphics{table_g4_1.pdf}\\
    \cline{2-3}
    &$3,5,6,8,9,10,\ldots$&\includegraphics{table_g4_2.pdf}\\
    \hline
\end{tabular}\quad \begin{tabular}{|c|c|c|}
    \hline
    Genus & Gonality sequence & Example graph\\
    \hline
    \multirow{3}{*}{$5$}&$2,4,6,8,10,11,\ldots$&\includegraphics{table_g5_1.pdf}\\
    \cline{2-3}
    &$3,5,7,8,10,11,\ldots$&\includegraphics{table_g5_2.pdf}\\
    \cline{2-3}
    &$4,6,7,8,10,11,\ldots$&\includegraphics{table_g5_3.pdf}\\
    \hline
    \multirow{5}{*}{6}&$2,4,6,8,10,12,\ldots$&\includegraphics{table_g6_1.pdf}\\
    \cline{2-3}
    &$3,5,7,9,10,12,\ldots$&\includegraphics{table_g6_2.pdf}\\
    \cline{2-3}
    &$3,6,7,9,10,12,\ldots$&\includegraphics{table_g6_3.pdf}\\
    \cline{2-3}
    &$4,5,8,9,10,12,\ldots$&\includegraphics{table_g6_4.pdf}\\
    \cline{2-3}
    &$4,6,8,9,10,12,\ldots$&\includegraphics{table_g6_5.pdf}\\
    \hline
\end{tabular}


\caption{All possible gonality sequences for graphs of genus at most $5$, with example graphs having those gonality sequences; and the same for genus $6$, assuming the gonality conjecture holds for graphs of genus $6$.}
\label{table:sequences}
\end{center}
\end{table}

We now compare and contrast the properties of our gonality sequences of graphs with those of algebraic curves. The analogue of Proposition \ref{prop:hyperelliptic} holds for for algebraic curves of gonality $2$, also known as hyperelliptic curves: the gonality sequence of the curve is determined by the genus of the curve and is given by the same formula. However, the behavior of graphs and curves of gonality $3$ do not so closely  mirror one another. We recall the following formula from algebraic geometry \cite[Remark 4.5]{trigonal}: if $C$ is a smooth projective curve of gonality $3$ and genus $g\geq 4$, then its $k^{\text{th}}$ gonality is
\[
\gon_k(C) = 
\begin{cases}
3k \quad &\text{if $1 \leq k \leq \left\lfloor \frac{g-1}{3} \right\rfloor$} \\
g + k - 1 - \left\lfloor \frac{g-k-1}{2} \right\rfloor \quad &\text{if $\left\lfloor \frac{g-1}{3} \right\rfloor < k \leq g - 1$} \\
g + k \quad &\text{if $k \geq g$}.
\end{cases}
\]
In particular, if a curve $C$ has gonality $3$, then its gonality sequence is determined by its genus.  The same does not hold for graphs of gonality $3$, as illustrated by Lemma \ref{lemma:G_and_H}. Thus, certain sequences which are the gonality sequence of a graph are \emph{not} the gonality sequence of any smooth projective curve. For instance, by Example \ref{example:g6}, there exists a graph $G$ of genus $6$ with gonality sequence
\[3,5,7,9,10,12,13,14,\ldots\]
 If a smooth projective algebraic curve were to have this gonality sequence, it must also have genus $6$, by the analogue of Corollary \ref{corollary:determined_genus} for curves. But any such curve with first gonality $3$ must have gonality sequence \[3,6,7,9,10,12,13,14,\ldots\] by the above formula.  Thus the gonality sequence of $G$ is not the gonality sequence of any smooth projective curve.  A similar argument applies for the genus $g$ version of the graph $G$ from Example \ref{lemma:G_and_H} for any $g\geq 7$:  any trigonal algebraic curve of genus $g$ must have second gonality $6$, but $G$ has second gonality $5$.  Thus for every genus $g\geq 6$, there exists a gonality sequence of a graph that is not the gonality sequence of a smooth algebraic curve.  However, all graph gonality sequences up to genus $5$ are also gonality sequences of curves:  there certainly exist curves of all possible genus and first gonality pairs, and the remainder of each sequence is determined by similar Riemann-Roch and Clifford's theorem arguments for algebraic curves.

We close this section with a remark on a known result for higher gonalities of algebraic curves which remains open for graphs.

\begin{lemma}[Lemma 4.3 in \cite{trigonal}]\label{lemma:adding_algebraic}  Let $C$ be a smooth projective curve of genus $g\geq 4$, such that $\textrm{gon}_{r+s}(C)=\textrm{gon}_{r}(C)+\textrm{gon}_{s}(C)$ for some $r,s\in\mathbb{Z}$.  Then $\textrm{gon}_k(C)=k\gon_1(C)$ for $1\leq k\leq r+s$.
\end{lemma}

We pose the analogous question for graphs.

\begin{question}\label{question:adding_graphs}
Let $G$ be a graph, and suppose $\gon_{r+s}(G)=\gon_r(G)+\gon_s(G)$.  Is it true that $ \gon_k(G)=k\gon_1(G)$ for $1\leq k\leq r+s$?
\end{question}

Note that the answer to this question is affirmative for $g(G)\leq 5$, as can be verified by examining all gonality sequences in Table \ref{table:sequences}.  We also remark that such a criterion would be useful in determining the first three gonalities of a graph; for instance, it would rule out $(2,3,5)$ and $(3,5,8)$ as possible starts to a gonality sequence.  The first of these is impossible by Proposition \ref{prop:hyperelliptic}; the authors do not know whether the second is possible.

The proof of Lemma \ref{lemma:adding_algebraic} in \cite{trigonal} uses the key fact that given two divisors $D$ and $E$ on a curve such that $r(D+E)=r(D)+r(E)$, we have $D\sim r(D)F$ and $E\sim r(E)F$ for some divisor $F$ of rank $1$; see \cite[Lemma 1.8]{4-gonal}.  Unfortunately such an argument will not work for graphs, as shown in the following example.  Thus a new approach will be needed to answer Question \ref{question:adding_graphs}.

\begin{example}\label{example:payne}
Let $G$ be the graph pictured in Figure \ref{fig:payne}.  By the proof of Theorem 1.2 in \cite{loop_of_loops}, each divisor  $D_i=v_1+v_2+w_i$ where $1\leq i\leq 3$ has rank $1$.  (Although this result is proven for metric graphs, the same holds here in the finite case.)  Since $D_1$, $D_2$, and $D_3$ are pairwise linearly inequivalent, we may choose two of them, say $D_i$ and $D_j$ such that $D_i\not\sim K-D_j$.  Then we have
\[r(D_i+D_j)-r(K-D_i-D_j)=6+1-4=3.\]
Note that $\deg(K-D_i-D_j)=0$, and since $D_i\not\sim K-D_j$, we have $r(K-D_i-D_j)=-1$.  Thus $r(D_i+D_j)=2=r(D_i)+r(D_j)$.  However, since $D_i\not\sim D_j$, there cannot exist a divisor $F$ with $D_i\sim F$ and $D_j\sim F$.  Thus the natural graph-theoretic analogue of \cite[Lemma 1.8]{4-gonal} does not hold.

\begin{figure}[hbt]
\begin{center}
\includegraphics[scale=0.8]{payne_example.pdf}
\caption{The graph $G$ from Example \ref{example:payne}}
\label{fig:payne}
\end{center}
\end{figure}


\end{example}

















\section{Banana Graphs and Second Gonalities}\label{section:bananas}

The main goal of this section is to prove that given any pair of ``reasonable'' integers $m$ and $n$, there exists a graph $G$ with first gonality $m$ and second gonality $n$.  Certainly a necessary condition is that $m<n\leq 2m$; we will show that this condition is sufficient by constructing families of graphs called the generalized banana graphs.

As in the previous section, we define the \textit{banana graph} $B_n$ as a graph with two vertices and $n$ edges connecting them. It is clear that for $n \geq 2$, $\gon_1(B_n) = 2$, since $\gon_1(G)\leq |V(G)|$ and $\gon_1(G)>1$ for any graph that is not a tree.  It follows immediately from Proposition \ref{prop:hyperelliptic} and the fact that $g(B_n)=n-1$ that $\gon_k(B_n)=2k$ for $1\leq k \leq n-1$.



A \textit{generalized banana graph} is a graph with vertices $\{v_1,\dots,v_n\}$ such that $v_i$ is connected to $v_{i+1}$ by at least one edge, and such that there are no other edges present in the graph.  In other words, it is a collection of $n-1$ banana graphs, glued together in a line.  In this section we study two families of generalized banana graphs:  those with a constant number of edges between pairs of vertices, and those with a descending number of edges.

Let $B_{n,e}$ denote the generalized banana graph on $n$ vertices where $|E(v_i,v_{i+1})|=e$ for $1\leq i\leq n-1$. Note that $B_{n,e}$ has edge-connectivity $e$, so by Lemma \ref{lemma:lower_bound} we have 
\[\gon_1(B_{n,e}) \geq \min\{\eta(B_{n,e}),|V(B_{n,e})|\}= \min \{e, n\}.\]  
The divisors $e(v_1)$ and $(v_1)+\cdots+(v_n)$ both have positive rank, so  $\gon_1(B_{n,e}) =  \min \{e, n\}$.



\begin{example}
The generalized banana graphs $B_{4,2}$ and $B_{5,5}$ are illustrated in Figure~\ref{fig:genbananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{genbanana.pdf}
\caption{The generalized banana graphs $B_{4,2}$ and $B_{5,5}$.}
\label{fig:genbananas}
\end{center}
\end{figure}

Over the following three lemmas, we will determine the second gonality of $B_{e,n}$ for any values of $e$ and $n$.  We will see that these graphs will not give us all the desired pairs of first and second gonalities, meaning we will need to consider other generalized banana graphs.

\begin{lemma}
If $n<e$, then $\gon_2(B_{e,n})=2n$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2\min\{n, e\} = 2n$. Now, suppose that we have a divisor $D \in \Div_+(B_{n,e})$ with $\deg(D) = 2n-1$. We will show that $r(D)<2$. We split into the following cases.
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, then there exists at least one vertex $v_i$ with $D(v_i) = 1$. Furthermore, for all other vertices $v_j$, $D(v_j) \leq n < e$. Hence, the divisor $D - 2 (v_i)$ is $v_i$-reduced, implying that $r(D) < 2$.
    \item[(2)] If exactly one vertex $v_i$ has zero chips and all other vertices have at least one chip, then there are two cases.
    \begin{itemize}
        \item[(i)] There exists exactly one vertex $v_j$ with $e$ chips. Note that since $2n - 1 - e \leq n - 2$, $v_j$ clearly cannot have more than $e$ chips and since $2n - 1 - 2e < 0$, we cannot have more than one vertex with $e$ chips. If $v_j$ has $e$ chips, then every other vertex (except for $v_i$ and $v_j)$ must have exactly one chip. Hence, the divisor $D - (v_i) - (v_j)$ is $v_i$-reduced.
        \item[(ii)] All vertices have fewer than $e$ chips. Notice that in this case, $D - 2(v_i)$ is $v_i$-reduced.
    \end{itemize}
    Both outcomes imply that $r(D)<2$.
    \item[(3)] If there are at least two distinct vertices $v_i$ and $v_j$ with $D(v_i)=0=D(v_j)$, then there is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists, and consider the divisor $D'=D-v_i-v_j$. Then we fire subsets of vertices in order to move $e$ chips from $v_k$ to either $v_i$ or $v_j$ (the closer of the two to $v_k$). Then, we can run Dhar's burning algorithm on this new configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is already no way to fire any subset of vertices without introducing debt. It follows that $r(D)<2$. 
\end{itemize}
Thus, $\gon_2(B_{n,e})=2n$.
\end{proof}

\begin{lemma}
If $e<n$, then $\gon_2(B_{n,e})=2e$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2 \min \{n, e \} = 2e$. Suppose that we have a divisor $D \in \Div_+(B_{n,e})$ such that $\deg(D) = 2e - 1$.
Again, we proceed by cases to show that $r(D)<2$.
\begin{itemize}

    \item[(1)] If $\supp(D) = V(B_{n,e})$, at least one vertex $v_i$ has exactly one chip. Furthermore, suppose some vertex $v_j$ has at least $e$ chips. Then, we have $2e - 1 - e = e - 1 < n-1$ chips remaining for the $n-1$ vertices, a contradiction. Thus, if we run Dhar's burning algorithm on the divisor $D - 2(v_i)$, then the entire graph burns because $D(v) < e$ for all vertices $v$. Thus $r(D)<2$.
    
    \item[(2)] If there is exactly one vertex $v_i$ satisfying $D(v_i)=0$, we have two cases.
    \begin{itemize}
        \item[(i)] If there exists a vertex $v_j$ such that $D(v_j) \geq e$, we know that $v_j$ must have exactly $e$ chips because $2e - 1 - (e + 1) = e - 2 < n - 2$, which is a contradiction to all vertices besides $v_i$ having a chip. Furthermore, all other vertices except for $v_i$ and $v_j$ must have exactly one chip. This is because we have $e - 1 \leq n-2$ chips remaining for $n-2$ vertices. Run Dhar's burning algorithm on the the divisor $D - (v_i) - (v_j)$ beginning at the vertex $v_i$. Notice that in this divisor, no vertex has more than $e-1$ chips so the whole graph burns.
        \item[(ii)] If all vertices have fewer than $e$ chips, then we can run Dhar's burning algorithm on the divisor $D - 2(v_i)$, beginning at the vertex $v_i$, which burns the whole graph.
    \end{itemize}
    In both cases we can conclude that $r(D)<2$.
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with zero chips, then consider the divisor $D-(v_i)-(v_j)$. There is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists. Then we can fire subsets of vertices in order to move $e$ chips from $v_k$ to $v_i$, without loss of generality. Then, we can run Dhar's burning algorithm on this configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is no way to fire any subset of vertices without introducing debt.  This gives $r(D)<2$.
\end{itemize}
Thus, $\gon_2(B_{n,e})=2e$.
\end{proof}

\begin{lemma}
If $n=e$, then $\gon_2(B_{n,e})=2n-1.$
\end{lemma}

\begin{proof}
First note that the divisor $n(v_1)+(v_2)+\cdots +(v_n)$ wins the second gonality game. If the opponent were to take away two chips from a vertex that currently has one, then we could fire $v_1$, and then increasingly larger subsets, in order to move the $n$ chips and reach an effective divisor. Now suppose that divisor $D$ wins the second gonality game, with $\deg(D)<2n-1$. We proceed by cases.
\begin{itemize}
\item[(1)] $\supp(D)=V(B_{n,e})$, in which case, there exist at least two vertices, $v_i$ and $v_j$, such that $D(v_i)=1=D(v_j)$.
\item[(2)] There exists some vertex $v_i$ such that $D(v_i)=0$, and $V-\left\{v_i\right\}=\supp(D)$.
\item[(3)] There exist at least two vertices $v_i$ and $v_j$ such that $D(v_i)=0=D(v_j)$, with $i<j$.
\end{itemize}

If we are in case (1), then consider the divisor $D-2(v_i)$. Notice that no vertex has greater than $n-1$ chips, so if we run Dhar's burning algorithm with respect to $v_i$, then the entire graph burns. If we are in case (2), then the maximum number of chips a vertex has is $n$. If no vertex has $n$ chips, then if we consider the divisor $D-2(v_i)$ and burn with respect to $v_i$, the entire graph burns. If a vertex, $v_j$ has $n$ chips, then consider the divisor $D-(v_i)-(v_j)$; now no vertex has at least $n$ chips, so burning with respect to $v_i$ burns the entire graph. Finally, if we are in case (3), then the maximum number of chips a vertex has is $n+1$. If no vertex has at least $n$ chips, then we can consider the divisor $D-2(v_i)$, and burning with respect to $v_i$ burns the entire graph. If a vertex, $v_k$, has at least $n$ chips, then there are no other vertices with at least $n$ chips. We can then consider the divisor $D-(v_i)-(v_j)$. Notice that we can fire subsets of vertices to move $n$ chips to $v_i$; then, $D(v_i)=n-1$ and no vertex has at least $n$ chips. If we then burn with respect to $v_j$, the entire graph burns. Thus, a winning divisor cannot have fewer than $2n-1$ chips, and $\gon(B_{n,e})=2n-1$.

\end{proof}




The graphs $B_{n,e}$ can only yield pairs of first and second gonalities of the form $(a,2a)$ and $(a,2a-1)$ where $a\geq 2$, as well as $(1,2)$ from $B_{2,1}$.  To obtain graphs with lower second gonalities, we construct another family.  For $a\leq b$, let $B^*_{a,b}$ be the generalized banana graph on $a$ vertices $\left\{v_1,\dots,v_a\right\}$ where the number of edges between $v_i$ and $v_{i+1}$ for $1\leq i\leq a-1$ is $b-a+i+1$. In other words, there are $b$ edges between the first pair of vertices starting from $\{v_{a-1},v_a\}$, with each subsequent pair having one fewer edge than the pair before as we move from $v_a$ to $v_1$. 


\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{bstarex.pdf}
\caption{The generalized banana graphs $B^*_{6,8}$ and $B^*_{4,5}$.}
\label{fig:banananas}
\end{center}
\end{figure}

\begin{lemma}\label{firstgonbanana}
We have $\gon_1(B^*_{a,b})=a$.
\end{lemma}

Our proof mimics that of Lemma 5 in \cite{ccNewtonPolygons}, in which it is proven that $\gon_1(B^*_{a,a})=a$. 

\begin{proof}
As with any graph, we have $\gon_1(B^*_{a,b})\leq |V(B^*_{a,b})|=a$. Suppose there exists a divisor $D$ such that $\deg(D)<a$ and $D$ has positive rank. We can also assume that $D$ is $v_1$-reduced, so $D(v_1)\geq 1$. There exists some other vertex with zero chips on it; let $i$ be the maximal index for which $D(v_i)=0$. We can then perform Dhar's burning algorithm with respect to $v_i$. The chips on the vertices $v_{i+1},\dots,v_m$ do not move, because $D$ is already $v_1$-reduced and fire from $v_1$ would pass through $v_i$. If $m$ is the number of edges between $v_{i-1}$ and $v_{i}$, then there need to be at least $m$ chips on the subgraph induced by the vertices $\left\{v_1,\dots,v_{i-1}\right\}$ since the entire graph will not burn as $D$ has positive rank. However, $m\geq i$, and $D(v_{i+1}),\dots,D(v_a)\geq 1$, so $\deg(D)=m+(a-i)\geq a$, a contradiction.
\end{proof}

\begin{lemma}\label{bananapairs}
Let $2\leq a\leq b\leq 2a-1$. We have $\gon_2(B^*_{a,b})=b+1$.
\end{lemma}

\begin{proof}
First notice that the divisor $(b+1)\cdot v_a$ has rank at least $2$: for any $k$ with $1\leq k\leq a$, this divisor is equivalent to $(b+k-a)\cdot v_k+\sum_{k\leq i\leq a}(v_k)$.  Allowing $k$ to vary, we find effective divisors greater than any given effective divisor of degree $2$. This means that $\gon_2(B^*_{a,b})\leq b+1$. Now suppose that a divisor $D\in\textrm{Div}_+^k(B_{a,b}^*)$ has rank at least $2$, where $k\leq b$. We proceed by cases.
\begin{itemize}
    \item[(1)]If $D(v_a)=1$, we can consider $D-2\cdot(v_a)$.  This divisor has $-1$ chips on $v_a$ and $k-1\leq b-1$ chips on the other vertices; no chips can move from $v_a$ to the rest of the graph without introducing debt, so this remains true as we try to eliminate debt via subset firing moves.  The only way to eliminate the debt on $v_a$ would be to fire a subset $W$ with $v_{a-1}\in W$, but this is only possible to do without introducing new debt if there are at least $b$ chips on $v_{a-1}$, a contradiction.
    
    \item[(2)]If $D(v_a)=0$, choose $v_i\in\textrm{supp}(D)$, and consider $D-(v_i)-(v_a)$.  The same argument from case (1) shows that the debt on $v_a$ cannot be eliminated, a contradiction.
    
    \item[(3)]If $D(v_a)=k$, then running Dhar's burning algorithm on the divisor $D-(v_{a-1})-(v_a)$ with respect to $v_{a-1}$ burns the entire graph, a contradiction.
    
    \item[(4)]If $D(v_a)=\ell$, $2\leq\ell\leq k-1$, we induct on $a$ to show that $D$ cannot win the second gonality game. As a base case, consider $B^*_{3,b}$, $3\leq b\leq 5$.  We might as well place only 2 chips on $v_3$, because placing any more does not allow us to chip fire from $v_3$ anyways. We can then consider the second gonality of the subgraph induced by $\left\{v_1,v_2\right\}$, which is the (usual) banana graph $B_{b-1}$. Since $\textrm{gon}_1(B_{b-1})=2$, we have $\gon_2(B_2)=3$ and $\gon_2(B_3)=4=\gon_2(B_4)$. Thus, no divisor $D$ with degree $\deg(D)\leq b$ can win the second gonality game if $2\leq D(v_3)\leq b-1$.
    
    Now suppose that for $B^*_{a,b}$, if a divisor $D$ has degree $\deg(D)=k\leq b$ and $2\leq D(v_a)\leq b-1$, then $D$ cannot win the second gonality game. Consider the graph $B^*_{a+1,b'}$ with $a+1\leq b'\leq 2a+1$, and suppose $D'$ is a  divisor with degree $\deg(D')=k\leq b'$ with rank at least $2$. Again, we can assume that $D'(v_{a+1})=2$. The subgraph $G'$ induced by the vertices $\left\{v_1,\dots,v_a\right\}$ is then $B^*_{a,b'-1}$, where $a\leq b'-1\leq 2a-1$.
    Restricting $D'$ to $G'$, we have  $\deg(D')=k-2\leq b-2\leq 2a-1$. From the cases above, as well as the inductive hypothesis, we know that $D'$ cannot win the second gonality game on $G'$. Thus, $D$ cannot win the second gonality game on $B^*_{a+1,b'}$.
\end{itemize}
Therefore, $\gon_2(B^*_{a,b})=b+1$.
\end{proof}

We can now prove that any reasonable pair of first two gonalities is achieved by some graph.


\begin{proof}[Proof of Theorem \ref{theorem:first_two}]  Let $m,n\in \mathbb{Z}$ with $m< n\leq 2n$.
To achieve the first and second gonality pair $(m,n)$, we can consider the graph $B^*_{m,n-1}$, which is well-defined since $m\leq n-1$. From Lemma \ref{firstgonbanana}, $\gon_1(B^*_{m,n-1})=m$. Notice that if $m+1\leq n\leq 2m$, then $m\leq n-1\leq 2m-1$, which are exactly our bounds for $a,b$ in Lemma~\ref{bananapairs}. Thus, given $(m,n)$ within our constraints, the graph $G=B^*_{m,n-1}$ has first gonality $\gon_1(G)=m$ and second gonality $\gon_2(G)=n$.
\end{proof}

We do not easily arrive at a corresponding result for the first three gonalities of a graph.  If $\ell=\gon_1(G)$, $m=\gon_2(G)$, and $n=\gon_3(G)$, then we certainly have $\ell<m<n$, $m\leq 2\ell$, and $n\leq \ell+m$.   However, not all triples $(\ell,m,n)$ satisfying these constraints are the first three gonalities of a graph; for instance,  due to  Proposition \ref{prop:hyperelliptic}, there exists no graph $G$ with $\gon_1(G)=2$, $\gon_2(G)=3$, and $\gon_2(G)=5$.  Determining which triples can be the first three gonalities of a graph seems to be an open question, although answering Question \ref{question:adding_graphs} might help.  For instance, an affirmative answer to that question would imply the triple $(3,5,8)$ to be impossible.  It could also be helpful to study the \emph{Clifford index} of graphs, defined as
\[\textrm{Cliff}(G):=\min\{\deg(D)-2r(D)\,|\, r(D)\geq 1\textrm{ and }\deg(D)\leq g-1\}.\]
As shown in \cite{cliffords_alg}, the Clifford index of an algebraic curve $C$ is always either $\gon_1(C)-2$ or $\gon_1(C)-3$; as noted in \cite{random_graphs}, it is unknown whether the Clifford index of graphs follows the same behavior.  If it does, then we could not have a graph with first three gonalities of the form $(a,a+1,a+2)$ if the graph has genus $g$ at least $a+3$, since then we would have $\textrm{Cliff}(G)\leq \gon_3(G)-2\cdot 3=a+2-6=a-4=\gon_1(G)-4$.


Another open question is the following:  given $m$ and $n$ as in Theorem \ref{theorem:first_two}, what are the possibilities for the genus $g$ of a graph $G$ with $\gon_1(G)=m$ and $\gon_2(G)=n$? In particular, when are there infinitely many possibilities for $g$? For instance, if $(m,n)=(2,3)$, then $g$ must be $1$; but if $(m,n)=(2,4)$, then $g$ can be any integer satisfying $g\geq 2$.




\section{A Modified Burning Algorithm}
\label{section:modified_dhars}

In this section, we present a modified version of the iterated Dhar's burning algorithm suited for checking if a divisor has higher gonality at least $r$.  Although this can be accomplished using the traditional Dhar's algorithm with the same time complexity, our algorithm is more transparent when determining gonalities beyond the first, and so may be useful for proofs relying on the burning algorithm. 

Recall that our method for computing the first gonality of a graph relies on being able to check whether the rank of a divisor $D$ is at least $1$.  The burning algorithm also provides a method for checking if the rank of $D$ is at least $r$.
\begin{enumerate}
\item For each of the finitely many $E \in \Div_+^r(G)$, take $D - E$.
\item Choose any $v \in V(G)$, and semi-reduce $D-E$ with respect to $v$.  Then, use the burning algorithm to compute $\Red_v(D-E)$, and check if it is effective.  If so, continue with more choices of $E$; if not, $r(D) < r$.
\end{enumerate}
To check if $\gon_r(G) > k$, run the above two steps on every effective divisor $D$ of degree $k$.

Our modified algorithm (Algorithm \ref{algorithm:modified_dhars}) provides an alternative to step 2.  Rather than semi-reduction followed by a repeated burning process to reach a reduced divisor, it consists simply of a repeated burning process that determines whether or not the given divisor is equivalent to an effective divisor.  It is thus one of many algorithms that solves the \emph{dollar game}, which asks: given a divisor $D$, is there effective divisor $D'$ with $D\sim D'$?  For other algorithms solving the dollar game, see \cite[Chapter 3]{cp}.

\begin{algorithm}
\caption{Modified Dhar's Burning Algorithm}
\label{algorithm:modified_dhars}
\begin{algorithmic}
	\Require A divisor $D=D^+-D^-$, where $D^+,D^-\geq 0$.
	\Ensure A divisor $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq 0$, or \textsc{None} if none exists.
	\If{$D\geq0$}
	\State \Return $D$
    \EndIf
	\State $W \coloneqq V(G) \setminus\supp(D^-)$
	\While{$W \neq \emptyset$}
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$}
	    \State $W = W\setminus \{v\}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	\Return \textsc{None} \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

We offer the following intuitive explanation of Algorithm \ref{algorithm:modified_dhars}.  Given $D=D^+-D^-$ where $D^+\geq 0$ and $D^->0$, set all vertices of $\supp(D^-)$ on fire.  Let the usual burning process propagate through the graph.  If the whole graph burns, then $D$ is not equivalent to any effective $D'$.  If the whole graph does not burn, fire the unburned vertices $W$, and run the process again.  We refer to each time we run through this burning process a \emph{pass} through our algorithm or an \emph{iteration} of our algorithm.

\begin{example}\label{example:modified_dhars}
As an example of running Algorithm \ref{algorithm:modified_dhars} on a divisor, consider the graph $G$ at the top of Figure \ref{figure:dhars_example}.  Let $D=-(a)+2\cdot(c)+7\cdot(f)-(g)-2\cdot(h)$; this divisor is illustrated on the bottom left.  We can write $D=D^+-D^-$, where $D^+=2\cdot(c)+7\cdot(f)$ and $D^-=(a)+(g)+2\cdot(h)$.  In accordance with Algorithm \ref{algorithm:modified_dhars}, we set the vertex set $\textrm{supp}(D^-)=\{a,g,h\}$ on fire.  The fire spreads until the whole graph burns except for $f$, so we fire $f$ to obtain the next divisor $D'=-(a)+(b)+2\cdot(c)+(d)+(e)+2\cdot(f)-(h)$.  We then set the vertices $a$ and $h$ on fire.  This time the vertices $b,c,d,e,$ and $f$ remain unburned, so these vertices are all fired, giving the divisor $D''=2\cdot(a)+2\cdot(g)+(h)$.  Since debt has been eliminated, the algorithm terminates.  If the whole graph had burned before debt was eliminated, we would have known that eliminating debt were impossible.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=1]{dhars_graph.pdf}
    \\\includegraphics[scale=0.7]{dhars1.pdf}\qquad\includegraphics[scale=0.7]{dhars2.pdf}\qquad\includegraphics[scale=0.7]{dhars3.pdf}
    \caption{The graph $G$ and the steps of Algorithm \ref{algorithm:modified_dhars} from Example \ref{example:modified_dhars}}
    \label{figure:dhars_example}
\end{figure}

\end{example}

We need to argue that this algorithm terminates and that it is correct.  For the termination argument, we will use the $\beta_q(D)$ notation from Subsection \ref{subsection:usual_dhars}.  Recall that
\[\beta_q(D) = \@ifstar{\oldparen}{\oldparen*}{\sum_{v \in S_0} D(v), \sum_{v \in S_1} D(v),\dots, \sum_{v \in S_d} D(v)},\]
where $d=\textrm{diam}(G)$ and $S_i$ is the set of all vertices at distance $i$ from vertex $q$.  Thus $\beta_q(D)$ records in its $i^{th}$ component the number of chips at distance $i$ from $q$.

\begin{proposition}\label{prop:terminates}
Algorithm \ref{algorithm:modified_dhars} terminates.
\end{proposition}

\begin{proof}
Suppose for the sake of contradiction that the algorithm does not terminate on an input $D$.   Since the output of \textsc{None} is never returned, the algorithm is repeatedly firing subsets $W_0,W_1,W_2,\ldots$, giving an infinite sequence of equivalent divisors $D=D_0,D_1,D_2,\ldots$ where $D_{i+1} = D_i - \Delta \mathbbm{1}_{W_i}$.

Note that if $v\in W_i$, then $D_i(v)\geq 0$: otherwise,  $v$ would have been burned from the beginning.  Also note that if $v\in W_i$, then $\outdeg_{W_i}(v)\leq D_i(v)$, meaning that $D_{i+1}(v)\geq 0$. Thus, $D_i(v) \geq 0$ implies $D_j(v) \geq 0$ for all $j \geq i$.  Letting $T_i=\supp(D_i^-)$, this means we have
\[T_0\supseteq T_1\supseteq T_2\supseteq\cdots.\]
Since the $T_i$'s are all subsets of $V(G)$, this sequence must eventually stabilize at some index $k\geq 0$:
\[T_0\supset \cdots\supset T_k=T_{k+1}=T_{k+2}=\cdots\]
Let $T=T_k$.  We know $T\neq \emptyset$:  otherwise, the algorithm would return $D_k$.

We can assume without loss of generality that $k=0$; if not, then we can replace $D$ with $D_k$ and still have an input on which the algorithm fails to terminate.  Thus we have $\supp(D_i^-)=T$ for all $i$.

Consider the $|T|$-tuple of $(d+1)$-tuples $\left(\beta_u(D)\right)_{u \in T}$, which we can think of as a $|T|(d+1)$-tuple.  We can provide a partial order on such tuples by setting $(\beta_u(D'))_T \geq (\beta_u(D))_T$ if for all $u \in T$, we have $\beta_u(D') \geq \beta_u(D)$, where the latter is again taken with respect to the lexicographic ordering.  We claim that
\[(\beta_u(D_{i+1}))_{T} > (\beta_u(D_i))_{T} \quad \text{for all $i \geq 0$.}\]  
To argue this, it suffices to show that $\beta_u(D_{i+1}) > \beta_u(D_i)$ lexicographically for all $u\in T$. We can now replicate the argument from the usual Dhar's algorithm.  In particular, given $u\in T$, pick $w \in W_i$ such that $d(u, w)$ is minimized. Then $w$ has a neighbor $v$ such that $d(u, v) < d(u, w)$ and $v \notin W_i$ (where we might have $v = u$). This directly corresponds to $\beta_u(D_{i+1})$ being strictly greater than $\beta_u(D_i)$ with respect to the lexicographic ordering.


Thus we have an infinite strictly increasing sequence
\[(\beta_u(D_{0}))_{T}<(\beta_u(D_{1}))_{T}<(\beta_u(D_{2}))_{T}<\cdots\]
of $|T|(d+1)$-tuples of integers.  Recall that each integer $\ell$ appearing in a tuple is the sum of the number of chips at a fixed distance from a vertex.  Since no new debt is introduced in the graph, we have $-\deg(D^-)\leq\ell\leq \deg(D^+)$.  Only finitely many $|T| (d+1)$-tuples of integers satisfy these bounds, a contradiction to the existence of an infinite sequence.  We conclude that the algorithm must terminate.
\end{proof}


Before we prove our algorithm is correct, we recall the following notation from \cite{db}. Let $D$ and $D'$ be equivalent divisors, with $D'=D-\Delta f$ for some $f$.  Define $m=\max\{f(v)\,|\, v\in V(G)\}$ and $k=m-\min\{f(v)\,|\,v\in V(G)\}$.  The \emph{level set decomposition} of $f$ is the sequence of sets $A_0\subset A_1\subset \cdots\subset A_k=V(G)$ given by \[A_i=\{v\in V(G)\,|\, f(v)\geq m-i\}.\]
Thus, $A_i$ contains $v$ if and only if $f$ prescribes firing $v$ at least $m-i$ times.
The sequence of divisors $D_0,D_1,\ldots,D_k\in \@ifstar{\oldabs}{\oldabs*}{D}$ given by $D_0=D$ and $D_{i+1}=D_i-\Delta\mathbbm{1}_{A_i}$ for all $i\in\{0,1,\ldots,k-1\}$ is called the \emph{divisor sequence associated with the level set decomposition}.

\begin{proposition}\label{prop:correct}
Algorithm \ref{algorithm:modified_dhars} is correct.
\end{proposition}

\begin{proof}
If Algorithm  \ref{algorithm:modified_dhars} terminates because at some point $D\geq 0$, then we have found a sequence of chip-firing moves (namely the sequence of moves given by firing the subset $W$ produced by each pass through the algorithm) that transforms the initial divisor into an equivalent effective divisor.  Thus the algorithm is correct if it returns a divisor.


We now wish to argue that if  Algorithm \ref{algorithm:modified_dhars} terminates with \textsc{None}, then it is correct. Let $D$ and $D'$ be equivalent divisors, where $D$ is not effective and $D'$ is.  Let $A_0\subset A_1\subset \cdots\subset A_k$ be the level set decomposition and $D=D_0,D_1,\ldots,D_k=D'$ the associated divisor sequence.

We recall \cite[Theorem 3.10]{db}:  for all $i\in\{0,1,\cdots,k\}$, we have $D_i(v)\geq\min\{D(v),D'(v)\}$ for all $v\in V(G)$. This means that no vertex goes any further into debt at any point during the sequence of firing moves. Suppose that $D=D^{+}-D^{-}$ where $D\sim D'\geq 0$ and choose $v\in \supp(D^{-})$.  Since $D(v)<D'(v)$, we have that $v\notin A_0$:  if $v$ were fired at every step, the number of chips on it would not increase.  Thus $A_0\cap \supp(D^{-})=\emptyset$.  It follows that $\textrm{outdeg}_{A_0}(v')\geq D(v')$ for all $v' \in A_0$.  Since $A_0$ is disjoint from $\supp(D^{-})$, it follows that when we run Algorithm \ref{algorithm:modified_dhars}, if $D\sim D'$ with $D'\geq 0$, then the whole graph does not burn, since at the very least $A_0$ will remain unburned. Contrapositively, if the whole graph burns, then $D$ is not equivalent to any $D'$ with $D'\geq 0$.  Thus  if the algorithm returns \textsc{None}, it is correct.
\end{proof}



We now bound the time complexity of Algorithm \ref{algorithm:modified_dhars}. We begin with the following lemma, whose statement and proof are very similar to that of Lemma 5 in \cite{tardos}.

\begin{lemma}\label{lemma:number_of_firings}
For any neighboring pair of vertices, the numbers indicating how many times each vertex has been fired so far cannot differ by more than $\deg(D^+)$ at any point during Algorithm \ref{algorithm:modified_dhars}.
\end{lemma}

\begin{proof}
Suppose that after some number of steps, we have reached $D'$ by performing $f(v)$ firing moves at each vertex $v$, so that $D'=D-\Delta f$.    Fix an edge $uv\in E(G)$.   If $f(u)=f(v)$, we are done.  Suppose $f(u)< f(v)$.  Let $U\subset V(G)$ be the set of vertices which were fired at most $f(u)$ times.  This means $u\in U$ and $v\notin U$.  By the definition of $U$, for any edge connecting $U$ with $V(G) - U$, more chips moved to $U$ than from $U$.  Hence, the total number of chips on $U$ has increased by at least $f(v)-f(u)$.  Since no new debt is created at any point in Algorithm \ref{algorithm:modified_dhars} and there are $\deg(D^+)$ chips at the beginning, we have $f(v)-f(u)\leq \deg(D^+)$.  A symmetric argument holds in the case that $f(v)<f(u)$.
\end{proof}

\begin{corollary}\label{corollary:modified_dhars_runtime}
The runtime of Algorithm \ref{algorithm:modified_dhars} is $O(|V(G)|^3\textrm{diam}(G)\deg(D^+))$.
\end{corollary}

\begin{proof}
Each pass through the algorithm runs in $O(|V(G)|^2)$ time: in the worst case, the vertices of $W$ burn one-by-one so we need to check at most $|V(G)|$ vertices at most $|V(G)|$ times each.

By construction, there is at least one vertex $q\in V(G)$ that does not fire over the course of the whole algorithm, since at least one vertex will be in debt the entire time (except possibly when it is brought out of debt at the very end).  By Lemma \ref{lemma:number_of_firings}, no neighbors of $q$ can fire more than $\deg(D^+)$ times; and therefore no neighbors of those vertices can fire more than $2\deg(D^+)$ times; and so on.  In general, no vertex of the graph can be fired more than $\textrm{diam}(G)\deg(D^+)$ times.  At least one vertex will fire on each pass through the algorithm (or else the algorithm will terminate), meaning that the total number of passes through the algorithm is at most $|V(G)|\textrm{diam}(G)\deg(D^+)$.  Combined with the running time of each individual pass, we have the desired result.
\end{proof}

It is worth noting that the time complexity computed in Corollary \ref{corollary:modified_dhars_runtime} is no better than that of Algorithm \ref{originaldhars}.  One upper bound for the runtime of that algorithm (ignoring the number of chips), presented as Algorithm 4 in \cite{bs}, is $3(|V(G)|-1)\textrm{diam}(G)\sum_{v\neq q}\deg(v)$. Since $\sum_{v\neq q}\deg(v)$ is $O(|V(G)|^2)$, this essentially matches our bound.  The work done in  \cite{bs} actually provides a more general bound on the runtime of the existing algorithm, derived by considering potential theory on graphs, of which the bound we recall here is only a corollary. It would be interesting to analyze the runtime of Algorithm \ref{algorithm:modified_dhars} through such a lens in future work.

We now describe a brute-force algorithm to determine if $\gon_r(G)>k$.

\begin{itemize}
    \item Choose a divisor $D\in \textrm{Div}_+^k(G)$ and a divisor $E\in  \textrm{Div}_+^r(G)$.  Run Algorithm \ref{algorithm:modified_dhars} on $D-E$. If it returns a divisor, move on to a new divisor $E$.  Keep testing $D-E$ for all possible divisors $E \in  \textrm{Div}_+^r(G)$ until either \textsc{None} is returned or until all possible choices of $E$ have produced a divisor.  If $D-E$ is equivalent to an effective divisor for every choice of $E$, return \textsc{False}, since the $r^{th}$ gonality is at most $\deg(D)=k$.

    \item If running Algorithm \ref{algorithm:modified_dhars} on $D-E$ returns \textsc{None}, then we know $r(D)<r$, so we can move on to a new divisor $D$ and repeat this process.  We will eventually either find $D$ with $r(D)\geq r$ (and return \textsc{False}) or we will find that there exists no such $D$ (and return \textsc{True}).


\end{itemize}



Setting $n=|V(G)|$, we have $|\textrm{Div}_+^k(G)|=\binom{n+k-1}{k}$ and  $|\textrm{Div}_+^r(G)|=\binom{n+r-1}{r}$. The runtime of Algorithm \ref{algorithm:modified_dhars} on $D-E$ is $O(n^3\textrm{diam}(G)\deg((D-E)^+))=O(n^3\textrm{diam}(G)k)$. Thus, the algorithm we have presented to determine if $\gon_r(G) > k$ will run in
\[O\left(\binom{n+k-1}{k}\binom{n+r-1}{r}n^3\textrm{diam}(G)k\right)\]
time.  For fixed $r$ and $k$, we can write this as
\[O\left(n^{k+r+3}\textrm{diam}(G)k\right),\]
or more concisely as
\[O\left(n^{k+r+4}k\right)\]
since $\textrm{diam}(G)\leq n-1$. This means that for fixed $k$ and $r$, there exists an algorithm, polynomial in $|V(G)|$, for determining if $\gon_r(G)>k$.

Of course, in order to compute $\gon_r(G)$, we would need to run this algorithm for numerous values of $k$, requiring an additional factor of $O(g(G))$ in the worst case. This quickly gives us a huge blow-up in computational time.  In the case of $r=1$, it was shown in \cite{gij} that it is NP-hard to bound gonality by $k$ (with $k$ no longer fixed).  We expect that the same holds for larger values of $r$, although do not know of any work in this direction.

Experimentally, we find that using our modified algorithm produces to compute higher gonalities provides a modest improvement in real-time performance against the traditional approach, which is to $q$-semi-reduce and then compute the $q$-reduced divisor, over varying divisors $D-E$. To conduct this analysis, we generated random connected graphs by fixing the number of vertices, inserting edges with probability $p = 0.5$, and excluding disconnected graphs. The two algorithms were compared on the same subset of 19 randomly generated connected graphs for each fixed number of vertices. We also found that performance gains appear to increase with the number of vertices in the graph (see Figure \ref{figure:dhars_runtime_comparison}).  However, most of the savings in our data come from the fact that the original iterated Dhar's algorithm spends time $q$-reducing even after debt is eliminated.  Running an early-return iterated Dhar's algorithm that terminates if debt is eliminated, we found a nearly identical performance to our modified algorithm.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=0.6]{comparing_algorithms2.png}
    \caption{Comparison of original Dhar's algorithm and our modified algorithm on graphs of low gonality}
    \label{figure:dhars_runtime_comparison}
\end{figure}


\medskip

\noindent \textbf{Acknowledgements}  The authors are grateful for the support they received from Williams College's SMALL REU, and from NSF Grants DMS1659037 and
DMS1347804.


\bibliographystyle{abbrv}

\section{Preliminary Results}

We begin by providing some basic results on higher gonalities, including \sout{certain} bounds for the $k$-th gonality of a graph based on lower gonalities.

\begin{lemma}
\label{nonneg}
For a graph $G$ and $k \in \mathbb{Z}_{>0}$, $\gon_k(G) \geq k$.
\end{lemma}

\begin{proof}
Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) < k$. Then, for all $D' \in \Div_+^k(G)$, we have $|D - D'| = \varnothing$ because $\deg(D - D') < 0$ and the degree of a divisor is preserved under linear equivalence. Hence, $r(D) < k$.
\end{proof}

More intuitively, recall that a divisor wins the chip-firing game if, no matter how the opponent subtracts $k$ chips from the board, the resulting divisor is always equivalent to an effective divisor. If we begin with fewer than $k$ chips and the opponent subtracts $k$ chips, then we are left with a divisor $D$ with $\deg(D) < 0$ so $D$ cannot be equivalent to an effective divisor.

\begin{proposition}
\label{tree}
For a graph $G$, $\gon_k(G) = k$ if and only if $G$ is a tree.
\end{proposition}

\begin{proof}
If $G$ is a tree, then $G$ has genus $g(G) = 0$. By Riemann-Roch, if we have a divisor $D$ with $\deg(D) = k$, then
\begin{align*}
    r(D) &= \deg(D) + 1 - g(G) + r(K - D) \\
    &= k + 1 + r(K - D) \geq k.
\end{align*}
Hence, $\gon_k(G) \leq k$. On the other hand, by Lemma \ref{nonneg}, we know that the gonality of $G$ must be at least $k$ so $\gon_k(G) = k$.


Conversely, if $\gon_k(G) = k$, we show that $\Div^0(G) \subseteq \Prin(G)$ (note that the reverse inclusion clearly holds). We mimic the proof of Theorem 4.1 given in \cite{db}. Note first that because $\gon_k(G) = k$, there exists a divisor $D \in \Div_+^k(G)$ such that $\@ifstar{\oldabs}{\oldabs*}{D - E} \neq \varnothing$ for each $E \in \Div_+^k(G)$. This implies that for each $E \in \Div_+^k(G)$, $D - E \in \Prin(G)$ because the only effective divisor of degree zero is the all-zeroes divisor. Suppose that $D = \sum_{i=1}^k (v_i)$ {\color{red}what is this notation? Franny is confused again :(} \g{eep, this was the old notation! I think I've fixed all of it now} for a collection of (not necessarily unique) vertices $v_i \in V(G)$. For each $w \in V$, define $E_w = (w) + \sum_{i=2}^k (v_i)$. Since $E_w \in \Div_+^k(G)$ for each $w \in V(G)$, we have
\[
D - E_w = \sum_{i=1}^k (v_i) - \left[(w) + \sum_{i=2}^k (v_i)\right] = (v_1) - (w).
\]
Hence, for fixed $v_1$ and all $w \in V(G)$, $(v_1) - (w) \in \Prin(G)$.


Now, fix $F \in \Div^0(G)$ and let $F' = \Red_{v_1}(F)$. Since $F'(w) \geq 0$ for all $w \in V(G) - \{v_1\}$ and $F'(v_1) = - \sum_{w \in V(G) - \{v_1\}} F'(w)$, we have
\[
F' = \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot (w) - \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot (v_1) = \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot \left[ (w) - (v_1) \right].
\]
Since $F'(w) \cdot \left[(w) - (v_1)\right] \in \Prin(G)$ for each $w \in V(G)$, we have $F' \in \Prin(G)$ and since $F \sim F'$, this implies that $F \in \Prin(G)$. We have thus shown that $\Div^0(G) = \Prin(G)$. By Theorem 2.13 of \cite{db}, it follows that $G$ has exactly one spanning tree so $G$ itself must be a tree.
\end{proof}

\begin{corollary}
\label{cycle}
For a cycle graph $C_n$, $\gon_k(C_n) = k+1$.
\end{corollary}

\begin{proof}
Since each cycle graph $C_n$ is \textit{not} a tree, we know that $\gon_k(C_n) \geq k+1$ by Proposition \ref{tree}. On the other hand, $g(C_n) = 1$. Hence, by Riemann-Roch \ref{RR}, we have an upper bound of $k+1$ on the gonality of the cycle family. {\color{red} I don't feel like the use of RR is immediately clear. Perhaps we could flush out.} Thus, $\gon_k(C_n) = k+1$ for all $n$.
\end{proof}

\begin{lemma}
\label{strict}
If $n > m$, then $\gon_n(G) > \gon_m(G)$.
\end{lemma}

\begin{proof}
We first show that, for any given divisors $D, E \in \Div_+(G)$, 
\[
r(D - E) \geq \max \{r(D) - \deg(E), -1\}.
\]
Suppose that $r(D) - \deg(E) > -1$. (Otherwise, this inequality is clearly true.) Let $r(D) = k$. By the definition of rank, we know that $\@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \varnothing$ for all $D' \in \Div_+^{k}(G)$. Hence, $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} \neq \varnothing$ for all $E' \in \Div_+^{k - \deg(E)}(G)$ as $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} = \@ifstar{\oldabs}{\oldabs*}{D - (E + E')}$ where $E + E' \in \Div_+^k(G)$. It follows that $r(D - E) \geq k - \deg(E) = r(D) - \deg(E)$.

Now let $\gon_n(G) = \gamma$. This means that there exists some divisor $D \in \Div_+^\gamma(G)$ such that $r(D) = n$. For any $E \in \Div_+^{n-m}(G)$, we have $r(D - E) \geq r(D) - \deg(E) = r(D) - (n-m) = m$. Since $\deg(D - E) = \gamma - (n-m) < \gamma$, we have
\[
\gon_m(G) \leq \deg(D - E) < \gon_n(G).
\]
\end{proof}

\begin{lemma}
\label{sum}
If $a = a_1 + \cdots + a_n$ with $a_i \in \mathbb{Z}_{>0}$, then $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$.
\end{lemma}

\begin{proof}
Let $\gamma_{a_i} = \gon_{a_i}(G)$ for each $i$. There exists a divisor $D_{a_i} \in \Div_+^{\gamma_{a_i}}(G)$ such that $r\left(D_{a_i}\right) = a_i$ for each $i$. This implies that $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E} \neq \varnothing$ for all $E \in \Div_+^{a_i}(G)$. Let $D = D_{a_1} + \cdots + D_{a_n}$. Notice that for each $E \in \Div_+^a(G)$, we have some decomposition $E = E_{a_1} + \cdots + E_{a_n}$ where $E_{a_i} \in \Div_+^{a_i}(G)$. 

Pick $F_i \in \Div_+(G)$ for $i \in \{1,\dots,n\}$. We now show that if $\@ifstar{\oldabs}{\oldabs*}{F_i} \neq \varnothing$ for all $i$, then $\@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n F_i} \neq \varnothing$. Notice that, for each $F_i$, there exists $F_i' \in \Div_+(G)$ such that $F_i' \sim F_i$. We note that $\sum_{i=1}^n F_i \sim \sum_{i=1}^n F_i'$ and that $\sum_{i=1}^n F_i' \in \Div_+(G)$, which implies that $\@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n F_i } \neq \varnothing$.

As a consequence, we see that
\[
\@ifstar{\oldabs}{\oldabs*}{D - E} = \@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n D_{a_i} - \sum_{i=1}^n E_{a_i} } = \@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n \@ifstar{\oldparen}{\oldparen*}{D_{a_i} - E_{a_i} } } \neq \varnothing,
\]
because for each $i$, we have $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E_{a_i}} \neq \varnothing$. We conclude that $r(D) \geq a$ which implies that $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$. 
\end{proof}

\begin{lemma}
\label{genus}
If $k \geq g(G)$, then $\gon_k(G) = g(G) + k$.
\end{lemma}

\begin{proof}
Let $g = g(G)$ and $k \geq g$. Choose a divisor $D \in \Div_+^{g+k}(G)$. By Riemann-Roch \ref{RR}, we know that
\begin{align*}
r(D) &= \deg(D) + 1 - g + r(K - D) \\
&= k + 1 + r(K - D) \geq k. 
\end{align*}
Hence, $\gon_k(G) \leq g + k$. Now, suppose that we have a divisor $D \in \Div_+^{g+k-\ell}(G)$ with $\ell \geq 1$ such that $r(D) \geq k$. Then, by Riemann-Roch, we see that
\begin{align*}
r(K - D) &= r(D) - (\deg(D) + 1 - ) \\
&\geq k - (g +k-\ell + 1 - g) \\
&= \ell - 1.
\end{align*}
Since $r(K - D) \geq \ell - 1$, we know that $\deg(K - D) \geq \ell - 1$. Hence,
\begin{align*}
\deg(K - D) = 2g - 2 - (g+k-\ell) &\geq \ell - 1 \\
g - 1 \geq k,
\end{align*}
contradicting our original assumption that $k \geq g$. We conclude that $\gon_k(G) = g + k$.
\end{proof}
\section{Gonality Sequences}

We define the \textbf{gonality sequence} of a graph to be its complete set of $k$-th gonalities for $k \in \mathbb{Z}_{>0}$. In this section, we first show that, using no more than the tools we have already developed, we can completely determine all possible gonality sequences for graphs of low genus. We then provide the complete gonality sequence for graphs of first gonality 1 and 2, as well as a conjecture regarding the gonality sequence for graphs of first gonality 3. 

\subsection{Classification by Genus}

All graphs of genus $g(G) = 0$ are trees. We have shown that $\gon_k(G) = k$ for all of these graphs. Note that this result also comes as a direct consequence of Lemma \ref{genus}.

\begin{proposition}
All graphs of genus $1$ have gonality sequence
\[
\gon_k(G) = k + 1.
\]
\end{proposition}

\begin{proof}
This is an immediate corollary of Lemma \ref{genus}.
\end{proof}

Note that Corollary \ref{cycle} can be immediately deduced from this result.

\begin{proposition}
All graphs of genus $2$ have gonality sequence
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
k + 2 \quad &\text{otherwise.}
\end{cases}
\]
\end{proposition}

\begin{proof}
By Riemann-Roch, every genus $2$ graph has a canonical divisor $K$ with $\deg(K) = 2$ and $r(K) = 1$. Hence, $\gon_1(G) \leq 2$, and \sout{by} {\color{red}using} Lemma \ref{tree}, we know that $\gon_1(G) = 2$. The higher gonalities follow as a consequence of Lemma \ref{genus}.
\end{proof}

\begin{proposition}
All graphs of genus $3$ have one of the two following gonality sequences:
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
k + 3 \quad &\text{otherwise,}
\end{cases}
\qquad \text{or} \qquad 
\gon_k(G) = \begin{cases}
3 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
k + 3 \quad &\text{otherwise}.
\end{cases}
\]
\end{proposition}

\begin{proof}
Clearly, $\gon_1(G) \geq 2$. By Corollary \ref{brillnoether}, the first gonality is bounded above by $\left\lfloor \frac{g+3}{2} \right\rfloor = 3$. Notice that all gonalities starting with $\gon_3(G)$ and onwards are determined by Lemma \ref{genus}. Using Lemma \ref{sum}, we can eliminate the following possibilities: $\gon_1(G) = 2$ and $\gon_2(G) = 3$, and $\gon_1(G) = 2$ and $\gon_2(G) = 5$. {\color{red}Flush out more...} Furthermore, we \sout{can also} eliminate the case where $\gon_1(G) = 3$ and $\gon_2(G) = 5$, using the fact that {\color{red}by Reimann-Roch \ref{RR}?} the canonical divisor $K$ has $\deg(K) = 4$ and $r(K) = 2$. Hence, we are left with the two aforementioned gonality sequences.
\end{proof}

{\color{red}Use remark environment?}
\textit{Note.} To see that both of these two gonality sequences can actually occur in graphs of genus $3$, note that the first is the gonality sequence of the complete bipartite graph $K_{2,4}$ and the second is the gonality sequence of the complete graph $K_4$ (see Figure \ref{highergen3}).

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.2]{highergongenus3-2.png}
    \caption{Genus $3$ graphs with two different gonality sequences}
    \label{highergen3}
\end{figure}

\begin{proposition}
All graphs of genus $4$ have one of the two following gonality sequences:
\[
\gon_k(G) = \begin{cases}
2 \quad &\text{if $k = 1$} \\
4 \quad &\text{if $k = 2$} \\
6 \quad &\text{if $k = 3$} \\
k + 4 \quad &\text{otherwise}
\end{cases}
\qquad \text{or} \qquad 
\gon_k(G) = \begin{cases}
3 \quad &\text{if $k = 1$} \\
5 \quad &\text{if $k = 2$} \\
6 \quad &\text{if $k = 3$} \\
k + 4 \quad &\text{otherwise}.
\end{cases}
\]
\end{proposition}

\begin{proof}
Notice that for $k \geq 4$, it is clear that $\gon_k(G) = k + 4$ by Lemma \ref{genus}. We also note that by Corollary \ref{brillnoether}, the first gonality is at most $\lfloor \frac{g+3}{2} \rfloor = 3$. \sout{Using}{\color{red}In light of} Lemma \ref{strict}, we can enumerate all possible sequences of the first three terms satisfying these conditions:

\begin{center}
\begin{tabular}{|c|c|c|c|}
\hline
$2,3,4$ & $2,3,5$ & $2,3,6$ & $2,3,7$ \\
\hline
$2,4,5$ & $2,4,6$ & $2,4,7$ & $2,5,6$ \\
\hline
$2,5,7$ & $2,6,7$ & $3,4,5$ & $3,4,6$ \\
\hline
$3,4,7$ & $3,5,6$ & $3,5,7$ & $3,6,7$ \\
\hline
\end{tabular}
\end{center}
Notice that we can immediately rule out all sequences with $\gon_2(G) = 3$ because, by Lemma \ref{sum}, this would mean $\gon_4(G) \leq 6$ {\color{red}contradicting that by our first statement, $\gon_4(G)=8$.} We can also rule out all sequences with $\gon_1(G) = 2$ and $\gon_2(G) \geq 5$ by a similar argument. {\color{red} which is...} Furthermore, since the canonical divisor $K$ has $\deg(K) = 6$ and $r(K) = 3$ {\color{red}by Reimann-Roch? \ref{RR}}, we can rule out all sequences with $\gon_3(G) > 6$. Finally, we can use Theorem \ref{coppensclif} to show that the sequences with $\gon_1(G) = 3$ and $\gon_2(G) = 4$ are impossible. This leaves us with the two sequences noted above.
\end{proof}

{\color{red}Use remark environment?}
\textit{Note.} Again, we provide examples of each gonality sequence. The graph $K_{2,5}$ satisfies the first gonality sequence and the graph $K_{3,3}$ satisfies the second gonality sequence (see Figure \ref{highergen4}).

\begin{figure}[h]
    \centering
    \includegraphics[scale=0.2]{highergongenus4.png}
    \caption{Genus $4$ graphs with two different gonality sequences}
    \label{highergen4}
\end{figure}

\subsection{Classification by First Gonality}

All graphs of gonality $1$ are trees so their gonality sequences are completely determined by Lemma \ref{tree}.

\begin{proposition}
If $\gon_1(G) = 2$, then $G$ has the following gonality sequence:
\[
\gon_k(G) = \begin{cases}
2k \quad &\text{if $k < g(G)$} \\
k + g(G) \quad &\text{if $k \geq g(G)$}.
\end{cases}
\]
\end{proposition}

\begin{proof}
By Lemma \ref{genus}, we know $\gon_k(G) = k + g(G)$ for $k \geq g(G)$. We also know that, by Lemma \ref{sum}, if $k < g(G)$, then $\gon_k(G) = \gon_{k-1}(G) + 1$ or $\gon_k(G) = \gon_{k-1}(G) + 2$. Notice that between $\gon_1(G)$ and $\gon_{g(G)}(G)$, we have an increase of $k + g(G) - 2$. This means that we cannot have $\gon_k(G) = \gon_{k-1}(G) + 1$ because this would require that $\gon_\ell(G) > \gon_{\ell-1}(G)$ for some $\ell \neq k$. Hence, we must have $\gon_k(G) = \gon_{k-1}(G) + 2$ for all $k \in \{1,\dots,g(G) - 1\}$.
\end{proof}

Based on results from classical algebraic geometry (see, for example, Remark 4.5 in \cite{trigonal}), we also make the following conjecture for graphs of first gonality $3$.

\begin{conjecture}
If $\gon(G) = 3$ then
\[
\gon_k(G) = 
\begin{cases}
3k \quad &\text{if $1 \leq k \leq \left\lfloor \frac{g-1}{3} \right\rfloor$} \\
g + k - 1 - \left\lfloor \frac{g-k-1}{2} \right\rfloor \quad &\text{if $\left\lfloor \frac{g-1}{3} \right\rfloor < k \leq g - 1$} \\
g + k \quad &\text{if $k \geq g$}.
\end{cases}
\]
\end{conjecture}

We begin with the following lemma, derived from Riemann-Roch:
\begin{lemma}\label{lemma:RRbounds}
If $\gon_k(G) \leq \gamma$, then $\gon_{k+g-1-\gamma}(G) \leq 2g - 2 - \gamma$.  Moreover, if $\gon_k(G) \geq \gamma$ then for $\delta \geq 2g - \gamma$, $\gon_{k-g+\delta}(G) \geq \delta$, and in particular, $\gon_{k+g-\gamma} \geq 2g - \gamma$.
\end{lemma}
\begin{proof}
Suppose $\gon_k(G) \leq \gamma$. Then there exists a divisor $D$ satisfying $\deg(D) = \gamma$ and $r(D) \geq k$.  Then $\deg(K-D) = 2g - 2 - \gamma$ and $r(K-D) \geq k + g - 1 - \gamma$, so $K-D$ provides an upper bound on $\gon_{k+g-1-\gamma}(G)$.

On the other hand, suppose $\gon_k(G) \geq \gamma$, and let $D'$ satisfy $\deg(D') = \delta - 1$.  Then $\deg(K-D') = 2g - \delta {\color{red}+} 1 < \gamma$, so $r(K-D') = r(D') + g - \delta < k$, implying $r(D') < k - g + \delta$, so $\delta$ provides a lower bound on $\gon_{k-g+\delta}(G)$.  
\end{proof}

We can now prove the following weaker result.
\begin{theorem}
If $G$ satisfies $\gon_k(G) = 3k$ whenever $1 \leq k \leq \floor{(g-1)/3}$ then $\gon_{\ell}(G) = g + \ell - 1 - \floor{(g-\ell-1)/2}$ whenever $\floor{(g-1)/3} < \ell \leq g-1$.
\end{theorem}
\begin{proof}
Let $\gamma_k = \gon_k(G)$.  By Lemma \ref{lemma:RRbounds}, \sout{if $1 \leq k < \floor{(g-1)/3}$ then?} since $\gamma_k \leq 3k$, $\gamma_{g-1+2k} \leq 2g - 2 - 3k$, and since $\gamma_{k+1} \geq 3k$, taking $\delta = 2g - 3k + 1$ we get $\gamma_{g-1+2k} \geq 2g - 2 - 3k$.  If we take $\ell = g - 1 + 2k$ in the statement of the theorem, a quick computation shows that this is the desired value.

Allowing $k$ to assume the value $\floor{(g-1)/3}$, \textcolor{red}{shouldn't we be determining what happens when $l= g-1$? Are we not assuming that when $k=\floor{(g-1)/3}$ that $\gon_k=3k$?} again by Lemma \ref{lemma:RRbounds}, since $\gamma_k \geq 3k$, taking $\delta = 2g - 3k$ we get $\gamma_{g-2k} \geq 2g - 3k$.  Moreover, $\gamma_{g-2k} < \gamma_{g+1-2k} = 2g - 3k + 1$ by the preceding paragraph, which establishes that $\gamma_{g-2k} = 2g - 3k$.  Again, a quick computation establishes that this is as desired.
\end{proof}
\textcolor{red}{It's really not clear what is going on here. It would also be helpful to clean up the statement of Lemma 3.7.}

{\color{red}\section{Second Gonality for Graph Families}

In this section, we argue the second gonality for two families of graphs: the complete bipartite graph and generalized banana graphs.

\subsection{Complete Bipartite Graphs}}

\sout{In this section,} We compute the second gonality of the complete bipartite graph $K_{m,n}$, for all values of $m$ and $n$. Note that $\gon_1(K_{m,n}) = \min \{m,n\}$, as determined by de Bruyn in \cite{db}. Our main result is summarized in the following theorem. 

\begin{theorem}\label{2gonKmn} The second gonality of $K_{m,n}$ is
$$\gon_2(K_{m,n})=\begin{cases} 2 &\text{if }m=n=1\\2m-1 &\text{if }1<m=n
\\2\min\{m,n\}&\text{if }m\neq n\end{cases}.$$
\end{theorem}

We will assume without loss of generality that $m\leq n$.  The result in the cases where $m=1$ or $m=2$ follows immediately from our classification of gonality sequences for trees and for graphs of first gonality $2$.  {\color{red}Thus, for the purposes of the proof,} we will now assume $m\geq 3$.

The following lemma will be useful in proving that certain divisors are $v$-reduced.

\begin{lemma}\label{lemma:inequality}  
Suppose $3\leq m$, $3\leq n$, $2\leq k_1\leq m$, $2\leq k_2\leq n$, and
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2$$
Then either $k_2=n-1$ or $k_2=n$.
\end{lemma}

\begin{proof} 

Expanding and rearranging our inequality, we have
$$(k_2-2)m\leq 2k_1k_2-k_1n-2<k_1(2k_2-n).$$
Since both sides are nonnegative and $k_1\leq m$, we may divide the left side by $m$ and the right side by $k_1$ and still preserve inequality:
$$k_2-2<2k_2-n.$$
Rearranging gives us
$$n<k_2-2, $$
which combined with $k_2\leq n$ implies $k_2=n-1$ or $k_2=n$.

\end{proof}

We will also use the following lemma to show that we may assume divisors on $K_{m,n}$ don't have too many chips on any one vertex.

\begin{lemma}  
\label{bipartite}
Let $G=K_{m,n}$, and let $D$ be an effective divisor on $G$.

\begin{enumerate}
\item If $m<n$ and $\deg(D)=2m-1$, then $D\sim D'=\sum a_v(v)$, where $0\leq a_v<\deg(v)$ for all vertices $v$.
\item If $m=n$ and $\deg(D)=2m-2$, then $D\sim D'=\sum a_v(v)$, where $0\leq a_v<\deg(v)$ for all vertices $v$.
\end{enumerate}
\end{lemma}

\begin{proof}  First we prove (1).  Let $v$ be a vertex of valence $m$, and let $E=\sum b_w(w)$ be the $v$-reduced divisor obtained from $D$. Since $D$ is effective, so is $E$. Since no vertex besides $v$ can fire, we have $b_w<\val(w)$ for all $w\neq v$.  If $b_v<m$, we can take $D'=E$ and we're done.  Otherwise, we have $m\leq b_v\leq 2m-1$, so we fire $v$ exactly once; we claim the resulting divisor is our desired $D'$.  To see this, note that $v$ will now have at most $m-1$ chips, and $\val(v)=m$; and since $m\leq b_v$, the most chips another vertex could have had would be $m-1$.  After firing $v$, this might change to $m$; but the degree of such a vertex is $n>m$.  Thus we have our desired $D'$.

The claim in (2) is proved in a similar fashion: choose a $v$, $v$-reduce, then fire $v$ if necessary.  If $v$ cannot fire, we're done.  If it can fire, then there are between $m$ and $2m-2$ chips on $v$, so the most chips another vertex could have is $m-2$.  After firing $v$ once, no chip will have more than $m-1$ vertices, giving us our desired divisor.
\end{proof}

We now handle the case of Theorem \ref{2gonKmn} where $m$ and $n$ are distinct.

\textcolor{red}{I feel like figures may help with understanding these proofs?}

\begin{proposition}  
\label{mncase}
If $3\leq m<n$, then
$$\gon_2(K_{m,n})=2m.$$
\end{proposition}


\begin{proof}  To distinguish vertices based on whether they are in the vertex class with $m$ vertices or the class with $n$ vertices, we will refer to the $m$-class and the $n$-class of $K_{m,n}$. We already know $\gon_2(K_{m,n})\leq 2\gon_1(K_{m,n})=2m$ by Lemma \ref{sum}. To show that $\gon_2(K_{m,n})\geq 2m$, we will show that for any divisor $D$ with $\deg(D)=2m-1$, we have $r(D)<2$.

Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) = 2m-1$. If any vertex in the $m$-class has $n$ or more chips, we fire it. If any vertex in the $n$-class has $m$ or more chips, we fire it. By Lemma \ref{bipartite}, this process eventually terminates. Thus, we may assume that every vertex in the $m$-class has fewer than $n$ chips and every vertex in the $n$-class has fewer than $m$ chips.

Since there are $n+m\geq 2m+1$ vertices, there are at least two vertices with zero chips. We consider the following two possible cases.

\begin{enumerate}
\item Both the $m$-class and the $n$-class have exactly one vertex with zero chips.
\item One class has at least two vertices with zero chips.
\end{enumerate}

In case (1), there are $n+m-2$ vertices with at least one chip each. Since $\deg(D)=2m-1$, we have $2m-1\geq n+m-2\geq 2m-1$, implying that $n=m+1$. Hence, we have $(m+1)+m - 2 = 2m-1$ vertices with at least one chip, which in turn implies that every vertex with at least one chip has exactly one chip. Thus, $D$ must be the divisor with one chip on every vertex, except for one vertex in each class. Let $v_1$ be a vertex in the $m$-class with one chip, and \textcolor{red}{let $v_2$ be the vertex in the $n$-class with exactly one chip} \textcolor{blue}{should this be the vertex with no chip? otherwise $D-(v_1) - (v_2)$ is effective}. Then by Dhar's burning algorithm, $D-(v_1) - (v_2)$ is $v_2$-reduced: lighting $v_2$ on fire burns $v_1$ and another vertex in the $n$-class. From here, all vertices in the $m$-class burn, causing the entire graph to burn. Since $D-(v_1) - (v_2)$ is not effective, we find that $r(D) < 2$ in this case.

Now consider case (2), where one class has at least two vertices with zero chips. We claim that the other class must have at least one vertex with no more than one chip. Otherwise, each vertex on that side would have at least two chips, so our divisor would be of degree $2m$ or $2n$. If this vertex has exactly one chip, subtract one chip from this vertex. If this vertex has no chips, then there exists at least one other vertex in the same class with no more than two chips (otherwise, there would be at least $3(m-1)=3m-3=2m-1+(m-2)>2m-1$ chips). If it has one or two chips, subtract one chip from it. Otherwise, subtract a chip from any vertex of the graph with a positive number of chips. Finally, subtract a chip from one of the original (at least) two vertices with zero chips. Call this vertex $v$ and the resulting divisor $D'$. \textcolor{red}{What 2 chips are being removed here? You talk about three locations?}

We deal with one special sub-case separately: it is possible that the divisor $D'$ now has a vertex class where every vertex has at least two chips except for a single vertex with zero chips This would only arise in the case where the $m$-class originally had all the chips, with one vertex having a single chip and all other vertices in this class having exactly two chips. However, in this case, $D'$ is already reduced with respect to any given vertex in the $n$-class. Running Dhar's burning algorithm from from the vertex in the $n$-class with $-1$ chips causes the one vertex with zero chips in the $m$-class to burn, causing every vertex in the $n$-class to burn. Since $n \geq 3$, the whole graph burns.

Outside of this case, one vertex class has a vertex $v$ with $-1$ chips and one with zero chips, and the other class has a vertex with zero chips and another with at most one chip. We \sout{will} show that this non-effective divisor $D'$ is $v$-reduced. Run Dhar's burning algorithm with this divisor. All four vertices mentioned above will burn \sout{by construction} \textcolor{red}{immediately?}. Continue burning until the process stabilizes, say with $k_1$ vertices burned in the $m$-class and $k_2$ vertices burned in the $n$-class.  We know that $2\leq k_1\leq m$, and $2\leq k_2\leq n$. Our goal is to show that $k_1=m$ and $k_2=n$, since this will imply that $D'$ is reduced.

Since the process has stabilized, we know that every unburnt vertex in the $m$-class has at least $k_2$ chips and every unburnt vertex in the $n$-class has at least $k_1$ chips. This means that there are at least $k_2(m-k_1)+k_1(n-k_2)$ chips on the unburnt vertices. Notice that $V(G) - \{v\}$ has a total of $2m-2$ chips, meaning
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2.$$  By Lemma \ref{lemma:inequality}, we know $k_1=n-1$ or $k_1=n$.  Since $m< n$, we also have
$$k_2(m-k_1)+k_1(n-k_2)\leq 2m-2,$$
we have $k_1=m-1$ or $k_1=m$.
\textcolor{red}{the above two statements are exactly the same?}

In other words, each vertex class has at most one unburnt vertex.  Note that if one class has all vertices burning, so does the other:  this follows from our assumption that, in our original divisor, each vertex in the $m$-class has at most $n$ chips and each vertex in the $n$-class has at most $m$ chips. Suppose for the sake of contradiction that each class has exactly one unburnt vertex. Then the unburnt vertex in the $m$-class has at least $n-1$ chips and the unburnt vertex in the $n$-class has at least $m-1$ chips. But $n-1+m-1=n+m-2>2m-2$, which is a contradiction. Thus $k_1=m$ and $k_2=n$, so every vertex is burning. This implies that $D'$ is $v$-reduced, and since it is not effective, $r(D)<2$.  This completes the proof.
\end{proof}

A similar argument allows us to compute $\gon_2(K_{m,m})$.

\begin{proposition}
If $m \geq 2$, then
\[
\gon_2(K_{m,m}) = 2m-1.
\]
\end{proposition}

\begin{proof}
First, we exhibit a divisor on $K_{m,m}$ of rank at least $2$ and degree $2m-1$. Then we will show that any divisor of degree $2m-2$ has rank at most $1$.

Fix $v \in K_{m,m}$, and let $D$ be the divisor consisting of one chip on every vertex besides $v$. Clearly, $\deg(D)=2m-1$. To show that $r(D)\geq 2$, we consider the possible degree $2$ divisors that can be subtracted from $D$:

\begin{enumerate}
\item $D' = D - 2 (v)$
\item $D' = D - (v) - (v')$ where $v'$ is a vertex in the same vertex class as $v$
\item $D' = D - (v) - (v')$ where $v'$ is a vertex in the opposite vertex class.
\end{enumerate}
In cases (1) and (2), we fire all vertices except for $v$. Then, $v$ has at least zero chips, all vertices in the same class as $v$ have the same number of chips as they started with, and all vertices in the opposite class from $v$ now have zero chips. In case (3), suppose $w$ is the vertex in the opposite class that now has zero chips. Fire all vertices except for $v$ and $w$. After firing, $v$ has at least zero chips, $w$ has $m-1$ chips, and all other vertices have zero chips. \textcolor{red}{Thus,} in each \textcolor{red}{of these} case\textcolor{red}{s}, we win the chip-firing game so $r(D) \geq 2$. 

Now, suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) = 2m-2$. If any vertex has $m$ or more chips, fire it. Continue until each vertex has fewer than $m$ chips. By Lemma \ref{bipartite}, this process terminates. Since there are $2m$ vertices, at least two vertices have zero chips on them. We have two cases:
\begin{enumerate}
\item Both vertex classes have exactly one vertex with zero chips.
\item One vertex class has at least two vertices with zero chips.
\end{enumerate}
In case (1), $D$ must be the divisor with a single chip on each vertex except for two vertices $v,w$ in opposite vertex classes with zero chips \textcolor{red}{why?}. Let $D' = D - (v) - (w')$ where $w'$ is any vertex in the opposite vertex class except $w$. Then, by Dhar's burning algorithm, $D'$ is $v$-reduced, and since it is not effective, we have $r(D)<2$.

Now, suppose we are in case (2). Let $A$ and $B$ denote the two vertex classes of the graph. Suppose that $A$ is the vertex class with at least two vertices, each with zero chips. Pick a vertex $v$ from these two on which to place a $-1$ chip. Since there are only $2m-2$ chips on the graph, there are at least two vertices on $B$ with no more than two chips between them. Otherwise, there would be at least $2(m-2) + 3 = 2m-1$ chips on the graph. If both of these vertices have zero chips, place a $-1$ chip on any other vertex in $B$ with a positive number of chips. If not, place a $-1$ chip on one of the two vertices so that one vertex now has zero chips and the other vertex has at most one chip. Call the resulting divisor $D'$.

We will show that this non-effective divisor $D'$ is $v$-reduced, implying that $r(D)<2$.  Run Dhar's burning algorithm. By construction, all four vertices mentioned above will burn. Continue burning until the process stabilizes, say with $k_1$ vertices burned in $A$ and $k_2$ vertices burned in $B$. We know that $2\leq k_1\leq m$, and $2\leq k_2\leq m$. Our goal is to show that $k_1=k_2=m$, since this will imply that $D'$ is $v$-reduced.

Since the process has stabilized, every unburnt vertex in $A$ has at least $k_2$ chips and every unburnt vertex in $B$ has at least $k_1$ chips. Hence, there are at least $k_2(m-k_1)+k_1(m-k_2)$ chips on the unburnt vertices. Notice that $V(G) - \{v\}$ has a total of $2m-3$ chips so 
$$k_2(m-k_1)+k_1(m-k_2)\leq 2m-3.$$ 

At this point, we can apply the exact same argument from the proof of Proposition \ref{mncase} to conclude that $k_1=k_2=m$, so that the entire graph is burnt and the non-effective divisor $D'$ is $v$-reduced. Hence, $r(D)<2$, implying that $\gon_2(K_{m,m}) = 2m-1$.
\end{proof}


\subsection{Banana Graphs}
We define the \textit{single banana graph} $B_n$ as a graph with two vertices and $n$ edges connecting them. It is clear that for $n \geq 2$, $\gon_1(B_n) = 2$, since $\gon_1(G)\leq |V(G)|$. \textcolor{red}{to me but... maybe cite the $|V(G)|$ bound?} \textcolor{blue}{maybe we can add a ``trivial'' upper bound on the kth gonality being $k|V(G)|$ in prelim results section? not sure this is worth a lemma/corollary}

\begin{lemma}\label{higherbn}
Let $k\in\mathbb{Z}$, with $1\leq k \leq n-1$. Then $\gon_k(B_n)=2k$.
\end{lemma}

\begin{proof}
Note that by Lemma \ref{sum}, $\gon_k(B_n) \leq 2k$. Suppose we have a divisor $D \in \Div_+(B_n)$ such that $\deg(D) = 2k-1$. Then $D$ has exactly $h$ chips on one vertex and $\ell$ chips on the other, where $h + \ell = 2k-1$. Without loss of generality, suppose $h < k$. The opponent can subtract $h+1$ chips from the first vertex and $k - (h+1)$ chips from the other vertex. Notice that we now have one vertex with $-1$ chips and another vertex with $\ell - (k - h - 1) = k$ chips. Since $k < n$, we cannot fire the chips to win so $r(D) < 1$. We conclude that $\gon_k(B_n) = 2k$. 
\end{proof}

We now define the \textit{generalized banana graph} denoted $B_{n,e}$ as the graph with $n$ vertices $\{v_1,\dots,v_n\}$ and each pair of vertices $v_i, v_{i+1}$ connected by $e$ edges. Since, for any graph $G$, $\gon_1(G) \geq \min \{ \eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$ \textcolor{red}{CITE (perhaps add in the background info section)} \textcolor{blue}{not sure where this would naturally fall within background} where $\eta(G)$ denotes the \textit{edge-connectivity} of the graph, it is clear that $\gon_1(B_{n,e}) = \min \{e, n\}$.

It is stated in \cite{liyau} and proved in \cite{gonthree} that, for any graph $G$, $\gon_1(G)\geq \min\{\eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$, where $\eta(G)$ denotes the \textit{edge-connectivity} of the graph. Thus, it is clear that $\gon_1(B_{n,e})=\min\{e,n\}$.

\begin{example}
The generalized banana graphs $B_{4,2}$ and $B_{5,5}$ are illustrated in Figure~\ref{fig:genbananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{genbanana.pdf}
\caption{The generalized banana graphs $B_{4,2}$ and $B_{5,5}$.}
\label{fig:genbananas}
\end{center}
\end{figure}

\begin{lemma}
If $n<e$, then $\gon_2(B_{e,n})=2n$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2\min\{n, e\} = 2n$. Now, suppose that we have a divisor $D \in \Div_+(B_{n,e})$ with $\deg(D) = 2n-1$. We have the following cases:
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, then there exists at least one vertex $v_i$ with $D(v_i) = 1$. Furthermore, for all other vertices $v_j$, $D(v_j) \leq n < e$. Hence, the divisor $D - 2 (v_i)$ is $v_i$-reduced, implying that $r(D) < 2$.
    \item[(2)] If exactly one vertex $v_i$ has zero chips and all other vertices have at least one chip, then there are two cases.
    \begin{itemize}
        \item[(i)] There exists exactly one vertex $v_j$ with $e$ chips. Note that since $2n - 1 - e \leq n - 2$, $v_j$ clearly cannot have more than $e$ chips and since $2n - 1 - 2e < 0$, we cannot have more than one vertex with $e$ chips. If $v_j$ has $e$ chips, then every other vertex (except for $v_i$ and $v_j)$ must have exactly one chip. Hence, the divisor $D - (v_i) - (v_j)$ is $v_i$-reduced.
        \item[(ii)] All vertices have fewer than $e$ chips. Notice that in this case, $D - 2(v_i)$ is $v_i$-reduced.
    \end{itemize}
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with $D(v_i)=0=D(v_j)$, then there is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists, and consider the divisor $D'=D-v_i-v_j$. Then we fire subsets of vertices in order to move $e$ chips from $v_k$ to either $v_i$ or $v_j$ (the closer of the two to $v_k$). Then, we can run Dhar's burning algorithm on this new configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is already no way to fire on any subset of vertices without inducing debt. 
\end{itemize}
Thus, $\gon_2(B_{n,e})=2n$.
\end{proof}

\begin{lemma}
If $e<n$, then $\gon_2(B_{n,e})=2e$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2 \min \{n, e \} = 2e$. Suppose that we have a divisor $D \in \Div_+(B_{n,e})$ such that $\deg(D) = 2e - 1$.
Again, we proceed by cases:
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, at least one vertex $v_i$ has exactly one chip. Furthermore, suppose some vertex $v_j$ has at least $e$ chips. Then, we have $2e - 1 - e = e - 1 < n-1$ chips remaining for the $n-1$ vertices, which is a contradiction. Thus, if we run Dhar's burning algorithm on the divisor $D - 2(v_i)$, then the entire graph burns because $D(v) < e$ for all vertices $v$.
    \item[(2)] If there is exactly one vertex $v_i$ satisfying $D(v_i)=0$, we have two cases.
    \begin{itemize}
        \item[(i)] If there exists a vertex $v_j$ such that $D(v_j) \geq e$, we know that $v_j$ must have exactly $e$ chips because $2e - 1 - (e + 1) = e - 2 < n - 2$, which is a contradiction. Furthermore, all other vertices except for $v_i$ and $v_j$ must have exactly one chip. This is because we have $e - 1 \leq n-2$ chips remaining for $n-2$ vertices. Run Dhar's burning algorithm on the the divisor $D - (v_i) - (v_j)$ beginning at the vertex $v_i$. Notice that in this divisor, no vertex has more than $e-1$ chips so the whole graph burns.
        \item[(ii)] All vertices have fewer than $e$ chips, in which case we can run Dhar's burning algorithm on the divisor $D - 2(v_i)$, beginning at the vertex $v_i$, which burns the whole graph.
    \end{itemize}
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with zero chips, then consider the divisor $D-(v_i)-(v_j)$. There is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists. Then we can fire subsets of vertices in order to move $e$ chips from $v_k$ to $v_i$, without loss of generality. Then, we can run Dhar's burning algorithm on this configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is no way to fire on any subset of vertices without inducing debt.
\end{itemize}
Thus, $\gon_2(B_{n,e})=2e$.
\end{proof}

\begin{lemma}
If $n=e$, then $\gon_2(B_{n,e})=2n-1.$
\end{lemma}

\begin{proof}
First note that the divisor $n(v_1)+(v_2)+\cdots +(v_n)$ wins the 2-gonality game. If the opponent were to take away two chips from a vertex that currently has one, then we could fire $v_1$, and then increasingly larger subsets, in order to move the $n$ chips and reach an effective divisor. Now suppose that divisor $D$ wins the 2-gonality game, with $\deg(D)<2n-1$. We proceed by cases.
\begin{itemize}
\item[(i)] $\supp(D)=V(B_{n,e})$, in which case, there exist at least two vertices, $v_i$ and $v_j$, such that $D(v_i)=1=D(v_j)$.
\item[(ii)] There exists some vertex $v_i$ such that $D(v_i)=0$, and $V-\left\{v_i\right\}=\supp(D)$.
\item[(iii)] There exist at least two vertices $v_i$ and $v_j$ such that $D(v_i)=0=D(v_j)$, with $i<j$.
\end{itemize}

\textcolor{red}{Can we make the enumerates match? I kinda like the i's, but we should then change all the proofs.}
If we are in case (i), then consider the divisor $D-2(v_i)$. Notice that no vertex has greater than $n-1$ chips, so if we run Dhar's burning algorithm with respect to $v_i$, then the entire graph burns. If we are in case (ii), then the maximum number of chips a vertex has is $n$. If no vertex has more than $n$ chips, then if we consider the divisor $D-2(v_i)$ and burn with respect to $v_i$, the entire graph burns. If a vertex, $v_j$ has $n$ chips, then consider the divisor $D-(v_i)-(v_j)$; now no vertex has at least $n$ chips, so burning with respect to $v_i$ burns the entire graph. Finally, if we are in case (iii), then the maximum number of chips a vertex has is $n+1$. If no vertex has at least $n$ chips, then we can consider the divisor $D-2(v_i)$, and burning with respect to $v_i$ burns the entire graph. If a vertex, $v_k$, has at least $n$ chips, then there are no other vertices with at least $n$ chips. We can then consider the divisor $D-(v_i)-(v_j)$. Notice that we can fire subsets of vertices to move $n$ chips to $v_i$; then, $D(v_i)=n-1$ and no vertex has at least $n$ chips. If we burn with respect to $v_j$, the entire graph burns. Thus, a winning divisor cannot have less than $2n-1$ chips, and $\gon(B_{n,e})=2n-1$.

\end{proof}




For $a\leq b$, let $B^*_{a,b}$ be the generalized banana graph on $a$ vertices, $V(B^*_{a,b})=\left\{v_1,\dots,v_a\right\}$. The number of edges between $v_i$ and $v_{i+1}$ for $1\leq i\leq a-1$ is $b-a+i+1$. In other words, there are $b$ edges in the last banana, and one less edge in each subsequent banana from the end. 

\begin{example}
The generalized bananas graphs $B^*_{6,8}$ and $B^*_{4,5}$ are illustrated in Figure~\ref{fig:banananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{bstarex.pdf}
\caption{The generalized banana graphs $B^*_{6,8}$ and $B^*_{4,5}$.}
\label{fig:banananas}
\end{center}
\end{figure}

\begin{lemma}\label{firstgonbanana}
$\gon_1(B^*_{a,b})=a$.
\end{lemma}

\begin{proof}
We mimic the proof of Lemma 5 given in \cite{ccNewtonPolygons}, in which they prove that $\gon_1(B^*_{a,a})=a$. Notice that $\gon_1(B^*_{a,b})\leq a$, since the divisor $(v_1)+\cdots +(v_a)$ wins the gonality game. Suppose there exists a divisor $D$ such that $\deg(D)<a$ and $D$ wins the gonality game. We can also assume that $D$ is $v_1$-reduced, so $D(v_1)\geq 1$. There exists some other vertex with zero chips on it; let $i$ be the maximal index for which $D(v_i)=0$. We can then perform Dhar's burning algorithm with respect to $v_i$. The chips on the vertices $v_{i+1},\dots,v_m$ do not move, because $D$ is already $v_1$ reduced and fire from $v_1$ would pass through $v_i$. If $m$ is the number of edges between $v_{i-1}$ and $v_{i}$, then there needs to be at least $m$ chips on the subgraph induced by the vertices $\left\{v_1,\dots,v_{i-1}\right\}$ in order for the entire graph to not burn. However, $m\geq i$, and $D(v_{i+1}),\dots,D(v_a)\geq 1$, so $\deg(D)=m+(a-i)\geq a$; hence, a contradiction.
\end{proof}

\begin{lemma}\label{bananapairs}
Let $a\leq b\leq 2a-1$, $a\geq 2$. Then, $\gon_2(B^*_{a,b})=b+1$.
\end{lemma}

\begin{proof}
First notice that the divisor $(b+1)v_a$ wins the 2-gonality game, so $\gon_2(B^*_{a,b})\leq b+1$. Now suppose that divisor $D$ wins the 2-gonality game, with $\deg(D)=k\leq b$. We proceed by cases.
\begin{itemize}
    \item[(i)]If $D(v_a)=1$, then $D$ is equivalent to a divisor $E$ such that the number of chips on $v_i$ is less than the number of edges between $v_i$ and $v_{i+1}$, for $1\leq i\leq a-1$. Then, we can run Dhar's burning algorithm on the divisor $E-2(v_a)$ with respect to $v_a$ and burn the entire graph. 
    \item[(ii)]If $D(v_a)=0$, then $D$ is equivalent to a divisor $E$ such that the number of chips on $v_i$ is less than the number of edges between $v_i$ and $v_{i+1}$, for $1\leq i\leq a-1$, and $D(v_{a-1})\leq b$. If we consider $E-2(v_a)$, then there is no way to fire any subset of vertices $A\subset\left\{v_1,\dots,v_{a-1}\right\}$ to get the vertex $v_a$ out of debt.
    \item[(iii)]If $D(v_a)=k$, then running Dhar's burning algorithm on the divisor $D-(v_{a-1})-(v_a)$ with respect to $v_{a-1}$ burns the entire graph.
    \item[(iv)]If $D(v_a)=\ell$, $2\leq\ell\leq k-1$, we induct on $a$ to show that $D$ cannot win the 2-gonality game. Consider $B^*_{3,b}$, $3\leq b\leq 5$; since $k-1<b$, we might as well place only 2 chips on $v_3$, because placing any more does not allow us to chip fire from $v_3$ anyways. We can then consider the second gonality of the subgraph induced by $\left\{v_1,\right\}$, or the banana graph $B_b$. Notice that $\gon_2(B_2)=3$ and $\gon_2(B_3)=4=\gon_2(B_4)$. Thus, no divisor $D$ with degree $\deg(D)\leq b$ can win the 2-gonality game if $2\leq D(v_3)\leq b-1$.
    
    Now suppose that for $B^*_{a,b}$, if a divisor $D$ has degree $\deg(D)=k\leq b$ and $2\leq D(v_a)\leq k-1$, then $D$ cannot win the 2-gonality game. Consider the graph $B^*_{a+1,b'}$, and divisor $D'$, with degree $\deg(D')\leq b'\leq 2a+1$. Again, we can assume that $D'(v_{a+1})=2$. If we consider subgraph $G'$, induced by vertices $\left\{v_1,\dots,v_a\right\}$, then the degree of $D'$ on $G'$ is $\deg(D')\leq 2a-1=b$. From the cases above, as well as the inductive hypothesis, we know that $D'$ cannot win the 2-gonality game on $G'$. Thus, $D$ cannot win the 2-gonality game on $B^*_{a+1,b'}$.
\end{itemize}
Therefore, $\gon_2(B^*_{a,b})=b+1$.
\end{proof}

\sout{A natural question to ask is: given $(m,n) \in \mathbb{Z}^2$, when does there exist a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$?}
\textcolor{red}{We can also use banana graphs to prove the following neat result about gonality sequences.} \textcolor{blue}{We can also use banana graphs to prove the following result about possible second gonalities given a first gonality.}

\begin{theorem}
Given $(m,n)\in\mathbb{Z}^2$ and $m+1\leq n\leq 2n$, there always exists a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$.
\end{theorem}

\begin{proof}
To achieve the gonality pair $(m,n)$, we can consider the graph $B^*_{m,n-1}$. From Lemma \ref{firstgonbanana}, $\gon_1(B^*_{m,n-1}=m$. Notice that if $m+1\leq n\leq 2m$, then $m\leq n-1\leq 2m-1$, which is exactly our bounds for $a,b$ in Lemma~\ref{bananapairs}. Thus, given $(m,n)$ within our constraints, the graph $G=B^*_{m,n-1}$ has first gonality $\gon_1(G)=m$ and second gonality $\gon_2(G)=n$.
\end{proof}














\section{Extending the Burning Algorithm}
Recall that our method for computing the first gonality of a graph relies on being able to check whether the rank of a divisor $D$ is at least one.  The burning algorithm also provides a method for checking if the rank of $D$ is at least $k$.
\begin{enumerate}
\item For each of the finitely many $E \in \Div_+^k(G)$, take $D - E$.
\item Choose some $v \in V(G)$, and semi-reduce $D-E$ with respect to $v$.  Then, use the burning algorithm to compute $\Red_v(D-E)$, and check if it is effective.  If so, continue; if not, $r(D) < k$.
\end{enumerate}

This approach has many downfalls.  First of all, it requires that we use an algorithm to semi-reduce our divisors at every intermediate step.  What is more, the burning algorithm actually does too much work, in a way.  We don't \textcolor{red}{do not} need to compute all the way to $\Red_v(D-E)$, we just need to compute until the value at $v$ is nonnegative. \textcolor{red}{change sentence structure}

We can get around these issues by extending the burning algorithm \textcolor{red}{for our purposes}.  We start by noting that in general, $r(D) \geq k$ if and only if for each $E \in \Div_+^k(G)$ there exists $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ such that $D' \geq E$.  Thus, we would like to generalize the burning algorithm to detect the existence of such divisors $D'$.  This is exactly what is accomplished by Algorithm \ref{alg:burn_ext}.

\begin{algorithm}
\caption{Extended Burning Algorithm}
\label{alg:burn_ext}
\begin{algorithmic}
\Require Divisors $D,E \in \Div_+(G)$
\Ensure A divisor $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq E$, or NONE if none exists
\If{$E=0$}
	\State \Return $D$ \Comment{any effective divisor will do}
\EndIf
\State $F \coloneqq \sum_{v\in V} \min\set{D(v),E(v)}\cdot (v)$ 
\If{$F > 0$}
	\State $\widetilde{D} \coloneqq \mathbf{Alg}(D-F,E-F) + F$ \Comment{remove chips from circled vertices}
    \State \Return $\widetilde{D}$
\EndIf
\State $W \coloneqq V \setminus \supp(E)$
\While{$W \neq \varnothing$}
	\If{$D(v) < \outdeg_W(v)$ for some $v \in W$}
    	\State $W \coloneqq W \setminus \set{v}$ \Comment{$v$ burns}
    \Else
    	\State $D' \coloneqq D - Q\mathbbm{1}_W$ \Comment{fire from $W$}
        \State \Return $\mathbf{Alg}(D',E)$
    \EndIf
\EndWhile
\Return NONE \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

We think of starting off with putting $E(v)$ circles on each $v \in \supp(E)$.  Then, we begin to burn from each vertex with a circle on it, following the same rules as in the usual burning algorithm.  Then, either the entire graph burns or we find some subset $W$ which we can fire from, and then we repeat.  If we ever end up with a chip on a circled vertex, we remove one chip and one circle from that vertex until we no longer have chips on circled vertices.  We must remember that the chips are there, since later we need to output a divisor of the correct degree, but the rest of the algorithm runs as if they weren't.  Another way to view this step is to change slightly our burning condition: we instead start to burn any vertex with fewer chips than it has circles, and if a vertex has more burning edges and circles combined than it has chips, then it catches fire.

To get at the workings of this algorithm, we return to our $\vartheta$ vectors, but now we will examine a collection of them.  Let $U \subset V$, and consider the collecton $\set{\vartheta^u(D)}_{u \in U}$.  We can provide a partial order on such collections by saying $\set{\vartheta^u(D')}_U \geq \set{\vartheta^u(D)}_U$ if for all $u \in U$ we have $\vartheta^u(D') \geq \vartheta^u(D)$, where the latter is again taken with respect to the lexicographic ordering. It is worth remarking that this is similar to the partial order defined on divisors.
\begin{proposition}\label{algprop}
If we obtain the divisor $D' = D - Q\mathbbm{1}_W$ after one cycle of Algorithm \ref{alg:burn_ext}, then $\set{\vartheta^u(D')}_{\supp(E)} > \set{\vartheta^u(D)}_{\supp(E)}$.
\end{proposition}
\begin{proof}
Notice that the argument for the burning algorithm still holds here, so for each $u \in \supp(E)$ we have $\vartheta^u(D') > \vartheta^u(D)$ lexicographically.  The claim follows immediately.
\end{proof}

We notice that \textcolor{red}{Proposition \ref{algprop}} implies that Algorithm \ref{alg:burn_ext} will terminate and return NONE only if $D(u) = 0$ for all $u \in \supp(E)$ and there is no way to fire without decreasing one of the $\vartheta^u(D)$.
\begin{proposition}
Let $D$ be such that $D(u) = 0$, and suppose there exists $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq E$.  Let $D = D_0, D_1,\dots,D_n = D'$ be the divisor sequence of the equivalence, then $\set{\vartheta^u(D_i)}_{\supp(E)} \geq \set{\vartheta^u(D)}_{\supp(E)}$.
\end{proposition}
\begin{proof}
Take $u \in \supp(E)$, 
\end{proof}
\section{Introduction}

{\color{red}This stuff might be better labeled "Background" to be preceded by an Introduction}

\subsection{Definitions and Terms}

In this paper, all graphs $G = (V, E)$ will be finite, loopless, combinatorial multigraphs. The set of vertices of a graph $G$ are denoted $V(G)$ and the set of edges, $E(G)$.  The \textbf{genus} of a graph is defined as $g(G) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(G)} - \@ifstar{\oldabs}{\oldabs*}{V(G)} + 1$.  If a vertex $v \in V(G)$ is an endpoint of an edge $e \in E(G)$, we will use the notation $v \in e$.  We denote $E(v) \coloneqq \{ e \in E(G) \colon e \ni v \}$ and $E(u, v) \coloneqq E(u) \cap E(v)$.  Moreover, for $U, W \subset V(G)$, we denote $E(U, W) \coloneqq \displaystyle{\bigcup \set{E(u,w) \colon u \in U, w \in W}}$. The \textbf{valence} of a vertex is the total number of edges incident with the vertex, $\val(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(v)}$.

Given a graph $G$, we define a \textbf{divisor} $D$ on $G$ as a $\mathbb{Z}$-linear sum of the vertices $V(G)$, denoted
\[
D=\sum_{v \in V(G)} a_v(v).
\]
For a divisor $D$ and a vertex $v \in V(G)$, we will use the notation $D(v)$ to denote the value of $D$ at $v$. Notice that the set of all divisors on a graph $G$, denoted $\Div(G)$, forms an abelian group under component-wise addition.


The \textbf{degree} of a divisor $D$ is defined as the sum of its coefficients,
\[
\deg(D) \coloneqq \sum_{v \in V(G)} D(v). 
\]
The set of divisors on $G$ of a given degree $k$ is denoted $\Div^k(G)$. {\color{red}Do we need to define the partial order?}  \g{I don't think so, because we don't end up using it} \textcolor{red}{except to define effective...} A divisor $D$ is said to be \textbf{effective} if $D(v) \geq 0$ for all $v \in V(G)$. We use $\Div_+(G)$ to denote the set of all effective divisors on a graph $G$. The support of an effective divisor $D \in \Div(G)$ is defined as
\[
\supp(D) \coloneqq \{ v \in V(G) \colon D(v) > 0 \}.
\]

The \textbf{Laplacian} matrix of a graph $G$ is defined as the matrix with entries
\[
\mathcal{L}_{v,w} = 
\begin{cases}
\val(v) \quad &\text{if $v = w$} \\
-\@ifstar{\oldabs}{\oldabs*}{ E(v,w) } \quad &\text{if $v \neq w$}.
\end{cases}
\]

The Laplacian operator $\Delta \colon \Div(G) \to \Div(G)$ is the map induced by the Laplacian matrix. We call a divisor \textbf{principal} if it is in the image of $\Delta$. The set of all principal divisors on a graph $G$ is denoted $\Prin(G)$. Since the columns of $\mathcal{L}(G)$ sum to zero, $\Prin(G) \subset \Div^0(G)$. We can define an equivalence relation $\sim$ on divisors where $D \sim D'$ if and only if $D - D' \in \Prin(G)$. If this is the case, then $D$ and $D'$ are said to be \textbf{linearly equivalent} divisors. It is clear that the degree of a divisor is invariant under linear equivalence. Given a divisor $D$, the \textbf{linear system} associated to $D$ consists of all effective divisors linearly equivalent to $D$: 
\[
\@ifstar{\oldabs}{\oldabs*}{D} \coloneqq \{ D' \in \Div_+(G) \colon D' \sim D \}.
\]

We define the \textbf{rank} $r(D)$ of a divisor $D$ as $r(D) = -1$ if $\@ifstar{\oldabs}{\oldabs*}{D} = \varnothing$ and 
\[
r(D) = \max \{ k \in \mathbb{Z}^+ \colon \@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \varnothing \; \text{for all} \; D' \in \Div_+^k(G) \}
\]
otherwise. It can be easily shown that rank of a divisor is also preserved under linear equivalence.




\subsection{Riemann-Roch for Combinatorial Graphs}

In \cite{bn}, Baker and Norine prove a Riemann-Roch theorem for combinatorial graphs, analogous to the classical Riemann-Roch theorem for algebraic curves. We re-state this result here. First, for a graph $G$, define the \textbf{canonical divisor} $K$ to be
\[
K \coloneqq \sum_{v \in V(G)} (\val(v) - 2) \cdot (v).
\]

\begin{theorem}[Riemann-Roch for graphs]\label{RR}
For a divisor $D \in \Div(G)$, 
\[
r(D) - r(K - D) = \deg(D) + 1 - g(G).
\]
\end{theorem}

As a corollary, Baker and Norine also prove a version of Clifford's theorem for graphs. Note that a \textbf{special} divisor $D$ is one for which $r(K - D) \geq 0$. 

\begin{theorem}
Let $D$ be an effective, special divisor on a graph $G$. Then
\[
r(D) \leq \frac{1}{2}\deg(D).
\]
\end{theorem}

In \cite{coppens}, Coppens proves a similar result, which he also calls Clifford's theorem on graphs. 

\begin{theorem}
\label{coppensclif}
If a graph $G$ has a divisor of rank $r$ and degree $2r$ for $2 \leq r \leq g(G) - 2$, then $G$ has a divisor of rank $1$ and degree $2$.
\end{theorem}

\subsection{Chip-Firing Games and Graph Gonality}

We define the \textbf{gonality} $\gon(G)$ of a graph $G$ to be
\[
\gon(G) \coloneqq \min \{ \deg(D) \colon r(D) \geq 1, D \in \Div_+(G) \}.
\]

More intuitively, for a divisor $D$ and a vertex $v$, we can regard $D(v)$ as representing a number of chips sitting on $v$, with $D(v) < 0$ indicating that $v$ is ``in debt''. Thus, a divisor $D$ represents some configuration of chips on the graph, allowing us to present an alternative definition of gonality in terms of the \textbf{Baker-Norine chip-firing game}.


In this game, the only legal moves are \textbf{chip-firing} moves{\color{red}:} Given a vertex $v \in V(G)$, in order to chip-fire from $v$, we subtract $\val(v)$ chips from $v$ and to each $u$ adjacent to $v$ add $\@ifstar{\oldabs}{\oldabs*}{E(v,u)}$ chips. The Baker-Norine chip firing game is \sout{played} {\color{red}defined} \g{I think "played" fits better here, or we could say something like "is played with the following rules?", "played in the following way"?} as follows:

\begin{enumerate}
    \item The player places $k$ chips on the vertices $V(G)$ of a graph $G$.
    \item An opponent chooses a vertex $v \in V(G)$ from which to subtract a chip.
    \item The player attempts to reach a configuration of chips where no vertex is in debt via a sequence of chip-firing moves.
\end{enumerate}


If the player can achieve a configuration of chips where every vertex is out of debt, then they win. It is proven in \cite{db} that chip-firing moves correspond to subtracting principal divisors, implying that the gonality of a graph is equivalent to the minimum number of chips $k$ that must initially be placed on the graph in order to guarantee a winning strategy.

However, even with{\color{red}in} this {\color{red}intuitive} framework, computing the gonality of a graph is difficult. For a given graph $G$, to show that $\gon(G) = k$, we must show that both of the following hold:

\begin{enumerate}
	\item There exists a divisor $D$ with $\deg(D) = k$ and $r(D) \geq 1$. That is, no matter where the opponent subtracts a chip, the player can always reach an effective chip configuration.
    \item For \textit{all} divisors $D'$ with $\deg(D') < k$, we have $r(D) < 1$. That is, no configuration of fewer chips wins the chip-firing game.
\end{enumerate}


Fortunately, \sout{we have a few tools to aid us in this process} {\color{red}there exist tools to aid in computing gonality}. 

{\color{red}\subsection{Subset Firing and $v$-Reduced Divisors}}

In \cite{db}, de Bruyn develops a theory of subset-firing and $v$-reduced divisors, along with several useful associated theorems. We provide a brief summary here. For a subset $A \subset V(G)$ and a vertex $v \in A$, we define the \textbf{outdegree} of $A$ at $v$ as
\[
\outdeg_A(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(\set{v},V\setminus A)}.
\]
The total outdegree of a subset $A$ is $\outdeg_A(A) \coloneqq \sum_{v \in A} \outdeg_A(v)$. Notice that because chip-firing moves are commutative, we can fire out from \textit{subsets} of vertices, rather than just single vertices. In order to fire out from a subset $A \subset V(G)$, we send one chip along each edge incident with a vertex in the subset and a vertex not in the subset. Hence, {\color{red}the net result is that} \g{hmmm...I think the previous sentence is actually describing the net result} each vertex in $A$ loses $\outdeg_A(v)$ chips. The following result is proven by de Bruyn.

\begin{lemma}
Given two effective divisors $D$ and $D'$ such that $D \sim D'$, there exists a finite sequence of subset-firing moves which transforms $D$ into $D'$ without inducing debt in any vertex of the graph.
\end{lemma}

Given a vertex $v$, a \textbf{$v$-reduced} divisor $D$ satisfies:

\begin{enumerate}
\item for each $v' \in V(G) - \{v\}$, $D(v') \geq 0$
\item for any nonempty $A \subset V(G) - \{v\}$, there exists some $v' \in A$ such that $D(v') < \outdeg_{v'}(A)$.
\end{enumerate}

If $D$ only satisfies the first condition, then we say that $D$ is \textbf{$v$-semi-reduced}. The following two results about $v$-reduced divisors are proven in \cite{db}.

\begin{lemma}
Given a divisor $D \in \Div(G)$ and a vertex $v \in V(G)$, there exists a unique $v$-reduced divisor $D'$ such that $D' \sim D$.
\end{lemma}

We use $\Red_v(D)$ to denote this unique $v$-reduced divisor equivalent to $D$.

\begin{lemma}
For a divisor $D \in \Div(G)$, $r(D) \geq 1$ if and only if $\Red_v(D)(v) \geq 1$ for each $v \in V(G)$.
\end{lemma}

This lemma provides us with a framework for checking if a divisor is a ``winning divisor'' (i.e., a divisor with $r(D) \geq 1$). To do so, we simply need to check that for all $v \in V(G)$, $v \in \supp(\Red_v(D))$.

\subsection{Dhar's Burning Algorithm}

Given a $q$-semi-reduced divisor $D$, Algorithm \ref{originaldhars} computes $\Red_q(D)$. This algorithm is called \textbf{Dhar's burning algorithm} after the physicist who developed it for use in the study of sandpile models (see \cite{dhar}).  For algorithms to $q$-semi-reduce a divisor $D$ with respect to a vertex $q$, see \cite{db,bs}.

We now provide an intuitive description of Algorithm \ref{originaldhars}.  Given a divisor $D$, we can represent the algorithm in terms of a fire spreading through our graph with the chips of the divisor representing firefighters.  The fire starts at $q$, the vertex we are reducing with respect to.  Whenever a vertex burns, the fire spreads to all edges incident with that vertex.  If a vertex has at least as many chips (firefighters) as it has incident burning edges, then the vertex is protected.  Otherwise, \sout{the fire overpowers the firefighters and} that vertex burns as well.  The fire spreads until no new vertices catch fire, at which point we chip-fire all the unburnt vertices and begin this process again.

\begin{algorithm}
\caption{Dhar's Burning Algorithm}
\label{originaldhars}
\begin{algorithmic}
	\Require vertex $q \in V(G)$, and $q$-semi-reduced divisor $D \in \Div(G)$
	\Ensure $\Red_q(D)$
	\State $W \coloneqq V\setminus\set{q}$
	\While{$W \neq \varnothing$} 
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$} 
	    \State $W = W\setminus{v}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(q, D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	return $D$ \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

It is an easy exercise to show that the entire graph burns only if the final configuration is $q$-reduced, and to show that each firing set delivered by the algorithm preserves $q$-semi-reducedeness.  To see that the algorithm will eventually terminate, suppose we are given the divisor $D$ – effective except perhaps at $q$ – and let $D_q$ denote the (unique) $q$-reduced divisor of $D$.  Let $\@ifstar{\oldabs}{\oldabs*}{V} = n$. We consider $\mathbb{Z}^{n-1}$ under the lexicographic order $>$.  Denote by $d(v,u)$ the length of the shortest path from $v$ to $u$.  Now, corresponding to the divisor $D$ we construct the vector $\vartheta^q(D) \in \mathbb{Z}^{n-1}$ given by
\[\vartheta_i^q(D) = \sum_{\substack{v\in V\\d(v,u)=i}} D(v).\]
That is, the $i$th component of $\vartheta^q(D)$ is the number of chips in the configuration $D$ that are distance $i$ from $q$.  What we will show is that if after one iteration of the burning algorithm we arrive at the new divisor $D'$ then $\vartheta^q(D_q) \geq \vartheta(D') > \vartheta(D)$.

{\color{red}Where does the superscript go? Franny is confused by notation.}

The first inequality follows since for any $q$-semi-reduced divisor $D$, $D_q(q) \geq D(q)$, and the Burning Algorithm preserves $q$-semi-reducedness.  To show the second inequality, let $W$ be the firing set provided by the algorithm, and let $w \in W$ minimize $d(q,w)$.  Then $\outdeg_W(w) > 0$, as $w$ must have a neighbor with lesser distance to $q$.  For an edge $e = (u,v)$, define $d(q,e) = \min\set{d(q,u),d(q,v)}$, and take some ordering on $E$ such that $e < f$ whenever $d(q,e) < d(q,f)$.  Then, during the burning algorithm, light available edges according to whichever comes first in this ordering.  The first burning edge to reach $w$ must come from a vertex closer to $q$, and so after firing one chip will be closer to $q$.  This corresponds exactly to $\vartheta(D')$ being greater in the lexicographic ordering.

Since the burning algorithm computes reduced divisors, it provides for us a polynomial time method for checking if the rank of a divisor $D$ is at least 1: for each $v \in V(G)$ we compute $\Red_v(D)$ with the burning algorithm, then check that $\Red_v(D)(v) \geq 1$.  This in turn provides us with a way to compute the gonality of a graph, since there are finitely many effective divisors of degree at most $\@ifstar{\oldabs}{\oldabs*}{V(G)}$, we can simply check them one-by-one until we find the smallest one with positive rank.  In section 3, we will discuss the shortcomings of using the burning algorithm to try to compute higher gonalities of graphs, and present an algorithm better suited to the task.

\subsection{Higher Gonalities}

Up until this point, we have defined the gonality of a graph in terms of divisors for which $r(D) \geq 1$. However, this definition extends naturally to what we call the \textbf{higher gonalities} of a graph. For fixed $k \in \mathbb{Z}^+$, let $\gon_k(G)$ denote the $k$-th gonality of $G$, defined as
\[
\gon_k(G) = \min \{ \deg(D) \colon D \in \Div(G), r(D) \geq k \}.
\]

Thus, the $k$-th gonality of $G$ is equivalent to the minimum number of chips required to win \sout{a version of} the Baker-Norine chip-firing game where the opponent is allowed to initially subtract $k$ chips arbitrarily.

In \cite{baker}, Baker conjectures the following result as a natural extension of Brill-Noether theory on algebraic curves.

\begin{conjecture}
Fix $g, r, d \in \mathbb{Z}_{\geq 0}$. Let $\rho(g, r, d) \coloneqq g - (r+1)(g - d + r)$. If $\rho(g, r, d) \geq 0$, then every graph of genus $g$ admits a divisor $D$ with $r(D) = r$ and $\deg(D) \leq d$. 
\end{conjecture}

It is proven in \cite{brill} that this conjecture holds for all graphs of genus $g \leq 5$. Hence, we have the following result.

\begin{corollary}
\label{brillnoether}
For all graphs of genus $g \leq 5$, $\gon_1(G) \leq \left\lfloor \frac{g+3}{2} \right\rfloor$.
\end{corollary}

The higher gonalities of graphs have been studied previously, but not extensively. For example, in \cite{panizzut}, the higher gonalities of the family of complete graphs $K_n$ are completely enumerated. Our goal is to provide a broader survey of the various bounds known on higher gonalities as well as explicitly determine the higher gonalities of certain families of graphs.
\section{Introduction}

In \cite{bn} and \cite{bn2}, Baker and Norine introduced a theory of divisors on finite graphs, analogous to the theory of divisors on algebraic curves.  Intuitively, a divisor on a graph can be viewed as a placement of integer numbers of chips on the vertices, with two placements equivalent if they differ by certain redistributions of chips called chip-firing moves.  This theory has been extended to metric graphs \cite{gk,mz}, and has been successfully applied to prove many results on algebraic curves \cite{cdpr}.

Two important numbers associated to a divisor $D$ on a graph (or on a curve) are the \emph{degree} $\deg(D)$, which is the total number of chips; and the \emph{rank} $r(D)$.  The rank of $D$ is an integer that, in the language of chip-firing, measures the extent to which the divisor $D$ can eliminate added debt to the graph.  The \emph{divisorial gonality}, or simply the \emph{gonality}, of a graph $G$ is the minimum degree of a divisor of positive rank. For algebraic curves, gonality is defined similarly; furthermore, in this setting, an equivalent definition of gonality is the minimum degree of a map from the curve to a line.

For both graphs and curves, we can also consider higher gonalities.  For $r\geq 1$, the $r^{\text{th}}$ gonality of a graph (or curve) is the minimum degree of a rank $r$ divisor:
\[\gon_r(G)=\min\{\deg(D)\,|\,\textrm{ $D\in\textrm{Div}(G)$ and $r(D)=r$}\}.\]
These higher gonalities are intimately related to one of the most significant open problems for divisor theory on graphs.

\begin{conjecture}[Brill-Noether Conjecture for Graphs, \cite{baker}]\label{conjecture:bn}  Choose $g,r,d\geq 0$, and let $\rho(g,r,d)=g-(r+1)(g-d+r)$.  If $\rho(g,r,d)\geq 0$, then every graph of genus $g$ has a divisor $D$ with $r(D)=r$ and $\deg(D)\leq d$.
\end{conjecture}
In the language of higher gonalities, this conjecture can be rephrased as saying that if $G$ is a graph of genus $g$ and we have $\rho(g,r,d)\geq 0$, then $\gon_r(G)\leq d$.  This conjecture has been verified for graphs of genus at most $5$ \cite{brill}. In the special case of $r=1$, the conjecture is an upper bound on the first gonality of a graph.


\begin{conjecture}[Gonality Conjecture for Graphs, \cite{baker}]\label{conjecture:gonality} If $G$ is a graph of genus $g$, then $\gon_1(G)\leq\floor{\frac{g+3}{2}}$.
\end{conjecture}

In this paper, we study the \emph{gonality sequence} of a graph $G$, which is the sequence of $r^{\text{th}}$ gonalities of $G$ as $r$ ranges from $1$ to $\infty$:
\[\gon_1(G),\gon_2(G),\gon_3(G),\gon_4(G),\cdots\]
Recent progress has been made towards determining the gonality sequences of various families of graphs, including the complete graphs $K_n$ \cite{panizzut} and the complete bipartite graphs $K_{m,n}$ \cite{bipartite}.  Work has also been done to study higher gonalities of Erd\"{o}s-Renyi random graphs \cite{higher_gonality_random}. A very ambitious program would be to answer the following question.
\begin{question}\label{question:main}
Which integer sequences are the gonality sequence of some graph?
\end{question}
We will see in Corollary \ref{corollary:determined_genus} that the genus of a graph can be read from its gonality sequence, so an answer to Question \ref{question:main} would furnish an answer to Conjecture \ref{conjecture:bn}; because of this, we believe a complete answer would be very difficult to obtain.  In this paper, we answer the question up to genus $5$; it turns out that for such graphs, the first gonality and the genus suffice to determine the gonality sequence.

\begin{theorem}\label{theorem:gonality_sequences}
Let $G$ be a graph of genus $g$.  If $g\leq 5$, then the gonality sequence of $G$ is determined by $g$ and $\gon_1(G)$. This no longer holds if $g\geq 6$ depending on the value of $\gon_1(G)$.
\end{theorem}

All possible gonality sequences of graphs of genus at most $5$, along with an example graph for each specified gonality sequence, appear in Table \ref{table:sequences}.  That table also contains the same for graphs of genus $6$, under the assumption that Conjecture \ref{conjecture:gonality} holds for such graphs.

We also prove that any ``reasonable'' pair of first and second gonalities are achieved by some graph.


\begin{theorem}\label{theorem:first_two}
Let $m,n\in \mathbb{Z}$ with $1\leq m< n\leq 2m$. There exists a graph $G$ such that $\gon_1(G)=m$ and $\gon_2(G)=n$.
\end{theorem}

Our paper is organized as follows.  In Section \ref{section:background}, we present general background and results for chip-firing on graphs.  In Section \ref{section:preliminary}, we present some preliminary results on gonality sequences of graphs, many arising as nice corollaries of the Riemann-Roch theorem for graphs.  In Section \ref{section:small_genus}, we prove Theorem \ref{theorem:gonality_sequences}, and also consider the possible gonality sequences of graphs of genus $6$.  In Section \ref{section:bananas}, we construct a family of graphs to prove Theorem \ref{theorem:first_two}.  We close in Section \ref{section:modified_dhars} with a modified version of Dhar's burning algorithm tailored to studying higher gonalities.

\section{Background and Notation}\label{section:background}


In this paper, all graphs will be finite, loopless, combinatorial multigraphs. The set of vertices of a graph $G$ is denoted $V(G)$, and the multiset of edges $E(G)$.  The \emph{genus} of a graph is defined as $g(G) := \@ifstar{\oldabs}{\oldabs*}{E(G)} - \@ifstar{\oldabs}{\oldabs*}{V(G)} + 1$.  If a vertex $v \in V(G)$ is an endpoint of an edge $e \in E(G)$, we use the notation $v \in e$.  We denote $E(v) \coloneqq \{ e \in E(G) \colon e \ni v \}$ and $E(u, v) \coloneqq E(u) \cap E(v)$.  Moreover, for $U, W \subset V(G)$, we denote $E(U, W) \coloneqq \displaystyle{\bigcup \set{E(u,w) \colon u \in U, w \in W}}$. The \emph{valence} of a vertex is the total number of edges incident to the vertex: $\val(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(v)}$.


\subsection{Divisor theory on graphs}

Given a graph $G$, a \emph{divisor} $D$ on $G$ is a $\mathbb{Z}$-linear sum of the vertices $V(G)$, and can be written as
\[
D=\sum_{v \in V(G)} D(v) \cdot v,
\]
where $D(v)\in\mathbb{Z}$ for all $v$. The set of all divisors on a graph $G$, denoted $\Div(G)$, forms an abelian group under coefficient-wise addition, namely the free abelian group generated by $V(G)$.

The \emph{degree} of a divisor $D$ is defined as the sum of its coefficients:
\[
\deg(D) \coloneqq \sum_{v \in V(G)} D(v). 
\]
The set of divisors on $G$ of a given degree $k$ is denoted $\Div^k(G)$. A divisor $D$ is said to be \emph{effective} if $D(v) \geq 0$ for all $v \in V(G)$. We use $\Div_+(G)$ to denote the set of all effective divisors on a graph $G$. The \emph{support} of an effective divisor $D \in \Div(G)$ is defined as
\[
\supp(D) \coloneqq \{ v \in V(G) \colon D(v) > 0 \}.
\]

The \emph{Laplacian matrix} of a graph $G$ is the $|V(G)|\times|V(G)|$ matrix with entries
\[
\mathcal{L}_{v,w} = 
\begin{cases}
\val(v) \quad &\text{if $v = w$} \\
-\@ifstar{\oldabs}{\oldabs*}{ E(v,w) } \quad &\text{if $v \neq w$}.
\end{cases}
\]
The Laplacian operator $\Delta \colon \Div(G) \to \Div(G)$ is the map induced by the Laplacian matrix. We call a divisor \emph{principal} if it is in the image of $\Delta$. The set of all principal divisors on a graph $G$ is denoted $\Prin(G)$. Since the columns of $\mathcal{L}(G)$ sum to zero, $\Prin(G) \subset \Div^0(G)$. We can define an equivalence relation $\sim$ on divisors where $D \sim D'$ if and only if $D - D' \in \Prin(G)$. If this is the case, then $D$ and $D'$ are said to be \emph{linearly equivalent} divisors. It is clear that the degree of a divisor is invariant under linear equivalence. Given a divisor $D$, the \emph{linear system} associated to $D$ consists of all effective divisors linearly equivalent to $D$: 
\[
\@ifstar{\oldabs}{\oldabs*}{D} \coloneqq \{ D' \in \Div_+(G) \colon D' \sim D \}.
\]

We define the \emph{rank} $r(D)$ of a divisor $D$ as $r(D) = -1$ if $\@ifstar{\oldabs}{\oldabs*}{D} = \emptyset$ and 
\[
r(D) = \max \{ r \in \mathbb{Z}^+ \colon \@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \emptyset \; \text{for all} \; D' \in \Div_+^r(G) \}
\]
otherwise. It can be easily shown that rank of a divisor is also preserved under linear equivalence.  We define the \emph{gonality} $\gon(G)$ of a graph $G$ to be
\[
\gon(G) \coloneqq \min \{ \deg(D) \colon r(D) \geq 1, D \in \Div_+(G) \}.
\]


More generally, for fixed $r \in \mathbb{Z}_{>0}$, we define the $r^{th}$ gonality of $G$, denoted $\gon_r(G)$, as the minimum degree of a rank $r$ divisor:
\[
\gon_r(G) = \min \{ \deg(D) \colon D \in \Div(G), r(D) \geq r \}.
\]

Recall Conjecture \ref{conjecture:bn}, which says that if $G$ is a graph of genus $g$ and $\rho(g,r,d)\geq 0$, then $\gon_r(G)\leq d$. (Here $\rho(g, r, d) \coloneqq g - (r+1)(g - d + r)$.) It is proven in \cite{brill} that this conjecture holds for all graphs of genus $g \leq 5$. Hence, we have the following result, which will be useful in Section \ref{section:small_genus}.



\begin{corollary}
\label{brillnoether}\label{theorem:up_to_5}
For all graphs of genus $g \leq 5$, we have $\gon_1(G) \leq \left\lfloor \frac{g+3}{2} \right\rfloor$.
\end{corollary}






In \cite{bn}, Baker and Norine prove a Riemann-Roch theorem for combinatorial graphs, analogous to the classical Riemann-Roch theorem for algebraic curves. We restate this result here. For a graph $G$, define the \emph{canonical divisor} $K$ to be
\[
K \coloneqq \sum_{v \in V(G)} (\val(v) - 2) \cdot (v).
\]

\begin{theorem}[Riemann-Roch for graphs]\label{RR}
For a divisor $D \in \Div(G)$, 
\[
r(D) - r(K - D) = \deg(D) + 1 - g(G).
\]
\end{theorem}

As a corollary, Baker and Norine also prove a version of Clifford's theorem for graphs. We say a divisor $D$ is \emph{special} if $r(K - D) \geq 0$. 

\begin{theorem}
Let $D$ be an effective, special divisor on a graph $G$. Then
\[
r(D) \leq \frac{1}{2}\deg(D).
\]
\end{theorem}

In \cite{coppens}, Coppens proves a similar result, which he also calls Clifford's theorem on graphs. 

\begin{theorem}
\label{coppensclif}
Let $G$ be a graph of genus $g$, and assume that there exists a divisor $D$ of rank $r$ with $2\leq r\leq g-2$ such that $\deg(D)=2r$.  Then $G$ has a divisor of rank $1$ and degree $2$.
\end{theorem}

\subsection{Chip-Firing Games and Graph Gonality}


We now present an intuition for divisors in the language of chip configurations and chip-firing. For a divisor $D$ and a vertex $v$, we can regard $D(v)$ as representing an integer number of chips sitting on $v$, with $D(v) < 0$ indicating that $v$ is ``in debt.'' Thus, a divisor $D$ represents some configuration of chips on the graph. This will allow us to present an alternative definition of gonality in terms of the \emph{Baker-Norine chip-firing game}.

In this game, the only legal moves are \emph{chip-firing} moves. Given a vertex $v \in V(G)$, in order to chip-fire from $v$, we subtract $\val(v)$ chips from $v$ and to each $u$ adjacent to $v$ add $\@ifstar{\oldabs}{\oldabs*}{E(v,u)}$ chips. The Baker-Norine chip firing game is played in the following way:

\begin{enumerate}
    \item The player places $k$ chips on the vertices $V(G)$ of a graph $G$.
    \item An opponent chooses a vertex $v \in V(G)$ from which to subtract a chip.
    \item The player attempts to reach a configuration of chips where no vertex is in debt via a sequence of chip-firing moves.
\end{enumerate}

If the player can achieve a configuration of chips where every vertex is out of debt, then they win.  As discussed in \cite{bn}, chip-firing moves correspond to subtracting principal divisors, implying that the gonality of a graph is equivalent to the minimum number of chips $k$ that must initially be placed on the graph in order to guarantee a winning strategy for the first player.  Similarly, the $r^{\text{th}}$ gonality of $G$ is the minimum number of chips required to win the Baker-Norine chip-firing game if the opponent is allowed to subtract $r$ chips of their choice instead of just $1$.


Computing the gonality of a graph is difficult. For a given graph $G$, to show that $\gon(G) = k$, one must show that both of the following conditions hold:

\begin{enumerate}
	\item There exists a divisor $D$ with $\deg(D) = k$ and $r(D) \geq 1$. That is, there exists a chip configuration with $k$ chips such that no matter where the opponent subtracts a chip, the player can always reach an effective chip configuration.
    \item For \textit{all} divisors $D'$ with $\deg(D') < k$, we have $r(D') < 1$. That is, no configuration of fewer chips wins the chip-firing game.
\end{enumerate}


There are some techniques that can be used to bound the gonality of a graph. For example, one can use other invariants of the graph, such as edge-connectivity. The following lower bound on gonality is stated in \cite{liyau} and proved in \cite{gonthree}.
\begin{lemma}\label{lemma:lower_bound}
Let $\eta(G)$ denote the edge-connectivity of a graph $G$.  Then $\gon_1(G)\geq \min\{\eta(G), \@ifstar{\oldabs}{\oldabs*}{V(G)}\}$.
\end{lemma}






In addition, there are techniques to determine if a chip configuration is ``winning'' (that is, has positive rank). In \cite{db}, van Dobben de Bruyn presents a theory of subset-firing, along with several useful associated results. We provide a brief summary here. For a subset $A \subset V(G)$ and a vertex $v \in A$, we define the \emph{outdegree of $A$ at $v$} as
\[
\outdeg_A(v) \coloneqq \@ifstar{\oldabs}{\oldabs*}{E(\set{v},V(G) - A)}.
\]
The total outdegree of a subset $A$ is $\outdeg_A(A) \coloneqq \sum_{v \in A} \outdeg_A(v)$. Notice that because chip-firing moves are commutative in the Baker-Norine chip-firing game, one can fire \textit{subsets} of vertices, rather than just single vertices. In order to fire a subset $A \subset V(G)$, we send one chip along each edge $e \in E(A, V(G)-A)$. Hence, each vertex in $A$ loses $\outdeg_A(v)$ chips. The following result is proven in \cite{db}.

\begin{lemma}
Given two effective divisors $D$ and $D'$ such that $D \sim D'$, there exists a finite sequence of subset-firing moves which transforms $D$ into $D'$ without introducing debt in any vertex of the graph.
\end{lemma}





\subsection{Dhar's Burning Algorithm}
\label{subsection:usual_dhars}

Given a vertex $v$, we say a divisor $D$ is \emph{$v$-reduced} if it satisfies two properties:
\begin{enumerate}
\item for each $v' \in V(G) - \{v\}$, $D(v') \geq 0$; and
\item for any nonempty $A \subset V(G) - \{v\}$, there exists some $v' \in A$ such that $D(v') < \outdeg_{A}(v')$.
\end{enumerate}
If $D$ only satisfies the first condition, then we say that $D$ is \emph{$v$-semi-reduced}.

It is proven in \cite[Proposition 3.1]{bn}
that given a divisor $D \in \Div(G)$ and a vertex $v \in V(G)$, there exists a unique $v$-reduced divisor $D'$ such that $D' \sim D$. Let $\Red_v(D)$ denote this unique $v$-reduced divisor. It follows that for a divisor $D \in \Div(G)$, $r(D) \geq 1$ if and only if $\Red_v(D)(v) \geq 1$ for each $v \in V(G)$.


Perhaps the most famous algorithm in chip-firing games is \emph{Dhar's burning algorithm}, named after the physicist who developed it for use in the study of sandpile models \cite{dhar}.  Given a semi-reduced divisor $D$ and a vertex $q$, this algorithm checks whether or not $D$ is $q$-reduced, and if not, outputs a subset of vertices $W\subset V(G)\setminus\{q\}$ that can be fired without introducing new debt.  By firing $W$ and iterating this algorithm, one can compute the unique $q$-reduced divisor equivalent to the semi-reduced divisor $D$; we refer to this iterated algorithm as the \emph{iterated Dhar's burning algorithm}, presented here as Algorithm \ref{originaldhars}.  For algorithms to $q$-semi-reduce a divisor $D$ with respect to a vertex $q$, see \cite{bs, db}.


\begin{algorithm}
\caption{Iterated Dhar's Burning Algorithm}
\label{originaldhars}
\begin{algorithmic}
	\Require vertex $q \in V(G)$, and $q$-semi-reduced divisor $D \in \Div(G)$
	\Ensure $\Red_q(D)$
	\State $W \coloneqq V(G) \setminus\set{q}$
	\While{$W \neq \emptyset$} 
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$} 
	    \State $W = W\setminus \{v\}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(q, D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	return $D$ \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

Given a divisor $D$, we can describe Algorithm \ref{originaldhars} in terms of a fire spreading through our graph with the chips of the divisor representing firefighters, each of whom can fight off one incoming fire. The fire starts at $q$, the vertex we are reducing with respect to.  Whenever a vertex burns, the fire spreads to all edges incident with that vertex. If a vertex has at least as many chips (firefighters) as it has incident burning edges, then the vertex is protected. Otherwise, that vertex burns as well. The fire spreads until no new vertices catch fire, at which point we chip-fire all the unburned vertices and begin this process again.  If the whole graph burns, then the divisor is $q$-reduced.



We now present an argument that this algorithm terminates and is correct; we will use similar arguments for Algorithm \ref{algorithm:modified_dhars} later in this paper. Each firing set $W$ delivered by the algorithm preserves $q$-semi-reducedness, since $D(v)\geq \outdeg_W(v)$ whenever $W$ is fired, so no new debt is ever introduced.  To see that the algorithm will eventually terminate, suppose we are given the divisor $D$, effective except perhaps at $q$, and let $D_q$ denote the (unique) $q$-reduced divisor of $D$. For $u,v\in V(G)$, denote by $d(v,u)$ the length of the shortest path from $v$ to $u$.  Let $d$ be the diameter of the graph $G$, defined as the greatest length of a shortest path between two vertices of $G$: $d=\textrm{diam(G)}:= \max_{v,u \in V(G)} d(v,u)$.  For $0 \leq i \leq d$, let $S_i = \set{v \in V(G): d(v,q) = i}$.  We define the function $\beta_q\colon \Div(G) \to \mathbb{Z}^{d+1}$ by
\[\beta_q(D) = \@ifstar{\oldparen}{\oldparen*}{\sum_{v \in S_0} D(v), \sum_{v \in S_1} D(v),\dots, \sum_{v \in S_d} D(v)}.\]
That is, the $i^{th}$ component of $\beta_q(D)$ is the number of chips in the configuration $D$ that are distance $i$ from $q$.

Note that each recursive call made by Algorithm \ref{originaldhars} involves firing a (nonempty) subset $W \subset V(G)$. Use $W_0, W_1, W_2, \dots$ to denote the consecutive subsets and label the resulting divisors $D = D_0, D_1, D_2, \dots$ such that $D_{i+1} = D_i - \Delta \mathbbm{1}_{W_i}$. We claim that if $W_i$ is nonempty, then $\beta_q(D_i) < \beta_q(D_{i+1})$ with respect to the lexicographic ordering. Pick some $w \in W_i$ such that $d(q, w)$ is minimized. Then $w$ has a neighbor $u$ such that $d(q, u) < d(q, w)$ and $u \notin W_i$ (note that we might have $u = q$). But this directly corresponds to $\beta_q(D_{i+1})$ being strictly greater than $\beta_q(D_i)$.

If Algorithm \ref{originaldhars} does not terminate, this means that there exists an infinite sequence of divisors $\{D_i\}_{i \geq 0}$ such that $\beta_q(D_i) < \beta_q(D_{i+1})$.  However, note that $\beta_q(D)$ is bounded for general $D$; in particular, each component is bounded between $\min\{0,D(q)\}$ and $\max\{\deg(D)+D(q), \deg(D)\}$.  Hence, such an infinite strictly increasing sequence cannot exist, so Algorithm \ref{originaldhars} must terminate.



We also need to check that the output of the algorithm is correct, i.e. that the entire graph burns only if the final configuration is $q$-reduced.  Given a divisor $D$ which is $q$-semi-reduced but not $q$-reduced,  there exists a subset $A$ not containing $q$ such that $D(v) \geq \outdeg_A(v)$ for all $v \in A$.  But  such a subset will not burn, so in particular the burning algorithm will find a subset $W$ to fire.  Thus, the whole graph burns only if the final divisor is $q$-reduced.

Since the iterated burning algorithm computes reduced divisors, it provides us with a polynomial time method for checking if the rank of a divisor $D$ is at least $1$: for each $v \in V(G)$ we compute $\Red_v(D)$ with the burning algorithm, then check that $\Red_v(D)(v) \geq 1$.  This in turn provides us with a way to compute the gonality of a graph: since there are finitely many effective divisors of degree at most $\@ifstar{\oldabs}{\oldabs*}{V(G)}$, we can simply check them one-by-one until we find the smallest one (as measured by degree) with positive rank.  In Section \ref{section:modified_dhars}, we will discuss the shortcomings of using the burning algorithm to try to compute higher gonalities of graphs and present an alternate algorithm designed for this setting.




\section{Preliminary Results}\label{section:preliminary}

We now consider the \emph{gonality sequence} of a graph $G$, the sequence of its $r^{\text{th}}$ gonalities for all $r\in\mathbb{Z}_{>0}$:
\[\gon_1(G),\gon_2(G),\gon_3(G),\ldots\]
We begin by providing some basic results on higher gonalities and gonality sequences, including bounds for the $r^{\text{th}}$ gonality of a graph based on lower gonalities. Some of results were previously known, appearing in papers such as \cite{higher_gonality_random} or as widely known corollaries of the Riemann-Roch theorem for graphs; we include them here for completeness.


Our first result shows that gonality sequences are strictly increasing.


\begin{lemma}
\label{strict}
If $n > m$, then $\gon_n(G) > \gon_m(G)$.
\end{lemma}

\begin{proof}  
We first show that, for any given divisors $D, E \in \Div_+(G)$, 
\[
r(D - E) \geq \max \{r(D) - \deg(E), -1\}.
\]
Suppose that $r(D) - \deg(E) > -1$. (Otherwise, this inequality is clearly true.) Let $r(D) = k$. By the definition of rank, we know that $\@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \emptyset$ for all $D' \in \Div_+^{k}(G)$. Hence, $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} \neq \emptyset$ for all $E' \in \Div_+^{k - \deg(E)}(G)$ as $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} = \@ifstar{\oldabs}{\oldabs*}{D - (E + E')}$ where $E + E' \in \Div_+^k(G)$. It follows that $r(D - E) \geq k - \deg(E) = r(D) - \deg(E)$.

Now let $\gon_n(G) = \gamma$. This means that there exists some divisor $D \in \Div_+^\gamma(G)$ such that $r(D) = n$. For any $E \in \Div_+^{n-m}(G)$, we have $r(D - E) \geq r(D) - \deg(E) = r(D) - (n-m) = m$. Since $\deg(D - E) = \gamma - (n-m) < \gamma$, we have
\[
\gon_m(G) \leq \deg(D - E) < \gon_n(G).
\]
\end{proof}

Our next result provides an upper bound on a higher gonality in terms of lower gonalities.

\begin{lemma}
\label{sum}
If $a = a_1 + \cdots + a_n$ with $a_i \in \mathbb{Z}_{>0}$, then $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$.
\end{lemma}

\begin{proof}
Let $\gamma_{a_i} = \gon_{a_i}(G)$ for each $i$. There exists a divisor $D_{a_i} \in \Div_+^{\gamma_{a_i}}(G)$ such that $r\left(D_{a_i}\right) = a_i$ for each $i$. This implies that $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E} \neq \emptyset$ for all $E \in \Div_+^{a_i}(G)$. Let $D = D_{a_1} + \cdots + D_{a_n}$. Notice that for each $E \in \Div_+^a(G)$, there exists some decomposition $E = E_{a_1} + \cdots + E_{a_n}$ where $E_{a_i} \in \Div_+^{a_i}(G)$. 

Pick $F_i \in \Div_+(G)$ for $i \in \{1,\dots,n\}$. We now show that if $\@ifstar{\oldabs}{\oldabs*}{F_i} \neq \emptyset$ for all $i$, then $\@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n F_i} \neq \emptyset$. Notice that, for each $F_i$, there exists $F_i' \in \Div_+(G)$ such that $F_i' \sim F_i$. We note that $\sum_{i=1}^n F_i \sim \sum_{i=1}^n F_i'$ and that $\sum_{i=1}^n F_i' \in \Div_+(G)$, which implies that $\@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n F_i } \neq \emptyset$.

As a consequence, we see that
\[
\@ifstar{\oldabs}{\oldabs*}{D - E} = \@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n D_{a_i} - \sum_{i=1}^n E_{a_i} } = \@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n \@ifstar{\oldparen}{\oldparen*}{D_{a_i} - E_{a_i} } } \neq \emptyset,
\]
because for each $i$, we have $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E_{a_i}} \neq \emptyset$. We conclude that $r(D) \geq a$ which implies that $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$. 
\end{proof}

We now prove a straightforward lower bound on the $k^{\text{th}}$ gonality of a graph.


\begin{proposition}
\label{tree}
 For a graph $G$ and $k \in \mathbb{Z}_{>0}$, we have $\gon_k(G) \geq k$, with equality if and only if $G$ is a tree.
\end{proposition}

\begin{proof} 
Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) < k$. Then, for all $D' \in \Div_+^k(G)$, we have $|D - D'| = \emptyset$ because $\deg(D - D') < 0$ and the degree of a divisor is preserved under linear equivalence. Hence, $r(D) < k$.  This shows that $\gon_k(G) \geq k$.

Now we show $\gon_k(G)=k$ if and only if $G$ is a tree. First we remark that $\gon_1(G)=1$ if and only if $G$ is a tree; this follows immediately from \cite[Lemma 1.1]{bn2}.  Assume that $G$ is a tree. Then $\gon_k(G)\leq k\gon_1(G)=k$ by Lemma \ref{sum}.  Combined with our lower bound of $k$, we have that $\gon_k(G)=k$.

Now assume $\gon_k(G)=k$.  Then the first $k$ terms of the gonality sequence of $G$ are
\[\gon_1(G),\gon_2(G),\cdots,\gon_{k-1}(G),k.\]
By Lemma \ref{strict}, this is a strictly increasing sequence of $k$ positive integers ending in $k$.  The only such sequence is
\[1,2,\cdots,k-1,k,\]
meaning that $\gon_1(G)=1$.  We conclude that $G$ is a tree.
\end{proof}








We now present a few well-known corollaries of Theorem \ref{RR}, the Riemann-Roch theorem for graphs.

\begin{lemma}\label{genus}  Let $G$ be a graph of genus $g$.
\begin{itemize}
    \item[(a)] We have $\gon_1(G)\leq g+1$.
    \item[(b)]
    If $g\geq 2$, then $\gon_{g-1}(G)=2g-2$.
    \item[(c)] If $k \geq g$, then $\gon_k(G) = g + k$.
\end{itemize}
\end{lemma}

\begin{proof}

To prove part (a), let $D$ be any divisor of degree $g+1$ on $G$.  By the Riemann-Roch theorem, we have
\[r(D)=\deg(D)+1-g+r(K-D)= 2+r(K-D)\geq 1\]
since $r(K-D)\geq -1$.  As $D$ has positive rank and degree $g+1$, we have $\gon_1(G)\leq g+1$.  (We remark that this is essentially the proof of part 1 of \cite[Theorem 1.9]{bn}.)


For part (b), note that $\deg(K)=2g-2$, and $r(K)=\deg(K)-g+1+r(K-K)=2g-2-g+1+0=g-1$.  Thus $\gon_{g-1}(G)\leq 2g-2$.  Suppose for the sake of contradiction that there exists a divisor $D$ of degree $2g-3$ and rank $g-1$ or more.  Then $r(K-D)=r(D)+g-\deg(D)-1\geq g-1+g-(2g-3)-1=1$, and $\deg(K-D)=1$.  The only way $G$ can have a positive rank divisor of degree $1$ is for $G$ to be a tree, but $g\geq 1$, a contradiction.  Thus $\gon_{g-1}(G)= 2g-2$.


We now prove part (c).  Let $k \geq g$. Choose a divisor $D \in \Div_+^{g+k}(G)$. By the Riemann-Roch theorem for graphs, we know that
\begin{align*}
r(D) &= \deg(D) + 1 - g + r(K - D) \\
&= k + 1 + r(K - D) \geq k. 
\end{align*}
Hence, $\gon_k(G) \leq g + k$. Now, suppose that we have a divisor $D \in \Div_+^{g+k-\ell}(G)$ with $\ell \geq 1$ such that $r(D) \geq k$. Then, by Riemann-Roch, we see that
\begin{align*}
r(K - D) &= r(D) - (\deg(D) + 1 - g) \\
&\geq k - (g +k-\ell + 1 - g) \\
&= \ell - 1.
\end{align*}
Since $r(K - D) \geq \ell - 1$, we know that $\deg(K - D) \geq \ell - 1$. Hence,
\begin{align*}
\deg(K - D) = 2g - 2 - (g+k-\ell) &\geq \ell - 1,
\end{align*}
which implies $g - 1 \geq k$, contradicting our original assumption that $k \geq g$. We conclude that $\gon_k(G) = g + k$.
\end{proof}

This lemma helps us prove the following corollary.

\begin{corollary}\label{corollary:determined_genus}
The genus of a graph is determined by its gonality sequence.
\end{corollary}

\begin{proof}
A graph has genus zero if and only if its gonality sequence is $1,2,3,4,\ldots$ by Proposition \ref{tree}.  Moreover, we claim that a graph has genus $1$ if and only if its gonality sequence is $2,3,4,5,\ldots$. The forward direction comes from a combination of Proposition \ref{tree} and parts (a) and (c) of Lemma \ref{genus}.  For the backward direction, any graph with genus $g\geq 2$ must have $\gon_g(G) = \gon_{g-1}(G) + 2$ by parts (b) and (c) of Lemma 3.4.


Now suppose $g\geq 2$.  By Lemma \ref{genus}, we know that $\gon_g(G) = \gon_{g-1}(G) + 2$ and $\gon_k(G) = \gon_{k-1}(G) + 1$ for all $k > g$. Thus, the genus of $G$ is the index of the last gonality that is more than one greater than the preceding gonality. We conclude that the genus of a graph is determined by its gonality sequence.
\end{proof}

Our next result says that if a graph has first gonality $2$, then its gonality sequence is determined by its genus.

\begin{proposition}\label{prop:hyperelliptic}
If $\gon_1(G) = 2$, then
\[
\gon_k(G) = \begin{cases}
2k \quad &\text{if $k < g(G)$} \\
k + g(G) \quad &\text{if $k \geq g(G)$}.
\end{cases}
\]
\end{proposition}

\begin{proof}
By part (c) of Lemma \ref{genus}, we know $\gon_k(G) = k + g(G)$ for $k \geq g(G)$. By Lemma \ref{sum}, we know that $\gon_k(G) \leq \gon_{k-1}(G) + 2$ for $2 \leq k \leq g(G)$. Since $\gon_{g(G)}(G) = 2g(G)$, this implies that $\gon_k(G) = \gon_{k-1}(G) + 2$ for $2 \leq k \leq g(G)$ so $\gon_k(G) = 2k$. 
\end{proof}

We will refer to graphs of gonality $2$ as \emph{hyperelliptic} graphs, matching the terminology used for algebraic curves. For such a graph of genus $g$, we will call its gonality sequence the hyperelliptic gonality sequence of genus $g$. We close this section with a corollary of Theorem \ref{coppensclif}.

\begin{corollary}\label{corollary:g-2}
Let $G$ be a graph of genus $g\geq 4$ with $\gon_1(G)\geq 3$.  We have $\gon_{g-2}(G)=2g-3$.
\end{corollary}

\begin{proof}
By part (b) of Lemma \ref{genus}, we know $\gon_{g-1}(G)=2g-2$, which is strictly larger than $\gon_{g-2}(G)$, so $\gon_{g-2}(G)\leq 2g-3$.  Suppose $\gon_{g-2}(G)\leq 2g-4$. Then there exists a divisor of degree $2g-4$ and rank $g-2$.  Since $g\geq 4$, we have $2\leq g-2$, so by Theorem \ref{coppensclif} it follows that $G$ has a divisor of rank $1$ and degree $2$, a contradiction to $\gon_1(G)\geq 3$.  We conclude that $\gon_{g-2}(G)=2g-3$.
\end{proof}




\section{Gonality Sequences for Graphs of Small Genus}\label{section:small_genus}


In this section, we will determine all possible gonality sequences for graphs of low genus. Moreover, we will show that for low genus, the genus of the graph combined with first gonality is enough information to determine the entire gonality sequence. 


We first present the following lemma, which handles the $g\geq 6$ part of Theorem \ref{theorem:gonality_sequences}.

\begin{lemma}\label{lemma:G_and_H}
For $g\geq 6$, there exist graphs $G$ and $H$ of genus $g$ with $\gon_1(G)=\gon_1(H)=3$, $\gon_2(G)=5$, and $\gon_2(H)=6$.
\end{lemma}

\begin{proof}
We explicitly construct our graphs as follows.  Let $G$ have $g$ vertices $v_1,\cdots,v_g$, with three edges connecting $v_1$ and $v_2$ and two edges connecting $v_i$ and $v_{i+1}$ for $2\leq i\leq g-1$.  Let $H$ have $g-1$ vertices $w_1,\cdots,w_{g-1}$, with three edges connecting $w_1$ and $w_2$, three edges connecting $w_2$ and $w_3$, and two edges connecting $w_i$ and $w_{i+1}$ for  $3\leq i\leq g-2$.  These graphs are illustrated in Figure \ref{figure:G_and_H} in the case of $g=6$, along with certain divisors.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=1]{G_and_H.pdf}
    \caption{The graphs $G$ and $H$ for $g=6$, along with divisors of ranks $1$ and $2$}
    \label{figure:G_and_H}
\end{figure}

We first remark that neither graph has first gonality $2$: if a rank $1$ divisor has only $2$ chips, then it must place $1$ chip on the leftmost divisor since no chips can be moved there without introducing debt. But this only leaves one chip for the rest of the graph, which is not sufficient. The illustrated divisors of degree $3$, namely $3\cdot (v_1)$ on $G$ and $3\cdot (w_1)$ on $H$, do each have rank $1$, so $\gon_1(G)=\gon_2(H)=3$. Moreover, we claim that the divisor $5\cdot (v_2)$ of degree $5$ on $G$ has rank $2$. To see this, we note that for any $i,j\geq 2$ the divisor $5\cdot(v_2)$ is equivalent to the divisors $3\cdot(v_1)+2\cdot(v_i)$ and $(v_2)+2\cdot(v_i)+2\cdot(v_j)$.  This means that for any effective divisor of degree $2$, $5(v_2)$ is equivalent to some divisor greater than it, meaning that $r(5\cdot(v_2))\geq 2$.
Since $G$ is not hyperelliptic, we have $\gon_2(G)\neq 4$ by Theorem \ref{coppensclif}, so $\gon_2(G)=5$.  Although we have assumed that $g\geq 6$, note that this same argument works to argue that $\gon_2(G') = 5$ for any graph $G'$ constructed in the same manner as $G$ with $g(G') \geq 3$. 

It remains to show that $\gon_2(H)=6$.  Certainly $\gon_2(H)\leq 2\gon_1(H)=6$; indeed, we obtain a rank $2$ divisor $6\cdot(w_1)$ of degree $6$ by doubling our rank $1$ divisor $3\cdot(w_1)$.  Suppose for the sake of contradiction that there exists a rank $2$ divisor $D$ of degree $5$ on $H$.  Without loss of generality, since $D$ has rank $2$, we may assume that $D(w_1)\geq 2$.  We will now deal with several cases, where all chip-firing moves we consider are subset-firing moves that do not introduce debt.

\begin{itemize}
    \item Suppose $D(w_1)=2$.  Since $\val(w_1) > 2$, these two chips cannot be moved from $w_1$. Hence, we are left with three chips for the rest of the graph, which is equivalent to a copy of $G$ with genus $g-2\geq 4$. But as we have already shown, such a graph needs at least $5$ chips to win the second gonality game.
    
    
    \item Suppose $D(w_1)=3$, so that it has two chips elsewhere on the graph. If we remove one chip from $w_1$, the remaining two chips on $w_1$ are now isolated. We are now in the situation of playing the first gonality game on a copy of $G$ with genus $g-2\geq 4$ and only two chips.  However, we need at least three chips to win the first gonality game on $G$.
    
    \item Suppose $D(w_1)\in\{4,5\}$. Chip-fire $w_1$ to produce a linearly equivalent divisor where any chips remaining on $w_1$ are isolated and the rest of the graph has at most four chips. We are now back in the same situation as in the first case.
\end{itemize}
In all cases we have reached a contradiction, so we must have $\gon_2(H)=6$, as desired.
\end{proof}

We are now ready to prove Theorem \ref{theorem:gonality_sequences}.

\begin{proof}[Proof of Theorem \ref{theorem:gonality_sequences}]  Let $G$ be a graph with $g(G)\leq 5$.  We will prove genus by genus that $\gon_1(G)$ determines the gonality sequence of $G$.

For $g\leq 2$, we will see that the gonality sequence is determined by $g$ alone without needing to know $\gon_1(G)$.  If $g(G)=0$, then $G$ is a tree, and so has gonality sequence given by $\gon_k(G)=k$ by Proposition \ref{tree}.  If $g=1$, then $\gon_k(G) = k+1$ by the proof of Corollary \ref{corollary:determined_genus}. If $g = 2$, then by part (b) of Lemma \ref{genus}, $\gon_1(G) = 2$ so the gonality sequence of $G$ is the hyperelliptic sequence of genus $2$ given by Proposition \ref{prop:hyperelliptic}.

Now suppose $g=3$.  Since $G$ is not a tree, we know $\gon_1(G)>1$, and by Theorem \ref{theorem:up_to_5}, we have $\gon_1(G)\leq\floor{\frac{g+3}{2}}=3$.  If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $3$ by Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)=3$, then for $k\geq 3$ we have $\gon_k(G)=k+3$ by part (c) of Lemma \ref{genus}.  By part (b) of Lemma \ref{genus}, $\gon_2(G) = 4$. We conclude that the gonality sequence for a graph is genus $3$ is either
\[2,4,6,7,8,9,\ldots\qquad\text{or}\qquad3,4,6,7,8,9,\ldots\]

Now suppose $g=4$.  Again we have $1 < \gon_1(G) \leq 3$. If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $4$ by Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)=3$, then by Lemma \ref{genus} we have $\gon_k(G)=k+4$ for $k\geq 4$, and $\gon_3(G)=2g-2=6$.  Moreover, we can apply Corollary \ref{corollary:g-2} to deduce that $\gon_2(G)=2g-3=5$.  We conclude that the gonality sequence of a graph of genus $4$ is either
\[2,4,6,8,9,10,\ldots\qquad\text{or}\qquad3,5,6,8,9,10,\ldots\]


Finally, suppose $g=5$.  We have $\gon_1(G)>1$ and $\gon_1(G)\leq\floor{\frac{g+3}{2}}=4$.   If $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $4$ by Proposition \ref{prop:hyperelliptic}. Now assume $\gon_1(G)\geq 3$. We know $\gon_4(G)=8$ by part (b) of Lemma \ref{genus}, and since $G$ is not hyperelliptic, we have $\gon_3(G)=7$ by Theorem \ref{corollary:g-2}, so only the first two gonalities are yet to be determined. Since $G$ is not hyperelliptic, we know that $\gon_2(G) > 4$. By applying the Riemann-Roch theorem, we find that $G$ has a divisor $D$ of degree $3$ and rank $1$ if and only if it also has a divisor $K-D$ of degree $5$ and rank $2$. Combined with the fact that $5\leq \gon_2(G)<\gon_3(G)=7$, we have that if $\gon_1(G)=3$, then $\gon_2(G)=5$; and if $\gon_1(G)=4$, then $\gon_2(G)=6$.  We conclude that the only possible gonality sequences for a graph of genus $5$ are
\[2,4,6,8,10,11,\ldots,\qquad3,5,7,8,10,11,\ldots,\qquad\text{and}\qquad4,6,7,8,10,11,\ldots\]
Hence for all $g\leq 5$, the genus and the first gonality of a graph determine the gonality sequence. As shown in Lemma \ref{lemma:G_and_H}, this does not hold for $g\geq 6$.  This completes the proof.
\end{proof}

\begin{remark}
We remark that each possible gonality sequence discussed in the proof of Theorem \ref{theorem:gonality_sequences} is indeed the gonality sequence of some graph; see Table \ref{table:sequences} for examples corresponding to each sequence. For $g \leq  2$, any graph of genus $g$ will suffice since there is a unique possible gonality sequence for that genus.  For $g \geq 3$, the hyperelliptic gonality sequence of genus $g$ is achieved by the \emph{banana graph}, comprised of $2$ vertices connected by $g+1$ edges. The graphs $K_4$ and $K_{3,3}$ both have first gonality $3$ and thus achieve the remaining possible gonality sequences for graphs of genus $3$ and $4$, respectively. Finally, for genus $5$, the gonality sequence beginning with first gonality $3$ is achieved by the genus $5$ version of the graph $G$ used in Lemma \ref{lemma:G_and_H}. The final gonality sequence beginning with first gonality $4$ is achieved by the graph illustrated in Table \ref{table:sequences} (this graph has first gonality $4$ by \cite[Proposition 4.5]{gonthree}). This table also includes all known gonality sequences for graphs of genus $6$, as computed in the following example. Assuming the gonality conjecture holds for graphs of genus $6$, this is a complete enumeration of the gonality sequences of graphs of genus $6$.
\end{remark}

\begin{example}\label{example:g6}
In this example, we determine all possible gonality sequences of graphs of genus $6$, under the assumption that any such graph has gonality at most $\floor{\frac{g+3}{2}}=4$.  First if $\gon_1(G)=2$, then $G$ has the hyperelliptic gonality sequence of genus $6$ from Proposition \ref{prop:hyperelliptic}.  If $\gon_1(G)\geq 3$, then by Lemma \ref{genus} and Corollary \ref{corollary:g-2}, the gonality sequence of the graph is of the form
\[\gon_1(G),\gon_2(G),\gon_3(G),9,10,12,13,14,\ldots\]
Since $\gon_1(G) \geq 3$, we have $5 \leq \gon_2(G) < \gon_3(G)$ and $7 \leq \gon_3(G) < 9$. By the Riemann-Roch theorem for graphs, a graph of genus $6$ has a divisor of degree $3$ and rank $1$ if and only if it has a divisor of degree $7$ and rank $3$. Thus, if $\gon_1(G) = 3$, we have $\gon_3(G) = 7$ and so our gonality sequence has the form
 \[3,\gon_2(G),7,9,10,12,13,14,\ldots\]
 where $\gon_2(G)\in\{5,6\}$.  The example graphs $G$ and $H$ of genus $6$ from Lemma \ref{lemma:G_and_H} have first gonality $3$ and second gonalities $5$ and $6$, respectively, so both sequences are achieved by some graph.
 
 On the other hand, if $\gon_1(G)=4$, we have $\gon_3(G)=8$, so the gonality sequence is of the form
  \[4,\gon_2(G),8,9,10,12,13,14,\ldots\]
By the Riemann-Roch theorem for graphs, a graph of genus $6$ has a divisor of degree $4$ and rank $1$ if and only if it has a divisor of degree $6$ and rank $2$, so $5\leq \gon_2(G)\leq 6$.  By \cite[Theorem 1]{panizzut}, the complete graph $K_5$ has genus $6$, first gonality $4$, and second gonality $5$. We can also construct a genus $6$ graph $G$ with first gonality $4$ and second gonality $6$ as follows:  start with four vertices $v_1,v_2,v_3,v_4$, and connect $v_1$ and $v_2$ by two edges, $v_2$ and $v_3$ by five edges, and $v_3$ and $v_4$ by two edges.  A similar argument to that of Lemma \ref{lemma:G_and_H} shows that $\gon_1(G)=4$ and $\gon_2(G)=6$.  Thus both sequences are achieved by some graph.

These sequences and example graphs achieving them appear in Table \ref{table:sequences}.  If we do not assume the gonality conjecture holds, then conceivably
\[5,7,8,9,10,12,13,14,\ldots\qquad\text{and}\qquad6,7,8,9,10,12,13,14,\ldots\]
could be gonality sequences for graphs of genus $6$.  No other sequence would be possible, since $\gon_1(G)>4$ implies $\gon_2(G)>6$, and since the sequences must be increasing and stabilize at $9,10,12,13,14,\ldots$.  Thus, to prove that the gonality conjecture holds for graphs of genus $6$, it would suffice to show that neither of the above sequences is realized as the gonality sequence of a graph of genus $6$.

We also remark that the Brill-Noether conjecture in the case of $g=6$, $r=2$, and $d=6$ says that any graph of genus $g = 6$ should have $\gon_2(G)\leq 6$.  Thus the gonality conjecture for genus $6$ (i.e. the Brill-Noether conjecture for $g=6$, $r=1$, and $d=4$) is equivalent to the Brill-Noether conjecture for $g=6$, $r=2$, and $d=6$.
\end{example}


\begin{table}
\begin{center}
\begin{tabular}{|c|c|c|}
    \hline
    Genus & Gonality sequence & Example graph\\
    \hline
    $0$ & $1,2,3,4,5,6,\ldots$ & \includegraphics{table_g0_1.pdf} \\ \hline
    $1$ & $2,3,4,5,6,7,\ldots$ & \includegraphics{table_g1_1.pdf} \\ \hline
    $2$ & $2,4,5,6,7,8,\ldots$ & \includegraphics{table_g2_1.pdf} \\
    \hline
    \multirow{2}{*}{$3$}&$2,4,6,7,8,9,\ldots$&\includegraphics{table_g3_1.pdf}\\
    \cline{2-3}
    &$3,4,6,7,8,9,\ldots$&\includegraphics{table_g3_2.pdf}\\
    \hline
    \multirow{2}{*}{$4$}&$2,4,6,8,9,10,\ldots$&\includegraphics{table_g4_1.pdf}\\
    \cline{2-3}
    &$3,5,6,8,9,10,\ldots$&\includegraphics{table_g4_2.pdf}\\
    \hline
\end{tabular}\quad \begin{tabular}{|c|c|c|}
    \hline
    Genus & Gonality sequence & Example graph\\
    \hline
    \multirow{3}{*}{$5$}&$2,4,6,8,10,11,\ldots$&\includegraphics{table_g5_1.pdf}\\
    \cline{2-3}
    &$3,5,7,8,10,11,\ldots$&\includegraphics{table_g5_2.pdf}\\
    \cline{2-3}
    &$4,6,7,8,10,11,\ldots$&\includegraphics{table_g5_3.pdf}\\
    \hline
    \multirow{5}{*}{6}&$2,4,6,8,10,12,\ldots$&\includegraphics{table_g6_1.pdf}\\
    \cline{2-3}
    &$3,5,7,9,10,12,\ldots$&\includegraphics{table_g6_2.pdf}\\
    \cline{2-3}
    &$3,6,7,9,10,12,\ldots$&\includegraphics{table_g6_3.pdf}\\
    \cline{2-3}
    &$4,5,8,9,10,12,\ldots$&\includegraphics{table_g6_4.pdf}\\
    \cline{2-3}
    &$4,6,8,9,10,12,\ldots$&\includegraphics{table_g6_5.pdf}\\
    \hline
\end{tabular}


\caption{All possible gonality sequences for graphs of genus at most $5$, with example graphs having those gonality sequences; and the same for genus $6$, assuming the gonality conjecture holds for graphs of genus $6$.}
\label{table:sequences}
\end{center}
\end{table}

We now compare and contrast the properties of our gonality sequences of graphs with those of algebraic curves. The analogue of Proposition \ref{prop:hyperelliptic} holds for for algebraic curves of gonality $2$, also known as hyperelliptic curves: the gonality sequence of the curve is determined by the genus of the curve and is given by the same formula. However, the behavior of graphs and curves of gonality $3$ do not so closely  mirror one another. We recall the following formula from algebraic geometry \cite[Remark 4.5]{trigonal}: if $C$ is a smooth projective curve of gonality $3$ and genus $g\geq 4$, then its $k^{\text{th}}$ gonality is
\[
\gon_k(C) = 
\begin{cases}
3k \quad &\text{if $1 \leq k \leq \left\lfloor \frac{g-1}{3} \right\rfloor$} \\
g + k - 1 - \left\lfloor \frac{g-k-1}{2} \right\rfloor \quad &\text{if $\left\lfloor \frac{g-1}{3} \right\rfloor < k \leq g - 1$} \\
g + k \quad &\text{if $k \geq g$}.
\end{cases}
\]
In particular, if a curve $C$ has gonality $3$, then its gonality sequence is determined by its genus.  The same does not hold for graphs of gonality $3$, as illustrated by Lemma \ref{lemma:G_and_H}. Thus, certain sequences which are the gonality sequence of a graph are \emph{not} the gonality sequence of any smooth projective curve. For instance, by Example \ref{example:g6}, there exists a graph $G$ of genus $6$ with gonality sequence
\[3,5,7,9,10,12,13,14,\ldots\]
 If a smooth projective algebraic curve were to have this gonality sequence, it must also have genus $6$, by the analogue of Corollary \ref{corollary:determined_genus} for curves. But any such curve with first gonality $3$ must have gonality sequence \[3,6,7,9,10,12,13,14,\ldots\] by the above formula.  Thus the gonality sequence of $G$ is not the gonality sequence of any smooth projective curve.  A similar argument applies for the genus $g$ version of the graph $G$ from Example \ref{lemma:G_and_H} for any $g\geq 7$:  any trigonal algebraic curve of genus $g$ must have second gonality $6$, but $G$ has second gonality $5$.  Thus for every genus $g\geq 6$, there exists a gonality sequence of a graph that is not the gonality sequence of a smooth algebraic curve.  However, all graph gonality sequences up to genus $5$ are also gonality sequences of curves:  there certainly exist curves of all possible genus and first gonality pairs, and the remainder of each sequence is determined by similar Riemann-Roch and Clifford's theorem arguments for algebraic curves.

We close this section with a remark on a known result for higher gonalities of algebraic curves which remains open for graphs.

\begin{lemma}[Lemma 4.3 in \cite{trigonal}]\label{lemma:adding_algebraic}  Let $C$ be a smooth projective curve of genus $g\geq 4$, such that $\textrm{gon}_{r+s}(C)=\textrm{gon}_{r}(C)+\textrm{gon}_{s}(C)$ for some $r,s\in\mathbb{Z}$.  Then $\textrm{gon}_k(C)=k\gon_1(C)$ for $1\leq k\leq r+s$.
\end{lemma}

We pose the analogous question for graphs.

\begin{question}\label{question:adding_graphs}
Let $G$ be a graph, and suppose $\gon_{r+s}(G)=\gon_r(G)+\gon_s(G)$.  Is it true that $ \gon_k(G)=k\gon_1(G)$ for $1\leq k\leq r+s$?
\end{question}

Note that the answer to this question is affirmative for $g(G)\leq 5$, as can be verified by examining all gonality sequences in Table \ref{table:sequences}.  We also remark that such a criterion would be useful in determining the first three gonalities of a graph; for instance, it would rule out $(2,3,5)$ and $(3,5,8)$ as possible starts to a gonality sequence.  The first of these is impossible by Proposition \ref{prop:hyperelliptic}; the authors do not know whether the second is possible.

The proof of Lemma \ref{lemma:adding_algebraic} in \cite{trigonal} uses the key fact that given two divisors $D$ and $E$ on a curve such that $r(D+E)=r(D)+r(E)$, we have $D\sim r(D)F$ and $E\sim r(E)F$ for some divisor $F$ of rank $1$; see \cite[Lemma 1.8]{4-gonal}.  Unfortunately such an argument will not work for graphs, as shown in the following example.  Thus a new approach will be needed to answer Question \ref{question:adding_graphs}.

\begin{example}\label{example:payne}
Let $G$ be the graph pictured in Figure \ref{fig:payne}.  By the proof of Theorem 1.2 in \cite{loop_of_loops}, each divisor  $D_i=v_1+v_2+w_i$ where $1\leq i\leq 3$ has rank $1$.  (Although this result is proven for metric graphs, the same holds here in the finite case.)  Since $D_1$, $D_2$, and $D_3$ are pairwise linearly inequivalent, we may choose two of them, say $D_i$ and $D_j$ such that $D_i\not\sim K-D_j$.  Then we have
\[r(D_i+D_j)-r(K-D_i-D_j)=6+1-4=3.\]
Note that $\deg(K-D_i-D_j)=0$, and since $D_i\not\sim K-D_j$, we have $r(K-D_i-D_j)=-1$.  Thus $r(D_i+D_j)=2=r(D_i)+r(D_j)$.  However, since $D_i\not\sim D_j$, there cannot exist a divisor $F$ with $D_i\sim F$ and $D_j\sim F$.  Thus the natural graph-theoretic analogue of \cite[Lemma 1.8]{4-gonal} does not hold.

\begin{figure}[hbt]
\begin{center}
\includegraphics[scale=0.8]{payne_example.pdf}
\caption{The graph $G$ from Example \ref{example:payne}}
\label{fig:payne}
\end{center}
\end{figure}


\end{example}

















\section{Banana Graphs and Second Gonalities}\label{section:bananas}

The main goal of this section is to prove that given any pair of ``reasonable'' integers $m$ and $n$, there exists a graph $G$ with first gonality $m$ and second gonality $n$.  Certainly a necessary condition is that $m<n\leq 2m$; we will show that this condition is sufficient by constructing families of graphs called the generalized banana graphs.

As in the previous section, we define the \textit{banana graph} $B_n$ as a graph with two vertices and $n$ edges connecting them. It is clear that for $n \geq 2$, $\gon_1(B_n) = 2$, since $\gon_1(G)\leq |V(G)|$ and $\gon_1(G)>1$ for any graph that is not a tree.  It follows immediately from Proposition \ref{prop:hyperelliptic} and the fact that $g(B_n)=n-1$ that $\gon_k(B_n)=2k$ for $1\leq k \leq n-1$.



A \textit{generalized banana graph} is a graph with vertices $\{v_1,\dots,v_n\}$ such that $v_i$ is connected to $v_{i+1}$ by at least one edge, and such that there are no other edges present in the graph.  In other words, it is a collection of $n-1$ banana graphs, glued together in a line.  In this section we study two families of generalized banana graphs:  those with a constant number of edges between pairs of vertices, and those with a descending number of edges.

Let $B_{n,e}$ denote the generalized banana graph on $n$ vertices where $|E(v_i,v_{i+1})|=e$ for $1\leq i\leq n-1$. Note that $B_{n,e}$ has edge-connectivity $e$, so by Lemma \ref{lemma:lower_bound} we have 
\[\gon_1(B_{n,e}) \geq \min\{\eta(B_{n,e}),|V(B_{n,e})|\}= \min \{e, n\}.\]  
The divisors $e(v_1)$ and $(v_1)+\cdots+(v_n)$ both have positive rank, so  $\gon_1(B_{n,e}) =  \min \{e, n\}$.



\begin{example}
The generalized banana graphs $B_{4,2}$ and $B_{5,5}$ are illustrated in Figure~\ref{fig:genbananas}.
\end{example}

\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{genbanana.pdf}
\caption{The generalized banana graphs $B_{4,2}$ and $B_{5,5}$.}
\label{fig:genbananas}
\end{center}
\end{figure}

Over the following three lemmas, we will determine the second gonality of $B_{e,n}$ for any values of $e$ and $n$.  We will see that these graphs will not give us all the desired pairs of first and second gonalities, meaning we will need to consider other generalized banana graphs.

\begin{lemma}
If $n<e$, then $\gon_2(B_{e,n})=2n$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2\min\{n, e\} = 2n$. Now, suppose that we have a divisor $D \in \Div_+(B_{n,e})$ with $\deg(D) = 2n-1$. We will show that $r(D)<2$. We split into the following cases.
\begin{itemize}
    \item[(1)] If $\supp(D) = V(B_{n,e})$, then there exists at least one vertex $v_i$ with $D(v_i) = 1$. Furthermore, for all other vertices $v_j$, $D(v_j) \leq n < e$. Hence, the divisor $D - 2 (v_i)$ is $v_i$-reduced, implying that $r(D) < 2$.
    \item[(2)] If exactly one vertex $v_i$ has zero chips and all other vertices have at least one chip, then there are two cases.
    \begin{itemize}
        \item[(i)] There exists exactly one vertex $v_j$ with $e$ chips. Note that since $2n - 1 - e \leq n - 2$, $v_j$ clearly cannot have more than $e$ chips and since $2n - 1 - 2e < 0$, we cannot have more than one vertex with $e$ chips. If $v_j$ has $e$ chips, then every other vertex (except for $v_i$ and $v_j)$ must have exactly one chip. Hence, the divisor $D - (v_i) - (v_j)$ is $v_i$-reduced.
        \item[(ii)] All vertices have fewer than $e$ chips. Notice that in this case, $D - 2(v_i)$ is $v_i$-reduced.
    \end{itemize}
    Both outcomes imply that $r(D)<2$.
    \item[(3)] If there are at least two distinct vertices $v_i$ and $v_j$ with $D(v_i)=0=D(v_j)$, then there is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists, and consider the divisor $D'=D-v_i-v_j$. Then we fire subsets of vertices in order to move $e$ chips from $v_k$ to either $v_i$ or $v_j$ (the closer of the two to $v_k$). Then, we can run Dhar's burning algorithm on this new configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is already no way to fire any subset of vertices without introducing debt. It follows that $r(D)<2$. 
\end{itemize}
Thus, $\gon_2(B_{n,e})=2n$.
\end{proof}

\begin{lemma}
If $e<n$, then $\gon_2(B_{n,e})=2e$.
\end{lemma}

\begin{proof}
By Lemma \ref{sum}, $\gon_2(B_{n,e}) \leq 2 \min \{n, e \} = 2e$. Suppose that we have a divisor $D \in \Div_+(B_{n,e})$ such that $\deg(D) = 2e - 1$.
Again, we proceed by cases to show that $r(D)<2$.
\begin{itemize}

    \item[(1)] If $\supp(D) = V(B_{n,e})$, at least one vertex $v_i$ has exactly one chip. Furthermore, suppose some vertex $v_j$ has at least $e$ chips. Then, we have $2e - 1 - e = e - 1 < n-1$ chips remaining for the $n-1$ vertices, a contradiction. Thus, if we run Dhar's burning algorithm on the divisor $D - 2(v_i)$, then the entire graph burns because $D(v) < e$ for all vertices $v$. Thus $r(D)<2$.
    
    \item[(2)] If there is exactly one vertex $v_i$ satisfying $D(v_i)=0$, we have two cases.
    \begin{itemize}
        \item[(i)] If there exists a vertex $v_j$ such that $D(v_j) \geq e$, we know that $v_j$ must have exactly $e$ chips because $2e - 1 - (e + 1) = e - 2 < n - 2$, which is a contradiction to all vertices besides $v_i$ having a chip. Furthermore, all other vertices except for $v_i$ and $v_j$ must have exactly one chip. This is because we have $e - 1 \leq n-2$ chips remaining for $n-2$ vertices. Run Dhar's burning algorithm on the the divisor $D - (v_i) - (v_j)$ beginning at the vertex $v_i$. Notice that in this divisor, no vertex has more than $e-1$ chips so the whole graph burns.
        \item[(ii)] If all vertices have fewer than $e$ chips, then we can run Dhar's burning algorithm on the divisor $D - 2(v_i)$, beginning at the vertex $v_i$, which burns the whole graph.
    \end{itemize}
    In both cases we can conclude that $r(D)<2$.
    \item[(3)] If there are at least two vertices, $v_i$ and $v_j$ with zero chips, then consider the divisor $D-(v_i)-(v_j)$. There is either exactly one other vertex $v_k$ such that $D(v_k)\geq e$, or there is no such vertex. Suppose such a $v_k$ exists. Then we can fire subsets of vertices in order to move $e$ chips from $v_k$ to $v_i$, without loss of generality. Then, we can run Dhar's burning algorithm on this configuration with respect to $v_j$, and the whole graph burns. If no such $v_k$ exists, then there is no way to fire any subset of vertices without introducing debt.  This gives $r(D)<2$.
\end{itemize}
Thus, $\gon_2(B_{n,e})=2e$.
\end{proof}

\begin{lemma}
If $n=e$, then $\gon_2(B_{n,e})=2n-1.$
\end{lemma}

\begin{proof}
First note that the divisor $n(v_1)+(v_2)+\cdots +(v_n)$ wins the second gonality game. If the opponent were to take away two chips from a vertex that currently has one, then we could fire $v_1$, and then increasingly larger subsets, in order to move the $n$ chips and reach an effective divisor. Now suppose that divisor $D$ wins the second gonality game, with $\deg(D)<2n-1$. We proceed by cases.
\begin{itemize}
\item[(1)] $\supp(D)=V(B_{n,e})$, in which case, there exist at least two vertices, $v_i$ and $v_j$, such that $D(v_i)=1=D(v_j)$.
\item[(2)] There exists some vertex $v_i$ such that $D(v_i)=0$, and $V-\left\{v_i\right\}=\supp(D)$.
\item[(3)] There exist at least two vertices $v_i$ and $v_j$ such that $D(v_i)=0=D(v_j)$, with $i<j$.
\end{itemize}

If we are in case (1), then consider the divisor $D-2(v_i)$. Notice that no vertex has greater than $n-1$ chips, so if we run Dhar's burning algorithm with respect to $v_i$, then the entire graph burns. If we are in case (2), then the maximum number of chips a vertex has is $n$. If no vertex has $n$ chips, then if we consider the divisor $D-2(v_i)$ and burn with respect to $v_i$, the entire graph burns. If a vertex, $v_j$ has $n$ chips, then consider the divisor $D-(v_i)-(v_j)$; now no vertex has at least $n$ chips, so burning with respect to $v_i$ burns the entire graph. Finally, if we are in case (3), then the maximum number of chips a vertex has is $n+1$. If no vertex has at least $n$ chips, then we can consider the divisor $D-2(v_i)$, and burning with respect to $v_i$ burns the entire graph. If a vertex, $v_k$, has at least $n$ chips, then there are no other vertices with at least $n$ chips. We can then consider the divisor $D-(v_i)-(v_j)$. Notice that we can fire subsets of vertices to move $n$ chips to $v_i$; then, $D(v_i)=n-1$ and no vertex has at least $n$ chips. If we then burn with respect to $v_j$, the entire graph burns. Thus, a winning divisor cannot have fewer than $2n-1$ chips, and $\gon(B_{n,e})=2n-1$.

\end{proof}




The graphs $B_{n,e}$ can only yield pairs of first and second gonalities of the form $(a,2a)$ and $(a,2a-1)$ where $a\geq 2$, as well as $(1,2)$ from $B_{2,1}$.  To obtain graphs with lower second gonalities, we construct another family.  For $a\leq b$, let $B^*_{a,b}$ be the generalized banana graph on $a$ vertices $\left\{v_1,\dots,v_a\right\}$ where the number of edges between $v_i$ and $v_{i+1}$ for $1\leq i\leq a-1$ is $b-a+i+1$. In other words, there are $b$ edges between the first pair of vertices starting from $\{v_{a-1},v_a\}$, with each subsequent pair having one fewer edge than the pair before as we move from $v_a$ to $v_1$. 


\begin{figure}[H]
\begin{center}
\includegraphics[scale=0.8]{bstarex.pdf}
\caption{The generalized banana graphs $B^*_{6,8}$ and $B^*_{4,5}$.}
\label{fig:banananas}
\end{center}
\end{figure}

\begin{lemma}\label{firstgonbanana}
We have $\gon_1(B^*_{a,b})=a$.
\end{lemma}

Our proof mimics that of Lemma 5 in \cite{ccNewtonPolygons}, in which it is proven that $\gon_1(B^*_{a,a})=a$. 

\begin{proof}
As with any graph, we have $\gon_1(B^*_{a,b})\leq |V(B^*_{a,b})|=a$. Suppose there exists a divisor $D$ such that $\deg(D)<a$ and $D$ has positive rank. We can also assume that $D$ is $v_1$-reduced, so $D(v_1)\geq 1$. There exists some other vertex with zero chips on it; let $i$ be the maximal index for which $D(v_i)=0$. We can then perform Dhar's burning algorithm with respect to $v_i$. The chips on the vertices $v_{i+1},\dots,v_m$ do not move, because $D$ is already $v_1$-reduced and fire from $v_1$ would pass through $v_i$. If $m$ is the number of edges between $v_{i-1}$ and $v_{i}$, then there need to be at least $m$ chips on the subgraph induced by the vertices $\left\{v_1,\dots,v_{i-1}\right\}$ since the entire graph will not burn as $D$ has positive rank. However, $m\geq i$, and $D(v_{i+1}),\dots,D(v_a)\geq 1$, so $\deg(D)=m+(a-i)\geq a$, a contradiction.
\end{proof}

\begin{lemma}\label{bananapairs}
Let $2\leq a\leq b\leq 2a-1$. We have $\gon_2(B^*_{a,b})=b+1$.
\end{lemma}

\begin{proof}
First notice that the divisor $(b+1)\cdot v_a$ has rank at least $2$: for any $k$ with $1\leq k\leq a$, this divisor is equivalent to $(b+k-a)\cdot v_k+\sum_{k\leq i\leq a}(v_k)$.  Allowing $k$ to vary, we find effective divisors greater than any given effective divisor of degree $2$. This means that $\gon_2(B^*_{a,b})\leq b+1$. Now suppose that a divisor $D\in\textrm{Div}_+^k(B_{a,b}^*)$ has rank at least $2$, where $k\leq b$. We proceed by cases.
\begin{itemize}
    \item[(1)]If $D(v_a)=1$, we can consider $D-2\cdot(v_a)$.  This divisor has $-1$ chips on $v_a$ and $k-1\leq b-1$ chips on the other vertices; no chips can move from $v_a$ to the rest of the graph without introducing debt, so this remains true as we try to eliminate debt via subset firing moves.  The only way to eliminate the debt on $v_a$ would be to fire a subset $W$ with $v_{a-1}\in W$, but this is only possible to do without introducing new debt if there are at least $b$ chips on $v_{a-1}$, a contradiction.
    
    \item[(2)]If $D(v_a)=0$, choose $v_i\in\textrm{supp}(D)$, and consider $D-(v_i)-(v_a)$.  The same argument from case (1) shows that the debt on $v_a$ cannot be eliminated, a contradiction.
    
    \item[(3)]If $D(v_a)=k$, then running Dhar's burning algorithm on the divisor $D-(v_{a-1})-(v_a)$ with respect to $v_{a-1}$ burns the entire graph, a contradiction.
    
    \item[(4)]If $D(v_a)=\ell$, $2\leq\ell\leq k-1$, we induct on $a$ to show that $D$ cannot win the second gonality game. As a base case, consider $B^*_{3,b}$, $3\leq b\leq 5$.  We might as well place only 2 chips on $v_3$, because placing any more does not allow us to chip fire from $v_3$ anyways. We can then consider the second gonality of the subgraph induced by $\left\{v_1,v_2\right\}$, which is the (usual) banana graph $B_{b-1}$. Since $\textrm{gon}_1(B_{b-1})=2$, we have $\gon_2(B_2)=3$ and $\gon_2(B_3)=4=\gon_2(B_4)$. Thus, no divisor $D$ with degree $\deg(D)\leq b$ can win the second gonality game if $2\leq D(v_3)\leq b-1$.
    
    Now suppose that for $B^*_{a,b}$, if a divisor $D$ has degree $\deg(D)=k\leq b$ and $2\leq D(v_a)\leq b-1$, then $D$ cannot win the second gonality game. Consider the graph $B^*_{a+1,b'}$ with $a+1\leq b'\leq 2a+1$, and suppose $D'$ is a  divisor with degree $\deg(D')=k\leq b'$ with rank at least $2$. Again, we can assume that $D'(v_{a+1})=2$. The subgraph $G'$ induced by the vertices $\left\{v_1,\dots,v_a\right\}$ is then $B^*_{a,b'-1}$, where $a\leq b'-1\leq 2a-1$.
    Restricting $D'$ to $G'$, we have  $\deg(D')=k-2\leq b-2\leq 2a-1$. From the cases above, as well as the inductive hypothesis, we know that $D'$ cannot win the second gonality game on $G'$. Thus, $D$ cannot win the second gonality game on $B^*_{a+1,b'}$.
\end{itemize}
Therefore, $\gon_2(B^*_{a,b})=b+1$.
\end{proof}

We can now prove that any reasonable pair of first two gonalities is achieved by some graph.


\begin{proof}[Proof of Theorem \ref{theorem:first_two}]  Let $m,n\in \mathbb{Z}$ with $m< n\leq 2n$.
To achieve the first and second gonality pair $(m,n)$, we can consider the graph $B^*_{m,n-1}$, which is well-defined since $m\leq n-1$. From Lemma \ref{firstgonbanana}, $\gon_1(B^*_{m,n-1})=m$. Notice that if $m+1\leq n\leq 2m$, then $m\leq n-1\leq 2m-1$, which are exactly our bounds for $a,b$ in Lemma~\ref{bananapairs}. Thus, given $(m,n)$ within our constraints, the graph $G=B^*_{m,n-1}$ has first gonality $\gon_1(G)=m$ and second gonality $\gon_2(G)=n$.
\end{proof}

We do not easily arrive at a corresponding result for the first three gonalities of a graph.  If $\ell=\gon_1(G)$, $m=\gon_2(G)$, and $n=\gon_3(G)$, then we certainly have $\ell<m<n$, $m\leq 2\ell$, and $n\leq \ell+m$.   However, not all triples $(\ell,m,n)$ satisfying these constraints are the first three gonalities of a graph; for instance,  due to  Proposition \ref{prop:hyperelliptic}, there exists no graph $G$ with $\gon_1(G)=2$, $\gon_2(G)=3$, and $\gon_2(G)=5$.  Determining which triples can be the first three gonalities of a graph seems to be an open question, although answering Question \ref{question:adding_graphs} might help.  For instance, an affirmative answer to that question would imply the triple $(3,5,8)$ to be impossible.  It could also be helpful to study the \emph{Clifford index} of graphs, defined as
\[\textrm{Cliff}(G):=\min\{\deg(D)-2r(D)\,|\, r(D)\geq 1\textrm{ and }\deg(D)\leq g-1\}.\]
As shown in \cite{cliffords_alg}, the Clifford index of an algebraic curve $C$ is always either $\gon_1(C)-2$ or $\gon_1(C)-3$; as noted in \cite{random_graphs}, it is unknown whether the Clifford index of graphs follows the same behavior.  If it does, then we could not have a graph with first three gonalities of the form $(a,a+1,a+2)$ if the graph has genus $g$ at least $a+3$, since then we would have $\textrm{Cliff}(G)\leq \gon_3(G)-2\cdot 3=a+2-6=a-4=\gon_1(G)-4$.


Another open question is the following:  given $m$ and $n$ as in Theorem \ref{theorem:first_two}, what are the possibilities for the genus $g$ of a graph $G$ with $\gon_1(G)=m$ and $\gon_2(G)=n$? In particular, when are there infinitely many possibilities for $g$? For instance, if $(m,n)=(2,3)$, then $g$ must be $1$; but if $(m,n)=(2,4)$, then $g$ can be any integer satisfying $g\geq 2$.




\section{A Modified Burning Algorithm}
\label{section:modified_dhars}

In this section, we present a modified version of the iterated Dhar's burning algorithm suited for checking if a divisor has higher gonality at least $r$.  Although this can be accomplished using the traditional Dhar's algorithm with the same time complexity, our algorithm is more transparent when determining gonalities beyond the first, and so may be useful for proofs relying on the burning algorithm. 

Recall that our method for computing the first gonality of a graph relies on being able to check whether the rank of a divisor $D$ is at least $1$.  The burning algorithm also provides a method for checking if the rank of $D$ is at least $r$.
\begin{enumerate}
\item For each of the finitely many $E \in \Div_+^r(G)$, take $D - E$.
\item Choose any $v \in V(G)$, and semi-reduce $D-E$ with respect to $v$.  Then, use the burning algorithm to compute $\Red_v(D-E)$, and check if it is effective.  If so, continue with more choices of $E$; if not, $r(D) < r$.
\end{enumerate}
To check if $\gon_r(G) > k$, run the above two steps on every effective divisor $D$ of degree $k$.

Our modified algorithm (Algorithm \ref{algorithm:modified_dhars}) provides an alternative to step 2.  Rather than semi-reduction followed by a repeated burning process to reach a reduced divisor, it consists simply of a repeated burning process that determines whether or not the given divisor is equivalent to an effective divisor.  It is thus one of many algorithms that solves the \emph{dollar game}, which asks: given a divisor $D$, is there effective divisor $D'$ with $D\sim D'$?  For other algorithms solving the dollar game, see \cite[Chapter 3]{cp}.

\begin{algorithm}
\caption{Modified Dhar's Burning Algorithm}
\label{algorithm:modified_dhars}
\begin{algorithmic}
	\Require A divisor $D=D^+-D^-$, where $D^+,D^-\geq 0$.
	\Ensure A divisor $D' \in \@ifstar{\oldabs}{\oldabs*}{D}$ satisfying $D' \geq 0$, or \textsc{None} if none exists.
	\If{$D\geq0$}
	\State \Return $D$
    \EndIf
	\State $W \coloneqq V(G) \setminus\supp(D^-)$
	\While{$W \neq \emptyset$}
	    \If{$D(v) < \outdeg_W(v)$ for some $v \in V(G)$}
	    \State $W = W\setminus \{v\}$ \Comment{$v$ burns}
	    \Else
	        \State return $\textbf{Alg}(D - \Delta \mathbbm{1}_{W})$
        \EndIf
	\EndWhile
	\Return \textsc{None} \Comment{entire graph burned}
\end{algorithmic}
\end{algorithm}

We offer the following intuitive explanation of Algorithm \ref{algorithm:modified_dhars}.  Given $D=D^+-D^-$ where $D^+\geq 0$ and $D^->0$, set all vertices of $\supp(D^-)$ on fire.  Let the usual burning process propagate through the graph.  If the whole graph burns, then $D$ is not equivalent to any effective $D'$.  If the whole graph does not burn, fire the unburned vertices $W$, and run the process again.  We refer to each time we run through this burning process a \emph{pass} through our algorithm or an \emph{iteration} of our algorithm.

\begin{example}\label{example:modified_dhars}
As an example of running Algorithm \ref{algorithm:modified_dhars} on a divisor, consider the graph $G$ at the top of Figure \ref{figure:dhars_example}.  Let $D=-(a)+2\cdot(c)+7\cdot(f)-(g)-2\cdot(h)$; this divisor is illustrated on the bottom left.  We can write $D=D^+-D^-$, where $D^+=2\cdot(c)+7\cdot(f)$ and $D^-=(a)+(g)+2\cdot(h)$.  In accordance with Algorithm \ref{algorithm:modified_dhars}, we set the vertex set $\textrm{supp}(D^-)=\{a,g,h\}$ on fire.  The fire spreads until the whole graph burns except for $f$, so we fire $f$ to obtain the next divisor $D'=-(a)+(b)+2\cdot(c)+(d)+(e)+2\cdot(f)-(h)$.  We then set the vertices $a$ and $h$ on fire.  This time the vertices $b,c,d,e,$ and $f$ remain unburned, so these vertices are all fired, giving the divisor $D''=2\cdot(a)+2\cdot(g)+(h)$.  Since debt has been eliminated, the algorithm terminates.  If the whole graph had burned before debt was eliminated, we would have known that eliminating debt were impossible.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=1]{dhars_graph.pdf}
    \\\includegraphics[scale=0.7]{dhars1.pdf}\qquad\includegraphics[scale=0.7]{dhars2.pdf}\qquad\includegraphics[scale=0.7]{dhars3.pdf}
    \caption{The graph $G$ and the steps of Algorithm \ref{algorithm:modified_dhars} from Example \ref{example:modified_dhars}}
    \label{figure:dhars_example}
\end{figure}

\end{example}

We need to argue that this algorithm terminates and that it is correct.  For the termination argument, we will use the $\beta_q(D)$ notation from Subsection \ref{subsection:usual_dhars}.  Recall that
\[\beta_q(D) = \@ifstar{\oldparen}{\oldparen*}{\sum_{v \in S_0} D(v), \sum_{v \in S_1} D(v),\dots, \sum_{v \in S_d} D(v)},\]
where $d=\textrm{diam}(G)$ and $S_i$ is the set of all vertices at distance $i$ from vertex $q$.  Thus $\beta_q(D)$ records in its $i^{th}$ component the number of chips at distance $i$ from $q$.

\begin{proposition}\label{prop:terminates}
Algorithm \ref{algorithm:modified_dhars} terminates.
\end{proposition}

\begin{proof}
Suppose for the sake of contradiction that the algorithm does not terminate on an input $D$.   Since the output of \textsc{None} is never returned, the algorithm is repeatedly firing subsets $W_0,W_1,W_2,\ldots$, giving an infinite sequence of equivalent divisors $D=D_0,D_1,D_2,\ldots$ where $D_{i+1} = D_i - \Delta \mathbbm{1}_{W_i}$.

Note that if $v\in W_i$, then $D_i(v)\geq 0$: otherwise,  $v$ would have been burned from the beginning.  Also note that if $v\in W_i$, then $\outdeg_{W_i}(v)\leq D_i(v)$, meaning that $D_{i+1}(v)\geq 0$. Thus, $D_i(v) \geq 0$ implies $D_j(v) \geq 0$ for all $j \geq i$.  Letting $T_i=\supp(D_i^-)$, this means we have
\[T_0\supseteq T_1\supseteq T_2\supseteq\cdots.\]
Since the $T_i$'s are all subsets of $V(G)$, this sequence must eventually stabilize at some index $k\geq 0$:
\[T_0\supset \cdots\supset T_k=T_{k+1}=T_{k+2}=\cdots\]
Let $T=T_k$.  We know $T\neq \emptyset$:  otherwise, the algorithm would return $D_k$.

We can assume without loss of generality that $k=0$; if not, then we can replace $D$ with $D_k$ and still have an input on which the algorithm fails to terminate.  Thus we have $\supp(D_i^-)=T$ for all $i$.

Consider the $|T|$-tuple of $(d+1)$-tuples $\left(\beta_u(D)\right)_{u \in T}$, which we can think of as a $|T|(d+1)$-tuple.  We can provide a partial order on such tuples by setting $(\beta_u(D'))_T \geq (\beta_u(D))_T$ if for all $u \in T$, we have $\beta_u(D') \geq \beta_u(D)$, where the latter is again taken with respect to the lexicographic ordering.  We claim that
\[(\beta_u(D_{i+1}))_{T} > (\beta_u(D_i))_{T} \quad \text{for all $i \geq 0$.}\]  
To argue this, it suffices to show that $\beta_u(D_{i+1}) > \beta_u(D_i)$ lexicographically for all $u\in T$. We can now replicate the argument from the usual Dhar's algorithm.  In particular, given $u\in T$, pick $w \in W_i$ such that $d(u, w)$ is minimized. Then $w$ has a neighbor $v$ such that $d(u, v) < d(u, w)$ and $v \notin W_i$ (where we might have $v = u$). This directly corresponds to $\beta_u(D_{i+1})$ being strictly greater than $\beta_u(D_i)$ with respect to the lexicographic ordering.


Thus we have an infinite strictly increasing sequence
\[(\beta_u(D_{0}))_{T}<(\beta_u(D_{1}))_{T}<(\beta_u(D_{2}))_{T}<\cdots\]
of $|T|(d+1)$-tuples of integers.  Recall that each integer $\ell$ appearing in a tuple is the sum of the number of chips at a fixed distance from a vertex.  Since no new debt is introduced in the graph, we have $-\deg(D^-)\leq\ell\leq \deg(D^+)$.  Only finitely many $|T| (d+1)$-tuples of integers satisfy these bounds, a contradiction to the existence of an infinite sequence.  We conclude that the algorithm must terminate.
\end{proof}


Before we prove our algorithm is correct, we recall the following notation from \cite{db}. Let $D$ and $D'$ be equivalent divisors, with $D'=D-\Delta f$ for some $f$.  Define $m=\max\{f(v)\,|\, v\in V(G)\}$ and $k=m-\min\{f(v)\,|\,v\in V(G)\}$.  The \emph{level set decomposition} of $f$ is the sequence of sets $A_0\subset A_1\subset \cdots\subset A_k=V(G)$ given by \[A_i=\{v\in V(G)\,|\, f(v)\geq m-i\}.\]
Thus, $A_i$ contains $v$ if and only if $f$ prescribes firing $v$ at least $m-i$ times.
The sequence of divisors $D_0,D_1,\ldots,D_k\in \@ifstar{\oldabs}{\oldabs*}{D}$ given by $D_0=D$ and $D_{i+1}=D_i-\Delta\mathbbm{1}_{A_i}$ for all $i\in\{0,1,\ldots,k-1\}$ is called the \emph{divisor sequence associated with the level set decomposition}.

\begin{proposition}\label{prop:correct}
Algorithm \ref{algorithm:modified_dhars} is correct.
\end{proposition}

\begin{proof}
If Algorithm  \ref{algorithm:modified_dhars} terminates because at some point $D\geq 0$, then we have found a sequence of chip-firing moves (namely the sequence of moves given by firing the subset $W$ produced by each pass through the algorithm) that transforms the initial divisor into an equivalent effective divisor.  Thus the algorithm is correct if it returns a divisor.


We now wish to argue that if  Algorithm \ref{algorithm:modified_dhars} terminates with \textsc{None}, then it is correct. Let $D$ and $D'$ be equivalent divisors, where $D$ is not effective and $D'$ is.  Let $A_0\subset A_1\subset \cdots\subset A_k$ be the level set decomposition and $D=D_0,D_1,\ldots,D_k=D'$ the associated divisor sequence.

We recall \cite[Theorem 3.10]{db}:  for all $i\in\{0,1,\cdots,k\}$, we have $D_i(v)\geq\min\{D(v),D'(v)\}$ for all $v\in V(G)$. This means that no vertex goes any further into debt at any point during the sequence of firing moves. Suppose that $D=D^{+}-D^{-}$ where $D\sim D'\geq 0$ and choose $v\in \supp(D^{-})$.  Since $D(v)<D'(v)$, we have that $v\notin A_0$:  if $v$ were fired at every step, the number of chips on it would not increase.  Thus $A_0\cap \supp(D^{-})=\emptyset$.  It follows that $\textrm{outdeg}_{A_0}(v')\geq D(v')$ for all $v' \in A_0$.  Since $A_0$ is disjoint from $\supp(D^{-})$, it follows that when we run Algorithm \ref{algorithm:modified_dhars}, if $D\sim D'$ with $D'\geq 0$, then the whole graph does not burn, since at the very least $A_0$ will remain unburned. Contrapositively, if the whole graph burns, then $D$ is not equivalent to any $D'$ with $D'\geq 0$.  Thus  if the algorithm returns \textsc{None}, it is correct.
\end{proof}



We now bound the time complexity of Algorithm \ref{algorithm:modified_dhars}. We begin with the following lemma, whose statement and proof are very similar to that of Lemma 5 in \cite{tardos}.

\begin{lemma}\label{lemma:number_of_firings}
For any neighboring pair of vertices, the numbers indicating how many times each vertex has been fired so far cannot differ by more than $\deg(D^+)$ at any point during Algorithm \ref{algorithm:modified_dhars}.
\end{lemma}

\begin{proof}
Suppose that after some number of steps, we have reached $D'$ by performing $f(v)$ firing moves at each vertex $v$, so that $D'=D-\Delta f$.    Fix an edge $uv\in E(G)$.   If $f(u)=f(v)$, we are done.  Suppose $f(u)< f(v)$.  Let $U\subset V(G)$ be the set of vertices which were fired at most $f(u)$ times.  This means $u\in U$ and $v\notin U$.  By the definition of $U$, for any edge connecting $U$ with $V(G) - U$, more chips moved to $U$ than from $U$.  Hence, the total number of chips on $U$ has increased by at least $f(v)-f(u)$.  Since no new debt is created at any point in Algorithm \ref{algorithm:modified_dhars} and there are $\deg(D^+)$ chips at the beginning, we have $f(v)-f(u)\leq \deg(D^+)$.  A symmetric argument holds in the case that $f(v)<f(u)$.
\end{proof}

\begin{corollary}\label{corollary:modified_dhars_runtime}
The runtime of Algorithm \ref{algorithm:modified_dhars} is $O(|V(G)|^3\textrm{diam}(G)\deg(D^+))$.
\end{corollary}

\begin{proof}
Each pass through the algorithm runs in $O(|V(G)|^2)$ time: in the worst case, the vertices of $W$ burn one-by-one so we need to check at most $|V(G)|$ vertices at most $|V(G)|$ times each.

By construction, there is at least one vertex $q\in V(G)$ that does not fire over the course of the whole algorithm, since at least one vertex will be in debt the entire time (except possibly when it is brought out of debt at the very end).  By Lemma \ref{lemma:number_of_firings}, no neighbors of $q$ can fire more than $\deg(D^+)$ times; and therefore no neighbors of those vertices can fire more than $2\deg(D^+)$ times; and so on.  In general, no vertex of the graph can be fired more than $\textrm{diam}(G)\deg(D^+)$ times.  At least one vertex will fire on each pass through the algorithm (or else the algorithm will terminate), meaning that the total number of passes through the algorithm is at most $|V(G)|\textrm{diam}(G)\deg(D^+)$.  Combined with the running time of each individual pass, we have the desired result.
\end{proof}

It is worth noting that the time complexity computed in Corollary \ref{corollary:modified_dhars_runtime} is no better than that of Algorithm \ref{originaldhars}.  One upper bound for the runtime of that algorithm (ignoring the number of chips), presented as Algorithm 4 in \cite{bs}, is $3(|V(G)|-1)\textrm{diam}(G)\sum_{v\neq q}\deg(v)$. Since $\sum_{v\neq q}\deg(v)$ is $O(|V(G)|^2)$, this essentially matches our bound.  The work done in  \cite{bs} actually provides a more general bound on the runtime of the existing algorithm, derived by considering potential theory on graphs, of which the bound we recall here is only a corollary. It would be interesting to analyze the runtime of Algorithm \ref{algorithm:modified_dhars} through such a lens in future work.

We now describe a brute-force algorithm to determine if $\gon_r(G)>k$.

\begin{itemize}
    \item Choose a divisor $D\in \textrm{Div}_+^k(G)$ and a divisor $E\in  \textrm{Div}_+^r(G)$.  Run Algorithm \ref{algorithm:modified_dhars} on $D-E$. If it returns a divisor, move on to a new divisor $E$.  Keep testing $D-E$ for all possible divisors $E \in  \textrm{Div}_+^r(G)$ until either \textsc{None} is returned or until all possible choices of $E$ have produced a divisor.  If $D-E$ is equivalent to an effective divisor for every choice of $E$, return \textsc{False}, since the $r^{th}$ gonality is at most $\deg(D)=k$.

    \item If running Algorithm \ref{algorithm:modified_dhars} on $D-E$ returns \textsc{None}, then we know $r(D)<r$, so we can move on to a new divisor $D$ and repeat this process.  We will eventually either find $D$ with $r(D)\geq r$ (and return \textsc{False}) or we will find that there exists no such $D$ (and return \textsc{True}).


\end{itemize}



Setting $n=|V(G)|$, we have $|\textrm{Div}_+^k(G)|=\binom{n+k-1}{k}$ and  $|\textrm{Div}_+^r(G)|=\binom{n+r-1}{r}$. The runtime of Algorithm \ref{algorithm:modified_dhars} on $D-E$ is $O(n^3\textrm{diam}(G)\deg((D-E)^+))=O(n^3\textrm{diam}(G)k)$. Thus, the algorithm we have presented to determine if $\gon_r(G) > k$ will run in
\[O\left(\binom{n+k-1}{k}\binom{n+r-1}{r}n^3\textrm{diam}(G)k\right)\]
time.  For fixed $r$ and $k$, we can write this as
\[O\left(n^{k+r+3}\textrm{diam}(G)k\right),\]
or more concisely as
\[O\left(n^{k+r+4}k\right)\]
since $\textrm{diam}(G)\leq n-1$. This means that for fixed $k$ and $r$, there exists an algorithm, polynomial in $|V(G)|$, for determining if $\gon_r(G)>k$.

Of course, in order to compute $\gon_r(G)$, we would need to run this algorithm for numerous values of $k$, requiring an additional factor of $O(g(G))$ in the worst case. This quickly gives us a huge blow-up in computational time.  In the case of $r=1$, it was shown in \cite{gij} that it is NP-hard to bound gonality by $k$ (with $k$ no longer fixed).  We expect that the same holds for larger values of $r$, although do not know of any work in this direction.

Experimentally, we find that using our modified algorithm produces to compute higher gonalities provides a modest improvement in real-time performance against the traditional approach, which is to $q$-semi-reduce and then compute the $q$-reduced divisor, over varying divisors $D-E$. To conduct this analysis, we generated random connected graphs by fixing the number of vertices, inserting edges with probability $p = 0.5$, and excluding disconnected graphs. The two algorithms were compared on the same subset of 19 randomly generated connected graphs for each fixed number of vertices. We also found that performance gains appear to increase with the number of vertices in the graph (see Figure \ref{figure:dhars_runtime_comparison}).  However, most of the savings in our data come from the fact that the original iterated Dhar's algorithm spends time $q$-reducing even after debt is eliminated.  Running an early-return iterated Dhar's algorithm that terminates if debt is eliminated, we found a nearly identical performance to our modified algorithm.

\begin{figure}[hbt]
    \centering
    \includegraphics[scale=0.6]{comparing_algorithms2.png}
    \caption{Comparison of original Dhar's algorithm and our modified algorithm on graphs of low gonality}
    \label{figure:dhars_runtime_comparison}
\end{figure}


\medskip

\noindent \textbf{Acknowledgements}  The authors are grateful for the support they received from Williams College's SMALL REU, and from NSF Grants DMS1659037 and
DMS1347804.


\bibliographystyle{abbrv}

\section{Preliminary Results}

We begin by providing some basic results on higher gonalities, including \sout{certain} bounds for the $k$-th gonality of a graph based on lower gonalities.

\begin{lemma}
\label{nonneg}
For a graph $G$ and $k \in \mathbb{Z}_{>0}$, $\gon_k(G) \geq k$.
\end{lemma}

\begin{proof}
Suppose we have a divisor $D \in \Div_+(G)$ with $\deg(D) < k$. Then, for all $D' \in \Div_+^k(G)$, we have $|D - D'| = \varnothing$ because $\deg(D - D') < 0$ and the degree of a divisor is preserved under linear equivalence. Hence, $r(D) < k$.
\end{proof}

More intuitively, recall that a divisor wins the chip-firing game if, no matter how the opponent subtracts $k$ chips from the board, the resulting divisor is always equivalent to an effective divisor. If we begin with fewer than $k$ chips and the opponent subtracts $k$ chips, then we are left with a divisor $D$ with $\deg(D) < 0$ so $D$ cannot be equivalent to an effective divisor.

\begin{proposition}
\label{tree}
For a graph $G$, $\gon_k(G) = k$ if and only if $G$ is a tree.
\end{proposition}

\begin{proof}
If $G$ is a tree, then $G$ has genus $g(G) = 0$. By Riemann-Roch, if we have a divisor $D$ with $\deg(D) = k$, then
\begin{align*}
    r(D) &= \deg(D) + 1 - g(G) + r(K - D) \\
    &= k + 1 + r(K - D) \geq k.
\end{align*}
Hence, $\gon_k(G) \leq k$. On the other hand, by Lemma \ref{nonneg}, we know that the gonality of $G$ must be at least $k$ so $\gon_k(G) = k$.


Conversely, if $\gon_k(G) = k$, we show that $\Div^0(G) \subseteq \Prin(G)$ (note that the reverse inclusion clearly holds). We mimic the proof of Theorem 4.1 given in \cite{db}. Note first that because $\gon_k(G) = k$, there exists a divisor $D \in \Div_+^k(G)$ such that $\@ifstar{\oldabs}{\oldabs*}{D - E} \neq \varnothing$ for each $E \in \Div_+^k(G)$. This implies that for each $E \in \Div_+^k(G)$, $D - E \in \Prin(G)$ because the only effective divisor of degree zero is the all-zeroes divisor. Suppose that $D = \sum_{i=1}^k (v_i)$ {\color{red}what is this notation? Franny is confused again :(} \g{eep, this was the old notation! I think I've fixed all of it now} for a collection of (not necessarily unique) vertices $v_i \in V(G)$. For each $w \in V$, define $E_w = (w) + \sum_{i=2}^k (v_i)$. Since $E_w \in \Div_+^k(G)$ for each $w \in V(G)$, we have
\[
D - E_w = \sum_{i=1}^k (v_i) - \left[(w) + \sum_{i=2}^k (v_i)\right] = (v_1) - (w).
\]
Hence, for fixed $v_1$ and all $w \in V(G)$, $(v_1) - (w) \in \Prin(G)$.


Now, fix $F \in \Div^0(G)$ and let $F' = \Red_{v_1}(F)$. Since $F'(w) \geq 0$ for all $w \in V(G) - \{v_1\}$ and $F'(v_1) = - \sum_{w \in V(G) - \{v_1\}} F'(w)$, we have
\[
F' = \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot (w) - \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot (v_1) = \sum_{w \in V(G) - \{v_1\}} F'(w) \cdot \left[ (w) - (v_1) \right].
\]
Since $F'(w) \cdot \left[(w) - (v_1)\right] \in \Prin(G)$ for each $w \in V(G)$, we have $F' \in \Prin(G)$ and since $F \sim F'$, this implies that $F \in \Prin(G)$. We have thus shown that $\Div^0(G) = \Prin(G)$. By Theorem 2.13 of \cite{db}, it follows that $G$ has exactly one spanning tree so $G$ itself must be a tree.
\end{proof}

\begin{corollary}
\label{cycle}
For a cycle graph $C_n$, $\gon_k(C_n) = k+1$.
\end{corollary}

\begin{proof}
Since each cycle graph $C_n$ is \textit{not} a tree, we know that $\gon_k(C_n) \geq k+1$ by Proposition \ref{tree}. On the other hand, $g(C_n) = 1$. Hence, by Riemann-Roch \ref{RR}, we have an upper bound of $k+1$ on the gonality of the cycle family. {\color{red} I don't feel like the use of RR is immediately clear. Perhaps we could flush out.} Thus, $\gon_k(C_n) = k+1$ for all $n$.
\end{proof}

\begin{lemma}
\label{strict}
If $n > m$, then $\gon_n(G) > \gon_m(G)$.
\end{lemma}

\begin{proof}
We first show that, for any given divisors $D, E \in \Div_+(G)$, 
\[
r(D - E) \geq \max \{r(D) - \deg(E), -1\}.
\]
Suppose that $r(D) - \deg(E) > -1$. (Otherwise, this inequality is clearly true.) Let $r(D) = k$. By the definition of rank, we know that $\@ifstar{\oldabs}{\oldabs*}{D - D'} \neq \varnothing$ for all $D' \in \Div_+^{k}(G)$. Hence, $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} \neq \varnothing$ for all $E' \in \Div_+^{k - \deg(E)}(G)$ as $\@ifstar{\oldabs}{\oldabs*}{(D - E) - E'} = \@ifstar{\oldabs}{\oldabs*}{D - (E + E')}$ where $E + E' \in \Div_+^k(G)$. It follows that $r(D - E) \geq k - \deg(E) = r(D) - \deg(E)$.

Now let $\gon_n(G) = \gamma$. This means that there exists some divisor $D \in \Div_+^\gamma(G)$ such that $r(D) = n$. For any $E \in \Div_+^{n-m}(G)$, we have $r(D - E) \geq r(D) - \deg(E) = r(D) - (n-m) = m$. Since $\deg(D - E) = \gamma - (n-m) < \gamma$, we have
\[
\gon_m(G) \leq \deg(D - E) < \gon_n(G).
\]
\end{proof}

\begin{lemma}
\label{sum}
If $a = a_1 + \cdots + a_n$ with $a_i \in \mathbb{Z}_{>0}$, then $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$.
\end{lemma}

\begin{proof}
Let $\gamma_{a_i} = \gon_{a_i}(G)$ for each $i$. There exists a divisor $D_{a_i} \in \Div_+^{\gamma_{a_i}}(G)$ such that $r\left(D_{a_i}\right) = a_i$ for each $i$. This implies that $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E} \neq \varnothing$ for all $E \in \Div_+^{a_i}(G)$. Let $D = D_{a_1} + \cdots + D_{a_n}$. Notice that for each $E \in \Div_+^a(G)$, we have some decomposition $E = E_{a_1} + \cdots + E_{a_n}$ where $E_{a_i} \in \Div_+^{a_i}(G)$. 

Pick $F_i \in \Div_+(G)$ for $i \in \{1,\dots,n\}$. We now show that if $\@ifstar{\oldabs}{\oldabs*}{F_i} \neq \varnothing$ for all $i$, then $\@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n F_i} \neq \varnothing$. Notice that, for each $F_i$, there exists $F_i' \in \Div_+(G)$ such that $F_i' \sim F_i$. We note that $\sum_{i=1}^n F_i \sim \sum_{i=1}^n F_i'$ and that $\sum_{i=1}^n F_i' \in \Div_+(G)$, which implies that $\@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n F_i } \neq \varnothing$.

As a consequence, we see that
\[
\@ifstar{\oldabs}{\oldabs*}{D - E} = \@ifstar{\oldabs}{\oldabs*}{ \sum_{i=1}^n D_{a_i} - \sum_{i=1}^n E_{a_i} } = \@ifstar{\oldabs}{\oldabs*}{\sum_{i=1}^n \@ifstar{\oldparen}{\oldparen*}{D_{a_i} - E_{a_i} } } \neq \varnothing,
\]
because for each $i$, we have $\@ifstar{\oldabs}{\oldabs*}{D_{a_i} - E_{a_i}} \neq \varnothing$. We conclude that $r(D) \geq a$ which implies that $\gon_a(G) \leq \gon_{a_1}(G) + \cdots + \gon_{a_n}(G)$. 
\end{proof}

\begin{lemma}
\label{genus}
If $k \geq g(G)$, then $\gon_k(G) = g(G) + k$.
\end{lemma}

\begin{proof}
Let $g = g(G)$ and $k \geq g$. Choose a divisor $D \in \Div_+^{g+k}(G)$. By Riemann-Roch \ref{RR}, we know that
\begin{align*}
r(D) &= \deg(D) + 1 - g + r(K - D) \\
&= k + 1 + r(K - D) \geq k. 
\end{align*}
Hence, $\gon_k(G) \leq g + k$. Now, suppose that we have a divisor $D \in \Div_+^{g+k-\ell}(G)$ with $\ell \geq 1$ such that $r(D) \geq k$. Then, by Riemann-Roch, we see that
\begin{align*}
r(K - D) &= r(D) - (\deg(D) + 1 - ) \\
&\geq k - (g +k-\ell + 1 - g) \\
&= \ell - 1.
\end{align*}
Since $r(K - D) \geq \ell - 1$, we know that $\deg(K - D) \geq \ell - 1$. Hence,
\begin{align*}
\deg(K - D) = 2g - 2 - (g+k-\ell) &\geq \ell - 1 \\
g - 1 \geq k,
\end{align*}
contradicting our original assumption that $k \geq g$. We conclude that $\gon_k(G) = g + k$.
\end{proof}