Counting non-crossing permutations on surfaces of any genus

Given a surface with boundary and some points on its boundary, a polygon diagram is a way to connect those points as vertices of non-overlapping polygons on the surface. Such polygon diagrams represent non-crossing permutations on a surface with any genus and number of boundary components. If only bigons are allowed, then it becomes an arc diagram. The count of arc diagrams is known to have a rich structure. We show that the count of polygon diagrams exhibits the same interesting behaviours, in particular it is almost polynomial in the number of points on the boundary components, and the leading coefficients of those polynomials are the intersection numbers on the compactified moduli space of curves.


Introduction
Define a polygon on a connected compact oriented surface S with boundary to be an embedded (closed) disc bounded by a sequence P 1 P 2 , P 2 P 3 , . . . , P m−1 P m , P m P 1 of properly embedded arcs, where P 1 , P 2 , . . . , P m lie on the boundary ∂S. The points P 1 , P 2 , . . . , P m are called the vertices of the polygon and the arcs P i P i+1 (with i taken modulo m) are its edges. This notion of polygon allows for "loops" and "bigons", which arise in the cases m = 1 and m = 2, respectively. Given a finite set of marked points M ⊂ ∂S, a polygon diagram on (S, M ) is a disjoint union of polygons on S whose vertices are precisely the marked points M . See figure 1 for an example. Two polygon diagrams D 1 , D 2 on (S, M ) are equivalent if there is an orientation-preserving diffeomorphism φ : S → S such that φ| ∂S is the identity and φ(D 1 ) = D 2 .
Polygon diagrams are closely related to non-crossing permutations as well as dessins d'enfant, as described in further detail below. In this paper we count them. Denote by S g,n a connected compact oriented surface of genus g with n 1 boundary components, or just S when g and n are understood. Label the boundary components of S as F 1 , . . . , F n . Since we will be performing cutting and pasting operations on polygon diagrams, it is often helpful to choose a single marked point m i ∈ M ∩ F i to be decorated on each boundary component F i containing at least one marked point (i.e. such that M ∩ F i = ∅). Two polygon diagrams D 1 , D 2 on S can then be regarded as equivalent if there is an orientation-preserving diffeomorphism from S to itself taking D 1 to D 2 , such that each decorated marked point on D 1 is mapped to the decorated marked point of D 2 on the same boundary component. Fixing the total number of vertices on each boundary component F i to be µ i (i.e. |M ∩ F i | = µ i ), let P g,n (µ 1 , . . . , µ n ) be the number of equivalence classes of polygon diagrams on (S, M ). Clearly P g,n only depends on g, n, µ 1 , . . . , µ n (not on the choice of particular S or M ) and is a symmetric function of the arguments µ 1 , . . . , µ n . Proposition 1. For (g, n) = (0, 1), (0, 2), (0, 3) and (1, 1), P g,n (µ 1 , . . . , µ n ) is given by P 0,2 (µ 1 , µ 2 ) = 2µ 1 −1 µ 1 2µ 2 −1 µ 2 2µ 1 µ 2 µ 1 +µ 2 + 1 , for µ 1 , µ 2 > 0, Here we take the non-standard convention that when µ = 0, 2µ−1 µ = −1 0 = 1. Observe that the expression for P 0,1 (µ 1 ) produces a Catalan number, which we have written in a non-standard form to highlight the binomial coefficient that arises in the general statement of theorem 3 below.
Suppose D is a polygon diagram on (S, M ) where S is a disc or an annulus, i.e. (g, n) = (0, 1) or (0, 2) respectively. Each boundary component F i inherits an orientation from S. Label the marked points of M by the numbers 1, 2, . . . , |M | = n i=1 µ i , in order around F 1 in the disc case, and in order around F 1 then F 2 in the annulus case. Orienting each polygon in agreement with S induces a cyclic order on the vertices (and vertex labels) of each polygon, giving the cycles of a permutation π of {1, 2, . . . µ i }. Such a permutation is known as a non-crossing permutation if S is a disc, and an annular noncrossing permutation if S is an annulus. We say the diagram D induces or represents the permutation π.
Non-crossing permutations are well-known combinatorial objects. It is a classical result that the number of non-crossing permutations on the disc with N marked points is given by the N th Catalan number. Annular non-crossing permutations were (so far as we know) first introduced by King [20]. They were studied in detail by Mingo-Nica [22], Nica-Oancea [24], Goulden-Nica-Oancea [13], Kim [18] and Kim-Seo-Shin [19]. More generally, there is now a wealth of literature on non-crossing combinatorics, with much of it inspired by connections to random matrices and free probability [28].
In general, if we number the marked points in M from 1 to |M | = n i=1 µ i in order around the oriented boundaries F 1 , then F 2 , up to F n , then in a similar way, a polygon diagram represents a non-crossing permutation on a surface with arbitrary genus and an arbitrary number of boundary components. This paper studies such non-crossing permutations via polygon diagrams.
The relation between permutation and genus here differs slightly from others in the literature. The notion of genus of a permutation π in [16] and subsequent papers such as [6,7,8], in our language, is the smallest genus g of a surface S with one boundary component on which a polygon diagram exists representing the permutation π; equivalently, it is the genus of a surface S with one boundary component on which a polygon diagram exists representing π, such that all the components of S\D are discs. This differs again from the notion of genus of a permutation in [5].
Given a non-crossing permutation π on the disc, it is clear that there is a unique polygon diagram D (up to equivalence) representing π. Therefore P 0,1 (µ) is also the µ-th Catalan number. Uniqueness of representation is also true for connected annular noncrossing partitions. An annular non-crossing partition is connected if there is at least one edge between the two boundary components, i.e. from F 1 to F 2 . Uniqueness of representation follows since an edge from F 1 to F 2 cuts the annulus into a disc. The number of connected annular non-crossing partitions counted in P 0,2 (µ 1 , µ 2 ) is known to be [22, cor. 6.8] which appears as a term in the formula (2) for P 0,2 (µ 1 , µ 2 ).
the electronic journal of combinatorics 28(4) (2021), #P4.9 A disconnected annular non-crossing permutation however can be represented by several distinct polygon diagrams. For example, consider a bigon on the disc and remove a small disk from the region on either side of the bigon to create two polygon diagrams on the annulus. Whereas these contribute separately to the enumeration P 0,2 (2, 0), they correspond to the same annular non-crossing permutation. So P 0,2 can be viewed as the total count of annular non-crossing permutations with multiplicities. Similarly, in general the numbers P g,n (µ, . . . , µ n ) can be regarded as counts with multiplicity of non-crossing permutations on arbitrary connected compact oriented surfaces with boundary.
Given a polygon diagram D on S where all components of S\D are discs, we may embed a bipartite graph G in S, dual to D, as follows. We place a white vertex in the interior of each polygon of D, a black vertex in each component of S\D, and join vertices by edges across each edge of the polygon diagram D. Capping off the surface S to a closed surfaceŜ by gluing a disc to each boundary component, distinguishing one edge of the graph G, as a root, and regarding two such graphs as equivalent if they are related by a homemorphism ofŜ, we then have a bicoloured rooted map in the sense of [14]. As S deformation retracts onto G, the number of components of S\G is the number of boundary components n of S. This graph G is exactly a dessin d'enfant with a decorated edge on each boundary component corresponding to the decorated marked point, and the polygon diagram can be recovered from the dessin. If n = 1 then we have a bicoloured unicellular rooted map. Goupil and Schaeffer [14, cor. 4.3] showed that the number Bi(µ, g) of unicellular bicoloured maps with µ edges (which corresponds to the number of vertices in a polygon diagram) of genus g is given asymptotically by Applying Stirling's approximation to our result contained in equation (4) immediately gives the same asymptotics in the case g = 1.
For general n, enumerative and polynomiality results for the enumeration of dessins have been previously obtained by Kazarian-Zograf [17], Ambjørn-Chekov [1], and Do-Norbury [11]. Let R k g,n (µ 1 , . . . , µ n ) denote the enumeration of dessins with k black vertices, and S(n, k) be the Stirling number of the second kind. Then our polygon diagram count is related to the dessin count by the equation This can be seen by starting with a polygon diagram where S g ,n \D consists of k discs, grouping those k discs together into l connected components by adding k − l handles, and then adding the remaining g − g − (k − l) handles amongst these l components.
If all polygons in D are bigons, then collapsing them into arcs turns D into an arc diagram, as defined and studied by the first and third authors with Koyama in [9]. The count of arc diagrams exhibits quasi-polynomial behaviour, and the asymptotic behaviour is governed by intersection numbers on moduli spaces of curves. In this paper we show that the count of polygon diagrams has an analogous structure. The arguments here parallel those in [9], which deal with the enumeration of arc diagrams. Our arguments are necessarily more involved than those for arc diagrams but, perhaps surprisingly, produce cleaner results.
The formulae for P g,n in proposition 1 suggest that P g,n (µ 1 , . . . , µ n ) is a product of the , together with a rational function of µ 1 , . . . , µ n . In fact we also know the form of the denominator. Moreover, the behaviour is better than for arc diagrams in the sense that we obtain polynomials rather than quasi-polynomials.
An edge is boundary-parallel if it cuts off a disc from the surface S. Two edges are parallel if there is a disc in the surface S bounded by the union of these two edges with two segments that lie on the boundary of S. A polygon all of whose edges are parallel to the same boundary component is local in the sense that it does not detect any of the underlying topology of S. The enumeration of these polygons is thus combinatorial in nature. Therefore from a topological point of view, it is natural to count polygon diagrams where no edges are boundary-parallel. We call such a diagram a pruned polygon diagram. Observe that a pruned polygon diagram cannot contain a polygon with one edge, otherwise known as a "loop". Let the count of pruned polygon diagrams be Q g,n (µ 1 , . . . , µ n ), i.e. the number of equivalence classes of pruned polygon diagrams on a surface of genus g, with n boundary components, containing µ 1 , . . . , µ n marked points respectively. Clearly Q g,n (µ 1 , . . . , µ n ) is also symmetric in the arguments µ 1 , . . . , µ n .
As the name suggests, the relationship between P g,n and Q g,n mirrors that of dessin and pruned dessin counts [11], as well as Hurwitz numbers and pruned Hurwitz numbers [10]. It also mirrors the relationship between the counts of arc diagrams G g,n and non-boundaryparallel arc diagrams N g,n in [9]; we can think of the latter as pruned arc diagrams. This correspondence between combinatorial objects and their pruned counterparts also bears a resemblance to constructions appearing in the literature on maps, such as the notion of non-choppable maps [2]. The relationship between pruned polygon diagrams and pruned dessins is not as simple as their unpruned versions. In particular the equivalent of equation (5) does not hold, and the polynomiality of Q g,n does not follow directly from that of the pruned dessin enumeration.
We call a function f (µ 1 , . . . , µ n ) that takes non-negative integer arguments a quasipolynomial if it is given by a family of polynomial functions, depending on whether each of the integers µ 1 , . . . , µ n is zero, odd, or even and nonzero. In other words, a quasi-polynomial can be viewed as a collection of 3 n polynomials, depending on whether each µ i is zero, odd, or even and nonzero. More precisely, for each partition X = X e X o X ∅ , there is a polynomial f (Xe,Xo,X ∅ ) (µ Xe , µ Xo ) such that f (µ 1 , . . . , µ n ) = f (Xe,Xo,X ∅ ) (µ Xe , µ Xo ) whenever µ i = 0 for i ∈ X ∅ , µ i is nonzero and even for i ∈ X e , and µ i is odd for i ∈ X o . (Here as above, X = {1, 2, . . . , n} and for a set I ⊆ X, Note that our definition of a quasi-polynomial differs slightly from the standard definition in the literature, in that 0 is treated as a separate case rather than an even number. The notion is sufficiently close though that one might consider it more practical to keep the term quasi-polynomial than to invent a new variation. Theorem 5. For (g, n) = (0, 1) or (0, 2), Q g,n (µ 1 , . . . , µ n ) is an odd quasi-polynomial in the sense described above.
The proof of this structural result relies heavily on a recursion for the numbers Q g,n (µ 1 , . . . , µ n ) that appears as theorem 17, which may be considered the technical core of the present work. While the recursion for Q g,n (µ 1 , . . . , µ n ) broadly resembles that for P g,n (µ 1 , . . . , µ n ) in theorem 4 above, it is more complicated. On the other hand, it has the virtue of being an effective recursion on (g, n), in the sense that it expresses Q g,n (µ 1 , . . . , µ n ) in terms of values of Q g ,n for which 2g + n < 2g + n. Contrast the recursion for P g,n (µ 1 , . . . , µ n ) of theorem 4, which involves other values of P g,n . Whereas the recursion for the pruned enumeration leads to the structural result for the pruned enumeration, an analogous approach at the level of the unpruned enumeration seems to the authors to be difficult. It is precisely for this reason that passing to the pruned enumeration is advantageous.
The pruned diagram enumeration captures topological information of S g,n in some sense. We will show that the highest degree coefficients of the quasi-polynomial Q g,n are determined by intersection numbers on the compactified moduli space of curves M g,n . In this way the quasi-polynomials Q g,n (µ 1 , . . . , µ n ) behave similarly not only to arc diagram counts [9], but also to the volume polynomials of Kontsevich [21], the Weil-Petersson volume polynomials of Mirzakhani [23], and the lattice count polynomials of Norbury [25]. These last three problems are all governed by the topological recursion of Chekhov, Eynard and Orantin [4,12] and the fact that they agree to leading order is a consequence of this fact. It is not yet clear whether the enumeration of non-crossing permutations discussed presently is also governed by the topological recursion or some variant of it. Theorem 6. For (g, n) = (0, 1) or (0, 2), Q (Xe,Xo,∅) g,n (µ 1 , . . . , µ n ) has degree 6g − 6 + 3n. The coefficient c d 1 ,...,dn of the highest degree monomial µ 2d 1 +1 1 · · · µ 2dn+1 n is independent of (X e , X o ), and Here ψ i is the Chern class of the i-th tautological line bundle over the Deligne-Mumford compactification M g,n of the moduli space of genus g curves with n marked points. A discussion of these algebro-geometric concepts would take us too far from the focus of the paper, so we refer the interested reader to the literature for more details [15].

Algebraic identities
In this section we state some identities required in the sequel. The proofs of all the results in this section appear in appendix A.
The combinatorial identities we require involve sums of binomial coefficients multiplied by polynomials. The sums themselves also have a certain polynomial structure, analogous to the sums in [9, defn. 5.5] and [26].
is an odd quasi-polynomial in n. This quasi-polynomial is given by a degree k 1 + k 2 + 1 polynomial when the parity of n is the sum of the fixed parities of i 1 and i 2 , and is equal to zero otherwise. Furthermore, the leading coefficient of this polynomial is independent of the choice of parities.
Proposition 8 can be directly generalised by induction to the following.
is an odd quasi-polynomial in n. This quasi-polynomial is given by a degree m i=1 k i +m−1 polynomial when the parity of n is the sum of the fixed parities of i 1 , i 2 , . . . , i m , and is equal to zero otherwise. Furthermore, the leading coefficient of this polynomial is independent of the choice of parities.
We will need the following particular cases, which can be proved by a straightforward induction, and follow immediately from the discussion in the appendix. When n is even, 0 i n i even i = n(n + 2) 4 and 0 i n i even i 2 = n(n + 1)(n + 2) 6 .
3 Basic results on polygon diagrams

Base cases for the pruned enumeration
We start by working out Q g,n for some small values of (g, n). As Q g,n (µ 1 , . . . , µ n ) is symmetric in its arguments, the next proposition gives all values of Q 0,1 , Q 0,2 and Q 0,3 Proposition 11.
Here δ is the Kronecker delta and n = n + δ n,0 as in [9], so for a positive integer n we have n = n, while 0 = 1.
For (g, n) = (0, 3), we can embed the pair of pants in the plane, with its usual orientation, and denote the three boundary components by F 1 = F outer , F 2 = F left and F 3 = F right , with µ 1 , µ 2 and µ 3 marked points respectively. Without loss of generality assume µ 1 µ 2 , µ 3 . A non-boundary-parallel edge can be separating, with endpoints on the same boundary component and cutting the surface into two annuli, or non-separating, with endpoints on different boundary components. See figure 2.
In a pruned polygon diagram on a pair of pants there can be only one type of separating edge, and all separating edges must be parallel to each other. Consider a polygon P in a pruned polygon diagram. All its diagonals are also non-boundary-parallel, for a boundaryparallel diagonal implies boundary-parallel edges. Further, there is at most one boundary component on which P has more than one vertex; if there were two boundary components F i , F j each with at least two vertices then there would be separating diagonals from each of F i , F j to itself, which is impossible since there can be only one type of separating edge. Moreover, P cannot have three vertices on a single boundary component, since the three diagonals connecting them would have to be non-boundary-parallel, hence separating, hence parallel to each other, hence forming a bigon at most. Therefore a polygon in a pruned diagram on a pair of pants is of one of the following types: • a non-separating bigon from one boundary component to another, • a separating bigon from one boundary component to itself, • a triangle with a vertex on each boundary component, • a triangle with two vertices on a single boundary component, and the third vertex on a different boundary component, • a quadrilateral with two opposite vertices on a single boundary component, and one vertex on each of the other two boundary components.
See figure 3. It is easy to see that there can be at most one quadrilateral or two triangles in any pruned diagram. If µ 2 = µ 3 = 0, then all edges must be between F outer and itself and separating. In this case a pruned polygon diagram must consist of a number of pairwise parallel bigons. Hence Q 0,3 (µ 1 , 0, 0) = 0 if µ 1 is odd. If µ 1 > 0 is even, then the configuration of µ 1 2 separating bigons gives rise to µ 1 pruned polygon diagrams, as the decorated marked point can be located at any one of the µ 1 positions. If µ 1 = 0 then there is only the empty diagram, so in general there are µ 1 diagrams. If µ 2 > 0 and µ 3 = 0, then since µ 1 µ 2 , the possible polygons are • a separating bigon between F outer and itself, • a non-separating bigon between F outer and F left , • a triangle with two vertices on F outer and a vertex on F left . Furthermore there can be at most one triangle. If µ 1 − µ 2 is even, then a pruned polygon diagram must consist of µ 2 bigons from F outer to F left and µ 1 −µ 2 2 bigons from F outer to itself. If µ 1 − µ 2 is odd, then a pruned polygon diagram must consist of a single triangle, µ 2 − 1 bigons from F outer to F left and µ 1 −µ 2 −1 2 bigons from F outer to itself. Again each such configuration determines µ 1 µ 2 pruned diagrams accounting for the locations of the two decorated marked points on F outer and F left .
If µ 1 , µ 2 , µ 3 > 0, then because µ 1 is maximal, any separating edge or separating diagonal in a quadrilateral must be from F outer to itself. Therefore the single quadrilateral (if it exists) must have a pair of opposite vertices on F outer and one vertex each on F left and F right . There are two types of triangles with a separating edge from F outer to itself, depending on whether the last vertex is on F left or F right . Call these left or right triangles respectively. There are also two types of triangles with a vertex on each boundary component, depending on whether the triangle's boundary, inheriting an orientation from the surface, goes from F outer to F left or F right . Call these up or down triangles respectively. We then have the following seven cases. See figure 4. Figure 4: The seven types of pruned polygon diagram on a pair of pants. These correspond to cases (i)-(vii) reading across rows from left to right (i) There is one quadrilateral. Then the pruned diagram must consist of this single quadrilateral, µ 2 − 1 bigons between F outer and F left , and µ 3 − 1 bigons between F outer and F right . In this case we must have µ 1 − µ 2 − µ 3 = 0.
(ii) There is a left and a right triangle. Then the pruned diagram must consist of these two triangles, µ 2 − 1 bigons between F outer and F left , µ 3 − 1 bigons between F outer and F right , and µ 1 −µ 2 −µ 3 −2 2 separating bigons between F outer and itself. In this case we have µ 1 − µ 2 − µ 3 is positive and even.
Observe that for each triple (µ 1 , µ 2 , µ 3 ), precisely two of these cases apply, depending on µ 1 − µ 2 − µ 3 . (Here we count the left and right versions of (iv) separately, and the up and down versions of (v) separately.) These cases yield two possible configurations of polygons, and each configuration corresponds to µ 1 µ 2 µ 3 pruned diagrams, accounting for the locations of the decorated marked points on the three boundary components. Thus Q 0,3 is as claimed.

Cuff diagrams
Consider the annulus embedded in the plane with F 1 being the outer and F 2 the inner boundary. A cuff diagram is a polygon diagram on an annulus with no edges between vertices on the inner boundary F 2 . (These are analogous to the local arc diagrams of [9].) Let L(b, a) be the number, up to equivalence, of cuff diagrams with b vertices on the outer boundary F 1 and a vertices on the inner boundary F 2 .
Proposition 12. For all non-negative integers a, b, L(b, a) is given by Proof. This argument follows [9], using ideas of Przytycki [27]. A partial arrow diagram on a circle is a labelling of a subset of vertices on the boundary of the circle with the label "out". Assume a > 0. We claim there is a bijection between the set of equivalence classes of cuff diagrams counted by L(b, a), on the one hand, and on the other, the set of partial arrow diagrams on a circle with 2b vertices and b−a "out" labels, together with a choice of decorated marked point on the inner circle. Clearly the latter set has cardinality a 2b b−a . This bijection is constructed as follows. Starting from a cuff diagram D, observe that there are b − a edges of D with both endpoints on the outer boundary F 1 . Orient these edges in an anticlockwise direction. (Note this orientation may disagree with the orientation induced from polygon boundaries.) Label the b vertices on F 1 from 1 to b starting from the decorated marked point. Taking a slightly smaller outer circle F 1 close to F 1 , the edges of D intersect F 1 in 2b vertices, say 1, 1 , 2, 2 , . . . , b, b . Label each of these 2b vertices "out" if it is a starting point of one of the oriented edges. We then have b − a "out" labels, and hence a partial arrow diagram of the required type. The decorated marked point on the inner circle is given by the cuff diagram.
Conversely, starting from a partial arrow diagram, there is a unique way to reconstruct the edges of the cuff diagram D so that they do not intersect. Regard the circle with 2b vertices of the partial arrow diagram as the outer boundary F 1 , with the 2b vertices lying in pairs close to each marked point of the original annulus, and with the pair close to marked point i labelled i, i . Since there are vertices with and without arrows among the 2b vertices, there is an "out" vertex on F 1 followed by an unlabelled vertex in an anticlockwise direction. The edge starting from this "out" vertex must end at that neighbouring unlabelled vertex (otherwise edges ending at those two vertices would intersect). Next we remove those two matched vertices and repeat the argument. Eventually all b − a "out" vertices are matched with unlabelled vertices by b − a oriented edges. The remaining 2a unlabelled vertices are joined to 2a vertices on the inner circle F 2 . These 2a edges divide the annulus into 2a sectors, which are further subdivided into a number of disc regions by the oriented edges. Since 2a is even, the disc regions can be alternately coloured black and white. Each pair of vertices on F 1 is then "pinched" into the original marked point; the colouring can be chosen so that the pinched vertices are corners of black polygons near F 1 . The vertices of F 2 can then be pinched in pairs in a unique way to produce a polygon diagram D, where the polygons are the black regions. This polygon diagram D has b vertices on F 1 and a vertices on F 2 . Finally, each vertex on F 2 belongs to a separate If a = 0 then the bijection fails. From the cuff diagram we can still construct a partial arrow diagram. But when the cuff diagram is being reconstructed from a partial arrow diagram, there is a single non-disc region, so not every partial arrow diagram gives rise to a cuff diagram. Call a partial arrow diagram compatible if it yields a cuff diagram. Since each edge is now separating, the regions divided by the edges can still be alternately coloured black and white. All regions are discs except one which is an annulus. Again choose the colouring so that the pairs of vertices labelled i, i on F 1 are pinched into corners of black regions. The partial arrow diagram is then compatible if and only if the annulus region is white. However, when the partial arrow diagram is not compatible, pinching instead the corners of white regions will then result in a cuff diagram. In other words, if we rotate all the "out" labels by one spot counterclockwise, the new partial arrow diagram will be compatible. Conversely, if a partial arrow diagram is compatible, then rotating its labels one spot clockwise will result in an incompatible partial arrow diagram. Hence there is a bijection between compatible and incompatible partial arrow diagrams, and the number of cuff diagrams is exactly half of the number of partial arrow diagrams, or 1 2 2b b . When a = b = 0, there is the unique empty cuff diagram.
the electronic journal of combinatorics 28(4) (2021), #P4.9 If µ 1 , µ 2 > 0, then as we saw in the introduction, from [22] the number of connected polygon diagrams (i.e. with at least one edge from F 1 to F 2 ) is If there are no edges between the two boundaries, then the polygon diagram is a union of two cuff diagrams, hence as required.

Decomposition of polygon diagrams
Suppose S is not a disc or an annulus. Then any polygon diagram on S can be decomposed into a pruned polygon diagram on S together with n cuff diagrams, one for each boundary component of S. Take an annular collar of each boundary component of S, and isotope all boundary-parallel edges to be inside the union of these annuli. The inner circle of the annulus at F i intersects the polygons in ν i 0 arcs. Pinch each arc into a vertex, choose one vertex on each inner circle with ν i > 0 as a decorated marked point, and cut along each inner circle. This produces a cuff diagram on each annular collar and a pruned polygon diagram on the shrunken surface. This decomposition is essentially unique except for the choice of decorated marked points on the inner circles, i.e. a single polygon diagram will give rise to n i=1 ν i distinct decompositions. (Recall that ν = ν + δ ν,0 .) See figure 6. Conversely, starting from such a decomposition, we can reconstruct the unique polygon diagram by attaching the cuff diagrams to the pruned polygon diagram by identifying the corresponding decorated marked points along the gluing circles, and "unpinching" all the vertices on the gluing circles into arcs. Therefore we have the following relationship between P g,n and Q g,n , corresponding to the "local decomposition" of arc diagrams in [9]. Proposition 14. For (g, n) = (0, 1) or (0, 2), It turns out that dividing by a power of 2 for each of the µ i that is zero, we obtain a nicer form of this result, eliminating the piecewise nature of L(µ i , ν i ). Defining P g,n (µ 1 , . . . , µ n ) = 1 n i=1 2 δ µ i ,0 P g,n (µ 1 , . . . , µ n ), Q g,n (ν 1 , . . . , ν n ) = 1 n i=1 2 δ ν i ,0 Q g,n (ν 1 , . . . , ν n ), and applying proposition 12, equation (11) becomes
Proof. It is easier to work with P and Q . We split the sum from (12) into separate sums depending on how many of the ν i are positive. Using proposition 11, the sum over ν i all being positive is given by Proposition 7 then gives this expression as Similarly, when ν 1 = 0 and ν 2 , ν 3 are positive we obtain We now perform a similar calculation with ν 1 = ν 2 = 0 and ν 3 > 0, which yields The sum over terms with one ν i being positive is given by repeating the above calculation, interchanging the roles of ν 1 , ν 2 , ν 3 . Finally when all ν i are zero we have Note that with our convention of −1 Summing the above terms, we have P 0,3 (µ 1 , µ 2 , µ 3 ) = n i=1 2 δ µ i ,0 P 0,3 (µ 1 , µ 2 , µ 3 ) as claimed.

Recursions
In this section we will prove recursion relations for both the polygon diagram counts P g,n and the pruned polygon diagrams counts Q g,n . The recursion for P g,n is similar to that obeyed by the arc diagram counts G g,n in [9]. The recursion for Q g,n , appears messy at first sight, but if we only consider the dominant part, it actually differs very little from the recursion for the non-boundary-parallel arc diagram count N g,n in [9]. The top degree component of N g,n in turn agrees, up to some simple scaling factors, with the volume polynomials of Kontsevich [21], the Weil-Petersson volume polynomials of Mirzakhani [23], and the lattice count polynomials of Norbury [25]. We orient each boundary component F i as the boundary of S. This induces a cyclic order on the µ i vertices on F i , and we denote by σ(v) the next vertex to v along F i . If µ i 2 then σ(v) = v for v a vertex on F i . For any polygon diagram D, orient the edges of D by choosing the orientation on each polygon to agree with the orientation on S.

Polygon diagram enumeration
We now prove theorem 4, the recursion on P g,n , which states that for g 0 and µ 1 > 0, equation (6) holds: Recall that we let X = {1, 2, . . . , n} and for each I ⊆ X, we let µ I = {µ i | i ∈ I}.
Proof of theorem 4. Consider the decorated marked point m 1 on the boundary component F 1 . Suppose it is a vertex of the polygon K of the diagram D. Let γ be the outgoing edge from m 1 . If the other endpoint of γ is also m 1 , then K is a 1-gon, and we obtain a new polygon diagram D by removing K entirely (including m 1 ), and then if µ 1 2, we select the new decorated marked point on F 1 to be σ(m 1 ). (If µ 1 = 1 then there will be no vertices on F 1 in D , so we do not need a decorated marked point). Conversely, starting with a polygon diagram D on S g,n with (µ 1 − 1, µ 2 , . . . , µ n ) boundary vertices, we can insert a 1-gon on F 1 just before the decorated marked point m 1 (if there are no vertices on F 1 , simply insert a 1-gon), and then move the decorated marked point to the vertex of the new 1-gon. These two operations are inverses of each other. This bijection gives the term P g,n (µ 1 − 1, µ X\{1} ) in (6).
If the other endpoint v of γ is different from m 1 , there are various cases.
(A) The edge γ has both endpoints on F 1 and is non-separating. We cut S = S g,n along γ into S = S g−1,n+1 , by removing a regular strip γ × (0, ) from S, where γ = γ × {0} and {m 1 } × [0, ] ⊂ F 1 is a small sub-interval of [m 1 , σ(m 1 )). Then F 1 splits into two arcs, which together with γ and a parallel copy γ × { }, form two boundary components F 0 and F 1 on S , with γ part of F 1 . If σ(m 1 ) = v on F 1 , then F 0 contains no vertices. We obtain a polygon diagram D on S by collapsing γ into a single vertex m 1 which is the decorated marked point on F 1 , and setting σ(m 1 ) as the decorated marked point on F 0 (if there is at least one vertex on F 0 ). The new diagram D has i 0 vertices on F 0 and j 1 vertices on F 1 with i + j = µ 1 − 1. Conversely starting with such a polygon diagram D on S g−1,n+1 with (i, j, µ 2 , . . . , µ n ) boundary vertices, we can reconstruct D. First expand the decorated marked point m 1 on F 1 into an interval. Then glue a strip joining this interval on F 1 to an interval just before the decorated marked point on F 0 . (If i = 0, we can glue to any interval on F 0 .) This bijection gives the term i+j=µ 1 −1, j>0 P g−1,n+1 (i, j, µ X\{1} ) in (6).
(B) The edge γ has both endpoints on F 1 and is separating. This is almost the same as the previous case. As before, we cut S g,n along γ into two surfaces S 1 and S 2 with polygon diagrams D 1 and D 2 , such that the new vertex m 1 obtained from collapsing γ is on S 2 . The polygon diagram D can be uniquely reconstructed from such a pair (D 1 , D 2 ). This bijection gives the term i+j=µ 1 −1, j>0 g 1 +g 2 =g, I J=X\{1} P g 1 ,|I|+1 (i, µ I ) P g 2 ,|J|+1 (j, µ j ) of (6).
(C) The edge γ has endpoints m 1 on F 1 and v on F k , for k > 1.
In this case γ is necessarily non-separating. Cutting S g,n along γ and collapsing γ following a similar procedure to the previous cases results in a polygon diagram D on a surface S g,n−1 with µ 1 + µ k − 1 vertices on its new boundary component F 1 , and the collapsed vertex m 1 as the decorated marked point on F 1 . However this is not a bijection since the information about the original location of the decorated marked point on F k (relative to v) is forgotten in D . In fact the map D → D is µ k -to-1.
The decorated marked point m k can be placed in any of the µ k locations (relative to v). All µ k such polygon diagrams will give rise to the same D after cutting along γ. Taking the multiplicity µ k into account gives the term n k=2 µ k P g,n−1 (µ 1 + µ k − 1, µ X\{1,k} ) of (6).

Pruned polygon diagram enumeration
The recursion for pruned polygon diagrams follows from a similar analysis. It is more involved due to the fact that after cutting along an edge γ, some other edges may become boundary-parallel, so more care is required.
We previously defined n as n = n if n is a positive integer, and 0 = 1, following [9]. We now introduce another notation of a similar nature.
Proof. Suppose D is a pruned polygon diagram on S. Let γ be the outgoing edge at the decorated marked point m 1 on F 1 . Since there is no 1-gon in D (they are boundaryparallel), the other endpoint v of γ is distinct from m 1 . There are three cases for γ: (A) it has both endpoints on F 1 and is non-separating; (B) it has endpoints on F 1 and some other F k , or has both endpoints on F 1 and cuts off an annulus parallel to F k ; or (C) it has both ends on F 1 , is separating, and does not cut off an annulus. Each of these cases, especially case (B), has various sub-cases, which we now consider in detail.
(A) The edge γ has both endpoints on F 1 and is non-separating.
If an edge becomes boundary-parallel after cutting S along γ, then it must be parallel to γ on S (relative to the endpoints) to begin with. Given two edges β 1 and β 2 , both parallel to γ, let I be a strip bounded by β 1 , β 2 and portions of F 1 . This strip I is unique, because after we cut open along I, β and β belong to different boundary components, so they cannot bound any other strips. There is a unique minimal strip A : [0, 1] 2 → S containing all edges parallel to γ, given by the union of connecting strips between all pairs of edges parallel to γ. The left (resp. right) boundary of A is an edge γ L (resp. γ R ) joining two vertices p L and q L (resp. p R and q R ), and the bottom (resp. top) boundary of A is an interval on F 1 from p L to p R (resp. q R to q L ). Note that A may be degenerate, i.e. γ L and γ R may have one or both of their endpoints in common, or they are the same edge γ.
Observe that all the edges in A, with the possible exception of γ L and γ R , form a block of consecutive parallel bigons inside A. Let there be m 1 polygons with at least one edge parallel to γ. See figure 7. There are four cases.
(1) All m such polygons are bigons. In this case the µ 1 vertices along F 1 are divided into 4 cyclic blocks of consecutive vertices: there is a block of m vertices (p 1 , . . . , p m ) followed by j 0 vertices, followed by another block of m consecutive vertices (q m , . . . , q 1 ), followed by i 0 vertices, such that there is a bigon between each pair of vertices {p i , q i }, and m 1 ∈ {p 1 , . . . , p m }. Remove all m bigons from the pruned polygon diagram D and cut S along γ. If j > 0 then let σ(p m ) be the decorated marked Therefore we have the following contribution to (13): (2) The edge γ L is part of a polygon K which is not a bigon, and all other polygons are bigons. If γ L = γ R then K and A lie on the opposite sides of γ L (otherwise K ⊆ A, so must be a bigon), and there are m − 1 bigons in A. Remove all bigons, cut S along γ L , collapse γ L to a single vertex m 0 which we take to be the decorated marked point on the new boundary component F 0 , and let σ(p R ) be the decorated marked point on F 1 . This produces a pruned polygon diagram D . Similar to the previous case, the map D → D is m-to-1, as m 1 can any one of the m vertices between p L and p R . Therefore we have the following contribution to (13): (15) Note that this formula includes the contribution from the special case γ L = γ R = γ, where m = 1.
(3) The edge γ R is part of a polygon K which is not a bigon, and all other polygons are bigons. This is almost identical to the previous case, except now γ cannot be the edge γ R . (If we had γ = γ R then, since γ is the outgoing edge from m 1 , the polygon containing γ would have to be on the same side of γ as A.) The map D → D is now (m − 1)-to-1, as m 1 cannot be p R . Therefore we have the following contribution to (13): Note that this formula correctly excludes the special case γ L = γ R = γ, where m − 1 = 0 and the formula vanishes.
(4) The edges γ L and γ R are each part of some polygon which is not a bigon, and all other polygons are bigons. We allow γ L and γ R to be different edges of the same polygon. We obtain a pruned polygon diagram D by removing the m − 2 bigons and collapsing γ L and γ R to decorated marked points m 0 and m 1 . For the same reason as the previous case, γ cannot be the edge γ R , so the map D → D is only (m−1)-to-1. Therefore the contribution to (13) is Now we compute the total contribution from cases (A)(1)-(4). We drop the subscripts g − 1, n + 1 from Q g−1,n+1 and X\{1} from µ X\{1} for convenience. Summing expressions (14) and (17) and separating the terms according to where i, j are zero or nonzero, we obtain the electronic journal of combinatorics 28(4) (2021), #P4.9 Similarly for expressions (15) and (16), Adding (18) and (19) we have the first line of (13).
The edge γ has endpoints on F 1 and F k , or has both endpoints on F 1 and cuts off an annulus parallel to F k .
Here k = 1. Note that since (g, n) = (0, 3), if γ cuts off an annulus parallel to F k , the remaining surface is not an annulus. Hence different values of k give different pruned polygon diagrams. There is no double counting when we sum over k.
To standardise the possibilities for γ, we define a path α from F 1 to F k as follows, withᾱ used to denote α with reversed orientation. If γ has endpoints on F 1 and F k , then let α = γ. In this case, the edges that become parallel after S is cut along γ must be one of three types of curves: those parallel to the concatenated paths α, αF kᾱ , andᾱF 1 α. On the other hand, if γ has both endpoints on F 1 and cuts off an annulus parallel to F k , then let α be a curve inside that annulus, connecting F 1 to F k . In this case, the curves that become boundary-parallel after S is cut along γ must be parallel to γ. See figure 8. Since S is not an annulus, there is a unique minimal strip A 1 containing all edges parallel to α, bounded by edges γ 1 L (resp. γ 1 R ) joining two vertices p 1 L ∈ F 1 and q 1 L ∈ F k (resp. p 1 R and q 1 R ). The top (resp. bottom) boundary of A 1 is an interval on F 1 (resp. F k ) from p 1 L to p 1 R (resp. q 1 R to q 1 L ). Similarly there are unique minimal strips A 2 and A 3 containing all edges of the second and third type respectively, with analogous notations. Note that edges of the second and third types cannot appear simultaneously, so A 2 and A 3 cannot both be non-empty. All three strips A i may be degenerate. See figure 9. Call a polygon partially boundary-parallel if at least one of its edges is of the three types α, αF kᾱ ,ᾱF 1 α. Call a polygon totally boundary-parallel if all of its edges are of these three types, and mixed if it is partially boundary-parallel but not totally boundary-parallel. A totally boundary-parallel polygon is either a bigon, or a triangle with two edges parallel to α and the third edge parallel to αF kᾱ orᾱF 1 α. Furthermore there can be at most one totally boundary-parallel triangle. Let there be m partially boundary-parallel polygons. Note m 1, since γ lies in a partially boundary-parallel polygon.
Assume µ k > 0. We split into the following sub-cases: all m partially boundaryparallel polygons are bigons; m−1 bigons and one totally boundary-parallel triangle; there is a totally boundary-parallel triangle and a mixed polygon; there is a mixed polygon but no totally boundary-parallel triangles.
We then split further into sub-cases accordingly as there are bigons parallel to αF kᾱ orᾱF 1 α, or not.
(a) There are no bigons parallel to αF kᾱ orᾱF 1 α. Then there are m consecutive bigons between F 1 and F k . Removing all m bigons and cutting S along γ gives a pruned polygon diagram D with i = µ 1 + µ k − 2m vertices on the new boundary component F 1 . When i > 0, the decorated marked point on F 1 is set to be σ(p 1 R ) if µ 1 > m, and σ(q 1 L ) if µ 1 = m. The map D → D is mµ k -to-1, since m 1 can be any of m vertices of the bigons on F 1 , and m k can be any of the µ k vertices on F k . Therefore we have the contribution (b) There are x 1 bigons parallel to αF kᾱ . See figure 10. Since αF kᾱ cuts off an annulus parallel to F k , the µ k vertices on F k belong to µ k bigons between F 1 and F k . Removing all m = x + µ k bigons and cutting along γ gives a pruned polygon diagram D with i = µ 1 − m − x vertices on the new boundary component F 1 . The decorated marked point on F 1 is set to be σ(q 1 L ) if i > 0. The map D → D is (2x + µ k )µ k -to-1, since m 1 can be any of the (2x + µ k ) vertices of the bigons on F 1 . Therefore we have the contribution Splitting the sum by writing 2x+µ k as (x+µ k )+x and setting m = x+µ k , we note that i + 2x = µ 1 − µ k becomes i + 2m = µ 1 + µ k and obtain (21) (c) There are x 1 bigons parallel toᾱF 1 α. This is the same as the previous case with F 1 and F k interchanged. The map D → D is µ 1 µ k -to-1, since the bigons now have µ 1 vertices on F 1 . Therefore we have the contribution: Writing µ 1 as (x + µ 1 ) − x and setting m = x + µ 1 , we note that i + 2x = µ k − µ 1 becomes i + 2m = µ 1 + µ k , and obtain Observe that the index set {i + 2m = µ 1 + µ k , m 1, i 0} is the disjoint union of index sets {i + 2m = µ 1 + µ k , 1 m min(µ 1 , µ k ), i 0}, {i + 2m = µ 1 + µ k , m µ k + 1, i 0}, and {i + 2m = µ 1 + µ k , m µ 1 + 1, i 0}. (If m µ k + 1 then µ 1 + µ k = i + 2m 2µ k + 2, hence µ 1 µ k + 2; similarly if m µ 1 + 1 then µ k µ 1 + 2. So the second and third sets are disjoint.) Dropping the subscript g, n − 1 from Q and X \ {1, k} from µ for convenience, we find that the sum of the expressions (20), (21) and (22) is (2) There is one totally boundary-parallel triangle and m − 1 bigons.
(a) The triangle has two edges parallel to α and the third edge parallel to αF kᾱ . See figure 11. The configuration of bigons and triangle is very similar to that of case (B)(1)(b), the only difference is the innermost bigon parallel to αF kᾱ now becomes the totally boundary-parallel triangle. There are x − 1 bigons parallel to αF kᾱ , 1 totally boundary-parallel triangle, and µ k − 1 bigons parallel to α. An analogous calculation shows we have the contribution (b) The triangle has two edges parallel to α and the third edge parallel tō αF 1 α. This is very similar to case (B)(1)(c). An analogous calculation shows we have the contribution (3) There are some mixed polygons and a totally boundary-parallel triangle. The edge of the triangle not parallel to α is then parallel to either αF kᾱ or αF 1 α; we consider the two possibilities separately.
(a) The third edge of the triangle is parallel to αF kᾱ . If we view F k as on the "inside" of an edge parallel to αF kᾱ , it is easy to see that only the "outermost" edge, γ 2 L on the minimal strip A 2 , can be an edge of a mixed polygon. Hence there is only one mixed polygon, and it is on the outside of γ 2 L . On the inside of γ 2 L we have exactly the same configuration of totally boundary-parallel polygons as Case (B)(2)(a) and figure 11. There are µ k − 1 bigons parallel to α. Let there be x − 1 bigons parallel to αF kᾱ , and i vertices on F 1 outside γ 2 L . Then µ 1 = i+2x+µ k +1 and m = x + µ k . We obtain a pruned polygon diagram D by removing all totally boundary-parallel bigons and triangles, cutting S along γ 2 L and collapsing γ 2 L into a new vertex on the new boundary component F 1 of S , which we set to be the decorated marked point m 1 . Consider the possible locations of m 1 . It can be a vertex on F 1 of any of the [(x − 1) + (µ k − 1)] bigons, of which there are 2(x − 1) + (µ k − 1). It can be either of the two vertices of the triangle on F 1 . Or it could be the vertex p 2 L , but not q 2 L , once again due to γ being an outgoing edge from m 1 . (If q 2 L is m 1 , then γ is γ 2 L . If γ 2 L is outgoing, then the polygon containing γ 2 L is on the inside of γ 2 L , making it totally boundary-parallel, a contradiction.) Since (2(x−1)+(µ k −1)+2+1)µ k = (2x+µ k )µ k , the map D → D is (2x+µ k )µ kto-1. An analogous calculation shows we have the contribution (b) The third edge of the triangle is parallel toᾱF 1 α. This is the same as the previous case with F 1 and F k interchanged. The map D → D is µ 1 µ k -to-1. An analogous calculation shows we have the contribution.
(4) There are some mixed polygons but no totally boundary-parallel triangles. We now split into cases accordingly as there are edges parallel to αF kᾱ orᾱF a α or not. There cannot be edges parallel to both, so we have 3 sub-cases.
(a) There are no edges parallel to αF kᾱ orᾱF 1 α. Consider the minimal strip A 1 containing all edges parallel to α. We now consider the leftmost and rightmost edges of this strip γ 1 L and γ 1 R , and to what extent they coincide. They may (i) be the same edge; or (ii) they may share both endpoints but be distinct edges; or they may share a vertex on (iii) F k or (iv) F 1 only; or they may be disjoint. When they are disjoint, (v) γ 1 L or (vi) γ 1 R or (vii) both may belong to mixed polygons. This leads to the seven sub-cases below. (i) We have γ 1 L = γ 1 R = γ. Then there are no other edges parallel to γ and thus no bigons. Since γ is an outgoing edge by assumption, it bounds a mixed polygon to the left. This configuration will be covered in Case (B)(4)(a)(v) and we do not include the contribution here.
(ii) The edges γ 1 L and γ 1 R are distinct but with the same endpoints. Then γ 1 L and γ 1 R bound the bigon A 1 and there are no other edges parallel to γ. This means there are no mixed polygons, contrary to assumption. Therefore the contribution vanishes in this case. = Figure 12: Configuration of polygons in case (B)(4)(a)(iii).
(iii) The edges γ 1 L and γ 1 R share a common vertex q 1 on F k but not on F 1 . See figure 12. Consider the boundary of A 1 on F k , [q 1 R , q 1 L ]. This interval could either be a single point q 1 , or the entire boundary F k . If it is a single point, then the polygon containing γ 1 L and γ 1 R has to be inside A 1 , so the diagonal joining p 1 L and p 1 R is boundary-parallel, contradicting the assumption of a pruned diagram. In the case [q 1 R , q 1 L ] is all of F k , γ 1 L and γ 1 R belong to a single "outermost" mixed polygon, and there are m − 1 bigons between F 1 and F k . Let i 0 be the number of remaining vertices on F 1 outside A 1 . Then i + µ k + 1 = µ 1 and we also have m = µ k . We obtain a pruned polygon diagram by removing all m − 1 bigons, cutting along the concatenated edge γ 1 L . Therefore we have the contribution (iv) The edges γ 1 L and γ 1 R share a common vertex p 1 on F 1 but not on F k . This is the same as the previous case with F 1 and F k interchanged.
The map D → D is µ 1 µ k -to-1. An analogous calculation shows we have the contribution (v) The edges γ 1 L and γ 1 R do not share any vertex, and γ 1 L belongs to a mixed polygon but γ 1 R does not. There are m − 1 1 bigons parallel to α. Let i = µ i + µ k − 2m be the total number of remaining vertices on F 1 and F k outside A 1 . We obtain a pruned polygon diagram D by removing all m − 1 bigons, cutting along γ 1 L and collapsing γ 1 L into a new vertex. The map D → D is mµ k -to-1. Note that if we allow m = 1, this exactly covers the configuration in case (B)(4)(a)(i). Therefore we have the contribution (vi) The edges γ 1 L and γ 1 R do not share any vertex, and γ 1 R belongs to a mixed polygon but γ 1 L does not. This is almost exactly the same as the previous case, except γ 1 R bounds a mixed polygon to the right, so it cannot be γ. It follows that m 1 cannot be p 2 R and the map D → D is (m − 1)µ k -to-1. Therefore we have the contribution: Note that we may allow m = 1 in the summation index because the summand vanishes for m = 1 anyway. (vii) The edges γ 1 L and γ 1 R do not share any vertex, and both belong to mixed polygons (possibly the same one). Since there could be 1 or 2 mixed polygons, we instead define m 2 to be 2 plus the number of bigons in A 1 . We obtain a pruned polygon diagram D by removing all m − 2 bigons, cutting the strip A 1 from S along γ 1 L and γ 1 R , and collapsing γ 1 L and γ 1 R into two new vertices. Set the decorated marked point to be the new vertex from collapsing γ 1 L . Again since γ cannot be γ 1 R , the map D → D is (m − 1)µ k -to-1. Therefore we have the contribution (again we trivially include m = 1 in the summation index) (b) There are some edges parallel to αF kᾱ . This is the same configuration as case (B)(3)(a), just without the single totally boundary-parallel triangle. An analogous calculation shows we have the contribution (c) There are some edges parallel toᾱF 1 α. This is the same configuration as case (B)(3)(b), just without the single totally boundary-parallel triangle. An analogous calculation shows we have the contribution We have exhausted all possibilities in case (B). The total contribution is the sum of all the expressions (23)-(34), which we now add together. We drop subscripts g, n − 1 from Q and X \ {1, k} from µ for convenience.
If µ k = 0, then there are only two possible configurations of partially boundaryparallel polygons. Either they form m bigons parallel to αF kᾱ , or they form m − 1 bigons and the outermost edge is parallel to αF kᾱ belongs to a mixed polygon. These two configurations respectively contribute the two terms of Adding a zero term to the first sum and reparametrising the second, this expression becomes This gives the third line of (13).
(C) The edge γ has both ends on S 1 , is separating, and does not cut off an annulus.
The configurations in this case are essentially identical to those in case (A), where γ is non-separating. Moreover the calculation is formally identical, since we simply substitute the expression Q g 1 ,|I|+1 ( , µ I ) Q g 2 ,|J|+1 ( , µ J ) in place of the expression Q g−1,n+1 ( , , µ X\{1} ) everywhere. We obtain the last line of (13).

The punctured torus case
With the recursion (13) of theorem 17 in hand, we now obtain the count of pruned polygon diagrams on punctured tori, using the established count for annuli in proposition 11. Then, using proposition 14, we obtain the count of general polygon diagrams.
Proof of theorem 5. We use induction on the negative Euler characteristic 2g − 2 + n. When 2g − 2 + n = 1, (g, n) = (0, 3) or (1, 1), and the theorem holds by propositions 11 and 18. Fix the parities/vanishings of (µ 1 , . . . , µ n ). We split the right hand side of the recursion of equation (13) for Q g,n into nine partial sums depending on the parities/vanishings of (i, j). We will show that each partial sum is a polynomial. Within each partial sum, since the parities/vanishings of (i, j, µ 1 , . . . , µ n ) are fixed, Q g−1,n+1 , Q g,n−1 , Q g 1 ,|I|+1 and Q g 2 ,|J|+1 are polynomials by the induction assumption. Split each polynomial into monomials in (i, j, µ 1 , . . . , µ n ). To show quasi-polynomiality and oddness it is sufficient to show that for (i, j) with fixed parities/vanishings, and for odd positive integers K and L, the following statements hold. (The degrees K and L remain odd by the inductive assumption.) 1. The expression A(µ 1 ) = i+j+m=µ 1 i 1,j,m 0 mi K j L is an odd polynomial in µ 1 .
For the first statement, we have Since i, j have fixed parities and K, L are odd, it follows from proposition 9 that A(µ 1 ) is an odd polynomial in µ 1 . A similar argument shows that C(µ 1 ) is an odd polynomial in µ 1 . As for B(µ 1 , µ 2 ), another application of proposition 9 shows that for some odd polynomial P (x), That P is odd then implies that B(µ 1 , µ k ) is odd with respect to both µ 1 and µ k .
the electronic journal of combinatorics 28(4) (2021), #P4.9 If we keep track of the degrees of the polynomials in Proposition 9, we see from the recursion of equation (13) that only the top degree terms in Q g,n−1 , Q g 1 ,|I|+1 and Q g 2 ,|J|+1 can contribute to the top degree component of Q (Xe,Xo,X ∅ ) g,n . Going through each term on the right hand side of (13), it is easy to verify by induction that • the degree of Q (Xe,Xo,∅) g,n is 6g − 6 + 3n (i.e. when X ∅ = ∅ and all variables µ 1 , . . . , µ n are nonzero), • the degree of Q (Xe,Xo,X ∅ ) g,n is at most 6g − 6 + 3n − |X ∅ | if X ∅ is non-empty.
Furthermore, since the leading coefficient of the resulting odd polynomial in Proposition 9 is independent of parities, it again follows by induction that for µ 1 , . . . , µ n 1, the top degree component of Q g,n (µ 1 , . . . , µ n ) is independent of the choice of parities of µ 1 , . . . , µ n .
Let [Q g,n (µ 1 , . . . , µ n )] top denote this common top degree component of the quasipolynomial Q g,n . More generally, we use [ · ] top to denote the top degree component of any polynomial. Then for positive µ 1 , . . . , µ n the recursion (13) truncates to We now compare the pruned polygon diagram counts Q g,n to the non-boundaryparallel (i.e. pruned) arc diagram counts N g,n of [9]. We observe from the following two theorems that N g,n satisfies some initial conditions and recursion similar to those of Q g,n .
Furthermore the leading coefficients of N g,n encode intersection numbers of psi-classes on the compactified moduli space of curves M g,n .
Proposition 24. The multidifferential ω Q g,n is the pullback of ω P g,n under the maps This result gives a way to relate the enumeration P g,n introduced in this paper with its pruned counterpart Q g,n at the level of generating functions and its proof relies on proposition 14. Although the relation appears rather succinct in this language, it is not clear how one could use it to easily bypass the intricate combinatorics involved in the proof of theorem 17. For instance, one can observe that using proposition 14 to replace all instances of P g,n in the recursion of theorem 4 with expressions involving Q g,n does not immediately reproduce the recursion of theorem 17.

A Proofs of combinatorial identities
We now give elementary proofs of the statements from section 2.
Recall proposition 8 states that for positive odd k 1 , k 2 and fixed parities of i 1 , i 2 , the sum of i k 1 1 i k 2 2 over i 1 , i 2 1 such that i 1 +i 2 = n is an odd polynomial of degree k 1 +k 2 +1, with leading coefficient independent of choice of parities.
Proof of proposition 8. Let S k (n), S e k (n), S o k (n) be the k-th power sum, the even k-th power sum and the odd k-th power sums: Let B i denote the i-th Bernoulli number with the convention B 1 = − 1 2 . The standard generating function argument leading to Faulhaber's formula can also be used to show that S e k (n) = n k + 1 2(k + 1) S o k (n) = n k + 1 2(k + 1) Since the odd Bernoulli numbers are zero except B 1 = − 1 2 , equations (49), (50), and (51) imply that S e k (n) and S o k (n) are even or odd polynomials depending on the parity of k + 1, with the possible exception of the constant term and the n k term. The coefficient of n k in S e k (n) is 1 2 if n is even and 0 otherwise. The coefficient of n k in S o k (n) is 1 2 if n is odd and 0 otherwise. If n is even, then the constant terms in S e k (n) and S o k (n) are both 0. If n is odd, then the constant terms in S e k (n) and S o k (n) are ±C k := ± 1 2(k + 1) Observe that C k /k! is the coefficient of x k in ( e x −1 2x )( 2x e 2x −1 ) = 1 e x +1 . Since 1 e x +1 + 1 e −x +1 = 1, C k = 0 for positive even k.