\section{Introduction}

An important tool in studying the moduli space of (meromorphic) abelian differentials $\bP\Omega\cM_g(\mu)$ is its modular compactification, the space of multi-scale differentials $\LMS$ for $\mu$ an integer partition of $2g-2$.
The boundary is of a combinatorial nature, parametrised, for any $\mu$, by finitely many labeled \emph{level graphs} \cite{LMS}.
However, already listing isomorphism classes of these graphs is a non-trivial task, and already for $g=3$ the number of components becomes so large that even listing them is unfeasible by hand.

Moreover, in \cite{strataEC} the tautological ring of $\LMS$ is described and calculations therein may be expressed purely in terms of the combinatorics of the boundary. 
Again, even the simplest calculations are extremely cumbersome to perform without the assistance of a computer.

The \verb|diffstrata| package provides a framework for calculations in the tautological ring of $\LMS$.
It is implemented in \verb|sage| \cite{sage} and is inspired by the package \verb|admcycles| \cite{admcycles} for calculations in the tautological ring of $\overline{\cM}_{g,n}$.
However, due to the differences in the structure of the boundary, the implementation and interface of the two packages have only little in common.
{A key step in the evaluation process is performed by \texttt{admcycles}, though.}

\verb|diffstrata| may be used naively for basic inquiries about strata. The following example contains the complete code required to calculate the (orbifold) Euler characteristic of $\bP\Omega\cM_{2}(2)$ (using \cite{strataEC}):
\begin{lstlisting}
sage: from admcycles.diffstrata import *
sage: X=Stratum((2,))
sage: X.euler_characteristic()
-1/40
\end{lstlisting}
We can also easily display information on the compactification of a stratum:
\begin{lstlisting}
sage: from admcycles.diffstrata import *
sage: X=Stratum((2,2))
sage: X.info()
Stratum: (2, 2)
with residue conditions: []

Genus: [3]
Dimension: 6
Boundary Graphs (without horizontal edges):
Codimension 0: 1 graph
Codimension 1: 20 graphs
Codimension 2: 86 graphs
Codimension 3: 147 graphs
Codimension 4: 110 graphs
Codimension 5: 30 graphs
Total graphs: 394
\end{lstlisting}
Moreover, we can compute the Masur--Veech volume as an intersection number of $\xi$-powers and $\psi$-classes, cf. \cite{CMSZ}:
\begin{lstlisting}
sage: from admcycles.diffstrata import *
sage: X=Stratum((1,1))
sage: (X.xi^2 * X.psi(1) * X.psi(2)).evaluate()
-1/720
sage: (X.xi^3 * X.psi(1)).evaluate()
-1/360
\end{lstlisting}
However, more extensive calculations necessarily require a deeper understanding of the syntax and the underlying objects of the package.

The most fundamental notion is that of an \emph{(enhanced) profile}, encoding isomorphism classes of level graphs using tuples of integers (essentially writing them as products of divisors).
It is explained in detail in \autoref{sec:AllGraphs} together with the algorithms used to list all boundary components.
This notion is used by \verb|diffstrata|, together with an encoding of $\psi$-polynomials, to encode all additive generators of the tautological ring and all calculations performed involve (formal) sums of these.

Implementing the recursive structure of the boundary, even when considering holomorphic strata, disconnected meromorphic strata with residue conditions will appear as levels of level graphs. 
To encode these, we use \emph{Generalised Strata}, as introduced in \cite{strataEC}. 
These may be thought of as container objects, where the graphs are stored and the calculations performed.

However, implementing any formula in the tautological ring will require some understanding of the subtleties surrounding enhanced profiles and the degeneration of level graphs, as well as extracting levels from graphs and working with these.
In \autoref{subsec:ec} we discuss, as an example, the implementation of the formula for the Euler characteristic using level-wise evaluations of top powers of the tautological class $\xi$, cf. \cite{strataEC}.


\addsubsection{Algorithmic aspects}

Implementing the compactification $\LMS$ poses a series of challenges not encountered in the boundary of $\overline{\cM}_{g,n}$.
First, constructing all level graphs satisfying precisely the conditions of \cite[Def.~1.1]{LMS} is a non-trivial problem.
While generating a codimension-one degeneration of a stable graph inside $\overline{\cM}_{g,n}$ is straight-forward (add an edge either as a loop or by splitting a vertex subject to the stability condition), for a \emph{level graph} this is the more subtle problem of \emph{splitting a level}.

To solve it, we must construct all divisors in any \emph{generalised} stratum, i.e. meromorphic, disconnected and with residue conditions, as these appear as levels already inside low-genus holomorphic strata. Since all the calculations
of the Chern classes of the logarithmic cotangent bundle and in particular
of the Euler characteristic (\cite{strataEC}) and also the computation of
Masur-Veech volumes (\cite{CMSZ}) happen in the tautological ring defined
by clutching
of \emph{non-horizontal divisors}, the \texttt{diffstrata} package treats
exclusively graphs without horizontal edges. See \cite[Section~8]{strataEC}
for other candidates of tautological rings that are potentially
larger but might actually agree with the tautological ring used here.
\par
We usually refer to two-level graphs for brevity as BICs (\emph{bicoloured
  graphs}, as in \cite{FP}).

The combinatorics arising from the distribution of point orders, level structures, genera and edges leads to the simplest approach, namely considering all enhanced level structures on stable graphs in $\overline{\cM}_{g,n}$ (e.g. using \verb|admcycles|), being too slow even for low-dimensional holomorphic strata.
Instead, we describe an algorithm for directly generating all BICs in a generalised stratum in detail in \autoref{subsec:bicgeneration}.

Moreover, this requires checking the Global Residue Condition (GRC), discovered in \cite{BCGGM}, for generalised strata, i.e. implementing the $\frakR$-GRC \cite[\S4]{strataEC}.
For this, we refine the combinatorial criterion of \cite{MUW} to work for the $\frakR$-GRC in \autoref{sec:GenStrata}.

Having generated all BICs, this allows us to construct any graph by recursively  clutching BICs (one for each level-crossing).
As a by-product, this yields discrete coordinates for the enhanced level graphs, as any graph splits uniquely into a product of distinct BICs: we therefore number the BICs of a stratum and associate to each level graph its \emph{profile}, the tuple of indices of BICs appearing as levels of this graph.
Unfortunately, this is not always injective: profiles may be reducible and we need an \emph{enhanced profile} to refer to a graph uniquely, see \autoref{subsec:degenerations} for details.

However, when multiplying two tautological classes, we require an implementation of the excess intersection formula for $\LMS$ \cite[\S 8]{strataEC} and this requires a good understanding of the degeneration graph of the boundary components.
Here again the notion of profile is key: it allows us to efficiently determine which graphs appear as degenerations and is essential in the computation of normal bundles and general intersections, see \autoref{sec:mult}.

Finally, even in low-genus holomorphic strata, calculations involving top-classes of the tautological ring are only feasible because we use extensive caching.
Again, our ability to replace graphs by enhanced profiles is essential, but already the higher-dimensional strata in genus three require more techniques to become manageable, see \autoref{sec:caching}.
Also, several computed values are written to files so that they can be easily reused between \verb|sage| sessions and may be easily precomputed on another machine and imported into the current session, see \autoref{subsec:files}.


\addsubsection{Open questions}

For the moduli space of (pointed) curves~$\barmoduli[g,n]$ enumerating the boundary
strata, also known as tropical curves, and providing a tight estimate for their
growth rate has been discussed at various places (\cite{ChanCombTT},
\cite{MPstablegraph}), but we are aware of a complete solution only in genus
zero (\cite{McMgenuszero}).
It seems interesting to address the analogous problem in $\LMS$, to count the
number of boundary strata of at least provide tight estimates for
their number. Some tables are given in Section~\ref{sec:AllGraphs} for the
number of graphs without horizontal nodes. Such estimates
would also be the basis for serious runtime analysis of the algorithms in
\verb|diffstrata|.\footnote{In practice, one runs out of memory before speed becomes a serious issue: Calculations in genus four take several hours but need several TB of RAM.}
\par
Related to this problem is the question of determining the number of components
of enhanced profiles for a given profile. There are obvious coarse upper bounds
for this number, but in practice the number is relatively small in average
(for fixed~$\mu$ and codimension). Can this be proven? On the algorithmic
side, it would be useful
to design an algorithm that implements directly the degeneration of enhanced
profiles. This could avoid the generation of the graphs altogether an lead
to significant speed-up.
\par
The alternating sum of the number of enhanced profiles appear to be zero
for all holomorphic strata (we thank A.~Neitzke for observing this during
a talk!). Can this be proven? Moreover, the same appears to hold for the number of
profiles, although the degeneration process of this is a main source of
the complexity of the algorithm, see \autoref{subsec:degenerations}.

\addsubsection{Installation}

The package \verb|diffstrata| is included with \verb|admcycles| version~$1.1$ or greater. See \cite{admcycles} for a detailed guide to installing it.

From now on, all examples will assume that the line
\begin{lstlisting}
sage: from admcycles.diffstrata import *
\end{lstlisting}
has been executed!


\addsubsection{Structure}

We begin by giving an overview of the package interface for the ``casual user'' in \autoref{sec:interface}, before explaining the implementation in more detail.
In \autoref{sec:GenStrata} we start by reviewing some of the mathematical background. 
In \autoref{sec:LG}, we explain the fundamental objects of \verb|diffstrata| and how they relate to their mathematical counterparts. The algorithms to construct all non-horizontal level graphs as well as determining the degeneration graph of a stratum and computing isomorphisms of graphs are described in \autoref{sec:AllGraphs}. \autoref{sec:AGs} explains how \verb|diffstrata| encodes and evaluates (using \verb|admcycles|) tautological classes on strata and in \autoref{sec:mult} the implementation of the excess intersection formula is discussed. In \autoref{clutching} the subtleties around splitting graphs around a level and clutching are discussed and the recursive evaluation of $\xi$ on levels is explained. Finally, in \autoref{sec:caching} we explain how and which computations are cached by \verb|diffstrata| and how to import pre-computed values and end in \autoref{sec:tests} by illustrating how \verb|diffstrata| calculates Euler characteristics and giving a few examples of cross-checks and tests.


\addsubsection{Acknowledgements}

We thank Vincent Delecroix and Johannes Schmitt for many helpful suggestions for implementing this package. We are also grateful to the
Mathematical Sciences Research Institute (MSRI, Berkeley)
and the Hausdorff Institute for Mathematics (HIM, Bonn),
where significant progress on this project was made during their programs
and workshops. The authors thank the MPIM, Bonn, for hospitality
and support for \cite{sage} computations. 
\par
\medskip


\def\listtheoremname{List of Algorithms}
\listoftheorems[ignoreall,show={algorithm}]
{"config": "arxiv", "file": "2006.12815/sec_intro.tex"}