1 Introduction

Persistent Homology (PH) is a computable descriptor of shape (Edelsbrunner and Harer 2008; Zomorodian and Carlsson 2005) with diverse applications in scientific domains where topology is prominent, e.g. analysing graphs and simplicial complexes \(K\). Given a function \(f:K\rightarrow \mathbb {R}\), one assembles the homology groups of the sub complexes \(f^{-1}((-\infty ,t])\) into a module which is faithfully represented by a so-called barcode \(D=\textrm{PH}(f)\). Using vectorization methods (Adams et al. 2017; Bubenik 2015) the topological information of the barcode can then be used in statistical studies and machine learning problems.

Unlike discrete valued topological invariants like Betti numbers, Persistent Homology reacts in a Lipschitz continuous manner to perturbations in the input data. This feature of \(\textrm{PH}\), known as the Stability Theorem (Cohen-Steiner et al. 2007), is one of the key reasons for its successful application to problems in various domains including neuroscience (Bendich et al. 2016), material sciences (Hiraoka et al. 2016), signal analysis (Perea and Harer 2015), shape recognition (Li et al. 2014), or machine learning (Chen et al. 2019.

The key property which is complementary to stability is the discriminative power of Persistent Homology, i.e. whether it is able to differentiate distinct inputs. Although it is clear that \(\textrm{PH}\) is not injective in general, the precise measure of failure of injectivity and of the discriminative power of \(\textrm{PH}\) is captured by the following inverse problem: what are the different functions f giving rise to the same barcode \(D=\textrm{PH}(f)\)? Equivalently, we are interested in understanding the fiber \(\textrm{PH}^{-1}(D)\) over a target barcode D.

The fiber \(\textrm{PH}^{-1}(D)\) was first studied in the case of continuous functions f over the unit interval (Curry 2018), where the number of connected components was established. The tools developed in Catanzaro et al. (2020) allow one to derive conjectures on the number of connected components in the case of Morse functions on the 2-sphere, while higher homotopy groups of \(\textrm{PH}^{-1}(D)\) for Morse functions on 1-dimensional and 2-dimensional manifolds were computed in Leygonie and Beers (2022).

Less is known about \(\textrm{PH}^{-1}(D)\) for discrete, combinatorial data structures, such as graphs and simplicial complexes \(K\), which arise in applications. To the best of our knowledge, the fiber \(\textrm{PH}^{-1}(D)\) has only been determined (up to homotopy) in the case of functions f defined by their values on vertices, when \(K\) is a subdivision of the unit interval (Cyranka et al. 2020) or of the circle (Mischaikow and Weibel 2021), for which each component of \(\textrm{PH}^{-1}(D)\) was shown to be contractible and circular respectively.

For general simplicial complexes, prior work (Leygonie and Tillmann 2021) has shown the fiber to be the geometric realization of a polyhedral complex; each polytope represents the restriction of the fiber to strata of the space of filters. Similarly the space of barcodes is given a stratification, and \(\textrm{PH}^{-1}(D)\) is piecewise-affinely isomorphic to \(\textrm{PH}^{-1}(D')\) for any \(D, D'\) that belong to the same barcode stratum.

However, understanding the fiber \(\textrm{PH}^{-1}(D)\) remains a challenge in general. In particular, computing examples to generate new intuition quickly becomes intractable by hand even on small complexes \(K\), because \(\textrm{PH}^{-1}(D)\) explodes in size. This motivates the design of a computerized calculation, in order to offer a range of new examples with which to test hypotheses and detect new patterns, thus contributing to the growth of theory.

In this paper we propose an algorithmic approach to compute the fiber of the persistence map \(\textrm{PH}\), for an arbitrary finite simplicial complex \(K\), over an arbitrary barcode D. We then generalize this approach to include arbitrary finite CW complexes, restricted families of filters (such as lower-star filters), and three related constructions: persistent cohomology, persistent relative cohomology, and persistent relative homology.

Outline of contributions In Sect. 1, we introduce elementary material from Persistence Theory, and we recall how the fiber \(\textrm{PH}^{-1}(D)\) naturally decomposes into a finite polyhedral complex. We also provide an independent, additional motivation for studying the fiber \(\textrm{PH}^{-1}(D)\), namely that it can be used to determine the collapsiblity of a contractible complex, a central notion in Simple Homotopy Theory.

In Sect. 2, we define the key data structure used in our method: that of canonical simplicial enumerations (\(\textrm{CSE}\)). From a high-level perspective, a canonical simplicial enumeration is simply an ordering of the simplices of \(K\). We show that each polytope in the fiber \(\textrm{PH}^{-1}(D)\) can be represented by at least one \(\textrm{CSE}\), and that the number of possible \(\textrm{CSE}\) is finite. This transforms the task of computing \(\textrm{PH}^{-1}(D)\) into a finite combinatorial problem.

The algorithm, presented in Sect. 3, lists all polytopes in the fiber \(\textrm{PH}^{-1}(D)\) by performing a depth-first search on a certain graph theoretic tree, \(\mathcal {T}(K)\), whose leaves are the \(\textrm{CSE}\). Once this elementary approach is formalized, we describe several heuristics to avoid exploring the whole tree, hence improving performance.

In Sect. 4, we extend the polyhedral structure theorem for the fiber \(\textrm{PH}^{-1}(D)\) from finite simplicial complexes to arbitrary finite-dimensional based chain complexes, as well as finite CW complexes, delta complexes, and cubical complexes. We show how this theory adapts from the regime of arbitrary filters to that of lower-star and lower-edge filters, in addition. In “Appendix A”, we show that it extends to persistent co-homology and relative (co)-homology. Our algorithm accommodates each of these extensions.

In Sect. 5 we apply a computer implementation of the algorithm to a variety of complexes and barcodes, and report statistics about the fiber \(\textrm{PH}^{-1}(D)\), such as the number of polytopes and Betti numbers. Unexpectedly, we observe that most of the properties observed for the 1-dimensional complexes studied in Cyranka et al. (2020); Leygonie and Tillmann (2021); Mischaikow and Weibel (2021) fail for more general complexes. For instance, a space as simple as the triangulated 2-sphere admits a fiber \(\textrm{PH}^{-1}(D)\) with non-trivial homology in degree 3, which appears to stand at odds with the existing examples of graphs, for which \(\textrm{PH}^{-1}(D)\) has vanishing homology in dimension greater than 1. We also find CW complexes which are topological manifolds, for example the real projective plane, which admit fibers that are not manifolds.

While supplying a variety of informative counterexamples, the algorithm also allows us to observe novel trends that hold consistently across examples: for instance, for each simplicial complex \(K\) we identify a specific barcode \(D_{K}\) such that the fiber \(\textrm{PH}^{-1}(D_{K})\) and \(K\) share identical Betti numbers (see conjecture 1).

Our code is publicly available at Leygonie and Henselman-Petrusek (2022).

Related works Algorithmic reconstruction procedures have been designed for a variety of related inverse problems. For instance, instead of taking a single function, the Persistent Homology Transform (PHT) computes the barcodes of a family of functions over a fixed shape in \(\mathbb {R}^3\), which is enough to completely characterise this shape (Turner et al. 2014). See Curry et al. (2018), Ghrist et al. (2018) for generalisations to higher dimensions. These and other results motivated the design of algorithms to reconstruct the complex \(K\) from the associated family of barcodes Betthauser (2018), Fasy et al. (2019).

2 Background

We fix a finite simplicial complex \(K\) of dimension \(\textrm{dim }K\) and with \(\sharp K\) many simplices. Throughout, simplicial homology is taken with coefficients in a fixed field \(\mathbb {k}\). A filter over \(K\) is a map \(f:K\rightarrow \text {I}\) valued in a compact interval \(\text {I}\subset \mathbb R\), whose sublevel sets are subcomplexes of \(K\). If we regard \(K\) as a poset partially ordered by face inclusions \(\sigma \subseteq \sigma '\), then \(f\) can be regarded, equivalently, as an order-preserving function into \(\text {I}\). Viewed as a subset of the Euclidean space \(\mathbb {R}^K\) of real-valued functions on \(K\), the set of filters is a polytope obtained by intersecting the cube \(\text {I}^K\) with the half-spaces \(\{f\in \mathbb {R}^K\mid f(\sigma )\le f(\sigma ') \}\), ranging over face inclusion \(\sigma \subseteq \sigma '\).

For each homology degree \(0\leqslant p \leqslant \textrm{dim }K\), we have a (finite-dimensional) persistent homology module arising from the sub-level sets of f. The isomorphism type of each module of this form is uniquely determined by the associated barcode \(\textrm{PH}_p(f)\); concretely, the barcode is a finite multi-set of pairs (bd) with \(-\infty< b < d \le +\infty \), called intervals, each of which characterizes the appearance and annihilation of a p-dimensional homological cycle in the filtration. For further details, see Zomorodian and Carlsson (2005), Edelsbrunner and Harer (2010).

The persistence map \(\textrm{PH}\) takes a filter f and returns the \(\textrm{dim }K+1\) barcodes of interest:

$$\begin{aligned} \textrm{PH}: f\in \textrm{Filt}(K) \longmapsto \big (\textrm{PH}_0(f),\textrm{PH}_1(f),\ldots , \textrm{PH}_{\textrm{dim }K}(f)\big ). \end{aligned}$$

For simplicity, we will refer to a tuple of barcodes \(D=(D_0,D_1,\ldots ,D_{\textrm{dim }K}) \) simply as a barcode. We also abuse notation and write \((b,d)\in D\) whenever \((b,d)\in D_p\) for some \(0\le p\le \textrm{dim }K\).

Our goal is to compute the fiber \(\textrm{PH}^{-1}(D)\), i.e. the set of filters with a given barcode D:

$$\begin{aligned} \textrm{PH}^{-1}(D)=\bigg \{ \text {filters } f:K\rightarrow \text {I}\mid \textrm{PH}(f)=D \bigg \}. \end{aligned}$$

2.1 The algorithm computing persistent homology

Algorithm 1 below computes the barcode \(D=\textrm{PH}(f)\) of a filter. For this, it requires the extra structure of a simplicial enumeration, which can be thought of as an ordering of the simplices of \(K\) compatible with the values of \(f\).Footnote 1

Definition 1.1

A simplicial enumeration (\(\textrm{SE} \)) of \(K\) consists of a strictly increasing sequence \(t_1< \cdots < t_m\) valued in the interval \(\text {I}\) and, for each \(t_i\), a nonempty sequence of simplices \(\sigma _\bullet ^{t_i} = (\sigma ^{t_i}_1, \sigma ^{t_i}_2, \ldots )\). We denote this object by

$$\begin{aligned} \sigma _\bullet ^\bullet = (\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_m}). \end{aligned}$$

We require, in addition, that each simplex in \(K\) appears in the concatenated sequence \(\sigma _\bullet = \sigma _\bullet ^{t_1} * \cdots * \sigma _\bullet ^{t_m}\) exactly once, and that each set of form \(\{\sigma _1, \ldots , \sigma _k\}\) be a subcomplex of \(K\).

A partial simplicial enumeration (PSE) is a simplicial enumeration of a subcomplex of \(K\).

Definition 1.2

The filter induced by a \(\textrm{SE} \) \(\sigma _\bullet ^\bullet \) is the function \(f[\sigma _\bullet ^\bullet ]\) sending each element to its superscript, i.e.

$$\begin{aligned} f[\sigma _\bullet ^\bullet ](\sigma ^{t_i}_j) = t_i. \end{aligned}$$

The barcode of \(\sigma _\bullet ^\bullet \) is \(\textrm{PH}(\sigma _\bullet ^\bullet ):= \textrm{PH}(f[\sigma _\bullet ^\bullet ])\).

Algorithm 1
figure a

The barcode of a simplicial enumeration

Algorithm 1 below computes the barcode \(\textrm{PH}(\sigma _\bullet ^\bullet )\) of a \(\textrm{SE} \) \(\sigma _\bullet ^\bullet \) in two main steps:

  1. 1.

    Reduce the boundary matrix \(R=\partial \) of \(K\) progressively, iterating over simplices \(\sigma _i\), naturally ordered by \(\sigma _\bullet ^\bullet \). For each simplex \(\sigma _i\), the column indexed by \(\sigma _i\) is used to reduce columns on the right in the boundary matrix.

  2. 2.

    Extract the barcode from the reduced matrix R. This is done by pairing simplices together: if the column of \(\sigma _i\) is zero, then the simplex is unpaired, otherwise it is paired with \(\sigma _j\), where j is the i-th column’s lowest non-zero entry. From there, we deduce the barcode \(\textrm{PH}(\sigma _\bullet ^\bullet )\) by applying the filter \(f=f[\sigma _\bullet ^\bullet ]\) to the pairing of simplices: we get intervals \((f(\sigma _i), +\infty )\) for unpaired simplices, and intervals \((f(\sigma _i), f(\sigma _j))\) for paired simplices.

Theorem 1.3

Algorithm 1 is correct.

Proof

By abuse of notation, let us regard \(\partial \) as a matrix in \(\mathbb {k}^{\# K\times \# K}\) such that \(\partial [i,j] = \partial [\sigma _i, \sigma _j]\).

We refer to the index i defined in Line 11 as the low index of column j. By construction, the barcode D has (A) one interval \((f(\sigma _i), f(\sigma _j))\) for every pair (ij) such that i is the low index of column j and \(f(\sigma _i)<f(\sigma _j)\), and (B) one interval \((f(\sigma _k), +\infty )\) for every k such that and no column \(\sigma _j\) has low index equal to k, and \(R[:,k]=0\). By the Pairing Uniqueness Lemma (Cohen-Steiner et al. 2006), it therefore suffices to show that (i) there exists an invertible upper triangular matrix V such that \(R = \partial V\), and (ii) R is reduced, in the sense that the lowest nonzero entry in each non-zero column is distinct.

The existence of V follows from the fact that every time we perform a clearing operation, we add a column from left to right. To verify condition (ii), fix any two non-zero columns \(R[:,j], R[:,j']\) such that \(j < j'\), and suppose that i is the low index of R[ : , j]. Then by construction \(R[i,j']=0\), because Algorithm 1 will have cleared entry \(R[i,j']\) on the j-th iteration of the for-loop starting on Line 3. The desired conclusion follows. \(\square \)

2.2 Polyhedral structure of \(\textrm{PH}^{-1}(D)\) for simplicial complexes

A (compact) polytope in \(\mathbb {R}^K\) is a (compact) subset of \(\mathbb {R}^K\) which can be expressed as the intersection of finitely many closed affine half-spaces. A finite set of polytopes \(\mathcal {P}\) is a polyhedral complex if for each polytope \(\mathcal {P}_i\in \mathcal {P}\), the faces of \(\mathcal {P}_i\) belong to \(\mathcal {P}\) as well, and if, furthermore, any two polytopes \(\mathcal {P}_i,\mathcal {P}_j\in \mathcal {P}\) intersect at a common face. The underlying space of \(\mathcal {P}\) is \(\vert \mathcal {P}\vert = \bigcup _{\mathcal {P}_i \in \mathcal {P}} \mathcal {P}_i\).

Next we describe how to make the fiber \(\textrm{PH}^{-1}(D)\) into a polyhedral complex.

Let \(f\) be a filter with barcode D. The set of all endpoints of intervals in D is

$$\begin{aligned} \textrm{End}(D) = \{ b \mid (b,d) \in D \text { for some } d \} \cup \{ d \mid (b,d) \in D \text { for some } b \} \subseteq \mathbb {R}\sqcup \{+\infty \}. \end{aligned}$$

Set \(\textrm{End}^*(D) = \textrm{End}(D) \backslash \{\infty \}\) and write \(\dim D = \# \left( \textrm{End}^*(D) \right) \) for the number of finite endpoints. By normalizing, we can ensure that the finite endpoints of D are consecutive integers. For convenience, we assume w.l.o.g. that this is the case in the rest of the paper:

$$\begin{aligned} \textrm{End}^*(D)= \bigg \{1, \ldots , \dim D \bigg \}. \end{aligned}$$

For instance, the barcode D with 4 intervals (in possibly different homology degrees) (1, 2), (1, 3), (2, 3) and \((2,+\infty )\) has bounded endpoint values forming the set \(\{1,2,3\}\), and in particular D has dimension 3.

The barcode D being fixed, for convenience we will also assume in the remainder of the paper w.l.o.g. that filters map into the interval:

$$\begin{aligned} \text {I}= [1,\dim D+1]. \end{aligned}$$

Definition 1.4

A filter \(g\in \text {I}^K\) specializes a filter \(f\in \text {I}^K\), written \(f\vdash g\), if for each simplex \(\sigma \in K\)

  • \(f(\sigma ) \in \mathbb {N}\implies g(\sigma ) = f(\sigma )\), and

  • \(f(\sigma ) \le f(\sigma ') \implies g(\sigma ) \le g(\sigma ')\).

The polytope of \(f\) is the family of filters that specialize \(f\):

$$\begin{aligned} \mathcal {P}(f):= \{ g\in \text {I}^K\mid \, \, f\vdash g\} \subseteq \text {I}^{K}. \end{aligned}$$

Likewise, the polytope of a simplicial enumeration \(\sigma _\bullet ^\bullet \) is \(\mathcal {P}(\sigma _\bullet ^\bullet ): = \mathcal {P}(f[\sigma _\bullet ^\bullet ])\), c.f. Definitions 1.1 and 1.2.

We write \(\Delta _{k}\) for the standard geometric simplex of dimension k, and define \(\eta _i(f) = \Im (f) \cap (i,i+1)\) to be the elements of the image of \(f\) that lie in the open interval \((i,i+1)\).

Theorem 1.5

(Leygonie and Tillmann 2021, Theorem 2.2) Let \(f\) be a filter with barcode D. Then

  • The set \(\mathcal {P}(f)\) is a subset of the fiber \(\textrm{PH}^{-1}(D)\). In particular, \(f\vdash g\) implies \(\textrm{PH}(g) = D\).

  • The set \(\mathcal {P}(f)\) is a polytope of dimension \(\# \left( \Im (f){\setminus } \mathbb {N}\right) \), which is affinely isomorphic to the product 

    $$\begin{aligned} \Delta _{\# \eta _1(f)} \times \cdots \times \Delta _{\# \eta _{\dim D}(f)} \end{aligned}$$
  • The family of polytopes \(\big \{ \mathcal {P}(f) \mid f\in \textrm{PH}^{-1}(D) \big \}\) is a polyhedral complex.

In Sect. 4 we extend Theorem 1.5 to CW complexes and more generally to based chain complexes.

2.3 Relations to Simple Homotopy Theory

In this section we detail an independent motivation for studying \(\textrm{PH}^{-1}(D)\) coming from Simple Homotopy Theory. Namely, we show that collapsibility of a complex \(K\), which is a combinatorial and stronger notion of contractibility, is equivalent to the condition that \(\textrm{PH}^{-1}(D)\) be non-empty, for some appropriately selected barcode D. In particular, it would be possible use the algorithm detailed in later sections for computing \(\textrm{PH}^{-1}(D)\) to determine if \(K\) is collapsible.

A simplex \(\tau \in K\) is a free face if there exists a unique simplex \(\sigma \) such that \(\tau \subsetneq \sigma \). The operation of removing \(\tau \) and \(\sigma \) is called an elementary collapse, and we write \(K\searrow L\) to indicate that \(L=K\setminus \{\tau \subseteq \sigma \}\) is the resulting complex. Finally, \(K\) is collapsible if there is a sequence of elementary collapses from \(K\) to one of its vertices:

$$\begin{aligned} K=L_n\searrow L_{n-1} \searrow L_{n-2} \searrow \cdots \searrow L_1 \searrow L_0=\{v\}. \end{aligned}$$

Collapsibility implies contractibility but the reverse is false: the dunce hat and the house with two rooms are instances of contractible 2-complexes that are not collapsible. To detect the collapsibility of a contractible complex, first note that the number of simplices in \(K\) must be odd. We then look at the K-elementary barcode of \(K\), that is, the barcode \(D_K\) with 1 infinite bar \((1,+\infty )\) in dimension 0 followed by \(\frac{\sharp K-1}{2}\) non-overlapping intervals \((2i,2i+1)\), for \(1\le i \le \frac{\sharp K-1}{2}\).

Proposition 1.6

Let \(K\) be a contractible complex. Then \(K\) is collapsible if and only if it has an odd number of simplices, and and \(\textrm{PH}^{-1}(D_K)\) is nonempty.

Proof

Suppose \(K\) is collapsible. Then there exists a sequence \(K=L_n\searrow L_{n-1} \searrow L_{n-2} \searrow \cdots \searrow L_1 \searrow L_0=\{v\}\), where \(n=\frac{\sharp K-1}{2}\). Define \(\tau _i\) and \(\sigma _i\) such that \(L_{i+1}=L_i\cup \{\tau _i\subseteq \sigma _i\}\), and define a filter \(f\) by the condition that \(f(v):=1\)\(f(\tau _i):=2i\), and \(f(\sigma _i):=2i+1\). Set \(D:=\textrm{PH}(f)\).

Because \(f\) is injective, \(\textrm{End}^*(D) = \{1,\cdots , 2n+1\}\). Furthermore, because \(K\) is contractible, D has a unique unbounded interval \((1,+\infty )\) in degree 0. The remaining n intervals are bounded. Since \(L_{i} \hookrightarrow L_{i+1}\) is a homotopy equivalence for any \(0\le i<n\), we have for each \(0\le p \le \dim K\) an isomorphism \(\textrm{H}_p \left( \{ \sigma \mid f(\sigma ) \le 2i+1\} \right) \rightarrow \textrm{H}_p(\{ \sigma \mid f(\sigma ) \le 2i+3\})\). This implies that no bounded interval of D ends at an even value \(2i+2\). Because no two bars share an endpoint, it follows by inclusion–exclusion that the n bounded intervals of D all start at even values and end at odd values. Let \((b_1,3)\in D\) be the bounded interval which ends at 3. Since \(b_1\) is even and \(1\le b_1<3\), we have \(b_1=2\). It follows by a simple induction that all bounded intervals of D have form \((2i,2i+1)\). Thus \(D = D_K\).

Conversely, suppose that \(K\) admits a filter \(f\) with barcode \(D_K\). Since D has exactly \(\sharp K\) distinct finite endpoint values, f establishes a bijection \(v\mapsto 1\), \((\tau _i,\sigma _i)\mapsto (2i,2i+1)\), from simplices of \(K\) to these endpoints. In particular \(\tau _n\) and then \(\sigma _n\) are the last two simplices to enter the sub-level set filtration of f, so that \(\sigma _n\) is a maximal face and no other simplex can contain \(\tau _n\). However \(\sigma _n\) itself contains \(\tau _n\) because the homological cycle created by \(\tau _n\), whose dimension \(\dim \tau _n= \dim \sigma _n -1\) equals the dimension of the interval \(\dim (2n,2n+1)\) in \(D_K\), becomes a boundary when adding \(\sigma _n\) in the filtration. Thus removing \(\tau _n\) and \(\sigma _n\) defines an elementary collapse, and we conclude by induction. \(\square \)

3 Data structures

Because computing infinitely many simplicial enumerations \(\sigma _\bullet ^\bullet \) with barcode D is impossible, we first make the problem finite in Sect. 2.1. In particular, we show that computing all polytopes in \(\textrm{PH}^{-1}(D)\) reduces to an exhaustive search over a finite set of canonically defined simplicial enumerations. These enumerations naturally fit into a graph theoretic tree which is defined in Sect. 2.2, and which our algorithm (developed in §3) will explore in a depth-first search manner.

3.1 Making the problem finite

Our first task is to define a simple rule for selecting a unique point from the relative interior of each polytope. There are many reasonable candidates for such a rule, so we choose one which is easy to formalize, and which will prove to be neatly compatible with the algorithms that we design. Though the rule itself is not unique, we refer to the points that it selects as canonical, because they lie in 1-1 correspondence with polytopes.

Definition 2.1

A filter \(f\) is canonical if its values \(t_1<\cdots < t_n\) satisfy \(t_1=1\) and \(t_{k+1} \in \left\{ \lfloor t_k + 1 \rfloor , \; \frac{\lfloor t_k + 1 \rfloor + t_k}{2} \right\} \), for each \(1\le k < n\). That is, \(t_{k+1}\) must take one of two values: (i) the smallest integer strictly greater than \(t_k\), namely \(p: = \lfloor t_k + 1 \rfloor \), or (ii) the average of \(t_k\) and p. Likewise, a canonical simplicial enumeration (\(\textrm{CSE}\)\(\sigma _\bullet ^\bullet \) is a \(\textrm{SE} \) whose values \(t_1<\cdots < t_n\) satisfy the same conditions. Equivalently, a \(\textrm{SE} \) \(\sigma _\bullet ^\bullet \) is a \(\textrm{CSE}\) if \(f[\sigma _\bullet ^\bullet ]\) is a canonical filter. Finally, a canonical partial simplicial enumeration (\(\textrm{CPSE}\)) of \(K\) is a \(\textrm{CSE}\) of a subcomplex of \(K\).

The set of all \(\textrm{CPSE}\) defined on \(K\) is finite because only finitely many sequences \(t_1< \cdots < t_n\) satisfy the constraints above. However, as we show next, they are expressive enough to recover all polytopes \(\mathcal {P}(\sigma _\bullet ^\bullet )\) in the fiber \(\textrm{PH}^{-1}(D)\).

Proposition 2.2

For every filter \(f\) there exists a unique canonical filter \(g\) such that \(\mathcal {P}(g)=\mathcal {P}(f)\). Consequently, there exists a (not necessarily unique) \(\textrm{CSE}\) \(\sigma _\bullet ^\bullet \) such that \(\mathcal {P}(\sigma _\bullet ^\bullet )=\mathcal {P}(f)\).

Proof

Let \(\{t_1<\cdots <t_n\}:=\Im (f)\). Let’s construct a canonical filter \(g\) satisfying \(\mathcal {P}(g)=\mathcal {P}(f)\). Concretely, this means that \(f\vdash g\) and \(g\vdash f\), so we must find values \(s_1<\cdots <s_n\) that satisfy the following conditions: (A) \(f(\sigma )=t_k \iff g(\sigma )=s_k\), (B) \(s_k=t_k\) if \(t_k\in \mathbb {N}\), and (C) for other values \(t_k\notin \mathbb {N}\), since \(g\) is canonical we must have \(s_{k}=\frac{\lfloor s_{k-1} + 1 \rfloor + s_{k-1}}{2}\). These conditions inductively define \(s_k\) uniquely, as illustrated in Fig. 1. This argument establishes existence and uniqueness of \(g\). The proof is completed by choosing any \(\textrm{SE} \) \(\sigma _\bullet ^\bullet \) such that \(f[\sigma _\bullet ^\bullet ]=g\).

Let \(\{t_1<\cdots <t_n\}:=\Im (f)\). To establish uniqueness, suppose that there exists a canonical filter \(g\) satisfying \(\mathcal {P}(g)=\mathcal {P}(f)\). Since \(f\vdash g\) and \(g\vdash f\), there are values \(s_1<\cdots <s_n\) such that \(f(\sigma )=t_k \iff g(\sigma )=s_k\). We must have \(s_k=t_k\) if \(t_k\in \mathbb {N}\). For other values \(t_k\notin \mathbb {N}\), since \(g\) is canonical we must have \(s_{k}=\frac{\lfloor s_{k-1} + 1 \rfloor + s_{k-1}}{2}\). These conditions determine \(s_k\) uniquely, as illustrated in Fig. 1. This argument establishes uniqueness of \(g\), and it is easily reversed to show existence. The proof is completed by choosing any \(\textrm{SE} \) \(\sigma _\bullet ^\bullet \) such that \(f[\sigma _\bullet ^\bullet ]=g\). \(\square \)

Fig. 1
figure 1

Replacing the values \(t_k\) of a filter \(f\) with \(s_k\) defines canonical filter \(g\) such that \(\mathcal {P}(g)=\mathcal {P}(f)\)

Canonical filters provide not only a convenient means to represent each polytope uniquely, but a simple method to calculate its faces. To see how, first fix a canonical filter \(f\) with values \(t_1<\cdots <t_n\). For each \(t_i\notin \mathbb {N}\), denote by \(g^{i^+}\) and \(g^{i^-}\) the filters obtained by rounding \(t_i\) up to \(t_{i+1}\) and down to \(t_{i-1}\), respectively. That is,  \(f(\sigma )=t_i\Rightarrow g^{i^+}(\sigma )=t_{i+1}\) and \(g^{i^-}(\sigma )=t_{i-1}\). The filters \(g^{i^+}\) and \(g^{i^-}\) belong to codimension 1 faces of \(\mathcal {P}(f)\), as we will see, however they are not canonical, in general. Therefore we replace \(g^{i^+}\) and \(g^{i^-}\) with the unique canonical filters \(f^{i^+}\) and \(f^{i^-}\) such that \(\mathcal {P}(f^{i^+} )=\mathcal {P}(g^{i^+})\) and  \(\mathcal {P}(f^{i^-})=\mathcal {P}(g^{i^-})\), which exist by Proposition 2.2.

Proposition 2.3

Let \(f\) be a canonical filter with values \(t_1<\cdots <t_n\). Then the polyhedra of form \(\mathcal {P}(f^{i^+})\) and \(\mathcal {P}(f^{i^-})\) collectively form the set of codimension 1 faces of \(\mathcal {P}(f)\), where i ranches over all values such that \(t_i\notin \mathbb {N}\).

Proof

This results from Theorem 1.5 by taking the codimension 1 faces of \(\Delta _{\# \eta _1(f)} \times \cdots \times \Delta _{\# \eta _{\dim D}(f)}\cong \mathcal {P}(f)\). \(\square \)

figure b

3.2 The enumeration tree

To explore the set of canonical simplicial enumerations efficiently, we introduce a rooted combinatorial tree, called the enumeration tree of \(K\), denoted

$$\begin{aligned} \mathcal {T}(K). \end{aligned}$$

The vertices of \(\mathcal {T}(K)\) are the canonical partial simplicial enumerations (\(\textrm{CPSE}\)) and the root is the empty sequence \(\sigma _\bullet ^\bullet = \emptyset \). The parent of a non-root node \((\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_m})\) is the node \((\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_{m-1}})\) obtained by deleting the final sequence \(\sigma _\bullet ^m\). See Fig. 2 for an illustration. It follows from the definition that the leaves of \(\mathcal {T}(K)\) are the complete canonical simplicial enumerations of \(K\), i.e. the \(\textrm{CSE}\) of \(K\), and that the children of a \(\textrm{CPSE}\) \(\sigma _\bullet ^\bullet =(\sigma _\bullet ^{t_1},\cdots , \sigma _\bullet ^{t_n})\) are the \(\textrm{CPSE}\) of the form

$$\begin{aligned} {[}\sigma _\bullet ^\bullet ,\sigma _\bullet ^{t_{n+1}}]:=(\sigma _\bullet ^{t_1},\cdots , \sigma _\bullet ^{t_n},\sigma _\bullet ^{t_{n+1}}). \end{aligned}$$

The descendants of \(\sigma _\bullet ^\bullet \) can be viewed inductively as being \(\sigma _\bullet ^\bullet \) itself if it is a leaf, and otherwise as the descendants of its children. A descendant is a special case of an extension, which is defined as follows:

Definition 2.4

An extension of a \(\textrm{CPSE}\) \(\sigma _\bullet ^\bullet =(\sigma _\bullet ^{t_1},\cdots , \sigma _\bullet ^{t_n})\) is a \(\textrm{CPSE}\) of the form 

$$\begin{aligned} \tau _\bullet ^\bullet = \left( \sigma _\bullet ^{t_1},\cdots , \sigma _\bullet ^{t_{n-1}}, (\sigma _\bullet ^{t_n} * \upsilon ^{t_n}_\bullet ), \upsilon ^{t_{n+1}}_\bullet , \cdots , \upsilon ^{t_m}_\bullet \right) \end{aligned}$$

where \(\upsilon ^{t_n}_\bullet \) may be empty. The extension is strict if \(\tau _\bullet ^\bullet \ne \sigma _\bullet ^\bullet \). It is a t-extension when \(t_m=t\).

Fig. 2
figure 2

The enumeration tree, \(\mathcal {T}(K)\)

4 The Algorithm

We now arrive at our algorithm for computing the fiber \(\textrm{PH}^{-1}(D)\), described in §3.1, which simply performs a depth-first search on the tree \(\mathcal {T}(K)\). In §3.2, we define several criteria to avoid exploring all branches of \(\mathcal {T}(K)\), which collectively produce an improved algorithm detailed in §3.3.

4.1 The algorithm to compute the fiber: depth-first search on the enumeration tree

Depth-first search refers to a general class of graph algorithms which iterate over the vertices of a rooted tree. While the details of implementation vary, every member of the class shares two essential characteristics: (i) the ancestors of a node N are visited before N, and (ii) the children of a node N are visited before its (unvisited) siblings.

\(\textbf{DFS}(K, D,\sigma _\bullet ^\bullet )\), presented in Algorithm 2, performs a depth-first search on the tree \(\mathcal {T}(K)\) and returns all canonical simplicial enumerations with barcode D. Significantly, it does not need to store \(\mathcal {T}(K)\) in memory. Rather, it generates the children for a given node, on the fly. As we visit a leaf \(\sigma _\bullet ^\bullet \) of the tree, i.e. a canonical simplicial enumeration, if its barcode is D, we add it to a list of results \(\mathcal {S}\). In this way, at the end of the tree exploration, the list \(\mathcal {S}\) contains all \(\textrm{CSE}\) in the fiber.

Listing the children of a given \(\textrm{CPSE}\) \(\sigma _\bullet ^\bullet =(\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_n})\) is achieved by \(\textbf{Children}(\sigma _\bullet ^\bullet )\), presented in Algorithm 3, which tries both of the available options to extend a canonical enumeration. That is, it attempts to build a new sequence \(\sigma _\bullet ^{t}\) of simplices, with either \(t = \lfloor t_n + 1 \rfloor \), or \(t = \frac{\lfloor t_n + 1 \rfloor + t_n}{2}\). It generates this sequence using \(\textbf{Extend}(\sigma _\bullet ^\bullet , t)\).

As described in Algorithm 4, \(\textbf{Extend}(\sigma _\bullet ^\bullet , t)\) takes a \(\textrm{CPSE}\) \(\sigma _\bullet ^\bullet =(\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_n})\) and a real number t as input. It then adds simplices incrementally to \(\sigma _\bullet ^{t}\) in all possible ways, and returns all possible extensions \(\sigma _\bullet ^\bullet =(\sigma _\bullet ^{t_1}, \ldots , \sigma _\bullet ^{t_n}, \sigma _\bullet ^t)\).

Algorithm 2
figure c

\(\textbf{DFS}(K, D,\sigma _\bullet ^\bullet )\)

Algorithm 3
figure d

\(\textbf{Children}(\sigma _\bullet ^\bullet )\)

Algorithm 4
figure e

\(\textbf{Extend}(\sigma _\bullet ^\bullet , t)\)

figure f

4.2 Criteria to accelerate the extension procedure

In order to improve algorithmic performance, we design criteria that the extension procedure \(\textbf{Extend}(\sigma _\bullet ^\bullet ,t_{n+1})\) can leverage to skip branches of \(\mathcal {T}(K)\) without sacrificing correctness. Each subsection details one such criterion, and the last subsection provides the refined version \(\textbf{FastExtend}(\sigma _\bullet ^\bullet ,t_{n+1})\).

Our first three criteria rely on the following result concerning the matrix \(R(\sigma _\bullet ^\bullet )\) produced by lines 1-7 of Algorithm 1. Recall that Algorithm 1 first initializes R as \(\partial \), the boundary matrix of \(K\) with rows and columns ordered to match \(\sigma _\bullet = \sigma _\bullet ^{t_1} * \cdots * \sigma _\bullet ^{t_m}\), the concatenation of all sequences in \(\sigma _\bullet ^\bullet \). The algorithm then clears certain entries in R by adding columns from left to right. We denote the resulting, reduced matrix by \(R(\sigma _\bullet ^\bullet )\), in order to emphasize dependence on \(\sigma _\bullet ^\bullet \).

Lemma 3.1

Let \(\upsilon _\bullet ^\bullet \) be an extension of a \(\textrm{CPSE}\) \(\tau _\bullet ^\bullet \). Then \(R(\tau _\bullet ^\bullet )\) is the submatrix of \(R(\upsilon _\bullet ^\bullet )\) spanned by simplices in \(\tau _\bullet ^\bullet \).

Proof

When applying Algorithm 1 to \(\upsilon _\bullet ^\bullet \), the k-th column of \(R(\upsilon _\bullet ^\bullet )\) remains unchanged after the k-th iteration of the for-loop starting at line 4. Thus the columns of \(R(\upsilon _\bullet ^\bullet )\) indexed by \(\tau _\bullet ^\bullet \) coincide exactly with the columns of \(R(\tau _\bullet ^\bullet )\). \(\square \)

4.2.1 Returning children with fixed barcodes

Let \(\upsilon _\bullet ^\bullet =(\upsilon _\bullet ^{t_1},\cdots , \upsilon _\bullet ^{t_n})\) be a \(\textrm{CSE}\) with barcode D, and let \(\tau _\bullet ^\bullet =(\tau _\bullet ^{t_1},\cdots , \tau _\bullet ^{t_k})\) be one of its ancestors, here \(k\le n\). Then by Lemma 3.1 and inspection of lines 10-17 of Algorithm 1, the barcode \(\textrm{PH}(\tau _\bullet ^\bullet )\) is obtained from \(\textrm{PH}(\upsilon _\bullet ^\bullet )\) by:

  • Removing intervals \((b,d)\in \textrm{PH}(\upsilon _\bullet ^\bullet )\) if \(b>t_k\),

  • Replacing intervals \((b,d)\in \textrm{PH}(\upsilon _\bullet ^\bullet )\) by \((b,+\infty )\), if \(b\le t_k <d\).

In particular, when \(\upsilon _\bullet ^\bullet \) is in the fiber, i.e. \(\textrm{PH}(\upsilon _\bullet ^\bullet )=D\), we denote the above barcode by \(D^{\le t_k}\).

figure g

4.2.2 Building only extensions which are D-compatible

\(\textrm{CPSE}\) \(\tau _\bullet ^\bullet =(\tau ^{t_1}_\bullet , \cdots , \tau ^{t_k}_\bullet )\) is D-compatible if \(\textrm{PH}(\tau _\bullet ^\bullet )\) it contains no more finite intervals of the form (bt) than does \(D^{\le t_k}\), for each dimension \(0\le p\le \textrm{dim }K\).

Proposition 3.2

Let \(\upsilon _\bullet ^\bullet \) be a \(\textrm{CSE}\) with barcode D, extending a \(\textrm{CPSE}\) \(\tau _\bullet ^\bullet =(\tau ^{t_1}_\bullet , \cdots , \tau ^{t_k}_\bullet )\). Then \(\tau _\bullet ^\bullet \) is D-compatible.

Proof

By Lemma 3.1 and inspection of lines 10-17 of Algorithm 1, an interval \((b,t_k)\) of \(\textrm{PH}(\tau _\bullet ^\bullet )\) is also an interval in \(\textrm{PH}(\upsilon _\bullet ^\bullet )\). Since \(\textrm{PH}(\upsilon _\bullet ^\bullet )=D\), this means that \(\textrm{PH}(\tau _\bullet ^\bullet )\) has no more intervals of the form \((b,t_k)\) than \(D^{\le t_k}\). \(\square \)

figure h

4.2.3 Imposing that enough simplices remain to account for all intervals in D

Let \(\partial ^{\tau _\bullet ^\bullet }\) denote the boundary matrix of a subcomplex spanned by a \(\textrm{CPSE}\)\(\tau _\bullet ^\bullet \).

Proposition 3.3

Let \(\upsilon _\bullet ^\bullet \) be a \(\textrm{CSE}\) with barcode D, extending a \(\textrm{CPSE}\) \(\tau _\bullet ^\bullet =(\tau ^{t_1}_\bullet , \cdots , \tau ^{t_k}_\bullet )\). Then

$$\begin{aligned} \dim (\ker \partial ^{\tau _\bullet ^\bullet }_p)&\le \textrm{M}^+_p := \dim (\ker \partial _p) - \# \big \{ (b,d) \in D_p \mid t_{k}< b\big \}, \\ \dim (\Im \partial ^{\tau _\bullet ^\bullet }_p)&\le \textrm{M}^-_p := \dim (\Im \partial _p) - \# \big \{ (b,d) \in D_p \mid t_k < d\big \}. \end{aligned}$$

Proof

By construction, the matrix \(R(\tau _\bullet ^\bullet )\) is in reduced column echelon form up to permutation and nonzero scaling of rows and columns. Thus \(\dim \ker (\partial ^{\tau _\bullet ^\bullet }_p)\) equals the cardinality of \(S(\tau _\bullet ^\bullet ):=\{ \sigma \mid \dim (\sigma )=p\text { and } R(\tau _\bullet ^\bullet )[:,\sigma ]=0\}\), i.e. the number of zero-columns of \(R(\tau _\bullet ^\bullet )\) that are indexed by p-simplices. Because \(R(\upsilon _\bullet ^\bullet )\) contains \(R(\tau _\bullet ^\bullet )\) as a submatrix by Lemma 3.1, we have \(S(\tau _\bullet ^\bullet ) \subseteq S(\upsilon _\bullet ^\bullet )\).

As prescribed in Step 2 of Algorithm 1, to each \((b,d) \in D_p = \textrm{PH}(\upsilon _\bullet ^\bullet )_p\) we can uniquely associate a distinct p-simplex \(\sigma \) such that \(f(\sigma )=b\) and \(R(\upsilon _\bullet ^\bullet )[:,\sigma ]=0\). If \(t_k < b\) then \(\sigma \) lies outside of \(\tau _\bullet ^\bullet \), because the filter \(f[\tau _\bullet ^\bullet ]\) takes a maximum value of \(t_k\). Thus \(\sigma \in S(\upsilon _\bullet ^\bullet )\backslash S(\tau _\bullet ^\bullet )\). Thus

$$\begin{aligned} \#\{(b,d) \in D_p \mid t_k < b\} \le \# \big ( S(\upsilon _\bullet ^\bullet )\backslash S(\tau _\bullet ^\bullet ) \big ) = \dim \ker (\partial _p) - \dim \ker (\partial _p^{\tau _\bullet ^\bullet }) \end{aligned}$$

This establishes the first half of the proposition. The second half is similar. \(\square \)

Criterion: If \(\tau _\bullet ^\bullet \) has an extension with barcode D, then \(\dim (\ker \partial ^{\tau _\bullet ^\bullet }_p) \le \textrm{M}^+_p\) and \(\dim (\Im \partial ^{\tau _\bullet ^\bullet }_p) \le \textrm{M}^-_p\).

4.2.4 Computing facets in the fiber only

Proposition 2.3 implies that the complete set of polytopes in \(\textrm{PH}^{-1}(D)\) can be recovered from the set of facets, i.e. the faces that are maximal with respect to inclusion. Numerical experiments confirm that this approach can reduce computational cost: among all calculations reported in §5, the time required to recover all faces of \(\textrm{PH}^{-1}(D)\) from the list of facets was negligible, when compared with the cost of performing depth-first search on \(\mathcal {T}(K)\). This suggests that one can save time by modifying the search procedure to skip branches of \(\mathcal {T}(K)\) whose leaves do not represent any facet. Proposition 3.4 yields an efficient means to identify a subset of these branches.

Proposition 3.4

Let \(\tau _\bullet ^\bullet =(\tau _\bullet ^{t_1},\cdots , \tau _\bullet ^{t_k})\) be a \(\textrm{CPSE}\) with barcode \(D^{\le t_k}\), and let \(\upsilon _\bullet ^\bullet \) be a \(\textrm{CSE}\) that extends \(\tau _\bullet ^\bullet \). If \(\tau _\bullet ^{t_k} \notin \{ \emptyset , \upsilon _\bullet ^{t_k}\}\), then \(\mathcal {P}(\upsilon _\bullet ^\bullet )\) is not a facet of \(\textrm{PH}^{-1}(D)\).

Proof

Suppose \(\tau _\bullet ^{t_k} \notin \{ \emptyset , \upsilon _\bullet ^{t_k}\}\). In particular \(\upsilon _\bullet ^{t_k}= \tau _\bullet ^{t_k} * u_{\bullet }\) for some non-empty sequence \(u_{\bullet }\). Define the modified \(\textrm{SE} \) with \(n+1\) values:

$$\begin{aligned} \tilde{\upsilon }_\bullet ^\bullet :=(\upsilon _\bullet ^{t_1},\cdots , \upsilon _\bullet ^{t_{k-1}}, \tau _\bullet ^{t_k}, u_{\bullet }^{\frac{t_k+t_{k+1}}{2}},\upsilon _\bullet ^{t_{k+1}}, \cdots \upsilon _\bullet ^{t_n}). \end{aligned}$$

Since \(\tilde{\upsilon }_\bullet ^\bullet \) and \(\upsilon _\bullet ^\bullet \) induce the same ordering on simplices on line 2 of Algorithm 1, lines 3–9 produce the same reduced boundary matrix for both. Since both \(\tau _\bullet ^\bullet =(\upsilon _\bullet ^{t_1},\cdots ,\upsilon _\bullet ^{t_{k-1}}, \tau _\bullet ^{t_k})\) and \((\upsilon _\bullet ^{t_1},\cdots , \upsilon _\bullet ^{t_k})\) have barcode \(D^{\le t_k}\), this means that when running Algorithm 1 on \(\upsilon _\bullet ^\bullet \) the intervals \((f(\sigma _i),f(\sigma _j))\) and \((f(\sigma _i),+\infty )\) generated lines 10–17 involve no simplices of \(u_{\bullet }\). Therefore \(\textrm{PH}(\tilde{\upsilon }_\bullet ^\bullet )=\textrm{PH}(\upsilon _\bullet ^\bullet )=D\), and \(\mathcal {P}(\upsilon _\bullet ^\bullet )\) is a codimension 1 face of \(\mathcal {P}(\tilde{\upsilon }_\bullet ^\bullet )\). \(\square \)

figure i

4.3 Refined version of the extension procedure

By plugging the criteria from the previous sections in the extension procedure \(\textbf{Extend}(\sigma _\bullet ^\bullet ,t)\), we obtain a faster extension procedure \(\textbf{FastExtend}(\sigma _\bullet ^\bullet , t)\), see Algorithm 5. The way this procedure works is very similar, i.e. given the value t, we add simplices \(\sigma \) incrementally to \(\sigma _\bullet ^{t}\) in all possible ways, but this time we only add the \(\sigma \) if it satisfies all the criteria of the previous section.

Algorithm 5
figure j

\(\textbf{FastExtend}(\sigma _\bullet ^\bullet , t)\)

Remark 3.5

In the actual implementation of the depth-first search (Algorithm 2), rather than computing the reduced boundary matrix of a \(\textrm{CSE}\) at the end of the exploration, we compute it progressively while exploring intermediate \(\textrm{CPSE}\) \(\sigma _\bullet ^\bullet \) of the tree \(\mathcal {T}(K)\). Namely, each time a new simplex \(\sigma _j\) is added to \(\sigma _\bullet ^\bullet \), we update the boundary matrix \(R(\sigma _\bullet ^\bullet )\) with lines 4–9 of Algorithm 1. We further keep in memory the dimensions \(\dim (\ker \partial ^{\sigma _\bullet ^\bullet }_p)\) and \(\dim (\Im \partial ^{\sigma _\bullet ^\bullet }_p) \), the numbers \(\textrm{M}^+_p\) and \(\textrm{M}^-_p\), and the barcode \(\textrm{PH}(\sigma _\bullet ^\bullet )\). These quantities can then be updated in constant time thanks to the reduced boundary matrix, by inspecting the column \(R(:,\sigma _j)\) and in particular whether it is non-zero. Therefore all the criteria defined in this section and used in Algorithm 5 are verified in constant time, modulo the overhead of incrementally reducing the boundary matrix.

5 Generalisation to based chain complexes

We generalise the fact that \(\textrm{PH}^{-1}(D)\) is the geometric realization of a polyhedral complex to filters defined directly at the level of based chain complexes. These include filters on simplicial complexes, cubical complexes, delta complexes and CW complexes. Our approach for computing \(\textrm{PH}^{-1}(D)\) adapts to these situations as well.

Definition 4.1

A \(\mathbb {k}\)-linear chain complex \(C = \bigoplus _i C_i\) is finite dimensional if \(\sum _i \dim (C_i) < \infty \). A based chain complex is a pair (CE) such that \(E_i: = E \cap C_i\) is a basis for each \(C_i\), and \(E = \bigcup _i E_i\). A filter on \((C, E)\) is a function \(f: E\rightarrow \mathbb {R}\) such that the linear span of each sublevel set \(\{ e \in E\mid f(e) \le t\}\) is a linear subcomplex of \(C\).

Here are some examples of \((C, E)\) induced by combinatorial complexes:

  1. 1.

    Simplicial Complexes. Basis \(E\) is the collection of simplices in a simplicial complex, with fixed orientations. We recover the standard setting of filters over \(K\).

  2. 2.

    Cubical complexes. Basis \(E\) is the collection of cubes in a cubical complex, with fixed orientations.

  3. 3.

    Delta and CW Complexes. Basis \(E\) is the collection of cells in a delta or CW complex, with fixed orientations.

These variations are of interest in practice: For instance, with delta and CW complexes we can decompose topological spaces with much fewer simplices, while cubical complexes appear naturally in analysis of images, random fields, etc.

The sublevel set filtration of a based chain complex with filter \(f\) is the nested family of subcomplexes spanned by the sublevel sets of \(f\). This nested family yields a persistence module in precisely the same manner as a filtered simplicial complex, allowing us to define a barcode \(\textrm{PH}(f)\) in the usual way (by decomposing the module into interval summands). We define the fiber as

$$\begin{aligned} \textrm{PH}^{-1}(D) = \{ \text {filters }f: E\rightarrow \text {I}\mid \textrm{PH}(f) = D \} \end{aligned}$$

where \(\text {I}\) is the closed interval \( [1, \dim D + 1 ]\).

The main result of this section, Theorem 4.13, generalizes the structure theorem for simplicial complexes (Theorem 1.5) to these important variants. In particular, this result implies:

Theorem 4.2

Let \(K\) be a simplicial, cubical, delta or CW complex and let D be a barcode. Then both

  • the fiber \(\textrm{PH}^{-1}(D)\), and

  • the intersection \(\textrm{PH}^{-1}(D) \cap S\), where S is the family of lower-star filtersFootnote 2

are the underlying spaces of polyhedral complexes composed of polytopes that are affinely isomorphic to products of standard simplices.

5.1 Polyhedral decomposition of the ambient cube

To define the polytopes of our decomposition, we require even less structure than that of a filtered complex. Therefore assume, temporarily, that \(E\) is simply a finite set, and \(\text {I}\) is any closed interval of form \([1, m+1]\), for some nonnegative integer m. For any pair of functions \(f, g: E\rightarrow \text {I}\), let us define the relation \(f\vdash g\) by either of the following two equivalent axioms:

  1. (A1)

    There exists an order-preserving map \(\psi : \text {I}\rightarrow \text {I}\) such that \(\psi (i) = i\) for each integer i, and \(g= \psi \circ f\).

  2. (A2)

    The function \(g\) satisfies

    • \(f(e) \in \mathbb {N}\implies g(e) = f(e)\), and

    • \(f(e) \le f(e') \implies g(e) \le g(e')\)

    for each \(e \in E\).

Note that the relation \(\sim \) is reflexive and transitive but not symmetric. The polytope of \(f\) is

$$\begin{aligned} \mathcal {P}(f):= \{ g\in \text {I}^E \mid \, \, f\vdash g\}. \end{aligned}$$

Lemma 4.3

The set \(\mathcal {P}(f)\) is a compact polytope. Moreover, the set

$$\begin{aligned} \mathcal {P}= \{ \mathcal {P}(f) \mid f: E\rightarrow \text {I}\} \end{aligned}$$

is finite.

Proof

Axiom (A2) represents a finite family of logical conditions, each of which determines either a closed affine half-space of form \(\{ g\mid g(e) \le g(e')\}\), or an affine hyperplane of form \(\{g\mid g(e) = f(e)\}\), where \(f(e) \in \{1, \ldots , m+1\}\). The intersection of the bounded polytope \(\text {I}^E \) with these closed spaces, \(\mathcal {P}(f)\), is a bounded polytope. Only finitely many polytopes of this form exist, since there are only finitely many (half-)spaces of form \(\{ g\mid g(e) \le g(e')\}\) and \(\{ g\mid g(e) \le c\}\) such that \(c \in \{1, \ldots , m+1\}\). \(\square \)

Lemma 4.4

If \(g\in \mathcal {P}(f)\) then \( \mathcal {P}(g) \subseteq \mathcal {P}(f)\).

Proof

Relation \(\sim \) is transitive. \(\square \)

Proposition 4.5

The set \(\mathcal {P}\) is a polyhedral complex with underlying space \(\vert \mathcal {P}\vert = \text {I}^E\).

Proof

Follows from Lemmas 4.3 and 4.4. \(\square \)

Having established that \(\mathcal {P}\) is indeed a polyhedral complex, we will now show that each polytope \(\mathcal {P}(f)\) is affinely isomorphic to a product of standard simplices. The idea behind the argument, as illustrated in Fig. 3, is that each element of \(\eta _i(f):= \Im (f) \cap (i,i+1)\) represents a degree of freedom which we can vary within the closed interval \([i,i+1]\). Elements of \(\eta _i(f)\) may not change order, hence they sweep out a simplex of dimension \(\#\eta _i(f)\). This idea is formalized in the proof of Theorem 4.6, which strictly generalizes the second assertion of Theorem 1.5.

Fig. 3
figure 3

Visual intuition for the realization of \(\mathcal {P}(f)\) as a product of simplices. We have one degree of freedom for each value \(t \in \Im (f) \backslash \mathbb {N}\). For each i, the set \(\eta _i(f)\) of values that lie strictly between i and \(i+1\) generates a simplex of dimension \(\# \eta _i(f)\)

Theorem 4.6

The set \(\mathcal {P}(f)\) is affinely isomorphic to \(\Delta _{\# \eta _1(f) } \times \cdots \times \Delta _{\# \eta _{m}}\), where

  • \(\eta _i(f) = \Im (f) \cap (i,i+1)\) is the subset of the image of \(f\) that lies in the open interval \((i,i+1)\),

  • \(\Delta _{k}\) is the standard geometric simplex of dimension k.

Proof

Let \(g\in \mathcal {P}(f)\) be given. Fix an integer \(i \in \text {I}\), and write \(\eta _i(f) = \{ s_1< \cdots < s_n\}\).

Axiom (A1) implies that \(g= \psi \circ f\) for some non-strictly increasing map \(\psi : \text {I}\rightarrow \text {I}\) such that \(\psi (i) = i\) for each integer i. Since \(\eta _i(f) \subseteq \Im (f)\), for each \(s_k\) there exists one or more simplices \(\sigma \in K\) such that \(f(\sigma ) = s_k\). In particular, one has \(\psi (s_k) = \psi (f(\sigma )) = g(\sigma )\). Therefore the sequence \(S_i(g): = (\psi (s_1)-i, \ldots , \psi (s_n)-i)\) depends only on \(g\), not on the choice of \(\psi \) satisfying \(g=\psi \circ f\).

Because \(\psi \) is non-decreasing and restricts to the identity on integers,

$$\begin{aligned} S_i(g) \in \Delta _{n} = \big \{ (t_1,\cdots , t_m) \mid 0 \le t_1 \le \cdots \le t_{m} \le 1 \big \}. \end{aligned}$$

Therefore the rule

$$\begin{aligned} g\mapsto (S_1(g), \ldots , S_m(g)) \end{aligned}$$

determines a well-defined map \(\mathcal {P}(f) \rightarrow \Delta _{\# \eta _1(f) } \times \cdots \times \Delta _{\# \eta _m(f)}\). This map is injective because g is determined by the restriction \(\psi |_{\Im (f)}\), which in turn is determined by the restriction \(\psi |_{\eta _1(f) \cup \cdots \cup \eta _m(f)}\). It is clearly surjective and affine, hence an affine isomorphism. \(\square \)

5.2 Polyhedral decomposition of \(\textrm{PH}^{-1}(D)\) for based chain complexes

For the remainder of §4, we will assume that \((C, E)\) is a based, finite-dimensional, \(\mathbb {k}\)-linear chain complex, D is a barcode such that

$$\begin{aligned} \textrm{End}^*(D) = \{1, \ldots , \dim D \} \end{aligned}$$

and \(\text {I}= [1, \dim D + 1]\).

Lemma 4.7

Let \(f: E\rightarrow \text {I}\) be a filter with barcode D. Then each element of \(\mathcal {P}(f)\) is also a filter with barcode D.

Proof

The persistence map is equivariant in the sense that \(\textrm{PH}(\psi \circ f)= \psi (\textrm{PH}(f))\) for any non-strictly increasing function \(\psi : \text {I}\rightarrow \text {I}\), as can be shown e.g. following Leygonie and Tillmann (2021, Lemma 1.5). Here \(\psi \) acts point-wise on intervals of \(\textrm{PH}(f)\), i.e. each interval \((b,d)\in \textrm{PH}(f)\) produces an interval \((\psi (b),\psi (d))\) in \(\psi (\textrm{PH}(f))\) whenever \(\psi (b)\ne \psi (d)\). The result therefore follows from Axiom (A1), since g can be expressed in form \(\psi \circ f\) for some non-strictly increasing \(\psi \) that restricts to the identity map on the endpoints of D. \(\square \)

Given a union of polytopes \(S\) in a polyhedral complex \(\mathcal {P}\), we define the subcomplex induced by \(S\) as

$$\begin{aligned} \mathcal {P}[S] = \{ X \in \mathcal {P}\mid X \subseteq S\}. \end{aligned}$$
(1)

Theorem 4.8

The fiber \(\textrm{PH}^{-1}(D)\) is a union of polytopes in \(\mathcal {P}\). A fortiori, the induced polyhedral subcomplex

$$\begin{aligned} \mathcal {P}[\textrm{PH}^{-1}(D)] \subseteq \mathcal {P}\end{aligned}$$

has underlying space \( \textrm{PH}^{-1}(D)\).

Proof

Lemma 4.7 implies that \(\textrm{PH}^{-1}(D)\) is the union of all polytopes of form \(\mathcal {P}(f)\) such that \(\textrm{PH}(f)=D\). \(\square \)

5.3 Polyhedral decomposition of \(\textrm{PH}^{-1}(D)\) for CW complexes

The polyhedral decomposition of \(\textrm{PH}^{-1}(D)\) for based chain complexes (Theorem 4.8) does not carry over directly to arbitrary CW complexes. In particular, given a CW complex \(K\), there may exist filters on the associated based chain complex \((C, E)\) that do not correspond to valid filters of \(K\). Here the notion of a filter on a CW complex (respectively, delta or cubical complex) naturally generalises the simplicial situation: it qualifies any function \(f: K\rightarrow \text {I}\) whose sub-level sets are sub-CW complexes (respectively, sub-delta or sub-cubical complexes).

Example 4.9

Let \(K= \{ v, e\}\) be the CW decomposition of \(S^1\) with one vertex, v, and one edge, e. Since all boundary maps are 0, the filtration \(\{e\} \subseteq \{v, e\}\) is perfectly valid for \((C, E)\), but not for \(K\).

Fortunately this problem is simple to address. Lemma 4.10 represents the only technical observation needed to extend our polyhedral characterization of the persistence fiber from regular finite CW complexes to arbitrary finite CW complexes. The proof is vacuous.

Lemma 4.10

Suppose that a function \(P:\text {I}^E\rightarrow \{\textrm{True}, \; \textrm{False}\}\) satisfies the condition that

$$\begin{aligned} P(f) = \textrm{True}\implies P\text { evaluates to } \textrm{True}\text { on each element of }\mathcal {P}(f). \end{aligned}$$
(2)

Then \(P^{-1}(\textrm{True})\) is a union of polytopes in \(\mathcal {P}\), hence \(\mathcal {P}[ P^{-1}(\textrm{True})] \) is a polyhedral subcomplex.

Theorem 4.11

Let \(K\) be a simplicial, cubical, delta or CW complex with based chain complex \((C, E)\). If F is the set of filters on \(K\), then \(\textrm{PH}^{-1}(D) \cap F\) is a union of polytopes in \(\mathcal {P}\).

Proof

Let \(K\) be a finite CW complex, and let \(P(f) = \textrm{True}\) iff \(f^{-1}(-\infty , t]\) is a CW subcomplex of \(K\) for each \(t \in \text {I}\). Then \(P(f) \implies P(g)\) for each \(g\) such that \(f\vdash g\), because every sublevel set of \(g\) can be expressed as a sublevel set of \(f\), by Axiom (A1). The desired conclusion therefore follows from Lemma 4.10. \(\square \)

Consequently, our procedure for computing the fiber adapts to CW complexes:

figure k

5.4 Polyhedral decomposition of \(\textrm{PH}^{-1}(D) \cap S\), for a restricted family S

It is common in practice to impose additional restrictions on the filters one wishes to consider. A noteworthy family of examples come from the lower-p filters: given a CW complex \(K\) with associated based chain complex \((C, E)\), we define the space of lower-p filters on \(K\) as

$$\begin{aligned} \textrm{Low}_{p}(K) = \bigg \{ f: E\rightarrow \text {I}\mid \text { for each cell } \tau \in E, \text { one has }f(\tau ) \\ = \max \{f(\sigma ) \mid \sigma \subseteq \textrm{cl}(\tau ), \; \dim (\sigma ) \le p \} \bigg \}. \end{aligned}$$

Examples include

  1. 1.

    The space of lower-star filters, \(\textrm{Low}_{0}(K)\).

  2. 2.

    The space of lower-edge filters, \(\textrm{Low}_{1}(K)\). These include the so-called Vietoris-Rips filters of a combinatorial simplicial complex.

The important fact about these spaces is that they are unions of polytopes in the polyhedral decomposition of the ambient cube:

Lemma 4.12

The space \(\textrm{Low}_{p}(K)\) is a union of polytopes in \(\mathcal {P}\), for all \(p \ge 0\).

Proof

Fix \(f\in \textrm{Low}_{p}(K)\), and suppose that \(f\vdash g\) for some \(g\). By hypothesis, each \(e \in E\) has a face \(e'\) of dimension no greater than p such that \(f(e) = f(e') = \max \{ f(e'') \mid e''\text { is a face of} \, e \text { with}\, \dim (e'')\le p \}\). The same must therefore hold for \(g\), by Axiom (A1). In particular, if \(\textrm{Low}_{p}(K)\) contains \(f\), then it contains \(\mathcal {P}(f)\). \(\square \)

Then we have the following.

Theorem 4.13

Suppose that \((C, E)\) is the based chain complex associated with a finite simplicial complex, a delta complex or a CW complex \(K\). Then

$$\begin{aligned} S = \textrm{PH}^{-1}(D)\cap \textrm{Low}_{p}(K) \end{aligned}$$

is a union of polytopes in \(\mathcal {P}\). Consequently there is a nested sequence of polyhedral subcomplexes

$$\begin{aligned} \mathcal {P}[S] \subseteq \mathcal {P}[\textrm{PH}^{-1}(D)] \subseteq \mathcal {P}. \end{aligned}$$
(3)

When \(p = 0\), the set S is the space of lower-star filters with barcode D. When \(p = 1\), the set S is the space of lower-edge filters with barcode D.

Proof

Follows from Lemma 4.12. \(\square \)

In principle one could compute \(\textrm{PH}^{-1}(D) \cap \textrm{Low}_{p}(K)\) by first computing the set of canonical filters in \(\textrm{PH}^{-1}(D)\), then removing the subset of filters which violate the criterion for being a lower-p filter. However, we can modify the DFS procedure of §3 to compute the desired subset, directly.

figure l

6 Experiments

Using our algorithm we compute the number of polytopes in \(\textrm{PH}^{-1}(D)\), binned by dimension, and the Betti numbers \(\beta _p(\textrm{PH}^{-1}(D))\). When the fiber contains at least one facet – i.e. a polytope without a proper coface – which is not of the maximal dimension in the polyhedral complex, we report the number of facets binned by dimension (in red). Implementation Algorithm 3 was implemented in the programming language Rust, and is publicly available (Leygonie and Henselman-Petrusek 2022). This implementation accommodates user-defined coefficient fields, based complexes, and restricted families of filters, e.g. lower-star. The implementation uses several dependencies from the ExHACT library (Hang and Henselman-Petrusek 2021; Hang et al. 2021) for low-level functions, including reduction of boundary matrices and implementation of common coefficient fields. The code includes extensive unit tests, including, for example, verification against the family of calculations published in Leygonie and Tillmann (2021). Reading the results Figs. 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 and 14 report the outputs of the algorithm. Each figure corresponds to a specific simplicial or CW complex and provides statistics about the fiber \(\textrm{PH}^{-1}(D)\) for multiple values of D. By convention, black intervals in the target barcode D are of dimension 0, blue intervals are of dimension 1, while green intervals are of dimension 2. In all cases the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in the form of an array, and the Betti numbers are computed with coefficients in \(\mathbb Z_2\). Unless explicitly stated otherwise:

Fig. 4
figure 4

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) when \(K\) is a tree (1st column) and D is a target barcode (2nd column), both when the fiber is viewed in the space of all filtrations (3rd column) or in the space of lower star filtrations (4th column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\)

Fig. 5
figure 5

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is homotopy equivalent to a circle (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\)

Fig. 6
figure 6

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) when \(K\) is homotopy equivalent to a bouquet of 2 circles (1st column) and D is a target barcode (2nd column), both when the fiber is viewed in the space of all filers (3rd column) or in the space of lower star filters (4th column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\)

Fig. 7
figure 7

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is homotopy equivalent to a 2-sphere (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\). The run time of the algorithm for computing them is given in the 4th column

Fig. 8
figure 8

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is a CW decomposition of the torus (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\). The run time of the algorithm for computing them is given in the 4th column

Fig. 9
figure 9

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column and 6th column) in the space of all filters, when \(K\) is a CW decomposition of the Klein bottle (1st column) and D is the target barcode of persistence modules computed with coefficients in the field \(\mathbb Q\) (2nd column) or \(\mathbb Z_2\) (4th column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\)

Fig. 10
figure 10

Two filters (bottom row) on a CW decomposition of the torus (top right) achieving the same barcode D (top left). The function’s values matching with interval endpoints are given in red, while the others are in orange

Fig. 11
figure 11

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is a CW decomposition of the real projective plane (1st column) and D is a target barcode (2nd column), for persistence modules computed with coefficients in the field \(\mathbb Q\) (bottom row) column or \(\mathbb Z_2\) (top row). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\). The run time of the algorithm for computing them is given in the 4th column

Fig. 12
figure 12

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is a CW decomposition of the Möbius strip (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\). The run time of the algorithm for computing them is given in the 4th column

Fig. 13
figure 13

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is a CW decomposition of the cylinder (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\). The run time of the algorithm for computing them is given in the 4th column

Fig. 14
figure 14

Some statistics about fibers \(\textrm{PH}^{-1}(D)\) (3rd column) in the space of all filters, when \(K\) is a CW decomposition of the Dunce Hat (1st column) and D is a target barcode (2nd column). For a fixed complex and barcode, the number of polytopes in \(\textrm{PH}^{-1}(D)\) is binned by dimension in an array, and the Betti numbers of \(\textrm{PH}^{-1}(D)\) are computed with coefficients in \(\mathbb Z_2\)

  • The persistence modules associated to barcodes D are computed with coefficients in \(\mathbb Z_2\). Otherwise, in special cases where we also compute persistence modules with coefficients in \(\mathbb Q\), the coefficient field is indicated in blue by a specific mention;

  • The fiber is computed inside the space of all filters. Otherwise, we provide as many columns for statistics about \(\textrm{PH}^{-1}(D)\) as there are categories of filters to consider.

  • If the facets only consists of the top-dimensional polytopes, then their number can be read directly from the array counting polytopes by dimension. Otherwise the facets do not consist only of the top dimensional polytopes, and then we report an additional red array with the facets binned by dimension;

Infrastructure, run time and complexity The experiments were implemented and tested on a cluster of nodes,Footnote 3 where each fiber was computed using 6 2.90 GHz Cascade Lake CPU cores and a memory of 8 GB.

The run times of the algorithm for computing the polytopes and the Betti numbers are reported for most complexes, as an additional column in the tables describing the statistics of the fiber. The following observations are consistent across all examples:

  • The computational bottleneck lies in computing the polytopes forming the fiber \(\textrm{PH}^{-1}(D)\). The homological computations are negligible by comparison.

  • The run time increases considerably with the number of simplices. For instance, when \(K\) is the 2-sphere as in Fig. 7 and D is the barcode with 2 infinite bars only, the run time of the algorithm is approximately 3.5 seconds. Attaching a single edge to the sphere results in a run time of 4600 seconds for the same barcode.Footnote 4

  • Since the fibers \(\textrm{PH}^{-1}(D)\) may be of completely different sizes over distinct barcodes, the choice of barcode D also drastically impacts runtime. For instance, when \(K\) is the torus as in Fig. 8, the algorithm ran for 0.007 seconds to compute the fiber for the barcode in the third row, while it ran for 1800 seconds for the barcode in the last row.

The time complexity of our depth-first search algorithm is hard to estimate accurately due to the heuristics it employs to avoid visiting the whole tree \(\mathcal {T}(K)\) of canonical simplicial enumerations of \(K\), in particular one very rough upper-bound for the complexity is given by the size of \(\mathcal {T}(K)\).

On the other hand, the time complexity of any algorithm computing the polyhedral structure of \(\textrm{PH}^{-1}(D)\) is at least O(n!), where \(n=\sharp K\) is the number of simplices of \(K\). For instance, if \(K\) consist of n disjoint points and D is a barcode with n distinct infinite bars in degree 0, then \(\textrm{PH}^{-1}(D)\) is made of n! disjoint polytopes: the singletons corresponding to the different orderings of points in \(K\).

This huge theoretical lower-bound on the time complexity prohibits computations on large complexes, and motivates the search for further heuristics to improve performance.

6.1 Simplicial complexes

In all the examples of this section, \(K\) is a simplicial complex. When \(K\) is a tree (Fig. 4), we report statistics both when the domain of \(\textrm{PH}\) consists of all filters and when it is restricted to lower star filters. For lower star filters on the interval, the fiber is shown by Cyranka et al. (2020) to consist of contractible components. Our computations indicate that this property holds as well for general filters on the interval, however it breaks for certain trees, as indicated by non-trivial Betti numbers \(\beta _1\).

For lower star filters on arbitrary subdivisions of the circle it is shown in Mischaikow and Weibel (2021) that each connected component of the fiber is homotopy equivalent to a circle. Our computations (Fig. 5) suggest that this property holds as well when allowing general filters and adding dangling edges to the circle.

When \(K\) is homotopy equivalent to a bouquet of two circles (Fig. 6), the fiber itself has trivial homology in degree higher than 1 and we observe cases (indicated in red) where some facets are not top-dimensional polytopes.

In light of all the previous calculations, we can conjecture that when \(K\) is a graph the fiber \(\textrm{PH}^{-1}(D)\) has trivial homology in degrees higher than 1. However, when \(K\) is the 2-skeleton of the 3-simplex (Fig. 7), for some barcodes D the fiber has non-trivial degree 3 homology. Therefore in general the fiber \(\textrm{PH}^{-1}(D)\) may have higher non-trivial homologies than the base complex \(K\).

Let \(K\) be an arbitrary connected simplicial complex, and let \(D_{K}\) be the barcode with one infinite bar \((1,+\infty )\) in degree 0, with no finite bars, followed by infinite bars \((2,+\infty )\) of multiplicity \(\beta _p(K)\) in each degree \(p\ge 1\). In all the examples computed with \(\mathbb {Z}_2\) coefficients by our algorithm, the fiber \(\textrm{PH}^{-1}(D_K)\) and the base complex \(K\) have the same Betti numbers (with coefficients in \(\mathbb {Z}_2\)). This motivates the following conjecture.

Conjecture 1

Let \(K\) be a simplicial complex. Then the fiber \(\textrm{PH}^{-1}(D_K)\) and \(K\) have equal Betti numbers.

6.2 CW complexes

In this section \(K\) is a surface with a CW structure: the torus (Fig. 8), the Klein bottle (Fig. 9), the real projective plane (Fig. 11), the Möbius strip (Fig. 12), the cylinder (Fig. 13) and the Dunce Hat (Fig. 14). Indeed from Sect. 4 our algorithm adapts to CW complexes and more generally to based chain complexes. This is a precious feature since simplicial triangulations of our surfaces have many simplices, hence our algorithm struggles to compute the associated fibers, while it handles cellular decompositions which are much smaller.

For cellular triangulations that are too small (e.g. the first two decompositions of the torus in Fig. 8), fibers are not interesting. This is why we consider cellular decompositions that are not minimal and have sufficiently many simplices for the fibers to comprise sufficiently many polytopes and display non-trivial topology. For such fibers, the remarks of Sect. 5.1 about simplicial complexes apply as well. In particular, the fiber \(\textrm{PH}^{-1}(D_K)\) and the base complex \(K\) have the same Betti numbers.

We also find novel behaviours:

  • For some CW complexes that are topological manifolds, such as the real projective plane and the Klein bottle, there are fibers whose facets do not consist only in top-dimensional polytopes. In particular these fibers are not manifolds.

  • For some CW complexes that are topological manifolds, such as the real projective plane, there exist fibers with connected components of at least two distinct homotopy types. This situation is detected whenever \(\beta _0(\textrm{PH}^{-1}(D))\ge 2\) and \(\beta _p(\textrm{PH}^{-1}(D))= 1\) for some \(p\ge 1\).

  • For some spaces, such as the Klein bottle and the real projective plane, whose homology with coefficients in \(\mathbb {Z}_2\) differ from that with coefficients in \(\mathbb Q\), the fibers \(\textrm{PH}^{-1}(D)\) strongly depend on the choice of field, as reflected by the number of polytopes, the dimensions of the facets, and the Betti numbers.

  • The dunce hat is contractible but some fibers have non-trivial 2-dimensional homology.

In Fig. 10, we also provide an example of filters in the fiber in the case of the CW decomposition of the torus.

7 Conclusion

This work introduces and implements the first algorithm to compute the fiber \(\textrm{PH}^{-1}(D)\). Each fiber \(\textrm{PH}^{-1}(D)\) admits a canonical polyhedral decomposition (Leygonie and Tillmann 2021), and the output of the algorithm is a collection of polytopes, with each polytope represented in computer memory as a simplicial enumeration of \(K\).

The proposed algorithm leverages the combinatorial structure of \(\textrm{PH}^{-1}(D)\) to organize the computation as a depth-first search, which conduces to a variety of heuristic acceleration methods.

In addition, we extend the polyhedral decomposition of the fiber from Leygonie and Tillmann (2021, Theorem 2.2) to encompass not only simplicial complexes but CW complexes generally, including cubical and delta complexes. We also incorporate variations on the notion of filter that arise naturally in applications, e.g. the lower-star filters and Vietoris-Rips filters. The proposed algorithm adapts naturally to these settings, and we include these variants in the implementation. Indeed, this flexibility proves useful in experiments, since several computations which proved intractable on a simplicial complex \(K\) due to excessive time demand later proved feasible for homeomorphic CW complexes that had fewer cells.

This work enables the research community to study persistence fibers empirically, for the first time. As a demonstration, we compute the fibers of approximately 120 barcode strata, the only corpus of its kind. The Betti statistics of the associated polyhedral complexes suggest several numerical trends, and provide counterexamples which would be impossible to replicate by hand.

An interesting feature of these complexes is their size. In each of our experiments, the underlying simplicial or CW complex had fewer than 20 cells; however the associated fibers often had hundreds of thousands of polytopes – in some cases, millions. It is surprising that so many distinct solution classes should exist, given the size of \(K\) and the number of conditions imposed by the persistence map. These examples should inform general approaches to computation in the future, and motivate the mathematical problem of formulating new, more compact representations of the fiber. This work also underscores the need for automated tools to visualize and explore the fiber, interactively.

Even in cases where the fiber remains small enough to fit comfortably in computer memory, we find that challenges remain vis-a-vis overall execution time. Most computations that are run on complexes with 15 cells or more consume hours or days; run time also depends, to a large degree, on the barcode selected. This motivates serious pursuit of improved methodology. In particular, a natural direction is to further design criteria to skip branches while exploring the tree of all enumerations, as initiated in Sect. 3.2. Another natural approach, provided a deeper understanding of how the fiber changes through consecutive elementary collapses of the complex \(K\), is to use Discrete Morse Theory to compute the fiber on a simplified, smaller complex.