# Determining Genus From Sandpile Torsor Algorithms.

1 Introduction

In this paper, we work with connected graphs that may have multiple edges between the same pair of vertices but we will not allow self loops. We will follow much of the same notation that is used in Chan et al. (2014). For a graph G, denote the set of vertices by V(G), the set of edges by E(G), and the set of spanning trees by T(G).

1.1 The Sandpile Group

For any graph G, define the group Div(G) of divisors of G as:

[mathematical expression not reproducible]

Define the subgroup [Div.sup.0](G) of degree-0 divisors of G as:

[mathematical expression not reproducible]

where in general, the degree of a divisor is the sum [mathematical expression not reproducible]

The Laplacian matrix [DELTA] of G is the symmetric matrix defined by:

[mathematical expression not reproducible]

Finally, define the sandpile group or Picard group [Pic.sup.0] (G) as:

[Pic.sup.0](G):=[Div.sup.0](G)/im([DELTA])

We can view the elements of [Div.sup.0](G) as configurations on a graph where we place some number of "chips" on each vertex (allowing for negative chips but not fractional chips). The image of the graph Laplacian is generated by "firing" and "unfiring" vertices of G. When a vertex v fires, it sends one chip along each edge incident to v. This decreases the number of chips at v by the degree of v and increases the number of chips at every other vertex w by the number of edges incident to both v and w. When a vertex v unfires, it takes in one chip along each edge incident to v. This increases the number of chips at v by the degree of v and decreases the number of chips at every other vertex w by the number of edges incident to both v and w.

Thus, an equivalent definition of [Pic.sup.0] (G) is the abelian group whose elements are configurations of zero total chips on the vertices of G, whose binary operation is pointwise addition, and with the equivalence relation given by firing and unfiring vertices. In fact, since unfiring a single vertex is equivalent to firing every other vertex, we can generate our equivalence relation purely by firing vertices. This gives the following useful lemma:

Lemma 1. Two elements S and S' of [Div.sup.0](G) are equivalent as elements of [Pic.sup.0](G) if and only if there is a sequence of vertex firings that leads from S to S'.

1.2 Sandpile Torsors

1.2.1 Relating [Pic.sup.0](G) and T(G)

The narrative of this section is similar to the narrative given in the introduction of Chan et al. (2014) and some of these ideas were also explored in Wagner (2000).

It is a well known fact that the size of the sandpile group of a graph G is the same as the number of spanning trees of G (as shown e.g. in Biggs (1999) and Holroyd et al. (2008)). Thus, it is natural to ask whether there exists a canonical (automorphism invariant) bijection between these two sets. However, this is impossible in general because there is not always a distinguished spanning tree to associate with the identity element of the sandpile group. For example, a complete graph with more than two vertices has no distinguished spanning tree.

The next best hope would be if there were a canonical free transitive action of [Pic.sup.0] (G) acting on T(G). A free transitive action of a group G on a set S is a function f : G x S [right arrow] S such that for any pair s, s' [member of] S, there is a unique g [member of] G such that f(g, s) = s'. A canonical free transitive action is also too much to ask for on a general graph. For example, on a graph with two vertices and three or more edges, each edge is a spanning tree and they are all indistinguishable. Furthermore, even after we select one of the edges, the remaining edges are still indistinguishable.

To resolve this issue, we introduce additional structure on G. For each vertex v [member of] V(G), assign a cyclic order [[rho].sub.v] to the edges incident to v. When this information is provided, (G, [rho]) is called a ribbon graph, sometimes referred to as a combinatorial embedding or a combinatorial map. Even with the ribbon graph structure provided, there is not always a canonical choice of free transitive action. For example, if we have a graph with two vertices v and w and three edges [e.sub.1],[e.sub.2] and [e.sub.3] such that [[rho].sub.v] = [[rho].sub.w] = ([[epsilon].sub.1], [e.sub.2], [e.sub.3]), then there is no canonical way to decide whether the equivalence class of the sandpile group containing (v - w) or the equivalence class of the sandpile group containing (w-v) should send [e.sub.1] to [e.sub.2] (see Figure 1).

This final ambiguity can be fixed by associating our free transitive action with a distinguished vertex, that we call the basepoint.

Definition 1.1. A sandpile torsor of a ribbon graph (G, [rho]) is a free transitive action of [Pic.sup.0] (G) on T(G) given a basepoint v [member of] V(G).

Definition 1.2. A sandpile torsor algorithm [alpha] is a function whose input is a ribbon graph (G, [rho]) and one of its vertices v [member of] V(G) and whose output is a sandpile torsor on (G, [rho]) with basepoint v.

The two sandpile torsor algorithms we will work with in this paper are the rotor routing process and the Bernardi process. We give a full description of these algorithms in Section 2.

1.3 Summary of Results

From a ribbon graph (G, [rho]), we obtain an associated surface by thickening the edges of G and then gluing disks to the boundary components while respecting the cyclic orders given by [rho]. The genus of a ribbon graph (G, [rho]) is the genus of its associated surface.(i) A ribbon graph is called planar if its genus is equal to 0. The inspiration for this paper comes from the following theorem proven in Chan et al. (2014) for the rotor routing case and Baker and Wang (2017) for the Bernardi case.

Theorem 2. The rotor routing and Bernardi processes on a ribbon graph (G, [rho]) are invariant to the choice of basepoint if and only if (G, [rho]) is planar.

This theorem suggests that we may be able to determine the genus of a ribbon graph from the structure of the sandpile torsors given by a sandpile torsor algorithm, a question posed by Melody Chan Chan. However, the following theorem shows that this is not the case:

Theorem 3. Let (G, [rho]) and (G', [rho]') be two ribbon graphs with genera g and g' respectively and let [[alpha].sub.v] be the rotor routing or Bernardi process with basepoint v. Assume that V(G) = V(G'), [phi] : T(G) [right arrow] T(G') is a bijection, and [gamma] : [Pic.sup.0](G) [right arrow] [Pic.sup.0] (G') is an isomorphism such that for every vertex v [member of] V(G) the following diagram commutes:

[mathematical expression not reproducible]

There exist (G, [rho]) and (G, [rho]') satisfying the above conditions where g [not equal to] g'.

We will construct two ribbon graphs demonstrating this theorem in Section 3.1. In fact, we give a very small counterexample where V(G) = V(G') = 2 and E(G) = E(G') = 5. Note that if we require g = 0, Theorem 3 does not hold (this is a corollary to Theorem 2).

For certain G and G', we can strengthen Theorem 3 by requiring [gamma] to be a particular kind of map, which we will define in Section 3.2.

Theorem 4. Consider the same conditions as Question 3, but where we require [gamma] to be induced by the identity on a suitable [V.sub.gen] [[subset].bar] V(G). We can still find (G, [rho]) and (G, [rho]') satisfying the above conditions where g [not equal to] g'.

While we could prove Theorem 3 by restricting to 2-vertex ribbon graphs, we show in Proposition 11 that we need more vertices to prove Theorem 4. Nevertheless, we give a family of 3-vertex ribbon graphs that demonstrate this theorem in Section 3.2.

Because of the failure of these conjectures, any algorithm for determining the genus of a ribbon graph must require more information than just the orbits of the sandpile torsors produced by the rotor routing or Bernardi process. In Section 4, we consider the case where we are given V(G) and E(G) but not [rho]. In this setting, we show that if we are given the map [r.sub.v] (i.e. the rotor routing torsor with basepoint v) for every v, we can determine the genus of (G, [rho]). Specifically, in Section 4 we prove:

Theorem 5. Let (G, [rho]) be a ribbon graph such that V(G) and E(G) are known but [rho] is not. Suppose that for every v [member of] V(G), we are given the map

[mathematical expression not reproducible]

where [r.sub.v] is the rotor routing torsor with basepoint v (and each T [member of] T is given as a subset of E(G)). Then, it is possible to determine the genus of(G, [rho]).

2 Two Sandpile Torsor Algorithms

2.1 Rotor Routing Process

The rotor routing process is a sandpile torsor algorithm described in Holroyd et al. (2008) and based on the "Eulerian walkers model" from Priezzhev et al. (1996).

For v [member of] V(G), denote [r.sub.v] as the sandpile torsor with basepoint v determined by the rotor routing process (or the rotor routing torsor with basepoint v for short). For S [member of] [Pic.sup.0] (G) and T [member of] T(G), define [r.sub.v] (S, T) in the following way:

Choose a representative of S with a nonnegative number of chips away from v. Then, direct the edges of T so that they point towards v along the path of T. There is now one directed edge coming out of every vertex w = v. This edge is called the rotor at w. Choose any vertex w that has a positive number of chips. Then, rotate the rotor at w to the next edge in [[rho].sub.w] and send a chip from w to the other vertex incident to this edge. Continue this process until every vertex has zero chips (at which point the chips have all been deposited at v). The resulting position of the rotors is independent of the order that the rotors are rotated and, after removing the directional information, produces a new spanning tree T. See Figure 2 for an example.

It is proven in Holroyd et al. (2008) that [r.sub.v] is a well-defined free transitive action.

2.2 Bernardi Process

The Bernardi process is another sandpile torsor algorithm that is described in Baker and Wang (2017) based on results from Bernardi (2008).

For v [member of] V(G), denote [[beta].sub.v] as the sandpile torsor with basepoint v determined by the Bernardi process (or the Bernardi torsor with basepoint v for short). For S [member of] [Pic.sup.0](G) and T [member of] T(G), define [[beta].sub.v](S, T) in the following way:

Consider an edge e incident to vertices [v.sub.1] and [v.sub.2] to be composed of two half-edges (e, [v.sub.1]) and (e, [v.sub.2]). Choose an arbitrary edge e incident to v. (The choice of e does not affect the action). We first need to find the break divisor associated with each spanning tree. To get the break divisor associated with T, we follow a recursive procedure beginning at the half-edge (e, v) and continuing until we return to (e, v). Informally, this procedure traces around T and places chips the first time it crosses each edge that is not in T. Say that our current edge is (e', v'). There are 2 cases:

1) If e' [member of] T, we consider the other half edge associated to e', say (e',w'). Then, we move to the half edge (e",w') where e" is the next edge after e' in [[rho].sub.w], and restart the procedure with (e",w') as our new half edge.

2) If e' [member of] T, we consider the half edge (e,v') where e is the next edge after e' in [[rho].sub.v']. Furthermore, if we have not already passed through the other half edge involving e', we place a chip on v'. Then we restart the procedure with (e, v') as our new half edge.

This process continues until we return to (e, v). At this point, we will have placed one chip for each edge not in T, so this gives us an element of [Div.sup.g](G) for g = E(G) - V(G) + 1 where

[mathematical expression not reproducible]

It is shown in An et al. (2014) that when we apply the Bernardi process to each spanning tree, the resulting chip configurations are all unique as elements of

[Pic.sup.g](G):=[Div.sup.g](G)/im([DELTA]).

The element of [Pic.sup.g](G) associated to the spanning tree T by this process is called the break divisor associated to T.(ii) [[beta].sub.v](S, T) is given by adding S to the break divisor associated to T, which gives us a new element of [Pic.sup.g](G), and then finding the spanning tree T' for which this is the break divisor. See Figure 3 for an example.

It is proven in Baker and Wang (2017) that [[beta].sub.v] is a well-defined free transitive action, and an efficient algorithm is provided to find the tree associated with a given break divisor.

3 Counterexamples

We first give an algebraic result that will help to prove both Theorem 3 and Theorem 4. In particular, this result says that in order to show that the diagrams commute, we only need to test on a set of generators of [Pic.sup.0](G).

Lemma 6. Let H be a group and X be a set such that [gamma] is an automorphism on H, [phi] is an automorphism on X, and [alpha] is a group action from H x X [right arrow] X.

Let {[h.sub.i]} be a set of generators for H and x be an arbitrary element of X. If [phi]([alpha]([h.sub.i],x)) = [alpha]([gamma]([h.sub.i]), [phi](x)) for all hi, then [phi]([alpha](h, x)) = [alpha]([gamma](h), [phi](x)) for all h [member of] H.

Proof: By definition, we can write any h [member of] H as [mathematical expression not reproducible]. We will proceed by induction on the degree of this monomial.

When the degree is 1, h is a generator and the result holds automatically. For an arbitrary h, assume without loss of generality that [k.sub.1] > 0. Then, we can write h = [h.sub.1]h' where the degree of h' is one less than the degree of h.

For any x [member of] X, the lemma follows from this chain of equalities (which hold by the definition of a group action and the induction hypothesis):

[mathematical expression not reproducible] []

3.1 Unrestricted [gamma] (Theorem 3)

We can prove Theorem 3 while only considering ribbon graphs with 2 vertices. For these graphs, each edge is a spanning tree, and there are several other nice properties. We begin with a well known result that is straightforward to prove either by the definition of [Pic.sup.0] (G) or by the chip-firing perspective.

Lemma 7. If G is a graph with 2 vertices and n edges then [Pic.sup.0] (G) [congruent to] Z/nZ. Furthermore, two configurations are equivalent as elements of [Pic.sup.0] (G) if and only if the number of chips on a fixed vertex differ by a multiple of n.

There is a known formula for the genus of a ribbon graph (G, [rho]). Define a cycle on a ribbon graph (G, [rho]) as a closed loop such that whenever we enter a vertex, we exit along the next edge in the cyclic order at that vertex. It was shown in Edmonds Jr (1960) that these cycles are the faces of the surface associated to (G, [rho]). Thus, we have the following by Euler's formula (where cyc(G, [rho]) is the number of cycles of (G, [rho])):

Proposition 8. For a ribbon graph (G, [rho]), the genus g satisfies 2g = 2 - | V(G) | + |E(G) | - cyc(G, [rho]).

With this formula in mind, we can construct a pair of ribbon graphs that prove Theorem 3. Consider 2 ribbon graphs, (G,[rho]) and (G',[rho]'), such that V(G) = {[v.sub.1],[w.sub.1]}, V(G') = {[v.sub.2],[w.sub.2]}, and |E(G)| = |E(G')| = 5 (see Figure 4). Furthermore, label the edges of G as [a.sub.1] through [a.sub.5] such that [[rho].sub.V1] = ([a.sub.1], [a.sub.2],[a.sub.3],[a.sub.4], [a.sub.5]) and [[rho].sub.w1] = ([a.sub.1], [a.sub.3], [a.sub.2], [a.sub.5], [a.sub.4]) and label the edges of G' such that [[rho].sub.V2] = ([b.sub.1],[b.sub.4],[b.sub.2],[b.sub.5],[b.sub.3]) and [[rho].sub.W2] = ([b.sub.1], [b.sub.5], [b.sub.3], [b.sub.4], [b.sub.2]) (again, see Figure 4). Finally, let [phi] be the map that sends ai to [b.sub.i] for each i and [gamma] be the map that doubles the number of chips at each vertex. Note that [gamma] is an isomorphism because [Pic.sup.0] (G) [congruent to] Z/5Z.

Proposition 9. Let (G, [rho]), (G', [rho]'), [gamma], and [phi] be constructed as above and identify [v.sub.1] with [v.sub.2] and [w.sub.1] with [w.sub.2]. For every vertex v [member of] V(G) the following diagram commutes, where [[alpha].sub.v] is the rotor routing process r or the Bernardiprocess [beta] with basepoint v:

[mathematical expression not reproducible]

However, the genus of (G, [rho]) is 2 while the genus of(G', [rho]') is 1.

Proof:

First, we observe that [mathematical expression not reproducible] and [mathematical expression not reproducible]. To see this, it suffices to show that they match on a generator.

[mathematical expression not reproducible]

Therefore, we only need to prove the result for the rotor routing torsors. Furthermore, by Lemma 6, it suffices to check a generator of [Pic.sup.0](G) (and we do not have to choose the same generator for [r.sub.v] as for [r.sub.w]).

Using [v.sub.i] - [w.sub.i] as our generator, we get the following diagram for [r.sub.w]:

[mathematical expression not reproducible]

Using [w.sub.i] - [v.sub.i] as our generator, we get the following diagram for [r.sub.v]:

[mathematical expression not reproducible]

Finally, we find from direct computation that cyc(G, [rho]) = 3 while cyc(G', [rho]') = 1. By Proposition 8, this means that the genus of (G, [rho]) is 1 while the genus of (G', [rho]) is 2. []

3.2 Restricted 7 (Theorem 4)

For any G and G' on the same set of vertices, the identity map on V(G) induces a natural isomorphism from [Div.sup.0](G) [right arrow] [Div.sup.0](G'). However, this isomorphism does not always induce an isomorphism from [Pic.sup.0] (G) [right arrow] [Pic.sup.0] (G') because it is possible that two chip configurations will be firing equivalent on G but not G' (or vice versa). Nevertheless, for certain graphs, we can find natural isomorphisms with respect to appropriate subsets of vertices.

Let G and G' be two graphs on the same set of vertices. Furthermore, suppose that there is some [V.sub.gen] [subset] V(G) satisfying the following properties:

* Every element of either [Pic.sup.0] (G) and [Pic.sup.0] (G') can be written as a linear combination of vertices in [V.sub.gen]. In other words, any chip configuration is firing equivalent to one with no chips on vertices outside of [V.sub.gen].

* Two chip configurations with no chips outside of [V.sub.gen] are firing equivalent in G if and only if they are firing equivalent on G'.

Then, let [gamma] be a map from [Pic.sup.0](G) [right arrow] [Pic.sup.0](G') that we get from the following procedure. Given S [member of] [Pic.sup.0](G), we first choose a representative for S with no chips outside of [V.sub.gen], which exists by Property 1. Then, we let [gamma](S) be the equivalence class of [Pic.sup.0](G') containing Id(S) where Id is the map from [Div.sup.0](G) [right arrow] [Div.sup.0](G') induced by the identity on V(G). By the second property, we have the following:

Lemma 10. [gamma] is a well-defined isomorphism.

If (G, [rho]) and (G', [rho]') are ribbon graphs on two vertices with the same number of edges, then G and G' must be isomorphic because we do not allow loop edges. This means that we can take [V.sub.gen] = V(G) and this will always give us a isomorphism [gamma] : [Pic.sup.0](G) [right arrow] [Pic.sup.0](G'). Note that [gamma] maintains the number of chips on each vertex while the [gamma] we used for Proposition 9 doubles them, so this is not sufficent to prove Theorem 4. In fact, we show the following:

Proposition 11. There are no examples of 2-vertex graphs satisfying Theorem 4.

Proof: Let V(G) = {[v.sub.1], [w.sub.2]} and V(G') = {[v.sub.2],[w.sub.2]} where we identify [v.sub.1] with [v.sub.2] and [w.sub.1] with [w.sub.2], and also refer to them as [v.sub.i] and [w.sub.i] respectively (similarly to the notation used in the proof of Proposition 9). We can use [r.sub.w] and [r.sub.v] (or equivalently [[beta].sub.v] and [[beta].sub.w]) to determine [[rho].sub.v2] and [[rho].sub.w2] in relation to [[rho].sub.v1] and [[rho].sub.w1]. Then, we show that cyc([[rho].sub.v1] * [[rho].sub.w1]) = cyc([[rho].sub.v2] * [[rho].sub.w2]).

Label one of the edges of G as t and then for each k [member of] [2, n], label [r.sub.w1] ((k - 1)v - (k - 1)w, [t.sub.1]) as [t.sub.k]. It follows by definition that [[rho].sub.v1] = ([t.sub.h]...., [t.sub.n]). Then, since [gamma] is induced by the identity, for every k, we have [r.sub.w2]((k - 1)v - (k - 1)w, [phi]([t.sub.1])) = [phi]([t.sub.k]). Thus, [[rho].sub.v2] = ([phi]([t.sub.1])...., [phi]([t.sub.n])).

Next, we define [sigma] [member of] [S.sub.n] to be the permutation such that [sigma]([t.sub.k]) = [r.sub.v1]((k - 1)w - (k - 1)v,[t.sub.1]). This means that [[rho].sub.w1] = ([sigma]([t.sub.1]),..,[sigma]([t.sub.n])). By the same reasoning as above, it follows that [[rho].sub.w2] = ([phi]([sigma]([t.sub.1])),.,[phi]([sigma]([t.sub.n]))).

Finally,

[mathematical expression not reproducible]

[phi] is a bijection, so it does not affect the number of cycles in the resulting product. This means that (G, [rho]) and (G', [rho]') must have the same genus. []

Proposition 11 says that in order to prove Theorem 4, we will need to work with ribbon graphs that have at least 3 vertices. Let x be any odd integer. Consider two ribbon graphs, (G, [rho]) and (G', [rho]') such that |V(G)| = |V(G')| = 3. Call the elements of V(G) [v.sub.1], [z.sub.1], and [w.sub.1], and call the elements of V(G') [v.sub.2], [z.sub.2], and [w.sub.2]. Connect [v.sub.1] and [z.sub.1] with 2 edges, [z.sub.1] and [w.sub.1] with x edges, [v.sub.2] and [z.sub.2] with 1 edge, and [z.sub.2] and [w.sub.2] with 2x edges (see Figure 5). For the cyclic ordering [[rho].sub.z1], set the 2 edges that connect to [v.sub.x] to be next to each other. Furthermore, set the cyclic order of edges connecting [z.sub.x] to [w.sub.x] to be the same for [[rho].sub.z1] as [[rho].sub.w1], and likewise, set the cyclic ordering of edges connecting [z.sub.2] to [w.sub.2] to be the same for [[rho]'.sub.z2] as [[rho]'.sub.w2] (again see Figure 5).

Theorem 12. For any g [member of] [Z.sub.>0], let (G,[rho]) and (G',[rho]') be constructed as above with x = 2g + 1. If we identify the vertices of G with the vertices of G', then [Pic.sup.0](G) [congruent to] [Pic.sup.0](G') and {[v.sub.i], [w.sub.i]} the [V.sub.gen] requirements of Lemma 10. Furthermore, the diagram in Theorem 4 commutes. However, the genus of (G, [rho]) is g while the genus of(G', [rho]') is 2g.

Note that if x is even, then this theorem does not hold. In particular, [Pic.sup.0](G) [congruent to] Z/2Z [direct sum] Z/xZ and [Pic.sup.0](G') [congruent to] Z/2xZ. These two groups are only isomorphic if x is odd.

Before we prove the theorem, we prove a lemma which gives a sufficient condition for two specific basepoints to be equivalent with respect to either of our sandpile torsor algorithms. In particular, when we apply this lemma to the ribbon graphs in Figure 5, we find that the rotor routing process is the same with basepoint [v.sub.i] as with [z.sub.i] (where i is either 1 or 2) and the same is true for the Bernardi process.

Let (G, [rho]) be a ribbon graph and let v, w [member of] V(G). We split G into 3 subgraphs labeled G', [G.sub.v], and [G.sub.w] using the following construction (which is given in Figure 6):

Forany e [member of] E(G),

* If every path from e to w passes through v, e [member of] [G.sub.v].

* If every path from e to v passes through w, e [member of] [G.sub.w].

* If neither above condition is met, e [member of] G'.

When including an edge in any of these subgraphs, we also include both incident vertices. Furthermore, we always require v [member of] [G.sub.v] and w [member of] [G.sub.w], even when [G.sub.v] or [G.sub.w] contains no edges. It is immediate that

[G.sub.v] [intersection] G' = {v} and [G.sub.w] [intersection] G' = {w}. Let (G', [rho]') be the restriction of (G, [rho]) to G.

Lemma 13. For a ribbon graph (G, [rho]) with v,w [member of] V(G), construct (G', [rho]') as above. Let the following conditions hold:

* (G', [rho]') is planar.

* The edges of G' that are incident to v are all sequential in [[rho].sub.v].

* The edges of G' that are incident to w are all sequential in [[rho].sub.w].

Then, [[alpha].sub.v] and [[alpha].sub.w] are equivalent sandpile torsors when [alpha] is replaced by either r or [beta].

Proof: First, we consider the case where [alpha] is the rotor routing process. Let S be any element of [Div.sup.0](G) that has a nonnegative number of chips away from v. Let S' be an element of [Div.sup.0](G) that is equivalent to S as an element of [Pic.sup.0](G) and has a nonnegative number of chips away from w.

We need to show that for any spanning tree T [member of] T(G), we have [r.sub.v] (S, T) = [r.sub.w] (S', T). We can begin our evaluation of each of these rotor routing torsors by performing rotor routing on [G.sub.v] and [G.sub.w] until all vertices in G\G' have no chips on them. Because S and S' are in the same sandpile equivalence class, and because the rotors in [G.sub.v] and [G.sub.w] will always point towards v and w respectively, the resulting portions of the spanning tree outside of G is the same with either basepoint. Furthermore, if a chip ever leaves G during rotor routing (say WLOG that it enters [G.sub.v]), then this happens because the rotor at v rotates into [G.sub.v]. For the chip to return to G (which must happen eventually), the rotor at v must keep spinning until it returns to an edge in G. This drops one chip across each edge in [G.sub.v] incident to v. The effect of this rotation is the same as firing v in the subgraph [G.sub.v] which has no effect on the resulting tree. By Theorem 2, we know that [r.sub.v] = [r.sub.w] when we restrict to (G', [rho]') and the above analysis shows that this is also true on(G,[rho]).

The Bernardi action is even simpler. If we start each tour with the first edge in G connected to the basepoint vertex, then the tours will go around [G.sub.v] and [G.sub.w] in the same direction. Thus, the effect of these subgraphs on the break divisors will be the same for each basepoint vertex. Because the two Bernardi actions are the same on G and we alter each of them in the same way, they are also the same on G. []

Now we are ready to prove the Theorem 12.

Proof Proof of Theorem 12: For each ribbon graph, there are 2x spanning trees, which means that this is also the size of the sandpile groups. We claim that the sandpile element [v.sub.i] - [w.sub.i] has order 2x in both [Pic.sup.0](G) and [Pic.sup.0](G'). This means that it must generate the sandpile group for both graphs. Furthermore, since there are no chips on [z.sub.i], the pair {[v.sub.i], [w.sub.i]} satisfies the [V.sub.gen] requirements of Lemma 10.

Label the spanning trees of [G.sub.1] as [a, b] where a is the index of the edge between [v.sub.1] and [z.sub.1] (either 1 or 2) and b is the index of the edge between [z.sub.1] and [w.sub.1] in cyclic order (ranging from 1 to x). Label the spanning trees of [G.sub.2] as [a] with a the index of the edge between [z.sub.2] and [w.sub.2] (ranging from 1 to 2x). Our claim follows if we show that

[mathematical expression not reproducible] (1)

are all distinct spanning trees of [G.sub.1] and

[mathematical expression not reproducible] (2)

are all distinct spanning trees of [G.sub.2] (where we could replace [r.sub.w]. with any other sandpile torsor).

On [G.sub.1], [mathematical expression not reproducible] (1,0, -1) switches the edge between [v.sub.1] and [z.sub.1] and then shifts the edge between [z.sub.1] and [w.sub.1] up by 1. The only special case is when we get to the last edge between [z.sub.1] and [w.sub.1] and shift over to the edges between [v.sub.1] and [z.sub.1]. However, this just causes the edge between [v.sub.1] and [z.sub.1] to shift twice which does not change it and then we get the first edge between [z.sub.1] and [w.sub.1] before depositing the chip at [w.sub.1]. Thus, the trees given in 1 are:

{[1,1], [2,2], [1,3],..,[1,x], [2,1],.., [2, x]}.

On [G.sub.2], [mathematical expression not reproducible] (1,0, -1) simply switches to the next edge between [z.sub.2] and [w.sub.2]. Thus, the trees given in 2 are:

{[1],[2],[3],..,[2x-1],[2x]}.

In both cases, we get 2x distinct trees. Additionally, this result, along with Lemma 6, tells us that there is a unique bijection [phi] : T([G.sub.1]) [right arrow] T([G.sub.2]) that will make the diagram from Theorem 4 commute when our sandpile torsor is [mathematical expression not reproducible]. In particular, we let [phi]([a, b]) = [b] when a and b have the same parity, and [phi]( [a, b]) = [b + x] when a and b are of opposite parity.

We now need to check that this same bijection will cause the diagram to commute when we replace [r.sub.w] with [r.sub.v],[[beta].sub.v].,or [[beta].sub.w]. (and by Lemma 6, we only need to check on a generator).

By similar computation to above, we find that

[mathematical expression not reproducible]

is equal to

{[1,1], [2,2], [1,3],..,[1,x], [2,1],.., [2, x]} while

[mathematical expression not reproducible]

is equal to

{[1],[2],[3],..,[2x-1],[2x]}.

These trees occur in the same order that they did for [r.sub.w].,so the same bijection holds.

Now, we look at the Bernardi torsors. On [G.sub.1], consider [mathematical expression not reproducible] (1,0, -1). We will start the Bernardi tour on the first edge connecting [v.sub.1] to [z.sub.1]. If this edge is part of our spanning tree, we will place one chip on [z.sub.1] when the tour reaches the other edge between [v.sub.1] and [z.sub.1]. Otherwise, we place one chip at [v.sub.1] at the very beginning. Additionally, we place one chip on [z.sub.1] for each edge between [z.sub.1] and [w.sub.1] before the edge of our spanning tree, and one chip on [w.sub.1] for each edge between [z.sub.1] and [w.sub.1] after the edge of our spanning tree. Thus there are 2 cases:

If the spanning tree is [1, k] for some k, then the break divisor is (0, k,x - k). If the spanning tree is [2, k] for some k, then the break divisor is (1, k - 1, x - k). In the first case, adding (1,0, -1) gives (1, k, x - k - 1) which is the break divisor for [2, k + 1] (if k = x, we have the divisor (1, x, -1) which is equal to (1,0, x - 1) after unfiring [w.sub.1] once. This is the break divisor for [2,1]). In the second case, adding (1,0, -1) gives (2,k-1,x-k- 1). After firing [v.sub.1] once, we get (0, k + 1, x - k - 1) which is the break divisor for [1, k + 1] (if k = x, we have the divisor (0, x + 1, -1) which is equal to (0,1, x - 1) after unfiring [w.sub.1] once. This is the break divisor for [1,1].) This means that

[mathematical expression not reproducible]

is equal to

([1,1],[2,2],[1,3],...,[1,x],[2,1],...,[2,x]) which is the same as the [mathematical expression not reproducible] action.

The case for [mathematical expression not reproducible] (-1,0,1) is completely similar and yields that

[mathematical expression not reproducible]

is equal to

{[1,1],[2,2],[1,3],...,[1,x],[2,1],...,[2,x]}

which is the same as [mathematical expression not reproducible].

On [G.sub.2], because the edge between [v.sub.2] and [z.sub.2] is in every spanning tree, we can ignore it and look at the other two vertices. On a two vertex graph, the rotor routing process at one basepoint produces the same tensor as the Bernardi process at the other basepoint. Thus, [mathematical expression not reproducible] and [mathematical expression not reproducible]. Combined with our previous results that [mathematical expression not reproducible] and [mathematical expression not reproducible], we conclude that [mathematical expression not reproducible] and [mathematical expression not reproducible]. This, the diagram commutes for either sandpile torsor algorithm.

The only thing left to show is that the genus of [G.sub.1] is g while the genus of [G.sub.2] is 2g. This is a direct application of Lemma 8. []

4 Genus From Rotor Routing when the Graph is Known

In order to determine the genus of a ribbon graph, we need more information than just the rotor routing or Bernardi torsors. For this final section of the paper, we work with a ribbon graph (G, [rho]) for which G is known, but [rho] is not. This alone is not enough to determine the genus of (G, [rho]), but we show that if we are also given the rotor routing action at each basepoint, we can calculate the genus. In other words, we prove Theorem 5.

Our method of proof is to take an arbitrary vertex of our ribbon graph and show that the cyclic order of edges around it is essentially uniquely determined. Then, we can apply Proposition 8 to determine the ribbon graph's genus.

Definition 4.1. Let (G, [rho]) be a ribbon graph and v [member of] V(G). A v-component of (G, [rho]) is the full ribbon subgraph induced on the vertices of a connected component of G\v union {v}.

Note that (G, [rho]) has multiple v-components if and only if v is a cut vertex. Furthermore, the intersection of any two v-components is v. In Figure 7, the lower ribbon graph is a v-component of the upper ribbon graph.

Lemma 14. Let (G, [rho]) be a ribbon graph with a vertex v. Let e1 and [e.sub.2] be two edges incident to v in the same v-component, and let w1 and [w.sub.2] be their other incident vertices respectively. There exists a spanning tree T of (G, [rho]) such that:

* [e.sub.1] [member of] T,

* [e.sub.2] [member of] T, and

* the path from [w.sub.2] to v using edges in T passes through w1.

Proof: By the definition of v-components, there is a path between [w.sub.1] and [w.sub.2] that does not pass through v. Because this path does not pass through v, adding [e.sub.1] to the path will not give us a cycle. Then, we expand to any spanning tree. This spanning tree must not contain [e.sub.2] or we would have a cycle, so all three conditions are met. []

Consider (G, [rho]), v, [e.sub.1], [e.sub.2], [w.sub.1], and [w.sub.2] as given in Lemma 14. Let T be a spanning tree satisfying the conditions of this lemma and (G', [rho]') be the v-component containing [e.sub.1] and [e.sub.2]. Let T be a spanning tree satisfying the conditions of Lemma 14, and let T be the restriction of T to G' (which is a spanning tree of G').

Let S [member of] [Div.sup.0](G) be the configuration that places 1 chip on v, -1 chips on [w.sub.2], and 0 chips elsewhere. Let [r.sub.w2] be the rotor routing torsor on (G, [rho]) with basepoint [w.sub.2]. Let T = [r.sub.w2] (S, T) and T' be the restriction of T to E(G').

Proposition 15. Consider the construction above. The edge [e.sub.2] is directly after e1 in [[rho]'.sub.v] if and only if T' = T' [union] [e.sub.2]\[e.sub.1].

Proof: In the evaluation of [r.sub.w2] (S, T), the single chip on v travels around the graph until it reaches [w.sub.2]. Whenever the chip enters a v-component other than (G', [rho]'), say (G", [rho]"), it remains in (G", [rho]") until it returns to v. While the chip is in (G", [rho]"), it can only shift edges within (G", [rho]"). In particular, it will not affect T". After the chip has returned to v, it will move on to the next edge in the cyclic order around v, and the effect on T" will be the same as if the rotor had spun an extra time without sending the chip. Hence, it suffices to consider the case where G has only one v-component.

After this simplification, the forward direction of the proof is immediate because if [e.sub.2] is the next edge after [e.sub.1] in the cyclic order around v, the rotor routing torsor will have a single step which exchanges [e.sub.1] for [e.sub.2] and then deposits the chip to [w.sub.2]. The result is our desired tree.

For the other direction, we proceed by contradiction. Assume that the edges [a.sub.1],.., [a.sub.k] all fall between [e.sub.1] and [e.sub.2] in the cyclic order around v. Consider the configuration S' [member of] [Div.sup.0](G) that places k + 1 chips on v and -[d.sub.x] chips on each other vertex x where [d.sub.x] is the number of edges in {[a.sub.1],.., [a.sub.k], [e.sub.2]} that are incident to x. Then, the evaluation of [r.sub.w2] (S', T) rotates the rotor at v around k + 1 times so that it is now at [e.sub.2]. Thus, the resulting tree is T' [union] [e.sub.2] \ [e.sub.1]. To establish our contradiction, we need to show that [r.sub.w2] (S', T) [not equal to] [r.sub.w2] (S, T). Because the rotor routing action is free and transitive, this statement reduces to showing that S and S' are not equivalent as elements of [Pic.sup.0](G), which is the same as showing that S - S' is not equivalent to the identity.

The configuration S - S' has -k chips on v and [d.sub.x] chips on each other vertex x, where [d.sub.x] is the number of edges in {[a.sub.1],..,[a.sub.k]} that are incident to x. By Lemma 1, if S - S' is equivalent to the identity, then we can get from this configuration to the configuration where there are no chips on the graph merely by firing vertices. Because firing a vertex is the only way to decrease the number of chips it has, every vertex that begins with chips must be fired. Additionally, any non-v vertex adjacent to a fired vertex must be fired because it begins with no chips and gains a chip once the adjacent vertex has been fired. By recursion, this means that any vertex that is connected to a fired vertex by a path not passing through v must fire. We assumed that every vertex is on the same v-component, so every non-v vertex must fire. Additionally, since every edge in E(G) is incident to a non-v vertex, every edge must have a chip travel across it. Since there are at least k + 2 edges incident to v, v will eventually have a positive number of chips and must also fire. However, firing every vertex is equivalent to firing no vertices, meaning S - S< must be the configuration where there are no chips. This is a contradiction because we assumed that there were edges between [e.sub.1] and [e.sub.2] []

This proposition implies that on any cut-free ribbon graph (G, [rho]), given the necessary inputs for Theorem 5, we can precisely calculate [[rho].sub.vh] and thus, by Proposition 8, also the genus of (G, [rho]). However, knowing the restriction of [[rho].sub.v] to each v-component is not generally enough information to determine genus. We will also need information about when edges from one v-component fall between edges of a second v-component. This is the content of the next two lemmas.

Let (G,[rho]) be a ribbon graph with a vertex v. Let [e.sub.x] and [e.sub.2] be two sequential edges within a v-component, and [w.sub.1] and [w.sub.2] be their other incident vertices respectively. Consider a different v-component (G', [rho]') such that [a.sub.1],..., [a.sub.k] are the edges in E(G') that are between [e.sub.1] and [e.sub.2] in [[rho].sub.v]. Let T be a spanning tree satisfying the conditions of Lemma 14, and T< be the restriction of T to E(G').

Let S [member of] [Div.sup.0](G) be the configuration with 1 chip on v, -1 chips on [w.sub.2], and 0 chips elsewhere. Additionally, let [r.sub.2] be the rotor routing action on (G, [rho]) with basepoint [w.sub.2],T = [r.sub.w2] (S, T), and T' be the restriction of [r.sub.w2] to E(G').

We compare the tree T' to a tree we obtain by restricting to (G', [[rho].sup.1]) from the start. Let S' [member of] [Div.sup.0](G') be the configuration with -k chips on v and [d.sub.x] chips on each other vertex x [member of] V(G'), where [d.sub.x] is the number of edges incident to x in {[a.sub.h]..., [a.sub.k]}. Finally, let [r'.sub.v] be the rotor routing torsor on (G', [rho]') with basepoint v.

Lemma 16. In the construction above, [r'.sub.v](S', T') = T'.

Proof: As the rotor at v rotates from [e.sub.1] to [e.sub.2], it will pass through each of the edges {[a.sub.1].., [a.sub.k]} once. By the same reasoning as discussed in the previous proof, any edges not in E(G') that the rotor passes through will have no effect on T'. Every time the rotor reaches edge [a.sub.i] one chip is transferred from v to the other vertex incident to ai (call this vertex [b.sub.i]). Then, the chip travels around in (G', [rho]') until it returns to v. This has the same effect on the rotors in (G', [rho]') as if we placed a single chip on [b.sub.i] and evaluated [r'.sub.v]. Combining these single chip addition configurations gives us the element of the sandpile group S'. See Figure 7 []

Let (G', [rho]') be a ribbon graph with a vertex v such that v is not a cut vertex. (iii) Let {[e.sub.h]..., en} be the edges of G incident to v. For any [epsilon] [[subset].bar] {[e.sub.1]..., [e.sub.n]}, let [S.sub.[epsilon]] [member of] [Div.sup.0](G') be the configuration that places -k chips on v and [d.sub.x] chips on each other vertex x [member of] V(G) where [d.sub.x] is the number of edges incident to x in E.

Lemma 17. In the construction above, if [S.sub.[epsilon]] = [S.sub.[epsilon]]> then either [epsilon] = [epsilon]' or one is {ei,...,[e.sub.n]} and the other

is 0.

Proof: [S.sub.[epsilon]] = [S.sub.[epsilon]], if and only if [S.sub.[epsilon]] - [S.sub.[epsilon]], = Id. Because [S.sub.[epsilon]] - [S.sub.[epsilon]], and [S.sub.[epsilon]], - [S.sub.[epsilon]] sum to the all zeros configuration, at least one of them must have a nonnegative number of chips placed on v. Call this configuration S'. By Lemma 1, if S' is equivalent to the identity, then we can get from S' to the all zeros configuration by firing vertices. Consider a sequence of firings that results in the all zeros configuration. Because the only way for a vertex to lose chips is to be fired, if v starts with a positive number of chips, it must be fired. Furthermore, if v starts with 0 chips, then unless S' is already the all zeros configuration (which only occurs when [epsilon] = [epsilon]'), some vertex must have a positive number of chips, and must therefore fire. By definition of [S.sub.[epsilon]] and [S.sub.[epsilon]]', the only vertices with a possibly nonzero number of chips in S' are those adjacent to v, so some vertex adjacent to v must fire. This deposits at least one chip to v, which means that v now has a finite number of chips and must fire as well.

We have shown that if [epsilon] [not equal to] [epsilon]', then v must fire at some point. Since the ordering of firings is irrelevant, we can assume that v fires first. Note that every vertex x in S' has either 0, [d.sub.x], or -[d.sub.x] chips on it where [d.sub.x] is the number of edges connecting v to x. Thus, after firing v, each edge has either 0, [d.sub.x], or 2[d.sub.x] chips. If every vertex ends up with 0 chips, then we have reached the all zeros configuration with only a single firing. This only occurs if every vertex began with -[d.sub.x] chips. By construction, we see that this occurs if E = {[e.sub.1],..., [e.sub.n]} and E' = 0 (or vice versa). Otherwise, some vertex has a positive number of chips and every other vertex has a nonnegative number of chips. By the same reasoning used in the previous proposition, since we have only a single v-component, all non v vertices must fire at least once. However, since v also must fire, this means that every vertex must fire at least once when going from S' to the all zeros configuration. This cannot be required since firing every vertex is equivalent to firing no vertices. []

By combining the results of the last two lemmas, for a ribbon graph (G, [rho]) we are able to find exactly which edges from one v-component (G', [rho]') fall between two sequential edges in a second v-component(G", [rho]") with one exception. If all of the edges of (G', [rho]') fall between the same two edges of (G", [rho]"), then we cannot always determine which pair of edges they fall between. However, the following lemma shows that any ambiguities in [[rho].sub.v] can be resolved with no effect on the genus of (G, [rho]).

Let (G,[rho]) be a ribbon graph, and v [member of] V(G) such that [[rho].sub.v] = ([e.sub.1],...,[e.sub.i+j]). Assume that for all 1 [less than or equal to] k [less than or equal to] i and i + 1 [less than or equal to] l [less than or equal to] i + j, [e.sub.k] and [e.sub.l] are on different v-components of (G, [rho]). Let (G', [rho]') be the union of all v-components non-trivially intersecting {[e.sub.1],.., [e.sub.i]} and (G", [rho]") be the union of all v-components non-trivially intersecting {[e.sub.i+1],.., [e.sub.i+j]} where {[[rho]'.sub.vk]} and {[p".sub.vk]} are defined naturally as restrictions of {[[rho].sub.vk]} (see Figure 8).

Lemma 18. In the above construction, the genus of (G, [rho]) is the sum of the genus of (G', [rho]') and the genus of (G", [rho]").

Proof: First, we note that |E(G')| + |E(G")| = |E(G) | because every edge in G is in exactly one of the subgraphs. Furthermore, |V(G')| + |V(G")| = |V(G)| + 1 because every vertex in G is in exactly one of the subgraphs, except for v which is in both.

Next note that every cycle of (G, [rho]) is entirely contained in either (G', [rho]') or (G", [rho]") unless it enters v on the edge [e.sub.i] or the edge [e.sub.i+j]. We also know that these two half edges must be part of the same cycle because after the cycle leaves (G', [rho]') via [e.sub.i], it must enter (G', [rho]') again via [e.sub.i+j] or it would not be a closed loop. Because this cycle remains a cycle when restricted to either (G', [rho]') or (G", [rho]") it is double counted when summing |cyc(G')| and |cyc(G")|. Thus, we have |cyc(G')| + |cyc(G")| = |cyc(G)| + 1.

Now, we use the genus formula given in Proposition 8,

[mathematical expression not reproducible] []

We are now ready to prove Theorem 5.

Proof Proof of Theorem 5: Choose any vertex v [member of] V(G) and consider its v-components. Lemma 15 gives us the order of edges for each v-component while Lemma 16 gives which edges of one v-component are between two given edges of another v-component. Lemma 17 tells us that there is potential ambiguity if all of the edges in one v-component fall between the same two edges of another v-component. However, Lemma 18 resolves this ambiguity by allowing us to choose arbitrarily when we cannot deduce cyclic order from the previous lemmas with no effect on the ribbon graph's genus. If we repeat this procedure for every vertex of G, we have deduced the cyclic orders for a ribbon graph with the same genus as (G,[rho]). Thus, we can use Proposition 8 to determine the genus of (G, [rho]). []

Finally, we conjecture that the same theorem holds for the Bernardi process.

Conjecture 19. Let (G, [rho]) be a ribbon graph. Suppose that we are given V(G), E(G), [Pic.sup.0] (G), T(G) [subset] E(G) and for every v [member of] V(G), we are given the map

[mathematical expression not reproducible]

where [[beta].sub.v] is the Bernardi process with basepoint v. Then, it is possible to determine the genus of (G, [rho]).

The challenge for this conjecture is that even on a cut-free graph, it is not easy to use the Bernardi process to detect information about the cyclic order around a fixed vertex without information about the cyclic order around other vertices. In other words, there is no clear analogue to Proposition 15.

Acknowledgements

The author would like to thank Melody Chan for asking the question that inspired this paper and Melody Chan, Caroline Klivans, Brian Freidin, Dori Bejleri, and the anonymous reviewers for a great deal of excellent revisions.

References

Y. An, M. Baker, G. Kuperberg, and F. Shokrieh. Canonical representations for divisor classes on tropical curves and the matrix-tree theorem. Forum of Mathematics, Sigma, 2:e24, 2014. doi: 10.1017/fms. 2014.25.

M. Baker and Y. Wang. The bernardi process and torsor structures on spanning trees. International Mathematics Research Notices, pagernx037, 2017. doi: 10.1093/imrn/rnx037.

O. Bernardi. Tutte polynomial, subgraphs, orientations and sandpile model: new connections via embeddings. the electronic journal of combinatorics, 15(1):109, 2008.

N. Biggs. Chip-firing and the critical group of a graph. Journal of Algebraic Combinatorics, 9(1):25-45, 01 1999. doi: 10.1023/A:1018611014097.

M. Chan. Personal communication.

M. Chan, T. Church, and J. A. Grochow. Rotor-routing and spanning trees on planar graphs. International Mathematics Research Notices, 2015(11):3225-3244, 2014.

J. R. Edmonds Jr. A combinatorial representation for oriented polyhedral surfaces. PhD thesis, 1960.

A. E. Holroyd, L. Levine, K. Meszaros, Y. Peres, J. Propp, and D. B. Wilson. Chip-Firing and Rotor-Routing on Directed Graphs, pages 331-364. Birkhauser Basel, Basel, 2008. doi: 10.1007/978-3-7643-8786-0_17.

V. B. Priezzhev, D. Dhar, A. Dhar, and S. Krishnamurthy. Eulerian walkers as a model of self-organized criticality. Physical Review Letters, 77(25):5079, 1996.

D. G. Wagner. The critical group of a directed graph. arXiv preprint math/0010241, 2000.

Alex McDonough

Department of Mathematics, Brown University

(i) Note that this is not the same as the combinatorial genus of G which is defined as E(G) - V(G) + 1.

(ii) See Baker and Wang (2017) for a complete definition of break divisor.

(iii) We use (G',[rho]') instead of (G, [rho]) because we want to think of (G, [rho]') as a v-component of a larger ribbon graph.

received 29th Feb. 2020, revised 18th Dec. 2020, accepted 20th Dec. 2020.