1 Introduction

Persistent homology is one of the most successful tools in Topological Data Analysis (Carlsson 2009), with recent applications in numerous scientific domains such as biology, medicine, neuroscience, robotics, and many others (Otter et al. 2017). In its most common implementation, persistent homology is used to infer topological properties of the metric space underlying a finite point cloud using two steps (Edelsbrunner and Harer 2010):

  1. (1)

    Build a filtration of simplicial complexes from distances, or similarities, between data points.

  2. (2)

    Compute the singular homology of each of the simplicial complexes in the filtration, along with the linear maps induced in homology by their inclusions. The resulting persistence module can normally be represented using a persistence diagram or a persistence barcode.

A fundamental limitation of persistent homology, and in fact homology, is its inability to incorporate directionality, which can be important in some real-world applications (see examples below). For instance, homology cannot in principle distinguish between directed and undirected cycles (Fig. 1). Although the definition of homology, namely the differential or boundary operator, requires a choice of orientation for the simplices, the resulting homology is independent of this choice. Previous attempts have had some partial success at this issue (see ‘Related work’ below), however, as far as we know, there is no homology theory able to exactly detect directed cycles up to boundary equivalence.

The main difficulty occurs at the algebraic level: opposite orientations on a simplex correspond to additive inverse elements in the coefficient ring or field. Our key insight is to retain the submodule of homology generated by those classes that only have non-negative coefficients on elementary chains. In this way, we can define a directed homology module (Definition 3.6) of directed simplicial complexes (Definition 3.1) that detects homology classes of directed 1-cycles, as desired (Fig. 1, Proposition 3.24).

This insight arises from the use of homology with semiring coefficients, where additive inverses may not exist. Indeed, the main results in this paper can be understood and reformulated in full generality using homology theory with semiring coefficients, see Appendix 1.

Our directed homology theory can be extended to the persistent setting. More concretely, we define two persistence modules associated to filtrations of directed simplicial complexes: an undirected one using the whole homology module (Definition 4.2) and a directed one using the submodule of directed homology (Definition 4.3). We show that the bars in the directed barcodes can be matched one-to-one with bars in the undirected barcodes, with the directed bars possibly having a later birth (Proposition 4.7, Figs. 2, 5, 6).

Our motivation to develop directed persistent homology is the applications to real-world data sets where asymmetry or directionality, in particular the presence of directed cycles, plays a fundamental role. Examples include biological neural networks (directed synaptic connections), time series data (directed temporal connections) or biological molecular networks such as protein-protein interaction networks (inhibitory and excitatory connections). Mathematically, we can model these situations using a finite set V of data points, and an arbitrary function \(d_V :V \times V \rightarrow {\mathbb {R}}\), which we call dissimilarity function (Sect. 2.2) and which, crucially, may not be symmetric. Our main example of a directed simplicial complex is the directed Rips complex (Definition 4.12) of \((V,d_V)\), which becomes the input of our suggested directed persistent homology pipeline.

Fig. 1
figure 1

Two examples of directed simplicial complexes X (left) and Y (right). Our directed submodules of homology over the rings \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\) detect directed 1-cycles: \(H_1^{{\text {Dir}}}(X,R)=\{0\}\), while \(H_1^{{\text {Dir}}}(Y,R)=R\) generated by the directed 1-cycle \([w_1,w_2] + [w_2,w_3] + [w_3,w_1]\)

In the context of dissimilarity functions, we prove a stability result with respect to the bottleneck distance between (directed) persistent diagrams and the correspondence distortion distance (a generalization of the Gromov-Hausdorff distance) between dissimilarity functions over finite sets (Theorem 4.19). We finish this article by discussing the computational challenges of our approach.

1.1 Related work

A first approach to incorporating directionality would be to encode the asymmetry of a data set in the simplicial complex built from it. In Turner (2019), the author uses ordered tuple complexes or OT-complexes, which are generalizations of simplicial complexes where simplices are ordered tuples of vertices. Similar ideas have been successfully used in the field of neuroscience to show the importance of directed cliques of neurons (Reimann et al. 2017), showing that directionality in neuron connectivity plays a crucial role in the structure and function of the brain. In Chowdhury and Mémoli (2018a), the authors use so-called Dowker filtrations to develop persistent homology for asymmetric networks, and note (Chowdhury and Mémoli 2018a, Remark 35) that a non-trivial 1-dimensional persistence diagram associated to Dowker filtrations suggests the presence of directed cycles. However, they also note that such persistence diagram may be non-trivial even if directed cycles are not present. Further progress can be achieved by combining the ideas above with homology theories that are themselves sensitive to asymmetry. In Chowdhury and Mémoli (2018b), the authors develop persistent homology for directed networks using the theory of path homology of graphs (Grigor’yan et al. 2020). This persistent homology theory shows stability with respect to the distance between asymmetric networks (Carlsson et al. 2014), and is indeed able to tell apart digraphs with isomorphic underlying graphs but different orientations on the edges. Nonetheless, cycles in path homology do not correspond to directed cycles, see Chowdhury and Mémoli (2018b, Example 10). Another significant contribution can be found in Turner (2019), where four new approaches to persistent homology are developed for asymmetric data, all of which are shown to be stable. Each approach is sensitive to asymmetry in a different way. For example, one of them uses a generalization of poset homology to preorders to detect strongly connected components in digraphs, a feature our implementation does not have (see Proposition 3.18). More interestingly for our purposes, in Turner (2019, Section 5) the author introduces a persistent homology approach that builds a directed Rips filtration of ordered tuple complexes associated to dissimilarity functions \(d_V:V\times V\rightarrow {\mathbb {R}}\). This is indeed sensitive to asymmetry and yields a persistent homology pipeline that is stable with respect to the correspondence distortion distance, a generalization of the Gromov-Hausdorff distance to dissimilarity functions (see Turner 2019, Section 2 and Sect. 2.2). However, undirected cycles are also detected by this homology theory. In contrast, in this article we produce a theory of persistent homology associated to ordered tuple complexes that only detects directed cycles and which is also stable with respect to the correspondence distortion distance.

1.1.1 Overview of results

We introduce modules of undirected and directed homology associated to directed simplicial complexes (Definition 3.4) and show that they satisfy some desirable properties. Furthermore, we prove that for certain coefficient rings, closed paths will only have non-trivial directed homology in dimension 1 when their edges form a directed cycle, as we set up to do (Proposition 3.24). Our modules of directed homology can be defined in dimensions greater than one, although they are zero in all even dimensions (Proposition 3.26) except in dimension 0 where they detect weakly connected components (Proposition 3.18).

Next, we extend our homology theory to the persistence setting. In particular, we introduce, for each dimension, two persistence modules associated to the same filtration: an undirected persistence module (Definition 4.2), which is analogous to the one introduced in Turner (2019, Section 5), and the submodule generated by directed classes, which we call the directed persistence module (Definition 4.3). The directed persistence module gives rise to bars associated to homology classes that can be represented by directed cycles, as illustrated in Fig. 2 and Examples 4.8 to 4.11. We also establish a relation between the undirected and directed persistence barcodes of the same filtration. Indeed, in Proposition 4.7 we show that every bar in the directed barcode corresponds to a unique bar in the undirected barcode that dies at the same time. The bar in the directed barcode may, however, be born later, and some bars in the undirected barcode may be left unmatched (see Figs.  2, 5 and 6).

Fig. 2
figure 2

A filtration of a directed simplicial complex (top, left to right) and corresponding undirected (bottom, left) and directed (bottom, right) persistence barcodes. Every bar in the directed barcode corresponds to a unique bar in the undirected barcode (shown here by matching colours) (colour figure online)

Having all the necessary ingredients, we can provide a complete workflow for directed persistent homology: given a dissimilarity function \(d_V\) on a finite set V, we construct its directed Rips filtration (Definition 4.12), and take the corresponding undirected and directed n-dimensional persistence modules, respectively denoted \({\mathcal {H}}_n(V, d_V)\) and \({\mathcal {H}}_{n}^{{\text {Dir}}}(V,d_V)\) (Definition 4.13). Both of these persistence modules have persistence diagrams and barcodes (Definition 4.15) and the associated persistence modules are stable with respect to the correspondence distortion distance (Sect. 2.2 and Theorem 4.19).

We finish the article with a discussion of the computational challenges of calculating the directed persistent homology of a dissimilarity function. The Standard Algorithm can easily be adapted to compute the barcodes of the undirected persistent homology of the dissimilarity function, but the computation of the directed persistence barcodes is more challenging. A direct approach results in an extreme ray enumeration problem (Sect. 5), a well-known problem in computational geometry. Developing an algorithm that computes the directed homology classes, rather than all directed cycles, remains an open problem.

We include an Appendix on homology with semiring coefficients and on how it gives rise to the ideas introduced in this article. This provides additional motivation and context for our results, and presents them in full generality.

1.1.2 Outline of the article

In Sect. 2, we introduce the necessary background in persistence modules (2.1) and dissimilarity functions (2.2). In Sect. 3 we introduce undirected and directed homology modules of directed simplicial complexes. We then use these homology modules to introduce directed and undirected persistent homology in Sect. 4, where we also show our stability results with respect to dissimilarity functions. In Sect. 5, we discuss the computational implementation of directed persistent homology and lay out some future research directions. Finally, Appendix 1 introduces homology with semiring coefficients and shows how it relates to directed homology.

2 Persistence modules and dissimilarity functions

Our goal is to extend persistent homology to directed simplicial complexes such as those constructed from a dissimilarity function. In this section, we introduce the necessary background regarding persistent homology (Sect. 2.1) and dissimilarity functions (Sect. 2.2).

2.1 Persistence modules, diagrams and barcodes

In this section, we introduce persistence modules and their associated persistence diagrams and barcodes. We follow the exposition in Chowdhury and Mémoli (2018b), as it is simple and focused on persistence modules arising in the context we are interested in: that of persistent homology of finite simplicial complexes. Many of the results below hold in more generality (Chazal et al. 2016) but we chose to keep the exposition simple.

Let R be a ring with unity and let \(T\subseteq {\mathbb {R}}\) be a subset.

Definition 2.1

A persistence R-module over T, written \({\mathcal {V}} = \big (\{V^\delta \},\{\nu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in T}\), is a family of R-modules \(\{V^\delta \}_{\delta \in T}\) and homomorphisms \(\nu _\delta ^{\delta '}:V^\delta \rightarrow V^{\delta '}\), whenever \(\delta \le \delta '\in T\), such that

  1. (1)

    for every \(\delta \in T\), \(\nu _\delta ^\delta \) is the identity map, and

  2. (2)

    for every \(\delta \le \delta '\le \delta ''\in T\), \(\nu _{\delta '}^{\delta ''}\circ \nu _\delta ^{\delta '} = \nu _\delta ^{\delta ''}\).

Let \({\mathcal {V}} = \big (\{V^\delta \},\{\nu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in T}\) and \({\mathcal {W}} = \big (\{W^\delta \},\{\mu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in T}\) be two persistence R-modules over T. A morphism of persistence R-modules \(f:{\mathcal {V}}\rightarrow {\mathcal {W}}\) is a family of morphisms of R-modules \(\{f^\delta :V^\delta \rightarrow W^\delta \}_{\delta \in T}\) such that for every \(\delta \le \delta '\in T\) we have a commutative diagram

figure a

Let us assume that R is a field, thus \({\mathcal {V}} = \big (\{V^\delta \},\{\nu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in T}\) is a persistence vector space, and that \(V^\delta \) is finite-dimensional, for every \(\delta \in {\mathbb {R}}\). Furthermore, we suppose that there exists a finite subset \(\{\delta _0,\delta _1,\dots ,\delta _n\}\subseteq T\) for which

  1. (1)

    if \(\delta \in T\), \(\delta \le \delta _0\), then \(V^\delta = 0\),

  2. (2)

    if \(\delta \in T\cap [\delta _{i-1},\delta _i)\) for some \(1\le i \le n\), the map \(\nu _{\delta _{i-1}}^\delta \) is an isomorphism, while \(\nu _\delta ^{\delta _i}\) is not, and

  3. (3)

    if \(\delta ,\delta '\in T\), \(\delta _n \le \delta < \delta '\), then \(v_\delta ^{\delta '}:V^{\delta }\rightarrow V^{\delta '}\) is an isomorphism.

Remark 2.2

When R is a field, either of these restrictions alone (namely, each \(V^\delta \) being finite-dimensional or the existence of a finite subset \(\{\delta _0,\delta _1,\dots ,\delta _n\}\) as above) is enough to associate a persistence barcode and a persistence diagram to \({\mathcal {V}}\) (Chazal et al. 2016, Theorem 2.8). We nevertheless assume both restrictions since they hold for persistence diagrams associated to finite simplicial complexes, which are precisely the sort of objects that arise from data, and such assumption makes the exposition simpler.

Let us now introduce persistence barcodes and diagrams. First, for simplicity, we consider \({\mathcal {V}}\) indexed by the natural numbers:

$$\begin{aligned} {\mathcal {V}} = \big (\{V^{\delta _i}\},\big \{\nu _{\delta _i}^{\delta _{i+1}}\big \}\big )_{i\in {\mathbb {N}}}, \end{aligned}$$

where \(V^{\delta _k} = V^{\delta _n}\) for all \(k \ge n\) and \(\nu _{\delta _k}^{\delta _l}\) is the identity whenever \(k, l \ge n\). (This clearly contains all the information in \({\mathcal {V}}\).)

By Edelsbrunner et al.  (2015, Basis Lemma), we can find bases \(B_i\) of the vector spaces \(V^{\delta _i}\), \(i \in {\mathbb {N}}\), such that

  1. (1)

    \(\nu _{\delta _i}^{\delta _{i+1}}(B_i)\subseteq B_{i+1}\cup \{0\}\),

  2. (2)

    \({\text {rank}}(\nu _{\delta _i}^{\delta _{i+1}}) = |v_{\delta _i}^{\delta _{i+1}}(B_i)\cap B_{i+1}|\), and

  3. (3)

    each \(w\in {\text {Im}}\big (v_{\delta _i}^{\delta _{i+1}}\big )\cap B_{i+1}\) is the image of exactly one element \(v\in B_i\).

Such bases are called compatible bases. Elements in \(B_i\) that are mapped to an element in \(B_{i+1}\) correspond to linearly independent elements of \(V^{\delta _i}\) that ‘survive’ until the next step in the persistence vector space. Similarly, elements in a basis \(B_i\) which are not in \(B_{i-1}\) are considered to be ‘born’ at index i. Formally, we define

$$\begin{aligned} L:=\left\{ (b,i)\mid b\in B_i, b\not \in {\text {Im}}\left( \nu _{\delta _{i-1}}^{\delta _i}\right) ,i > 0\right\} \cup \{(b,0)\mid b\in B_0\}. \end{aligned}$$

Given \((b,i) \in L\), we call i the birth index of the basis element b. This element ‘survives’ on subsequent bases until it is eventually mapped to zero. When this happens, the number of steps taken until the class dies is its death index of b. Formally, the death index of (bi) is

$$\begin{aligned} \ell (b,i):=\max \left\{ j\in {\mathbb {N}}\mid \left( \nu _{\delta _{j-1}}^{\delta _j}\circ \dots \circ \nu _{\delta _{i+1}}^{\delta _{i+2}}\circ \nu _{\delta _i}^{\delta _{i+1}}\right) (b)\in B_j\right\} . \end{aligned}$$

We allow \(\ell (b,i) = \infty \), if b is in every basis \(B_j\) for all \(j\ge i\), so that the death index takes values in \(\overline{{\mathbb {N}}}={\mathbb {N}} \cup \{+\infty \}\). Using this information, we can introduce the persistence barcode of \({\mathcal {V}}\). We call a pair (Xm) a multiset if X is a set and \(m :X \rightarrow \overline{{\mathbb {N}}}={\mathbb {N}}\cup \{+\infty \}\) is a function. We call m(x) the multiplicity of \(x \in X\).

Definition 2.3

Consider a persistence vector space \({\mathcal {V}} = \big (\{V^{\delta _i}\},\big \{\nu _{\delta _i}^{\delta _{i+1}}\big \}\big )_{i\in {\mathbb {N}}}\) as above. The persistence barcode of \({\mathcal {V}}\) is defined as the multiset of intervals

$$\begin{aligned} {\text {Pers}}({\mathcal {V}}):= & {} \big \{[\delta _i,\delta _{j+1})\mid \exists (b,i)\in L, j\in {\mathbb {N}} \hbox {s.t.} \ell (b,i)=j \big \}\\{} & {} \cup \big \{[\delta _i,+\infty )\mid {\exists (b,i)\in L \hbox {s.t.} \ell (b,i)=+\infty }\big \}, \end{aligned}$$

with the multiplicity of \([\delta _i,\delta _{j+1})\) (respectively \([\delta _i,+\infty )\)) being the number of elements \((b,i)\in L\) such that \(\ell (b,i) = j\) (respectively \(\ell (b,i)=+\infty \)).

Thus, persistence barcodes encode the birth and death of elements in a family of compatible bases. Crucially, and even though compatible bases are not unique, the number of birth and death events at each step is determined by the rank of the linear maps \(\nu _{\delta _i}^{\delta _{i+1}}\) and their compositions, and it is thus independent of the choice of compatible bases. Furthermore, the persistence barcode of a persistence vector space completely determines both the dimension of the vector spaces \(V^{\delta _i}\) and the ranks of the linear maps between them, hence it determines the persistence vector space up to isomorphism (Chazal et al. 2016, Theorem 2.8).

Each interval in \({\text {Pers}}({\mathcal {V}})\) is called a persistence interval. Persistence barcodes can be represented by stacking horizontal lines, each of which represents a persistence interval or bar. The endpoints of the line in the horizontal axis correspond to the endpoints of the interval it represents, whereas the vertical axis has no significance other than being able to represent every persistence interval at once. Persistence bars can be stacked in any order, although they are usually ordered by their birth. This representation is what gives persistence barcodes their name.

An alternative characterization of a persistence vector space is its persistence diagram. Let us write \(\overline{{\mathbb {R}}}={\mathbb {R}}\cup \{-\infty ,+\infty \}\) for the extended real line.

Definition 2.4

The persistence diagram of the persistence vector space \({\mathcal {V}}\) is the multiset

$$\begin{aligned} {\text {Dgm}}({\mathcal {V}}):= \big \{(\delta _i, \delta _{j+1})\in \overline{{\mathbb {R}}}^2\mid [\delta _i,\delta _{j+1})\in {\text {Pers}}({\mathcal {V}})\big \} \cup \big \{(\delta _i,+\infty )\in \overline{{\mathbb {R}}}^2\mid [\delta _i,+\infty )\in {\text {Pers}}({\mathcal {V}})\big \}. \end{aligned}$$

The multiplicity of a point in \({\text {Dgm}}({\mathcal {V}})\) is the multiplicity of the corresponding interval in \({\text {Pers}}({\mathcal {V}})\).

A crucial property for applications of persistent homology to real data is that a small perturbation of the input (a data set, encoded as filtration of simplicial complexes) results in a small perturbation of the output (its persistence module). Algebraically, this amounts to proving that a small perturbation of the persistence diagram results in a small perturbation of the associated persistence module. In order to state this stability result, we therefore need to introduce distances between persistence diagrams, and persistence modules, respectively.

To measure how far apart two persistence diagrams are, we can use the bottleneck distance between multisets of \(\overline{{\mathbb {R}}}^2\). Let \(\Delta ^\infty \) denote the multiset of \(\overline{{\mathbb {R}}}^2\) consisting of every point in the diagonal counted with infinite multiplicity. A bijection of multisets \(\varphi :(X,m_X)\rightarrow (Y,m_Y)\) is a bijection of sets \(\varphi :\cup _{x\in X} \sqcup _{i=1}^{m_X(x)} x\rightarrow \cup _{y\in Y} \sqcup _{i=1}^{m_Y(y)} y\), that is, a bijection between the sets obtained when counting each element in both X and Y with its multiplicity.

Definition 2.5

Let A and B be two multisets in \(\overline{{\mathbb {R}}}^2\). The bottleneck distance between A and B is defined as

$$\begin{aligned} d_B(A,B):=\inf _\varphi \left\{ \sup _{a\in A}\Vert a-\varphi (a)\Vert _\infty \right\} , \end{aligned}$$

where the infimum is taken over all bijections of multisets \(\varphi :A\cup \Delta ^\infty \rightarrow B\cup \Delta ^\infty \) and where \(\Vert \cdot \Vert _\infty \) denotes the \(\ell ^\infty \)-norm in \(\overline{{\mathbb {R}}}^2\).

Note that the bottleneck distance between two persistence diagrams defined from persistence barcodes can only be finite if the diagrams have the same amount of bars of form \([a,\infty )\) for \(a\in {\mathbb {R}}\).

We also need a distance between persistence vector spaces. To that purpose, we use the interleaving distance, introduced in Chazal et al. (2009).

Definition 2.6

Let \({\mathcal {V}} = \big (\{V^\delta \},\{\nu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in {\mathbb {R}}}\) and \({\mathcal {W}} = \big (\{W^\delta \},\{\mu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in {\mathbb {R}}}\) be two persistence vector spaces, and \(\varepsilon \ge 0\). We say that \({\mathcal {V}}\) and \({\mathcal {W}}\) are \(\varepsilon \)-interleaved if there exist two families of linear maps

$$\begin{aligned} \{\varphi _\delta :V^\delta \rightarrow W^{\delta +\varepsilon }\}_{\delta \in {\mathbb {R}}},\quad \{\psi _\delta :W^\delta \rightarrow V^{\delta +\varepsilon }\}_{\delta \in {\mathbb {R}}} \end{aligned}$$

such that the following diagrams are commutative for all \(\delta '\ge \delta \in {\mathbb {R}}\):

figure b

The interleaving distance between \({\mathcal {V}}\) and \({\mathcal {W}}\) is then defined as

$$\begin{aligned} d_I({\mathcal {V}},{\mathcal {W}}) = \inf \{\varepsilon \ge 0 \mid {{\mathcal {V}}\,\, \hbox {and}\,\, {\mathcal {W}} \,\, \hbox {are}\,\, \varepsilon -\hbox {interleaved}}\}. \end{aligned}$$

The authors in Chazal et al. (2009) show that the interleaving distance is a pseudometric (a zero distance between distinct points may occur) in the class of persistence vector spaces. Moreover, they show the following Algebraic Stability Theorem.

Theorem 2.7

(Chazal et al. 2009) Let \({\mathcal {V}} {=} \big (\{V^\delta \},\{\nu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in {\mathbb {R}}}\) and \({\mathcal {W}} {=} \big (\{W^\delta \},\{\mu _\delta ^{\delta '}\}\big )_{\delta \le \delta '\in {\mathbb {R}}}\) be two persistence vector spaces. Then,

$$\begin{aligned} d_B\big ({\text {Dgm}}({\mathcal {V}}),{\text {Dgm}}({\mathcal {W}})\big ) \le d_I({\mathcal {V}},{\mathcal {W}}). \end{aligned}$$

2.2 Dissimilarity functions and the correspondence distortion distance

Our objective is to define a theory of persistent homology able to detect directed cycles modulo boundaries. Therefore, instead of building filtrations (of simplicial complexes) from finite metric spaces, we are interested in filtrations (of directed simplicial complexes) built from arbitrary dissimilarity functions. We will follow (Turner 2019), where they receive the name of set-function pairs, and Carlsson et al. (2014), Chowdhury and Mémoli (2018a, 2018b), where they are referred to as dissimilarity networks or asymmetric networks.

In this section, we introduce the necessary background on dissimilarity functions, and the correspondence distortion distance between them, which is a generalization of the Gromov-Hausdorff distance to the asymmetric setting. We finish with a reformulation of this distance, established in Carlsson et al. (2014), which we will need to prove our persistent homology stability result.

Definition 2.8

Let V be a finite set. A dissimilarity function \((V,d_V)\) on V is a function \(d_V:V\times V\rightarrow {\mathbb {R}}\). The value of \(d_V\) on a pair \((v_1,v_2)\) is called the distance, or dissimilarity, from \(v_1\) to \(v_2\).

Note that no restrictions are imposed on \(d_V\), thus it may not be symmetric, the triangle inequality may not hold, and the distance from a point to itself may not be zero. These functions are also referred to as asymmetric networks (Carlsson et al. 2014; Chowdhury and Mémoli 2018a, b) since they may be represented as a network with vertex set V and an edge from \(v_1\) to \(v_2\) with weight \(d_V(v_1,v_2)\) for every \((v_1,v_2)\in V\times V\). Thus, dissimilarity functions are very flexible and allow for the modelling of widely different problems, including any problem that can be modelled using a network.

We would like to build (directed) simplicial complexes and, ultimately, persistence diagrams from dissimilarity functions. In order to check the stability of our constructions, we need a way to measure how close two such objects are. When comparing networks with the same vertex sets, a natural choice is the \(\ell ^\infty \) norm. However, we are interested in comparing dissimilarity functions on different vertex sets. To that end, we consider the \(\ell ^\infty \) norm over all possible pairings (quantified by a binary relation) between vertex sets, following ideas similar to those behind the definition of the Gromov-Hausdorff distance.

Definition 2.9

Let \((V,d_V)\) and \((W,d_W)\) be two dissimilarity functions and let \(\theta \) be a non-empty binary relation between V and W, that is, an arbitrary subset \(\theta \subseteq V \times W\). The distortion of the relation \(\theta \) is defined as

$$\begin{aligned} {\text {dis}}(\theta ):= \max _{(v_1,w_1), (v_2,w_2)\in \theta } |d_V(v_1,v_2) - d_W(w_1,w_2)|. \end{aligned}$$

A correspondence between V and W is a relation \(\theta \) between these sets such that \(\pi _V(\theta )=V\) and \(\pi _W(\theta ) = W\), where \(\pi _V :V \times W \rightarrow V\) is the projection onto V, and similarly for \(\pi _W\). That is, \(\theta \) is a correspondence if every element of V is related to at least an element of W, and vice-versa. The set of all correspondences between V and W is denoted \({\mathcal {R}}(V,W)\).

The correspondence distortion distance (Turner 2019) between \((V,d_V)\) and \((W,d_W)\) is defined as

$$\begin{aligned} d_{{\text {CD}}}\big ((V,d_V), (W,d_W)\big ) = \frac{1}{2}\min _{\theta \in {\mathcal {R}}(V,W)}{\text {dis}}(\theta ). \end{aligned}$$

This notion agrees with that of the Gromov–Hausdorff distance when \((V,d_V)\) and \((W,d_W)\) are metric spaces (Burago et al. 2001, Section 7.3.3).

We will use a reformulation of the correspondence distortion that can be found in Chowdhury and Mémoli (2018a). In order to introduce it, we need to define the distortion and co-distortion of maps between sets endowed with dissimilarity functions.

Definition 2.10

Let \((V,d_V)\) and \((W,d_W)\) be any two dissimilarity functions and let \(\varphi :V\rightarrow W\) and \(\psi :W\rightarrow V\) be maps of sets. The distortion of \(\varphi \) (with respect to \(d_V\) and \(d_W\)) is defined as

$$\begin{aligned} {\text {dis}}(\varphi ):= \max _{v_1,v_2\in V} \big |d_V(v_1,v_2) - d_W\big (\varphi (v_1),\varphi (v_2)\big )\big |. \end{aligned}$$

The co-distortion of \(\varphi \) and \(\psi \) (with respect to \(d_V\) and \(d_W\)) is defined as

$$\begin{aligned} {\text {codis}}(\varphi ,\psi ):= \max _{(v,w)\in V\times W} \big |d_V\big (v,\psi (w)\big ) - d_W\big (\varphi (v),w\big )\big |. \end{aligned}$$

Note that codistortion is not necessarily symmetrical, namely, \({\text {codis}}(\varphi ,\psi )\) and \({\text {codis}}(\psi ,\varphi )\) may be different if either of the dissimilarity functions are asymmetric.

Finally, we have the following reformulation of the correspondence distortion distance.

Proposition 2.11

(Chowdhury and Mémoli 2018a, Proposition 9) Let \((V, d_V)\) and \((W, d_W)\) be any two dissimilarity functions. Then,

$$\begin{aligned} d_{{\text {CD}}}\big ((V,d_V),(W,d_W)\big ) = \frac{1}{2}\min _{\begin{array}{c} \varphi :V\rightarrow W,\\ \psi :W\rightarrow V \end{array}}\big \{\max \left\{ {\text {dis}}(\varphi ),{\text {dis}}(\psi ), {\text {codis}}(\varphi ,\psi ), {\text {codis}}(\psi ,\varphi )\right\} \big \}. \end{aligned}$$

3 Directed homology of directed simplicial complexes

In this section, we introduce and study a family of subrings of the homology rings of simplicial complexes which encode directionality information and in particular detect directed cycles (Fig. 1). We cannot introduce such a family using (undirected) simplicial complexes, as they cannot encode directionality information of the simplices. One approach is to use the so-called ordered-set complexes, where simplices are sets with a total order on the vertices. They generalize simplicial complexes, which can be encoded as fully symmetric ordered-set complexes, that is, ordered-set complexes where if a set of vertices forms a simplex, it must do so with every possible order. However, persistent homology of ordered-set complexes is not stable (Remark 4.20).

To achieve stability, we use one further generalization, called ordered tuple complexes or OT-complexes in Turner (2019), and called directed simplicial complexes in this article (Definition 3.1). The only difference is that arbitrary repetitions of vertices are allowed in the ordered tuples representing simplices. Clearly, any ordered-set complex is a directed simplicial complex. Furthermore, a (undirected) simplicial complex can be encoded as a fully symmetric (as above) directed simplicial complex where every possible repetition of vertices is also included. When doing so, the (undirected) simplicial complex and its associated directed simplicial complex have isomorphic homologies over rings (Remark 3.5), and morphisms of simplicial complexes can be lifted to morphisms between their associated directed simplicial complexes (Remark 3.9). Finally, and crucially for us, we will be able to use the above-mentioned subrings encoding information on directed cycles to introduce a theory of persistent homology for dissimilarity functions which is stable with respect to the correspondence-distortion distance (Sect. 4). Note that, as ordered-set complexes are directed simplicial complexes, the results stated here apply to homology computations on ordered-set complexes as well.

3.1 Chain complexes of directed simplicial complexes

In this section, we introduce directed simplicial complexes and their associated chain complexes and homology modules, including modules of directed homology.

Definition 3.1

A directed simplicial complex, or ordered tuple complex, is a pair (VX) where V is a finite set of vertices, and X is a family of tuples \((x_0,x_1,\dots ,x_n)\) of elements of V such that if \((x_0,x_1,\dots ,x_n)\in X\), then \((x_0,x_1,\dots ,\widehat{x_i},\dots ,x_n)\in X\) for every \(i=0,1,\dots ,n\). (Here and throughout the rest of the paper, \(\widehat{x_i}\) indicates that \(x_i\) is omitted from the list.)

We will denote the directed simplicial complex (VX) just by X, and assume that every vertex belongs to at least one directed simplex (so that V is uniquely determined from X). Elements of X of length \(n+1\) are called n-simplices, and the subset of the n-simplices of X is denoted by \(X_n\). Note that arbitrary repetitions of vertices in a tuple are allowed.

Note that directed simplicial complexes are more general objects than simplicial complexes, in a way that allows directed simplicial complexes to encode asymmetric information. Note further that it is possible to define a geometric realization for these objects in which simplices with vertex repetitions are collapsed to a simplex with no repetitions, thus simplices with repeated vertices play a role similar to that of the degenerate simplices in simplicial sets.

We make use of the following terminology when dealing with directed simplicial complexes. Elements of X of length \(n+1\) are called n-simplices, and the subset of the n-simplices of X is denoted by \(X_n\). An n-simplex obtained by removing vertices from an m-simplex, \(n \le m\), is said to be a face of the m-simplex. Such face is called proper if \(n<m\), or equivalently, if at least vertex of the m-simplex is removed. A directed simplicial complex is said to be n-dimensional, denoted \({\text {dim}}(X)=n\), if \(X_{n+1}\) is trivial (empty) but \(X_n\) is not. A collection Y of simplices of X that is itself a directed simplicial complex is said to be a directed simplicial subcomplex (or, simply, subcomplex) of X, denoted \(Y\subseteq X\). Note that the vertex set of Y may be strictly smaller than that of X.

We now introduce chain complexes associated to a directed simplicial complex. These definitions are straight generalizations of those for (undirected) simplicial complexes.

Definition 3.2

Let R be a commutative ring. The n-dimensional chains of X are defined as the elements of the free R-module generated by the n-simplices,

$$\begin{aligned} C_n(X,R) = R\big (\left\{ [x_0,x_1,\dots ,x_n]\mid (x_0,x_1,\dots ,x_n)\in X\right\} \big ). \end{aligned}$$

We call the elements \([x_0,x_1,\dots ,x_n]\in C_n(X,R)\), \((x_0,x_1,\dots ,x_n)\in X\), elementary n-chains.

Definition 3.3

Let X be a directed simplicial complex. For each \(n>0\), we define a morphism of R-modules \(\partial _n:C_n(X,R)\rightarrow C_{n-1}(X,R)\) by

$$\begin{aligned} \partial _n([x_0,x_1,\dots ,x_n]) = \sum _{i=0}^{n}(-1)^i [x_0,x_1,\dots , \widehat{x_{i}},\dots ,x_n] \end{aligned}$$

For \(n=0\), let \(\partial _0:C_0(X,R)\rightarrow \{0\}\) be the trivial map.

A straightforward computation analogous to the one for chain complexes in simplicial homology shows that \(\{C_n(X,R),\partial _n\}\) is a chain complex of R-modules. In particular, we can define homology groups.

Definition 3.4

Let X be a directed simplicial complex, R a commutative ring, and \(n \ge 0\). The n-dimensional cycles, boundaries, and homology of X are \(Z_n(X,R) = \{x\in C_n(X,R)\mid \partial _n(x)=0\}\), \(B_n(X,R)={\text {Im}}\partial _{n+1}\) and the quotient \(H_n(X,R)=Z_n(X,R)/B_n(X,R)\), respectively.

Remark 3.5

If X is an (undirected) simplicial complex, we can define an ordered-set simplicial complex \(X^{\text {OT}}\) where \((x_0,x_1,\dots ,x_n)\in X^{\text {OT}}\) whenever \(\{x_0,x_1,\dots ,x_n\}\), after removing any repetition of vertices, is a simplex in X. The chain complex \(C_*(X^{\text {OT}},R)\) is called the ordered chain complex of X in Munkres (1984), and its homology is isomorphic to the singular homology of X over R.

We now discuss how to only retain the information associated to directed cycles. Note that when introducing the differential for the chain complexes of simplicial complexes, an orientation is chosen for each of the simplices. However, undirected cycles can still be produced because the chosen orientation for a simplex can be reverted by changing the sign of the corresponding elementary chain. As such, homology of (undirected) simplicial complexes is independent of these choices of orientations.

In the case of directed simplicial complexes, orientations are not chosen, and we can ensure that we are only retaining information regarding directed cycles by making sure that all the chains have positive coefficients, when the coefficient ring is chosen appropriately. However, we also require the introduced object to be a submodule of the entire module of homology. Thus, we arrive at the following definition.

Definition 3.6

Let X be a directed simplicial complex and let \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\). The set of n-dimensional directed cycles of X over R is

$$\begin{aligned} Z_n^{{\text {Dir}}}(X,R) = \left\{ \sum _i\lambda _i c_i\in Z_n(X,R)\mid \lambda _i\ge 0, c_i\, \text {elementary}\, n\text {-chain}\right\} . \end{aligned}$$

The nth dimensional module of directed homology, \(H_n^{{\text {Dir}}}(X,R)\), is the submodule of \(H_n(X,R)\) generated by the directed cycles,

$$\begin{aligned} H_n^{{\text {Dir}}}(X,R) = \left\langle \left\{ [x]\mid x\in Z_n^{{\text {Dir}}}(X,R)\right\} \right\rangle . \end{aligned}$$

Remark 3.7

The rings \({\mathbb {Z}},{\mathbb {Q}}\) and \({\mathbb {R}}\) are used to simplify the exposition: the definition of \(Z_n^{{\text {Dir}}}(X,R)\), and thus of \(H_n^{{\text {Dir}}}(X,R)\), can be made in an analogous way for any ring R that is the Grothendieck completion of a cancellative, zerosumfree semiring \(\Lambda \) (see Appendix 1).

In view of Definition 3.6 it is clear that, in dimension 1, directed circuits in the directed graph underlying a directed simplicial complex will give rise to directed cycles. In Sect. 3.3 we will show how these directed submodules of homology behave in a desirable way.

3.2 Functoriality of directed homology

In this section, we prove that homology and directed homology are functors from the category of directed simplicial complexes to the category of graded R-modules. We also show that two morphisms allowing for the construction of the prism operator must induce the same map on homology, a result we will need to prove our persistent homology stability result. We begin by introducing morphisms of directed simplicial complexes.

Definition 3.8

A morphism of directed simplicial complexes \(f:(V,X)\rightarrow (W,Y)\) or just \(f:X\rightarrow Y\), is a map of sets \(f:V\rightarrow W\) such that if \((x_0,x_1,\dots ,x_n)\in X\) then \(\big (f(x_0), f(x_1),\dots , f(x_n)\big )\in Y\).

Remark 3.9

This definition is stricter than the classical notion of morphism of simplicial complexes, where morphisms are allowed to take simplices to simplices of lower dimension, as directed simplicial complexes can intrinsically account for vertex repetitions. However, note that if X and Y are (undirected) simplicial complexes, a map \(f:X\rightarrow Y\) is a morphism of simplicial complexes if and only if \(f:X^{\text {OT}}\rightarrow Y^{\text {OT}}\) (see Remark 3.5) is a morphism of directed simplicial complexes.

Definition 3.10

Let \(f:X\rightarrow Y\) be a morphism of directed simplicial complexes. Then f induces morphisms of R-modules \(C(f) = \{C_n(f)\}\), defined as

$$\begin{aligned} C_n(f):C_n(X,R)&\longrightarrow C_n(Y,R) \\ [x_0,x_1,\dots ,x_n]&\longmapsto [f(x_0), f(x_1),\dots ,f(x_n)]. \end{aligned}$$

We will often abbreviate \(C_n(f)=f_n\).

Proposition 3.11

If \(f:X\rightarrow Y\) is a morphism of directed simplicial complexes, the family of maps \(\{C_n(f)\}\) is a R-homomorphism of chain complexes. Therefore, it induces a map \(H_n(f):H_n(X,R)\rightarrow H_n(Y,R)\). Furthermore, \(H_n(f)\) restricts to a map \(H_n^{{\text {Dir}}}(f):H_n^{{\text {Dir}}}(X,R)\rightarrow H_n^{{\text {Dir}}}(Y,R)\).

Proof

Let \([x_0,x_1,\dots ,x_n]\in C_n(X,R)\) be a simplex. Simple computations show that \(C_{n-1}(f)\partial _n = \partial _n C_n(f)\), thus inducing a map \(H_n(f):H_n(X,R)\rightarrow H_n(Y,R)\).

Now let \(x\in Z_n^{{\text {Dir}}}(X,R)\). We can write \(x = \sum _i \lambda _i x_i\), where \(\lambda _i\ge 0\) and \(x_i\) is an elementary n-chain. Then, \(C_n(f)(x) = \sum _i\lambda _i C_n(f)(x_i)\). Clearly, \(C_n(f)\) takes elementary n-chains to elementary n-chains, thus \(C_n(f)(x)\in Z_n^{{\text {Dir}}}(Y,R)\). It is then clear from the definition of directed homology that \(H_n(f)\) restricts to \(H_n(f):H_n(X,R)\rightarrow H_n(Y,R)\). \(\square \)

Remark 3.12

Let X and Y be (undirected) simplicial complexes and let R be a ring. If \(f:X\rightarrow Y\) is a morphism of (undirected) simplicial complexes, the map induced on homology by \(f:X\rightarrow Y\) is the same as the map induced on homology by \(f:X^{\text {OT}}\rightarrow Y^{\text {OT}}\) (see Remarks 3.5 and 3.9).

Corollary 3.13

(Directed) Homology is a functor from the category of directed simplicial complexes to the category of graded R-modules. In particular, isomorphic directed simplicial complexes have isomorphic (directed) homologies.

We finish this section by showing a sufficient condition for two morphisms to induce the same map on homology. We will need this result to prove that our definition of persistent homology is stable.

Lemma 3.14

Let R be a commutative ring. Let X and Y be two directed simplicial complexes and let \(f,g:X\rightarrow Y\) be morphisms of directed simplicial complexes such that if \((x_0,x_1,\dots ,x_n)\in X\), then \(\big (f(x_0),f(x_1),\dots ,f(x_i),g(x_i),\dots ,g(x_n)\big )\in Y\) for every \(i=0,1,\dots ,n\). Then, \(H_n(f) = H_n(g)\) for every \(n \ge 0\). Consequently, \(H_n^{{\text {Dir}}}(f)=H_n^{{\text {Dir}}}(g)\), for every \(n\ge 0\).

Proof

For \(x = [x_0,x_1,\dots ,x_n]\in C_n(X,R)\) an elementary n-chain, define

$$\begin{aligned} s_n[x_0,x_1,\dots ,x_n] = (-1)^i \sum _{i=0}^n [f(x_0),\dots ,f(x_{i}),g(x_{i}),\dots ,g(x_n)].\end{aligned}$$

We show that this family of maps provides a chain homotopy between f and g. Namely, we prove that \(C_n(g) - C_n(f) = \partial _{n+1} s_n + s_{n-1}\partial _n\), for all n. On the one hand,

$$\begin{aligned} \begin{aligned} s_{n-1}\partial _n(x) = \sum _{i=0}^n (-1)^i \left[ \sum _{j=0}^{i-1} (-1)^j \big [f(x_0), f(x_1),\dots , f(x_j), g(x_j),\dots , \widehat{g(x_i)},\dots , g(x_n)\big ] \right. \\ \left. + \sum _{j=i+1}^n (-1)^{j+1} \big [f(x_0),f(x_1),\dots , \widehat{f(x_i)},\dots , f(x_j),g(x_j),\dots , g(x_n)\big ]\right] . \end{aligned}\nonumber \\ \end{aligned}$$
(3.1)

On the other hand,

$$\begin{aligned} \begin{aligned} \partial _{n+1} s_n(x) = \sum _{j=0}^n (-1)^j\left[ \sum _{i=0}^j (-1)^i \big [f(x_0), f(x_1),\dots , \widehat{f(x_i)},\dots , f(x_j), g(x_j),\dots ,g(x_n)\big ] \right. \\ \left. + \sum _{i=j}^n (-1)^{i+1} \big [f(x_0),f(x_1),\dots ,f(x_j),g(x_j),\dots ,\widehat{g(x_i)},\dots ,g(x_n)\big ]\right] . \end{aligned} \end{aligned}$$

By exchanging the roles of the indices in this last equation, we obtain that

$$\begin{aligned} \begin{aligned} \partial _{n+1} s_n(x) = \sum _{i=0}^n \left[ \sum _{j=0}^i (-1)^{i+1} (-1)^j \big [f(x_0),f(x_1),\dots ,f(x_j),g(x_j),\dots ,\widehat{g(x_i)},\dots ,g(x_n)\big ]\right. \\ \left. + \sum _{j=i}^n (-1)^i (-1)^j\big [f(x_0),f(x_1),\dots , \widehat{f(x_i)},\dots , f(x_j),g(x_j),\dots , g(x_n)\big ]\right] . \end{aligned}\nonumber \\ \end{aligned}$$
(3.2)

Now, adding Eqs. (3.1) and (3.2),

$$\begin{aligned} \partial _{n+1} s_n(x) + s_{n-1}\partial _n(x)&= \sum _{i=0}^n [f(x_0), f(x_1),\dots ,f(x_{i-1}),g(x_i),\dots ,g(x_n)] \\&\quad - \sum _{i=0}^n \big [f(x_0),f(x_1),\dots ,f(x_i),g(x_{i+1}),\dots ,g(x_n)\big ]. \end{aligned}$$

It is now straightforward to check that this sum amounts to

$$\begin{aligned}{}[g(x_0), g(x_1),\dots , g(x_n)] - [f(x_0),f(x_1),\dots ,f(x_n)] = C_n(g)(x) - C_n(f)(x), \end{aligned}$$

and we are done. \(\square \)

3.3 Basic computations and examples

In this section, we explore some basic properties of this homology theory. We begin by studying the relation between homology and connectivity.

Definition 3.15

Let (VX) be a directed simplicial complex and \(v,w \in V\) be two vertices. A path from v to w in X a sequence of vertices \(v=x_0,x_1,\ldots ,x_n=w\) such that either \((x_i,x_{i+1})\) or \((x_{i+1},x_{i})\) is a simplex, for all \(1\le i \le n-1\). The (weakly) connected components of X are the equivalence classes of the equivalence relation \(v \sim w\) if there is a path in X from v to w. We call X (weakly) connected if it has only one connected component, that is, every pair of vertices can be connected by a path.

Note that this notion of connectedness ignores the direction of the edges (1-simplices). The next result shows that we can compute the homology of each connected component independently. The proof follows by observing that the chain complex \(C_n(X,R)\) is clearly the direct sum of the chain complexes associated to each of the (weakly) connected components of X. In particular, it is immediate that any directed cycle can be decomposed as a sum of directed cycles in each of the directed components.

Proposition 3.16

The (directed) homology of a directed simplicial complex X is isomorphic to the direct sum of the (directed) homology modules of its (weakly) connected components.

We next show that the 0th (directed) homology counts the number of (weakly) connected components of a directed simplicial complex X. We start with a lemma.

Lemma 3.17

Let R be a commutative ring and X be a directed simplicial complex. For any vertex v and any \(\lambda \in R\), \(\lambda [v]\) is homologous to the trivial class if and only if \(\lambda = 0\).

Proof

It is clear that \(\lambda [v]\) is a cycle as \(\partial _0\) is trivial. On the other hand, it is clear that it must be the trivial class if \(\lambda =0\). Now assume that \(\lambda [v]\) is the trivial class. We shall prove that \(\lambda =0\).

Assume that X has \(n+1\) vertices, namely \(V = \{x_0 = v, x_1,\dots , x_n\}\). Then if \(\lambda [x_0]\) is trivial, there exists a 1-chain

$$\begin{aligned} x = \sum _{i,j=0}^n \lambda _{ij} [x_i, x_j] \end{aligned}$$

such that \(\lambda [x_0] = \partial (x)\), where we are assuming that \(\lambda _{ij} = 0\) whenever \([x_i,x_j]\) is not a 1-chain. By computing the differentials,

$$\begin{aligned} \lambda [x_0] = \sum _{i,j=0}^n \lambda _{ij} [x_j] - \sum _{i,j=0}^n \lambda _{ij} [x_i]. \end{aligned}$$

Now, since \(\big \{[x_0], [x_1], \dots , [x_n]\big \}\) is a basis of \(C_0(X,R)\), the coefficients of each element in the basis must be equal in both sides of the equality. Namely, for each \(j \ne 0\), \(0 = \sum _{i=0}^n (\lambda _{ij} - \lambda _{ji})\), and \(\lambda = \sum _{i=0}^n (\lambda _{i0} - \lambda _{0i})\). Adding these equations, we deduce that \(\lambda = 0\). \(\square \)

Proposition 3.18

Let X be a directed simplicial complex and let R be a commutative ring. Then \(H_0(X,R) \cong R^k\), where k is the number of (weakly) connected components of X. Furthermore, if \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), then \(H_0(X,R) = H_0^{{\text {Dir}}}(X,R)\cong R^k\).

Proof

By Proposition 3.16 we only need to show that if X is connected, then \(H_0(X,R)\cong R\). Let v, w be any two vertices and let us show that [v] and [w] are homologous 0-cycles. Indeed, since X is connected, we can find vertices \(v = v_0, v_1,\dots , v_m = w\) such that either \([v_i, v_{i+1}]\) or \([v_{i+1},v_i]\) are 1-chains, for all \(i = 0,1,\dots ,n-1\). If either \([v_i, v_{i+1}]\) or \([v_{i+1}, v_i]\) are chains, then \([v_i]\) and \([v_{i+1}]\) are homologous. As this holds for every \(i = 0,1,\dots ,{m-1}\), [v] is homologous to [w]. Now, if \(\sum _{i=1}^n\lambda _i [x_i]\) is any 0-cycle, it is homologous to \(\sum _{i=1}^n \lambda _i [v]\). Then, by Lemma 3.17, \(\lambda [v]\) is not homologous to \(\mu [v]\) whenever \(\lambda \ne \mu \), thus \(H_0(X,R) \cong R\).

For the second statement, if \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), we can compute \(H_n^{{\text {Dir}}}(X,R)\). In such case, [v] is a directed cycle, thus \(\langle [v]\rangle = H_0(X,R)\subseteq H_0^{{\text {Dir}}}(X,R)\). It then follows that \(H_0(X,R) = H_0^{{\text {Dir}}}(X,R)\). \(\square \)

Remark 3.19

The fact that 0th directed homology ignores edge directions seems counter-intuitive, as we set up this framework to detect directed features, namely directed cycles. However, this is a natural consequence of homology being an equivalence relation. In particular, as mentioned in the proof, if either [uv] or [vu] are 1-chains, [u] and [v] are homologous, thus directionality of the 1-chains does not affect 0th directed homology. However, this only occurs in dimension 0, as a consequence of 0-chains always being cycles. Thus, when working with 1-simplices, the symmetry in the homology relation does not affect the detection of asymmetry in the data, as such asymmetry is encoded in the cycles themselves. It is also worth mentioning that a persistent homology able to detect strongly connected components in directed graphs has been introduced in Turner (2019).

We now show that the homology of a point is trivial for positive indices.

Example 3.20

Let R be a commutative ring and let X be the directed simplicial complex with vertex set \(V = \{x_0\}\) and simplices \(X=\{(x_0)\}\). Then,

$$\begin{aligned}H_n(X,R) = {\left\{ \begin{array}{ll} R, &{}\quad \hbox { if}\,\, n = 0, \\ 0, &{}\quad \text {if}\,\, n > 0. \end{array}\right. } \end{aligned}$$

Indeed, X is connected, thus \(H_0(X,R) = R\) by Proposition 3.18. For \(n\ge 1\), there are no n-chains, hence \(H_n(X,R)=0\). In this case, it is also immediate to check that if \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), \(H_n^{{\text {Dir}}}(X,R) = H_n(X,R)\), for every n.

Directed simplicial complexes whose homology is isomorphic to that of the point are called acyclic.

Definition 3.21

A directed simplicial complex X is acyclic if

$$\begin{aligned}H_n(X,R) = {\left\{ \begin{array}{ll} R, &{} \quad \hbox { if}\,\, n = 0, \\ 0, &{}\quad \text {if} \,\,n > 0. \end{array}\right. }\end{aligned}$$

If \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), we say that X is directionally acyclic if

$$\begin{aligned}H_n^{{\text {Dir}}}(X,R) = {\left\{ \begin{array}{ll} R, &{}\quad \hbox { if}\ n = 0, \\ 0, &{}\quad \text {if}\, n > 0. \end{array}\right. } \end{aligned}$$

Note that acyclic implies directionally acyclic, as directed homology is a submodule of the module of homology, for every n.

Next, we show that a directed simplicial complex consisting of one m-dimensional simplex along with all of its faces (note that this is an ordered-set complex) is acyclic.

Proposition 3.22

Let X be the directed simplicial complex consisting of the simplex \((x_0,x_1,\dots ,x_m)\) and all of its faces. Then X is acyclic.

Proof

As a consequence of how X is defined, if \(x\in C_n(X,R)\) is a chain so that \(x_0\) does not participate in any of its elementary n-chains (as there are no repetitions in the simplices of X), then \(x_0\) can be added as the first element of every elementary n-chain in x, giving us an \((n+1)\)-chain which we denote \(x_0 x\in C_{n+1}(X,R)\). Simple computations show that

$$\begin{aligned}\partial (x_0 x) = x - x_0\partial (x).\end{aligned}$$

Now take \(x \in Z_n(X,R)\) any cycle and decompose it as \(x = x_0 y + z\), where \(x_0\) does not participate in any of the chains in either y or z. Using the formula above,

$$\begin{aligned} \partial (x) = \partial (x_0 y + z) = y - x_0\partial (y) + \partial (z) = 0. \end{aligned}$$

In particular, the chains in which \(x_0\) does not participate must add up to zero, namely \(y + \partial (z) = 0\). Finally, consider the chain \(x_0 z\). We have that

$$\begin{aligned} \partial (x_0 z) = z - x_0\partial (z) = z + x_0 y = x. \end{aligned}$$

Thus, \(x \in Z_n(X,R)\) is homologous to zero, and the result follows. \(\square \)

We now illustrate the ability of this homology theory to detect directed cycles. We do so through some simple examples.

Example 3.23

Let \(R \in \{{\mathbb {Z}}, {\mathbb {Q}}, {\mathbb {R}} \}\). Let X, Y and Z be the directed simplicial complexes represented in Fig. 3. These three complexes are connected, so their 0th homologies are R, both directed and undirected. Furthermore, neither X nor Y have k-simplices for \(k\ge 2\), so \(H_k(X,R)\) and \(H_k(Y,R)\) are trivial (zero) for every \(k\ge 2\). This in particular implies that \(H_k^{{\text {Dir}}}(X,R)\) and \(H_k^{{\text {Dir}}}(Y,R)\) are trivial as well. Although Z has one 2-simplex, it is not a 2-cycle, thus \(H_2(Z,R)\) is also trivial.

Fig. 3
figure 3

Directed homology detects directed 1-cycles modulo boundaries. In these examples, \(H_1^{{\text {Dir}}}(X, R)=0\) while \(H_1^{{\text {Dir}}}(Y,R)=H_1^{{\text {Dir}}}(Z,R)=R\) respectively generated by \([w_1,w_2]+[w_2,w_3]+[w_3,w_1]\) and \([u_1,u_2]+[u_2,u_4]+[u_4,u_1]\) (or \([u_1,u_2]+[u_2,u_3]+[u_3,u_4]+[u_4,u_1]\)). To be a directed 1-cycle, the directions of the involved 1-simplices must form circuit. This does not hold for (undirected) homology

To compute the first homology, we need to consider the 1-simplices and their differentials. We list them below.

X

\(\partial \)

\([v_1,v_2]\)

\(v_2-v_1\)

\([v_2,v_3]\)

\(v_3-v_2\)

\([v_1,v_3]\)

\(v_3-v_1\)

Y

\(\partial \)

\([w_1,w_2]\)

\(w_2-w_1\)

\([w_2,w_3]\)

\(w_3-w_2\)

\([w_3,w_1]\)

\(w_1-w_3\)

Z

\(\partial \)

\([u_1,u_2]\)

\(u_2-u_1\)

\([u_2,u_3]\)

\(u_3-u_2\)

\([u_3,u_4]\)

\(u_4-u_3\)

\([u_4,u_1]\)

\(u_1-u_4\)

\([u_2,u_4]\)

\(u_4-u_2\)

We start with X. Note that \(\lambda _1 [v_1,v_2] + \lambda _2[v_2,v_3]+\lambda _3[v_1,v_3]\), \(\lambda _1,\lambda _2,\lambda _3\in R\), is a cycle for X if and only if \(\lambda _1 = \lambda _2 = - \lambda _3\). Since there are no 2-cycles in X, different 1-cycles cannot be homologous. We deduce that \(H_1(X,R) \cong R\). However, no 1-cycle can have non-negative coefficients for the three elementary 1-cycles, thus \(H_1^{{\text {Dir}}}(X,R) = \{0\}\).

Regarding Y, note that \(\mu _1[w_1,w_2] + \mu _2[w_2,w_3] + \mu _3[w_3,w_1]\), \(\mu _1,\mu _2,\mu _3\in R\), is a cycle if and only if \(\mu _1 = \mu _2 = \mu _3\). Since there are no 2-simplices in Y, we deduce that \(H_1(Y,R) = R\). Furthermore, the coefficients can be simultaneously positive. Namely, \([w_1,w_2] + [w_2,w_3] + [w_3,w_1]\) is a directed cycle, which generates the entirety of \(H_1(X,R)\). We deduce that \(H_1^{{\text {Dir}}}(X,R)\cong R\). Note that X and Y have isomorphic homology rings, but their directed homology rings are different.

Finally, for Z, similar computations show that \(Z_1(Z,R)\) is the free R-module generated by \(x_1 = [u_1,u_2] + [u_2,u_3] + [u_3,u_4] + [u_4, u_1]\) and \(x_2 = [u_1,u_2] + [u_2,u_4] + [u_4, u_1]\), both of which are directed cycles. In particular, \(Z_1^{{\text {Dir}}}(Z,R)\) consists of linear combinations of those two cycles, with positive coefficients. Note, however, that generating sets of \(Z_1(X,R)\) containing fewer than two directed cycles exist. This shows that computing a generating set for the cycles may not be enough to compute the full set of directed cycles.

Continuing with the homology computations, note that in this case we have a 2-simplex, \(y=[u_2,u_3,u_4]\), for which \(\partial (y) = [u_3,u_4] - [u_2,u_4] + [u_2, u_3] = x_1 - x_2\). Namely, \(x_1\) and \(x_2\) are homologous. Therefore, \(H_1(Z,R) = H_1^{{\text {Dir}}}(Z,R) = R\), generated by either \(x_1\) or \(x_2\). In particular, both the directed and undirected homologies of Y and Z are isomorphic, and we can see how 2-simplices can make directed cycles equivalent, as expected.

More generally, if \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), a polygon will give rise to a non-trivial directed homology class in dimension 1 if, and only if, the cycle can be traversed following the direction of the edges.

Proposition 3.24

Let X be a 1-dimensional directed simplicial complex with vertices \(v_0,v_1,\dots ,v_n\), \(n\ge 1\), and with 1-simplices \(e_0\), \(e_1,\dots , e_n\) where either \(e_i = (v_i, v_{i+1})\) or \(e_i = (v_{i+1}, v_i)\), \(i=0,1,\dots ,n\), and we write \(v_{n+1}=v_0\). Then, \(H_1(X,R) = R\). If \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), then \(H_1^{{\text {Dir}}}(X,R)\) is non-trivial if and only if either \(e_i = (v_i,v_{i+1})\) for all i or \(e_i = (v_{i+1},v_i)\) for all i, in which case \(H_1^{{\text {Dir}}}(X,R)\cong R\).

Proof

We first prove that \(H_1(X,R) = R\). Let \(x = \sum _{i=0}^n \lambda _i [e_i]\) be a cycle. If x is non-trivial, we can assume without loss of generality that \(\lambda _0\ne 0\). We can further assume that \(e_0 = (v_0, v_1)\). Thus, \(\partial (\lambda _0 [e_0]) = \lambda _0[v_1] - \lambda _0[v_0]\). The only other edge in which \(e_1\) participates is \(e_1\). We deduce that \(\lambda _1 = \lambda _0\), if \(e_1 = (v_1, v_2)\), or \(\lambda _1 = -\lambda _0\), if \(e_1 = (v_2, v_1)\). By proceeding iteratively, we deduce that \(\lambda _i = \lambda _0\), if \(e_i = (v_i, v_{i+1})\), or that \(\lambda _i = -\lambda _0\), if \(e_i = (v_{i+1}, v_i)\). It is now straightforward to check that, with \(\lambda _i\) defined in terms of \(\lambda _0\) in such way, \(i = 1,\dots ,n\), \(x = \sum _{i=0}^n \lambda _i [e_i]\) is a non-trivial cycle. Since there are no 2-chains, \(H_1(X,R) \cong R\).

Regarding the directed homology, note that if \(e_0 = (v_0, v_1)\), the coefficients of the cycle x can only be all positive if and only if \(e_i = (v_i, v_{i+1})\). In such case, \(H_1^{{\text {Dir}}}(X,R) = H_1(X,R) \cong R\), and otherwise \(H_1^{{\text {Dir}}}(X,R) = 0\). The case in which \(e_0 = (v_1, v_0)\) is analogous. \(\square \)

Remark 3.25

Note that Proposition 3.24 applies to polygons with only two vertices \(v_1\) and \(v_2\) (see Fig. 4), which are allowed in a directed simplicial complex. Indeed, an immediate computation shows that \([v_1,v_2] + [v_2,v_1]\) is a directed 1-cycle. This result shows that directed homology is not a homotopy invariant for the geometric realization of directed simplicial complexes, as all of the polygons considered in Proposition 3.24 give rise to homotopic geometric realizations.

Fig. 4
figure 4

A directed simplicial complex with just two vertices can have a non-trivial 1-cycle

We end this section by noting that, although our initial aim was a directed homology group able to detect directed 1-cycles, we have a directed homology theory defined in all dimensions. However, we can show that the directed homology is trivial in even dimensions other than 0.

Proposition 3.26

Let X be a directed simplicial complex \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\). Then \(H_{2n}^{{\text {Dir}}}(X,R)=\{0\}\), for every \(n\ge 1\).

Proof

We will show that no non-trivial directed cycles may exist in such dimensions. In order to do so, consider the morphism of R-modules

$$\begin{aligned} \varphi _n:C_n(X,R)&\longrightarrow R \\ [v_0,v_1,\dots ,v_n]&\longmapsto 1. \end{aligned}$$

Thus, if \(x = \sum _{i=0}^k \lambda _i x_i\) where \(x_i\) is an elementary n-chain, \(\varphi _n(x)=\sum _{i=0}^k \lambda _i\).

Now assume that \(x_i\) is an elementary 2n-chain, for some \(n\ge 1\). In this case, \(\partial (\lambda _i x_i) = \lambda _i\partial (x_i)\), where \(\partial (x_i)\) consists of the sum of \(\lfloor \frac{2n}{2}\rfloor = n\) elementary n-chains with positive sign and \(\lfloor \frac{2n-1}{2}\rfloor = n-1\) elementary n-chains with negative sign. Thus, \(\varphi _{2n-1}(\lambda _i x_i) = \lambda _i (n - (n - 1)) = \lambda _i\).

To prove our claim, let \(x = \sum _{i=0}^k \lambda _i x_i\in Z_{2n}(X,R)\) be a cycle where each \(x_i\) is an elementary 2n-cycle. Then, given that \(\partial (x) = 0\), \(\varphi _{2n-1}\big (\partial (x)\big ) = \sum _{i=0}^k \lambda _i = 0\). If x is directed, then \(\lambda _i \ge 0\), for all i, thus we deduce that \(\lambda _i = 0\), for all i. Namely, the trivial cycle is the only directed cycle, and \(H_{2n}^{{\text {Dir}}}(X,R)=\{0\}\). \(\square \)

Remark 3.27

The proof of this result is based on the fact that the number of positive coefficients in the boundary of an elementary n-chain is larger than the number of negative coefficients, if n is even. This may also be related to the fact that there is no obvious way to define directed n-cycles for \(n>1\). For the purposes of this article, it suffices to consider 1-cycles and \(H_1(X,R)\). However, note that non-trivial (homological) cycles do exist in all odd dimensions. For instance, the elementary \((2n-1)\)-chain obtained by repeating a vertex 2n times is always a cycle.

4 Persistent directed homology

In this section, we introduce a theory of persistent homology for directed simplicial complexes which comes in two flavours: one takes into account the directionality of the complex, whereas the other one is analogous to persistent homology in the classical setting. We thus have, associated to the same filtration of directed simplicial complexes, two persistence modules which produce two different barcodes. Both persistent homology theories show stability (see Theorem 4.19) and they are closely related. Indeed, directed cycles are undirected cycles as well, thus every bar in a directed persistence barcode can be uniquely matched with a bar in the corresponding undirected one, although the undirected bar may be born sooner, see Proposition 4.7.

4.1 Persistence modules associated to a directed simplicial complex

Let us begin by introducing filtrations of directed simplicial complexes.

Definition 4.1

Let X be a directed simplicial complex (Definition 3.1). A filtration of X is a family of subcomplexes \((X_\delta )_{\delta \in T}\), \(T\subseteq {\mathbb {R}}\), such that if \(\delta \le \delta '\in T\), then \(X_\delta \) is a subcomplex of \(X_{\delta '}\), and such that \(X = \cup _{\delta \in T} X_\delta \). Note that for \(\delta \le \delta '\), the inclusion \(i_\delta ^{\delta '}:X_\delta \rightarrow X_\delta '\) is a morphism of directed simplicial complexes.

We now introduce undirected persistence modules.

Definition 4.2

Let \((X_\delta )_{\delta \in T}\) be a filtration of a directed simplicial complex X and let R be a commutative ring. The n-dimensional undirected persistence R-module of X is the persistence R-module

$$\begin{aligned} (\{H_n(X_\delta , R)\}, \{H_n(i_\delta ^{\delta '})\}\big )_{\delta \le \delta '\in T}. \end{aligned}$$

The functoriality of \(H_n\) makes this a persistence module.

Now, in order to retain the information on directionality, we take the submodule of directed classes.

Definition 4.3

Let \((X_\delta )_{\delta \in T}\) be a filtration of a directed simplicial complex X and let \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\). The n-dimensional directed persistence R-module of X is the persistence R-module

$$\begin{aligned} \big ( \{H_n^{{\text {Dir}}}(X_\delta ,R)\}, \{H_n^{{\text {Dir}}}(i_\delta ^{\delta '})\}\big )_{\delta \le \delta '\in T}, \end{aligned}$$

where \(H_n^{{\text {Dir}}}(X_\delta ,R)\) are defined as in Definition 3.6, \(i_\delta ^{\delta '}:X_\delta \rightarrow X_{\delta '}\) are the inclusion maps, and \(H_n^{{\text {Dir}}}(i_\delta ^{\delta '})\) are the restrictions of the maps \(H_n(i_\delta ^{\delta '})\) to directed homology, as introduced in Proposition 3.11.

Remark 4.4

Let \((X_\delta )_{\delta \in T}\) be a filtration of a directed simplicial complex X and let \(\delta \le \delta '\in T\). If \(R\in \{{\mathbb {Z}},{\mathbb {Q}},{\mathbb {R}}\}\), by applying Proposition 3.11 to the map \(i_\delta ^{\delta '}:X_\delta \rightarrow X_{\delta '}\), we have a commutative diagram

figure c

In particular, the injections \(\big \{H_{n}^{{\text {Dir}}}(X_\delta ,R)\hookrightarrow H_n(X_\delta ,R)\big \}_{\delta \in T}\) give rise to a monomorphism of persistence modules.

We can now introduce persistence diagrams and barcodes associated to filtrations of directed simplicial complexes. As these were only introduced for fields in Sect. 2.1, from this point on, we will assume that R is a field. In particular, when taking directed homology, we will assume that \(R\in \{{\mathbb {Q}},{\mathbb {R}}\}\).

Definition 4.5

Let \((X_\delta )_{\delta \in T}\) be a filtration of a directed simplicial complex X where \(T\subseteq {\mathbb {R}}\) is finite. The persistence diagrams associated to the n-dimensional undirected and directed persistence R-modules of X are respectively denoted \({\text {Dgm}}_n(X,R)\) and \({\text {Dgm}}_{n}^{{\text {Dir}}}(X,R)\). Similarly, the respective barcodes are denoted \({\text {Pers}}_n(X,R)\) and \({\text {Pers}}_{n}^{{\text {Dir}}}(X,R)\).

Remark 4.6

Note that \(H_0^{{\text {Dir}}}(X_\delta ,R)\cong H_0(X_\delta ,R)\) for every \(\delta \in T\), as shown in Proposition 3.18. As a consequence, the 0-dimensional directed and undirected persistence R-modules of a directed simplicial complex X are isomorphic. In particular, they have the same persistence barcodes and diagrams, and they measure the connectivity of the simplicial complex at each stage of the filtration.

The next result establishes the relation between the undirected and directed persistence barcodes and diagrams of a persistence module, and it is thus key to understanding the directed persistence barcodes.

Proposition 4.7

Let \((X_\delta )_{\delta \in T}\) be a filtration of directed simplicial complexes. Then, there is an injective matching sending each bar in \({\text {Pers}}_n^{{\text {Dir}}}(X,R)\) to a bar in \({\text {Pers}}_n(X,R)\) which contains it. Furthermore, matched bars must die at the same time.

Proof

This result is an immediate consequence of Remark 4.4 and Bauer and Lesnick (2014, Proposition 6.1). \(\square \)

Note that a bar in the directed persistence barcode of a filtration may be born after the one it is matched with in the undirected one, and some bars in the undirected barcode may remain unmatched (see Examples below and Figs. 5 and 6).

We now introduce some examples to illustrate Proposition 4.7 and the general behaviour of the directed persistence barcodes.

Example 4.8

Let us illustrate how undirected and directed persistence modules and their barcodes can be different. First, consider the directed simplicial complexes X and Y in Fig. 3 (see Example 3.23). Regardless of the filtration chosen for X, the lack of directed cycles means that the 1-dimensional directed persistence module is trivial. However, at the end of the filtration, there is a cycle in homology, thus there is a bar in the undirected persistence barcode. In the case of Y, the only 1-cycle is directed, so the undirected and directed persistence modules associated to any filtration of Y are isomorphic, and different from those of X.

Example 4.9

Consider now the directed simplicial complex Z in Fig. 3 (see Example 3.23). Let \(T=\{0,1,2,\dots \}\) and consider the filtration of Z given by \((Z_\delta )_{\delta \in T}\), as illustrated in Fig. 5, where \(Z_\delta = Z\) for every \(\delta \ge 3\).

Fig. 5
figure 5

A filtration of the directed simplicial complex Z in Example 3.23 (Fig. 3) and its associated undirected (bottom, left) and directed (bottom, right) 1-dimensional persistence barcodes. The shorter undirected bar (blue) is also directed, while the longer undirected bar (red) becomes directed at \(\delta =2\) (colour figure online)

The undirected and directed 1-dimensional persistence modules of this filtration are not isomorphic. Indeed, in \(Z_1\) there is clearly an undirected cycle, whereas \(Z_1^{{\text {Dir}}}(Z_1,R)\) is trivial, thus \(H_1^{{\text {Dir}}}(Z_1,R)=\{0\}\). However, \(H_1(Z_2,R)\cong H_1^{{\text {Dir}}}(Z_2,R)\), as both vector spaces are generated by the classes of \([v_1,v_2]+[v_2,v_3]+[v_3,v_4]+[v_4,v_1]\) and \([v_2,v_4]+[v_4,v_1]+[v_1,v_2]\). These two classes become equivalent in \(Z_3\). The undirected and directed 1-dimensional persistence barcodes of this filtration, shown in Fig. 5, illustrate how undirected classes may become directed.

The last example also shows an important difference between classical and directed persistence modules and barcodes. Namely, in the undirected setting, the addition of one simplex to the filtration can either cause the birth of a class in the dimension of the added simplex, or kill a class in the preceding dimension. This simple idea is in fact the basis of the Standard Algorithm for computing persistent homology. However, the addition of only one simplex to a directed simplicial complex can cause the birth of several classes in directed homology, as shown in the previous example at \(\delta =2\), and also in the following example.

Example 4.10

Let \(T=\{0,1,2,\dots \}\) and consider the filtration of simplicial complexes \((X_\delta )_{\delta \in T}\) illustrated in Fig. 2 in the Introduction, where \(X_\delta = X_3\) for every \(\delta \ge 3\).

It is clear that \(Z_1^{{\text {Dir}}}(X_j,R)\) is trivial for \(j=0,1,2\), whereas undirected cycles appear as early as \(X_1\). However, by adding the edge from \(v_5\) to \(v_1\), several directed cycles are born at once. Namely, \(Z_1^{{\text {Dir}}}(X_3,R)\) contains the cycles

$$\begin{aligned}&[v_1,v_2] + [v_2,v_3] + [v_3,v_4] + [v_4, v_5] + [v_5,v_1], \\&[v_1,v_2] + [v_2,v_4] + [v_4, v_5] + [v_5,v_1], \\&[v_1,v_2] + [v_2,v_3] + [v_3, v_5] + [v_5,v_1], \\&[v_1,v_3] + [v_3,v_4] + [v_4,v_5] + [v_5,v_1], \\&[v_1,v_3] + [v_3,v_5] + [v_5,v_1]. \end{aligned}$$

Straightforward computations show that \(H_1(X_3,R) = R^4\), and four of the cycles above are linearly independent, thus \(H_{1}^{{\text {Dir}}}(X_3,R) = H_{1}(X_3,R) = R^4\). Consequently, at \(\delta = 3\) every class (including the birthing one) becomes directed.

Our last example shows an undirected homology class that never becomes directed.

Example 4.11

Let \(T=\{0,1,2,\dots \}\) and consider the filtration of simplicial complexes \((X_\delta )_{\delta \in T}\) illustrated in Fig. 6, where \(X_\delta = X_2\) for \(\delta \ge 2\).

Fig. 6
figure 6

A filtration of directed simplicial complexes and its associated undirected (bottom, left) and directed (bottom, right) 1-dimensional persistence barcodes. The shorter undirected bar (blue) is also directed, while the longer undirected bar (red) never becomes directed (colour figure online)

Clearly, \(Z_1^{{\text {Dir}}}(X_j,R)=\{0\}\) for \(j=0,1,\) whereas \(Z_1^{{\text {Dir}}}(X_2,R)\) contains the cycle \([v_1,v_2] + [v_2,v_4] + [v_4,v_1]\). The undirected class represented by this element is thus directed, but there is a linearly independent class in undirected homology, \([v_3,v_2] + [v_2,v_4] - [v_3,v_4]\), which never becomes directed. Its bar in the barcode is thus unmatched.

4.2 Directed persistent homology of dissimilarity functions

In this section, we introduce the undirected and directed persistence diagrams and barcodes associated to dissimilarity functions (Definition 4.13) and prove their stability with respect to the bottleneck distance (Theorem 4.19).

Let us begin by introducing the directed Rips filtration of directed simplicial complexes associated to a dissimilarity function (Turner 2019, Definition 16).

Definition 4.12

Let \((V,d_V)\) be a dissimilarity function. The directed Rips filtration of \((V,d_V)\) is the filtration of directed simplicial complexes \(\big ({\mathcal {R}}^{{\text {Dir}}}(V,d_V)\big )_{\delta \in {\mathbb {R}}}\) where \((v_0,v_1,\dots ,v_n)\in {\mathcal {R}}^{{\text {Dir}}}(V,d_V)_\delta \) if and only if \(d_V(v_i,v_j)\le \delta \), for all \(0\le i \le j \le n\). It is clearly a filtration with the inclusion maps \(i_\delta ^{\delta '}:{\mathcal {R}}^{{\text {Dir}}}(V,d_V)_\delta \rightarrow {\mathcal {R}}^{{\text {Dir}}}(V,d_V)_{\delta '}\) for all \(\delta \le \delta '\).

Let us now introduce the persistent homology modules associated to such a filtration. Assume that \(R\in \{{\mathbb {Q}},{\mathbb {R}}\}\).

Definition 4.13

Let \((V, d_V)\) be a dissimilarity function and consider its associated directed Rips filtration \(\big ({\mathcal {R}}^{{\text {Dir}}}(V,d_V)\big )_{\delta \in {\mathbb {R}}}\). For each \(n\ge 0\), the n-dimensional undirected persistence R-module of \((V,d_V)\) is

$$\begin{aligned} {\mathcal {H}}_n(V, d_V):= \big (\{H_n({\mathcal {R}}^{{\text {Dir}}}(V,d_V)_{\delta },R)\}, \{H_n(i_\delta ^{\delta '})\}\big )_{\delta \le \delta '\in {\mathbb {R}}}. \end{aligned}$$

Similarly, the n-dimensional directed persistence R-module of \((V,d_V)\) is defined as

$$\begin{aligned} {\mathcal {H}}_{n}^{{\text {Dir}}}(V, d_V):= \big (\{H_{n}^{{\text {Dir}}}({\mathcal {R}}^{{\text {Dir}}}(V,d_V)_{\delta },R)\}, \{H_{n}^{{\text {Dir}}}(i_\delta ^{\delta '})\}\big )_{\delta \le \delta '\in {\mathbb {R}}}. \end{aligned}$$

Remark 4.14

The persistence module \({\mathcal {H}}_n(V,d_V)\) associated to the directed Rips filtration of \((V,d_V)\) is precisely the persistence module studied in Turner (2019, Section 5), hence the remarks made there hold for the undirected persistence module. In particular, if \((V,d_V)\) is a (finite) metric space, \({\mathcal {R}}^{{\text {Dir}}}(V,d_V)\) is the (classical) Vietoris-Rips filtration of \((V,d_V)\). Furthermore, in this case, it can easily be seen that \({\mathcal {H}}_n(V,d_V) = {\mathcal {H}}_n^{{\text {Dir}}}(V,d_V)\). Thus, these persistence modules generalize the persistence modules associated to the Vietoris-Rips filtration of a metric space. Also note that \({\mathcal {R}}^{{\text {Dir}}}(V,d_V)\) is closed under adjacent repeats (Turner 2019, Definition 18). Namely, given \((v_0,v_1,\dots ,v_n)\in {\mathcal {R}}^{{\text {Dir}}}(V, d_V)_\delta \), \((v_0,v_1,\dots ,v_i,v_i,\dots ,v_n)\in {\mathcal {R}}^{{\text {Dir}}}(V, d_V)_\delta \), for any \(i=0,1,\dots ,n\). Using this, it can be proven that the homology of this object must be trivial in dimensions larger than \(|V|+1\).

As R is a field and since V is finite, both of these persistence modules fulfil the assumptions in Sect. 2.1. Namely, their indexing sets can be chosen to be finite, corresponding to the threshold values where new simplices are added to the simplicial complex. Furthermore, no simplex is added to the filtration until the threshold value reaches the minimum of the images of the dissimilarity function. Finally, and even though the directed simplicial complex \({\mathcal {R}}^{{\text {Dir}}}(V,d_V)_\delta \) may have infinite simplices due to arbitrary repetitions of vertices being allowed, it always has a finite number of simplices in a given dimension n, thus its n-dimensional homology is always finite-dimensional. As a consequence, we can introduce the following.

Definition 4.15

Let \((V, d_V)\) be a dissimilarity function. For each \(n\ge 0\), the n-dimensional persistence diagrams associated to the persistence R-modules \({\mathcal {H}}_n(V, d_V)\) and \({\mathcal {H}}_{n}^{{\text {Dir}}}(V, d_V)\) are respectively denoted by \({\text {Dgm}}_n(V,d_V)\) and \({\text {Dgm}}_{n}^{{\text {Dir}}}(V,d_V)\). Similarly, their associated persistence barcodes are denoted by \({\text {Pers}}_n(V,d_V)\) and \({\text {Pers}}_{n}^{{\text {Dir}}}(V,d_V)\).

Of course, Proposition 4.7 holds for these barcodes, namely, every bar in \({\text {Pers}}_n^{{\text {Dir}}}(V,d_V)\) can be uniquely matched with one in \({\text {Pers}}_n(V,d_V)\) which dies at the same time, although the directed bar may be born later.

We now use results from Sect. 2.2 to show that both these persistent homology constructions are stable. The proof is split in several lemmas. Let \((V,d_V)\) and \((W, d_W)\) be two dissimilarity functions on respective sets V and W and define \(\eta = 2 d_{{\text {CD}}}\big ((V,d_V), (W,d_W)\big )\), where \(d_{CD}\) is the correspondence distortion distance (Definition 2.9). By Proposition 2.11, we can find maps \(\varphi :V\rightarrow W\) and \(\psi :W\rightarrow V\) such that \({\text {dis}}(\varphi ), {\text {dis}}(\psi ), {\text {codis}}(\varphi ,\psi ),{\text {codis}}(\psi ,\varphi )\le \eta \). To simplify notation in the proofs below, denote \({\mathcal {R}}^{{\text {Dir}}}(V,d_V)_\delta =X_V^\delta \) and \({\mathcal {R}}^{{\text {Dir}}}(W,d_W)_\delta =X_W^\delta \), for all \(\delta \in {\mathbb {R}}\).

Lemma 4.16

For each \(\delta \in {\mathbb {R}}\), the maps \(\varphi \) and \(\psi \) induce morphisms of directed simplicial complexes

$$\begin{aligned} \begin{aligned} \varphi _\delta :X_V^\delta&\longrightarrow X_W^{\delta +\eta } \\ x&\longmapsto \varphi (x), \end{aligned}{} & {} \begin{aligned} \psi _\delta :X_W^\delta&\longrightarrow X_V^{\delta +\eta } \\ x&\longmapsto \psi (x). \end{aligned} \end{aligned}$$

Proof

Let us prove the statement for \(\varphi _\delta \) (the proof is analogous for \(\psi _\delta \)). Let \((x_0,x_1,\dots ,x_n)\) be an n-simplex in \(X_V^\delta \). Then \(d_V(x_i,x_j)\le \delta \) for all \(1\le i\le j\le n\). Since \({\text {dis}}(\varphi )\le \eta \), we have that, for all \(v_1,v_2\in V\),

$$\begin{aligned} \big |d_V(v_1,v_2)-d_W\big (\varphi (v_1),\varphi (v_2)\big )\big |\le \eta . \end{aligned}$$

Choosing \(v_1=x_i\) and \(v_2=x_j\), we have

$$\begin{aligned} d_W\big (\varphi (x_i),\varphi (x_j)\big )\le \eta + d_V(x_i,x_j)\le \delta + \eta \text { for all } 1\le i \le j \le n. \end{aligned}$$

Consequently, \(\big (\varphi (x_0),\varphi (x_1),\dots ,\varphi (x_n)\big )\in X_W^{\delta +\eta }\) and the result follows. \(\square \)

Lemma 4.17

For \(\delta \le \delta '\in {\mathbb {R}}\) consider the inclusion maps \(i_\delta ^{\delta '}:X_V^\delta \hookrightarrow X_V^{\delta '}\) and \(j_\delta ^{\delta '}:X_W^\delta \hookrightarrow X_W^{\delta '}\). The following are commutative diagrams of morphisms of directed simplicial complexes:

figure d

Proof

We prove that the first diagram is commutative (the proof for the second diagram is analogous). Let \(x\in V\). Since \(i_\delta ^{\delta '}\) is an inclusion, \((\varphi _{\delta '}\circ i_{\delta }^{\delta '})(x) = \varphi _{\delta '} (x) = \varphi (x)\). Similarly, since \(j_{\delta +\eta }^{\delta '+\eta }\) is an inclusion, \((j_{\delta +\eta }^{\delta '+\eta }\circ \varphi _\delta )(x) = j_{\delta +\eta }^{\delta '+\eta }\big (\varphi (x)\big ) = \varphi (x)\). \(\square \)

Lemma 4.18

With the same notation as in Lemmas 4.16 and 4.17, for every \(\delta \in {\mathbb {R}}\), the following diagrams of morphisms of directed simplicial complexes induce commutative diagrams on homology.

figure e

Proof

Again, we only prove the result for the first diagram, as the proof for the second diagram is analogous. We show that it is commutative up to homotopy by showing that the maps \(i_\delta ^{\delta +2\eta }\) and \(\psi _{\delta +\eta }\circ \varphi _\delta \) satisfy the hypothesis of Lemma 3.14.

Take a simplex \(\sigma = (x_0,x_1,\dots ,x_n)\in X_V^\delta \), thus \(d_V(x_i,x_j)\le \delta \), for all \(1\le i\le j\le n\). On the one hand, \(i_\delta ^{\delta +2\eta }\) is an inclusion, so \(i_\delta ^{\delta + 2\eta }(\sigma ) = \sigma \). On the other hand, since \(\psi _{\delta +\eta }\circ \varphi _\delta \) is a morphism of directed simplicial complexes (Definition 3.8), \(\big (\psi (\varphi (x_0)),\psi (\varphi (x_1)),\dots ,\psi (\varphi (x_n))\big )\in X_V^{\delta +2\eta }\). This implies that \(d_V\big (\psi (\varphi (x_i)),\psi (\varphi (x_j))\big )\le \delta +2\eta \), for all \(1\le i\le j\le n\).

Now recall that \({\text {codis}}(\varphi ,\psi )\le \eta \), thus for all \(v\in V\) and \(w\in W\),

$$\begin{aligned} \big |d_V\big (v,\psi (w)\big )-d_W\big (\varphi (v),w\big )\big |\le \eta . \end{aligned}$$

Then, for \(1\le i \le j \le n\), by taking \(v = x_i\) and \(w = \varphi (x_j)\),

$$\begin{aligned} d_V\big (x_i,\psi (\varphi (x_j))\big )\le \eta + d_W\big (\varphi (x_i),\varphi (x_j)\big )\le \delta + 2\eta . \end{aligned}$$

As a consequence of the inequalities above, we have shown that for every \(0\le i \le n\),

$$\begin{aligned} \big (x_0,x_1,\dots ,x_i,\psi (\varphi (x_i)),\psi (\varphi (x_{i+1})),\dots ,\psi (\varphi (x_n))\big )\in X_V^{\delta +2\eta }. \end{aligned}$$

Therefore, the maps \(i_\delta ^{\delta +2\eta }\) and \(\psi _{\delta +\eta }\circ \varphi _\delta \) satisfy the hypothesis of Lemma 3.14, thus they induce the same map on homology. The result follows. \(\square \)

We now have everything we need to prove the stability results.

Theorem 4.19

Let \(R\in \{{\mathbb {Q}},{\mathbb {R}}\}\). Let \((V, d_V)\) and \((W, d_W)\) be two dissimilarity functions on finite sets V and W. Then, for all \(n\ge 0\),

$$\begin{aligned} d_B\big ({\text {Dgm}}_n(V,d_V),{\text {Dgm}}_n(W,d_V)\big )\le 2 d_{{\text {CD}}}\big ((V,d_V),(W,d_W)\big ) \end{aligned}$$

and

$$\begin{aligned} d_B\big ({\text {Dgm}}_{n}^{{\text {Dir}}}(V,d_V),{\text {Dgm}}_{n}^{{\text {Dir}}}(W,d_V)\big )\le 2 d_{{\text {CD}}}\big ((V,d_V),(W,d_W)\big ). \end{aligned}$$

Proof

Define \(\eta = 2 d_{{\text {CD}}}\big ((V,d_V),(W,d_W)\big )\). By Theorem 2.7, it suffices to show that the persistence modules \({\mathcal {H}}_n(V, d_V)\) and \({\mathcal {H}}_n(W, d_W)\) (respectively \({\mathcal {H}}_{n}^{{\text {Dir}}}(V, d_V)\) and \({\mathcal {H}}_{n}^{{\text {Dir}}}(W, d_W)\)) are \(\eta \)-interleaved. Comparing Definition 2.5 (for \(\varepsilon =\eta \)) and Lemmas 4.16, 4.17 and 4.18, the result follows by using the functoriality of homology and, in the directed case, Proposition 3.11. \(\square \)

Remark 4.20

Recall from Remark 4.14 that the persistence module \({\mathcal {H}}_n(V,d_V)\) associated to the directed Rips filtration of \((V,d_V)\) is the persistence module studied in Turner (2019, Section 5). Thus, the remarks made in Turner (2019, Section 5.2) hold for these persistence modules, meaning that a result analogous to Theorem 4.19 would not hold if we were using ordered-set complexes instead of directed simplicial complexes, as mentioned at the beginning of Sect. 3. This justifies our definition of directed simplicial complex (Definition 3.1).

5 Computational challenges

Let \((V, d_V)\) be a dissimilarity function in a finite set V. In this section, we study the algorithmic aspects of computing both \({\mathcal {H}}_{n}(V, d_V)\) and \({\mathcal {H}}_{n}^{{\text {Dir}}}(V, d_V)\). For simplicity, we assume that \(R ={\mathbb {R}}\).

The computation of the persistence barcodes for the undirected persistent homology \({\mathcal {H}}_{n}(V, d_V)\) can be made using the Standard Algorithm (Edelsbrunner et al. 2001; Zomorodian and Carlsson 2005), which also applies to ordered simplicial complexes. Write \({\mathcal {R}}^{{\text {Dir}}}(V,d_V)_\delta = X_V^\delta \), \(\delta \in {\mathbb {R}}\) for the directed Rips filtration (Definition 4.12). As V is finite, the number of simplices in \(X_V^\delta \) up to dimension \(n+1\) is finite, say N. We can list them \(\{\sigma _1,\sigma _2,\dots ,\sigma _N\}\) in such a way that \(i < j\) if \(\sigma _i\) is a (proper) face of \(\sigma _j\), or if \(\sigma _j\) appears ‘later’ in the filtration, thus having a compatible ordering. Then, we can represent the differential using a sparse \(N\times N\) matrix M over \({\mathbb {R}}\), where the (ij)-entry \(M_{ij}\) is the coefficient of \(\sigma _j\) in the differential of \(\sigma _i\). Such matrix M is an upper-triangular matrix. At this stage, the Standard Algorithm can be used to compute \({\text {Dgm}}_k(V,d_V)\) by reducing M at once using column operations.

We cannot directly adapt the Standard Algorithm to compute \({\text {Dgm}}_k^{{\text {Dir}}}(V,d_V)\): we can try to find reduction operations that generate directed cycles using operations with positive coefficients only, but this is not enough to guarantee that we find all the possible directed cycles. For instance, once one column has been eliminated, we may be preventing the participation of the simplex it represents in directed cycles not involving the columns we are using in the elimination. To avoid such a problem, we would need to keep track of every possible way in which column eliminations can be produced using only positive coefficients. This is very similar to the double description algorithm for the computation of extreme rays of a polyhedral cone (Fukuda et al. 1995; Motzkin et al. 1953). Indeed, the directed cycles \(Z_n^{{\text {Dir}}}(X,{\mathbb {R}})\) are the non-negative solutions to the linear equation \(Mx = 0\), that is,

$$\begin{aligned} \big \{x = (x_1,x_2,\dots ,x_N)\in {\mathbb {R}}^N \mid M x = 0, x\ge 0\big \}, \end{aligned}$$
(5.1)

where a vector \(x = (x_1,x_2,\dots ,x_N) \in {\mathbb {R}}^N\) represents the cycle \(\sum _{i=1}^N x_i \sigma _i\), M is the matrix corresponding to the differential, and \(x \ge 0\) means that every entry in x is non-negative, that is, \(x_i \ge 0\) for all i. Equivalently, directed cycles are the extreme rays of the unbounded polyhedral cone consisting of the intersection of the solution space to the linear system \(M x = 0\) with the first quadrant of \({\mathbb {R}}^N\). The enumeration of the extreme rays (generators of the solution set) of a polyhedral cone such as Eq. (5.1) is a well-known albeit hard problem in computational geometry. Several algorithms, including the double description algorithm, and modifications thereof, exist (Terzer 2009).

Note, however, that we do not require the computation of all the directed cycles. Indeed, it would be enough to calculate them up to homology, which suggests that efficient computations may be possible.

In summary, although important challenges remain on the computation of the persistence diagrams associated to directed persistence modules, our objective was to provide the necessary groundwork for the study of directed persistent homology of asymmetric data sets, and we are hopeful that we are opening up an exciting new approach for future research into the topological properties of asymmetric data sets.