bradley j. nelson arxiv:2108.05022v1 [math.at] 11 aug 2021

16
ACCELERATING I TERATED P ERSISTENT H OMOLOGY C OMPUTATIONS WITH W ARM S TARTS Yuan Luo Committee on Computational and Applied Mathematics University of Chicago Chicago, IL 60637 [email protected] Bradley J. Nelson * Department of Statistics University of Chicago Chicago, IL 60637 [email protected] August 12, 2021 ABSTRACT Persistent homology is a topological feature used in a variety of applications such as generating features for data analysis and penalizing optimization problems. We develop an approach to accelerate persistent homology computations performed on many similar filtered topological spaces which is based on updating associated matrix factorizations. Our approach improves the update scheme of Cohen-Steiner, Edelsbrunner, and Morozov for permutations by additionally handling addition and deletion of cells in a filtered topological space and by processing changes in a single batch. We show that the complexity of our scheme scales with the number of elementary changes to the filtration which as a result is often less expensive than the full persistent homology computation. Finally, we perform computational experiments demonstrating practical speedups in several situations including feature generation and optimization guided by persistent homology. Keywords Computational topology · Persistent homology · Topological data analysis 1 Introduction Persistent homology is an algebraic invariant of filtered topological spaces commonly used in topological data analysis and in other areas of applied and computational topology. At its core, persistent homology is typically computed using factorizations of the boundary matrices obtained from applying the chain functor (with field coefficients) to a finite cell complex [47]. A variety of improvements and optimizations to this algorithm have been developed [23, 19, 39, 7, 37, 42] along with efficient implementations [37, 5, 33] which have allowed for the computation of persistent homology of increasingly large filtrations. However, a variety of problems require not just the computation of persistent homology of a single large filtration but of many related filtrations - examples include feature generation for data in machine learning tasks [13, 32, 12, 28] as well as in continuous optimization problems with persistent homology included in the objective [20, 9, 36, 10, 17, 34]. In this work, we develop an update scheme for computing persistent homology which updates the computation for a related problem with a warm-start and this scheme can be used efficiently in applications which require iterated computations. Background on Persistent Homology We provide a brief introduction to the necessary building blocks from alge- braic topology to describe our algorithms. For a more complete introduction to computational topology and persistent homology, we refer to [26, 42]. A cell complex X is a collection of contractible cells of varying dimensions in which q-dimensional cells are connected to (q - 1)-dimensional cells with maps on their boundaries. For simplicity, one may consider simplicial or cubical complexes where these boundary maps are determined combinatorically. Furthermore, we will only consider finite cell complexes. Homology (with field coefficients) in dimension q is a functor from a topological category to the category of vector spaces over a field k. The homological dimension q captures information * Corresponding author arXiv:2108.05022v1 [math.AT] 11 Aug 2021

Upload: others

Post on 23-Apr-2022

9 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

ACCELERATING ITERATED PERSISTENT HOMOLOGYCOMPUTATIONS WITH WARM STARTS

Yuan LuoCommittee on Computational and Applied Mathematics

University of ChicagoChicago, IL 60637

[email protected]

Bradley J. Nelson∗Department of StatisticsUniversity of Chicago

Chicago, IL [email protected]

August 12, 2021

ABSTRACT

Persistent homology is a topological feature used in a variety of applications such as generatingfeatures for data analysis and penalizing optimization problems. We develop an approach to acceleratepersistent homology computations performed on many similar filtered topological spaces which isbased on updating associated matrix factorizations. Our approach improves the update scheme ofCohen-Steiner, Edelsbrunner, and Morozov for permutations by additionally handling addition anddeletion of cells in a filtered topological space and by processing changes in a single batch. We showthat the complexity of our scheme scales with the number of elementary changes to the filtrationwhich as a result is often less expensive than the full persistent homology computation. Finally, weperform computational experiments demonstrating practical speedups in several situations includingfeature generation and optimization guided by persistent homology.

Keywords Computational topology · Persistent homology · Topological data analysis

1 Introduction

Persistent homology is an algebraic invariant of filtered topological spaces commonly used in topological data analysisand in other areas of applied and computational topology. At its core, persistent homology is typically computed usingfactorizations of the boundary matrices obtained from applying the chain functor (with field coefficients) to a finite cellcomplex [47]. A variety of improvements and optimizations to this algorithm have been developed [23, 19, 39, 7, 37, 42]along with efficient implementations [37, 5, 33] which have allowed for the computation of persistent homology ofincreasingly large filtrations. However, a variety of problems require not just the computation of persistent homology ofa single large filtration but of many related filtrations - examples include feature generation for data in machine learningtasks [13, 32, 12, 28] as well as in continuous optimization problems with persistent homology included in the objective[20, 9, 36, 10, 17, 34]. In this work, we develop an update scheme for computing persistent homology which updatesthe computation for a related problem with a warm-start and this scheme can be used efficiently in applications whichrequire iterated computations.

Background on Persistent Homology We provide a brief introduction to the necessary building blocks from alge-braic topology to describe our algorithms. For a more complete introduction to computational topology and persistenthomology, we refer to [26, 42]. A cell complex X is a collection of contractible cells of varying dimensions in whichq-dimensional cells are connected to (q − 1)-dimensional cells with maps on their boundaries. For simplicity, one mayconsider simplicial or cubical complexes where these boundary maps are determined combinatorically. Furthermore,we will only consider finite cell complexes. Homology (with field coefficients) in dimension q is a functor from atopological category to the category of vector spaces over a field k. The homological dimension q captures information

∗Corresponding author

arX

iv:2

108.

0502

2v1

[m

ath.

AT

] 1

1 A

ug 2

021

Page 2: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

about q-dimensional features: q = 0 encodes connected components, q = 1 encodes loops, and general q encodesq-dimensional voids.

A filtration, or filtered cell complex, is a sequence of cell complexes related by inclusion

X0 ⊆ X1 ⊆ . . . (1)

Persistent homology is the application of homology to the filtration in Equation (1). The result can be considered as ak[T ] module [47] or as a diagram of vector spaces connected by linear maps induced by inclusion known as a type-Aquiver representation [14, 43]. Both representations are characterized up to isomorphism by persistence barcodes,which describe the birth and death of homological features in the filtration.

Computing Persistent Homology Persistent Homology is computed by first applying the cellular chain functor tocell complexes. A chain complex C∗(X ) consists of vector spaces Cq(X ), q = 0, 1, . . . with a basis element for eachq-dimensional cell, and maps

Bq : Cq(X )→ Cq−1(X ) (2)

which maps the basis element of a cell to a linear combination of basis elements of cells in its boundary. The boundarymaps have the property Bq−1Bq = 0, and homology is computed as the quotient vector space

Hq(X ) = kerBq/ imgBq+1. (3)

Most algorithms for computing persistent homology are based on computing a factorization of filtered boundary matrix(meaning the rows and columns of Bq are arranged in the order of appearance of cells in the filtration):

BqUq = Rq, (4)

where Uq is upper-triangular and Rq is reduced, which means that it has unique low pivots, i.e. the index of the lastnon-zero row of each column (if it exists) is unique. The computation ofRq is implicit in the early work of Edelsbrunner,Lester, and Zomorodian [27], an explicit algorithm and analysis forRq was given by Zomorodian and Carlsson [47], andthen an factorization viewpoint was introduced by Cohen-Steiner, Edelsbrunner, and Morozov [22] when developing ascheme for updating persistent homology which is also the starting point for this work.

We can obtain the persistence information from the factorization in Equation (4) for each dimension q. Only Rq isneeded to read off persistent homology: a q-dimensional homology class is born when a cell is added that generates azero column in Rq, and this class dies when the index of the birth cell is the pivot of a column of a cell in Rq+1 [47].The formation of Uq is only necessary if one wishes to obtain a representative for the homology class, or, as we shallsee, update the factorization. A variety of optimizations have been developed for efficient computation of persistenthomology which are incompatible with the formation of Uq, particularly the clearing [19, 23] and compression [7]optimizations which are used by state-of-the-art implementations for computing persistent homology [33, 5]. Otherpractical accelerations for persistent homology include the use of discrete Morse theory [39] and efficient data structures[8].

Motivations Our work is motivated by several applications in topological data analysis. First, in exploratory dataanalysis, one may wish to compute the persistent homology of geometric filtrations (i.e. built using pairwise distances)on point-cloud data. Sometimes several constructions and metrics may be considered, and there may be large amountsof redundant computation done processing the same region for each choice. Second, in a variety of data analysisproblems persistent homology is computed as a feature for each datum in a data set [24, 29, 3, 4, 11, 44]. Oftenthere is a shared structure which we might expect to exploit. Finally, recent work using persistent homology ingradient-based optimization [9, 10, 17, 20, 34, 36] produces a situation where a topological space undergoes relativelyminor modifications in each gradient step. We seek to be able to reuse computation to the largest extent possible.

Theoretic stability results of persistence homology implies minor modifications on space will not cause many changeson persistence. As established in [21], the bottleneck distance between two persistent diagrams (a multiset of points inthe extended plane encodes persistence information) built on two continuous and tame functions are bounded by theL∞ difference of the two functions. In other words, given a filtration induced by a function f , if we slightly perturb ormodify its values on some cells, the persistent diagram will not change too much. This result also makes us believe thatan updating persistence scheme is reasonable to develop.

Warm Starts: The idea of simply updating the factorization in Equation (4) for a series of iterated problems isrelated to a variety of similar techniques in sparse numerical linear algebra and numerical optimization to update LUfactorizations [30, 31, 45, 46]. Our goal is to re-use a previous computation to the largest extent possible, known as a“warm start” to the problem.

2

Page 3: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

Contributions In this work we provide algorithms to compute persistent homology of one filtration starting fromthe persistent homology of another by updating the associated matrix factorizations. We analyze the complexityof this update in terms of how close the two filtrations are to each other, namely in terms of the number of cellsadded and deleted from the filtration and in terms of how the filtrations’ order changes. This approach generalizesthe earlier work of Cohen-Steiner, Edelsbrunner, and Morozov [22] to include addition and removal of cells from afiltration, and includes an analysis that can be applied to general updates beyond elementary permutations. We provideseveral examples of how our techniques provide practical speedups for both level set and geometric filtrations, and ourimplementations are made publicly available at https://github.com/YuanL12/TDA_Updating_Persistence.

2 Algorithms and Analysis

2.1 Matrix Reduction

Notation: We denote column j of a matrix A as A[j], entry i of a (column) vector v as v[i], and the entry in row iand column j of a matrix A as A[i, j]. We say the (low) pivot of a column vector v, denoted piv(v) is the largest indexi such that the entry v[i] is non-zero.

We first review the reduction algorithm for computing persistent homology [47] which we use and modify for ouralgorithms. We say a matrix R is reduced if every column R[j] is either zero or has a unique pivot. The reductionalgorithm, Algorithm 1, produces a reduced matrix R from an input matrix B using elementary column operationsthat preserve the grading of columns (meaning column j′ can be added to column j only if j′ < j), which means thetransformation can be encoded using an invertible upper triangular matrix U

BU = R. (5)Equation (5) can be re-written as a factorization B = RU−1, and we refer to this as a RU -decomposition of B. This isequivalent to the terminology used in [22] up to inversion of the matrix U .

Algorithm 1 Reduction Algorithm [47]

1: Input: m× n matrix B and n× n matrix U(= In default parameter)2: Result: Decomposition BU = R3: R = B4: for j = 1, ..., n do5: while piv(R[j]) > 0 and j′ < j exists so that i = piv(R[j]) = piv(R[j′]) do6: α = R[i, j]/R[i, j′]7: R[j] = R[j]− αR[j′]8: U [j] = U [j]− αU [j′]9: end while

10: end for11: return R, U

The persistence barcode can be read off from Rq by computing this decomposition for each filtered boundary matrix ina filtered chain complex: a new q-dimensional bar is born for each column that is reduced to zero in Rq, and this bardies when the same column index appears as a pivot of a column in Rq+1 [47].

We will now examine the role of U in the algorithm. First, the algorithm 1 performs identical column operations on Uand R and so even if we pass into an argument U different from In into the reduction algorithm, then the decompositionof B will not hold, but U will still record those operations, which will be useful in our work. Second, unless thevisualization of a representative of each homology class is needed, the matrix U that provides this representativeinformation is often not formed practically in general. If so, then the line 8 of algorithm 1, about performing the columnoperations on U can be omitted and the algorithm in fact will not need U at all, which can allow for optimizations suchas clearing and compression [7, 19, 23] based on the key observation pivRq+1[j] = i implies Rq[i] = 0. Third, asmentioned earlier, all column operations are added left-to-right, which will make U upper-triangular and invertible (ifthe initial passing argument U is upper-triangular and invertible). It also corresponds to the fact that, at an intermediatecomplex of a filtration, cells can be used to compute homology or homology representatives only if they have appearedin the inclusion. Finally, the decomposition BU = R is not generally unique, as we can add columns with lower pivotor zero columns to columns with higher pivot and higher index without altering the pivots in R or the upper triangularstructure of U . This observation is related to the non-uniqueness of homology representatives.

A straightforward complexity analysis of Algorithm 1 yields a run time of O(mnmax (m,n)), or cubic in the numberof cells [47]. The decomposition can be obtained in matrix-multiplication time with more complex algorithms [38],

3

Page 4: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

but practical implementations use variants of the standard algorithm and sparsity typically makes asymptotic run timebounds pessimistic in practice [42].

2.2 Permuting Filtration Order

Assuming we have computed the decompositions BqUq = Rq, q = 0, 1, 2, . . . , of boundary matrices of a filtered cellcomplex, we would like to update this decomposition to compute persistent homology of the same cell complex with adifferent filtration order. If B′q is the boundary of this new filtration, then

B′q = Pq−1BqPq (6)

Where Pq−1 and Pq are permutations of the orderings of (q − 1)-cells and q-cells respectively. We can then modify thedecomposition of Bq:

Pq−1BqPqPTq Uq = Pq−1Rq (7)

B′qPTq Uq = Pq−1Rq (8)

where we use the identity PqPTq = I . There are two obstacles that we must overcome to produce a decompositionB′qU

′q = R′q: first, PTq Uq is not upper triangular, and second Pq−1Rq may no longer have unique column pivots. We

achieve the decomposition using Algorithm 2.

Algorithm 2 Update Decomposition with Permutation

1: Input: m× n matrix R, n× n matrix U , m×m matrix Pr, and n× n matrix Pc2: Result: Factorization B′U ′ = R′ where B′ = PrRU

−1Pc3: U = PTc U4: R = PrR5: U,R = Reduction Algorithm(U , R) . reduce U using Algorithm 16: for j = 1, ..., n do . make U upper-triangular7: if piv(U [j]) 6= j and piv(U [j

′]) = j then

8: Swap column U [j] and U [j′]

9: Swap column R[j] and R[j′]

10: end if11: end for12: R,U = Reduction Algorithm(R, U ) . reduce R using Algorithm 113: return R,U

Algorithm 2 has a similar purpose to the algorithm of Cohen-Steiner, Edelsbrunner, and Morozov [22] which breaks uppermutations into a sequence of elementary transpositions and applies updates based on one of four cases. In comparison,Algorithm 2 is simpler to state and use of the standard reduction algorithm makes implementation straightforward in apackage that already computes persistent homology. The algorithm of [22] uses a more specialized data structure toallow row swaps in constant time which allows for a better complexity bound in the case of elementary transpositions.While Algorithm 2 could be adapted to use this optimization, the applications we consider typically permute enoughelements of the matrix that there isn’t any disadvantage to using whatever matrix data structure is already used forAlgorithm 1, typically a list-of-lists.

Proof of correctness: Through line 4, Algorithm 2 simply applies the requisite permutations to U and R to produceB′U = R. This decomposition invariant is maintained by applying the same column operations to U and R through therest of algorithm, since Algorithm 1 performs identical column operations, and the for loop beginning on line 6 alsoperforms identical column operations. If U is already upper-triangular, then the call to Algorithm 1 on line 12 will keepU upper triangular and reduce R. Thus, it suffices to show that lines 5–12 put U in upper triangular form. Note that thecall to Algorithm 1 in line 5 reverses the inputs U and R compared to the call in line 12, so it will have the effect ofputting U in reduced form. Because U is invertible, after reduction no columns will be zeroed out and every columnwill have a distinct pivot. Because U is square, there must be n distinct pivots for each of the n columns, so everyrow must appear as a pivot. In lines 6-12 we then simply permute the columns of the reduced U so that the columnwith pivot j is put in the j-th position, which puts U in upper-triangular form by definition. Denoting the output ofAlgorithm 2 as R′, U ′, we conclude that Algorithm 2 produces a valid decomposition B′U ′ = R′ where U ′ is uppertriangular and R′ is reduced.

4

Page 5: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

Complexity A trivial upper bound for the run time of Algorithm 2 comes from the calls to Algorithm 1. However, atighter bound can be obtained based on how greatly the permutations change the filtration order.Theorem 2.1. Algorithm 2 performs the update in

O((m+ n)(|Pr|τ + |Pc|τ ) + nnz(U) + nnz(R)) (9)

field operations, where |P |τ is the Kendal-tau distance between the permutation P and the identity permutation [25].

A proof is given in Section 3.1. Practically, this means that we expect an advantage to using Algorithm 2 when filtrationvalues are not changed too drastically, and since |Pr|τ = O(m2) and |Pc|τ = O(n2) the algorithm is also worst-casecubic in the number of cells, comparable to Algorithm 1 albeit with a worse scaling constant. Note that we can’t expectto do better than this since we use the standard reduction algorithm as a subroutine.

2.3 General Updates

Permutation of filtration order is sufficient for applications such as computing persistent homology of different super-level set filtrations on a fixed complex. However, we may also wish to insert and delete cells in a filtration. One suchexample is Rips filtration, which is a useful tool for computing persistent homology on a metric space, where thepersistence parameter is often truncated at the enclosing radius of the metric space for a practical speedup [33, 5].

Suppose we have filtrations F and F ′ and wish to compute the decomposition B′qU′q = R′q for F ′ starting from the

decomposition BqUq = Rq. We first compute Iq and Iq−1: the sets of cell indices which will be deleted from F indimensions q and q − 1; then I ′q and I ′q−1: the sets of cell indices which will be inserted into F ′ in dimensions q andq − 1; and finally Pq and Pq−1: the permutations of filtration order on the q and q − 1 cells that are present in both Fand F ′. The key observations for our procedure are that in the context of the matrix decomposition BU = R,

1. Cells at the end of a filtration are trivial to remove without altering the upper-triangular structure of U and thereduced structure of R;

2. Cells can be inserted in arbitrary locations without altering the upper-triangular structure of U .

Observation 1 is because if a q-cell is the final cell in a filtration, then its column in Bq will not be used to reduce anyother columns in the RU -decomposition since it is furthest right. Furthermore, its row in Bq+1 will be the last rowand will be entirely zero since it can not appear as a face in a valid filtration (since it is the final cell and faces mustappear before a cell can appear). In contrast to observation 1, deleting rows and columns in the middle of the filtrationrequires us to update columns to the right which use the deleted column in their reduction. Observation 2 is easy to see,since adding columns to the boundary Bq (and thus rows and columns to Uq) does not invalidate the upper-triangularstructure of Uq, although a final pass of Algorithm 1 is required to ensure Rq and Rq+1 are reduced. We incorporatethese observations into Algorithm 3, which generalizes Algorithm 2.

Proof of correctness: The discussion in Section 2.2 applies here as well. The key modifications are the addition anddeletion of rows and columns to the matrices. From the discussion above, it is clear that by permuting the rows andcolumns to be deleted to the end of the matrices and then updating U to be upper-triangular, we are free to delete theserows and columns in line 13 with no additional considerations while maintaining the decomposition invariant. Afterthis, insertion of rows and columns in lines 14–16 maintains the decomposition invariant and keeps U upper-triangular,so the final call to Algorithm 1 on line 17 will put R in reduced form and give the desired result.

Complexity Again, we are interested in a tighter-than-cubic bound for Algorithm 3, and defer proof to Section 3.2.Theorem 2.2. Algorithm 3 performs the update in

O(nnz(U) log n+ nnz(R) logm+ (m+ n)(|Qc|τ + |Qr|τ ) +mmax(m,n)|I ′c|) (10)

field operations, where |Q|τ is the Kendal-tau distance between the permutation Q and the identity permutation.

3 Computational Complexity

We will now turn to analyze the computational complexity of Algorithms 2 and 3. We use nnz(A) to denote the numberof non-zeros in a column or a matrix (A). In this section, we will assume that matrices are stored in a list of lists formatas is standard in implementations for persistent homology, that is a list of columns each of which is stored as a list ofpairs of nonzero indices and values. This format is optimized for column operations which take the most time in thestandard reduction algorithm. In our update schemes, the first two steps are to permute rows of a matrix which can

5

Page 6: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

Algorithm 3 Update Decomposition with Permutation, Insertion, and Deletion

1: Input: m× n matrix R, n× n matrix U , collections of rows and columns to delete Ir and Ic, a collection of rowsand column indices to insert I ′r and I ′c as well as the columns to be inserted B′c, and m×m matrix Pr, and n× nmatrix Pc which permute rows and columns which are not inserted and deleted.

2: Result: Factorization B′U ′ = R′ incorporating updates3: Form permutation matrices Qr and Qc that act as Pr and Pc on rows and columns which survive deletion and

permute Ir and Ic to the end.4: U = QTc U5: R = QrR6: U,R = Reduction Algorithm(U , R) . reduce U using Algorithm 17: for j = 1, ..., n do . make U upper-triangular8: if piv(U [j]) 6= j and piv(U [j

′]) = j then

9: Swap column U [j] and U [j′]

10: Swap column R[j] and R[j′]

11: end if12: end for13: Delete the last |Ic| rows and columns from U and the last |Ir| columns from R.14: Insert zero rows at locations I ′r in R15: Insert columns B′c in locations specified by I ′c in R16: Insert rows and columns specified by I ′c in U which act as the identity.17: R,U = Reduction Algorithm(R, U ) . reduce R using Algorithm 118: return R,U

be inefficient for very small permutations. One option when dealing with very minor perturbations may be to use amore specialized data structure as in [22], but in a variety of cases using the standard list-of-lists format is a reasonableoption.

3.1 Permuting Filtrations

Let B be a m× n matrix with BU = R, and Pr, Pc be row and column permutations so that B′ = PrBPc.

Since we use a list of lists format, applying row permutations to U and R generally will require us to alter eachnon-zero index and sort each column by index (for indices in each column is stored in increasing order). If weconsider the application of a row permutation to a m× n matrix A, altering each nonzero index takes nnz(A) time,and sorting indices of non-zeros in each column using standard algorithms takes O(

∑nj=1 nnz(A[j]) log nnz(A[j]))

operations. Bounding nnz(A[j]) by m will give O(∑nj=1 nnz(A[j]) logm) = O(nnz(A) logm). Thus, applying the

row permutations in Algorithm 2 takes O(nnz(U) log n+ nnz(R) logm).

Next, we analyze the complexity of reducing U after the row permutation of Algorithm 2. We first will give a lemmaand use the following notation: for a m × n matrix M , we say the row i has k pivots, if there are k columns in Mthat have i as their pivots. i.e.,|{j | piv(M [j]) = i}| = k. We also use an elementary transposition to denote a swapbetween two adjacent elements of a list.Lemma 3.1. For an m× n matrix M , suppose row i has k pivots and row i+ 1 has l pivots. Then, if we swap row iand i+ 1, then row i will have at most l pivots and row i+ 1 will have at most k + l pivots. We also say the adjacentswap maps the pivots pair (k, l) to (l, k + l).

Proof. We consider the change of pivots of rows in terms of the pivot change of each column, and there are 3 cases tobe discussed. Denote the matrix after the adjacent swap by M ′.

1. If piv(M [j]) < i or piv(M [j]) > i + 1, then after swapping, the column j has no effect on the number ofpivots that row i and i+ 1 have.

2. If piv(M [j]) = i, then after swapping, piv(M ′[j]) = i+ 1, and so the row i will have one less pivot and therow i+ 1 will have one more pivot.

3. If piv(M [j]) = i + 1, then after swapping, depending on if M [i, j] = 0 or not, the pivot of column j willbe either piv(M ′[j]) = i+ 1 or piv(M ′[j]) = i. In particular, if M [i, j] = 0, then swapping row i and rowi+ 1 will give piv(M ′[j]) = i, and so row i now has one more pivot and row i+ 1 now has one less pivot; if

6

Page 7: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

M [i, j] 6= 0, then swapping row i and row i + 1 will still keep piv(M ′[j]) = i + 1, and so row i and i + 1still have the same number of pivots. Thus, in terms of upper-bound, we can state that the column j has noeffect on the upper bound of pivots of row i+ 1, but row i has one more pivot.

For each column, we can apply the above 3 cases and summing over the pivot changes on all columns. Thus, theadjacent swap of row i and i+ 1 will cause:

1. row i has at most l pivots, because the original k pivots move to row i + 1 (by case 2) and the (possibly)additional new l pivots come from row i+ 1 (by case 3);

2. row i+ 1 has at most k + l pivots, because the original l pivots can still exist (by case 3) and the new l pivotscome from row i (by case 2).

Note that the Lemma 3.1 does not make any assumption on the matrix structure like reduced or upper-triangular.

For an n× n upper-triangular (also reduced by definition) matrix U , each row has only one pivot. However, after weapply a row permutation PTc on it (in Line 5 of Algorithm 2), pivots of columns of PTc U might not be unique, whichmeans we need to eliminate those new duplicate pivots. In order to count the number of column operations to reducePTc U by the standard Reduction Algorithm 1, our approach is to inductively, starting from the last row, loop over eachrow to count the number of duplicate pivots on each row and then reduce them.

Note that this approach is very similar to the bubble sort algorithm and each time only looks at one row above. Weconsider the permutation using a series of passes of elementary transpositions that will permute a row to its new indexin PTc U . For each pass, we let πc(i) be the row index in the last pass that will be permuted to row i of PTc U , whichwill require i− πc(i) = |i− πc(i)| elementary transpositions.

Then, the number of duplicate pivots needed to be eliminated will also be at most |i− πc(i)|, by Proposition 3.1.

Proposition 3.1. Let U be an n× n upper-triangular matrix and Pc be an n× n permutation matrix. Then, for PTc U ,the number of duplicate pivots needed to be eliminated in row i is at most |i− πc(i)|.

Proof. Starting from the last row we will count the number of duplicate pivots to be reduced.

First, we count the number of duplicate pivots in the last row n. We use Table 1 to illustrate the change of pivots in rowsfrom πc(n) to n. For an upper triangular matrix U , the number of pivots in each row is one, which corresponds to theinitial state row of Table 1. Next, we swap row πc(n) with πc(n) + 1, by Lemma 3.1, and the pivots pair of row πc(n)and πc(n) + 1 will change from (1, 1) to (1, 2), which corresponds to the second row of Table 1. Then, we continue toperform elementary transpositions until reaching the last row n. In the end, except for row n, pivots in the other rows is1, and only row n has n− πc(n) + 1 pivots, and so has at most |n− πc(n)| duplicate pivots. Now, to eliminate theseduplicate pivots, we need to add the column πc(n) to the right and the number of non-zeros in that column is at most n,so reducing the row n takes O(n|n− πc(n)|).Next, assume we have finished the passes for rows i+ 1, i+ 2, . . . , n and eliminated all duplicate pivots. Then at thebeginning of the pass for permuting row πc(i) to i, U is still reduced. It means that we return back to the the initial statein Table 1 with unique pivots. To calculate the number of pivots in row i, since πc(i) < i, the procedure is the same asin Table 1.

Pivots Map πc(n) πc(n) + 1 πc(n) + 2 ... n− 1 ninitial state 1 1 1 ... 1 1

(1, 1)→ (1, 2) 1 2 1 ... 1 1(1, 2)→ (1, 3) 1 1 3 ... 1 1

... ... ... ... ... ... ...(1, n− πc(n)− 1)→ (1, n− πc(n)) 1 1 1 ... n− πc(n) 1(1, n− πc(n))→ (1, n− πc(n) + 1) 1 1 1 ... 1 n− πc(n) + 1

Table 1: The upper bound of the number of pivots of each row after each elementary transposition. Every row recordsthe number of pivots after a pivot map introduced in Lemma 3.1.

7

Page 8: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

Corollary 3.1. The total number of duplicate pivots needed to be eliminated in all rows is∑ni=1 |πc(i)− i| = |Pc|τ ,

where |Pc|τ := d(Pc, I)K−τ is Kendal-tau distance from Pc to the identity permutation. To reduce PTc U , we alsoincur an additional cost of O(m|i− πc(i)|) for row i, for the same operations performed to R. Thus, the total cost ofreducing PTc U is

O(

n∑i=1

(i+m)|πc(i)− i|) = O((n+m)

n∑i=1

|πc(i)− i|) = O((n+m)|Pc|).

After reducing the permuted U , we need to permute the columns of U to make it upper-triangular. Permuting thecolumns of U and R can be done in O(nnz(U)+nnz(R)) time, or O(n) time in the case of a lists-of-lists data structuresince we can just permute column pointers.

Finally, we turn to the complexity of reducing the matrix R in line 12 of Algorithm 2. Note that R experiences 3multiplication before reducing: PrRUP , where U comes from the reduction on PTc U and P comes from the columnpermutation. In PrRUP , we only need to consider Pr and U , because column permutation will not affect the rowstructure. Reversing the column operations that are stored in U costs O(m|Pc|τ ) and then we need O(m|Pr|τ ) toreduce R by viewing a reduced matrix as an upper-triangular matrix after column permutation, which then returns backto the argument we made for U in Corollary 3.1. At the same time, we add additional cost O(n|Pr|τ ) from the thesame operations performed on U to reduce R.

Thus, by adding all above cost together, we get

O((m+ n)(|Pr|τ + |Pc|τ ) + nnz(U) log n+ nnz(R) logm),

for the Algorithm 2 to execute.

3.2 Addition and Deletion of Cells

We will now turn to an analysis of Algorithm 3. Again, we apply row permutations for a cost of O(nnz(U) log n +nnz(R) logm), and it is straightforward to extend the analysis of Section 3.1 to the reduction of U on line 6, for a costof O((m+ n)(|Qr|τ + |Qc|τ )). Again, the permutation of columns in lines 7–12 can be accomplished by swappingcolumn pointers for a cost of O(n).

Because we use lists of lists as our data structure of matrix, deleting the final |Ic| columns of U and R is trivial.Furthermore, because after we have deleted these columns in U there are no non-zeros in the last |Ic| rows, deletingthese rows does not affect any entries of the remaining columns so can be done in constant time. Inserting zero rows inR potentially requires us to modify all non-zero indices in its columns, so may cost O(nnz(R)) operations. Insertingcolumns can be done in O(n) time by inserting pointers, plus the time to form the columns in Bc which has O(m|I ′c|)non-zeros.

Assume the new boundary matrix B′ has size m′ × n′ after insertion, we now investigate the cost to reduce R afterinserting |I ′c| columns. For each inserted column j, suppose its pivot is pivR′[j] = i, and there are 2 possible cases tobe discussed:

• if the pivot is not shared by any other columns, then there is no need to reduce this inserted column and R isstill reduced.

• if the pivot is shared by another column, then the row i has two pivots, and we need to eliminate the column witha larger index, which can also potentially create a new pivot in row i− 1. We then keep eliminating duplicatepivots in columns with larger indices, until a new unique pivot appears. There are at most max(m′, n′) pivotsto iterate through in this way.

Since each column operation costs O(m′), inserting |I ′c| columns increases the cost of reducing R by a factor ofO(|I ′c|m′max(m′, n′)).

To simplify notation, we use m,n to be the respective maximum number of rows and columns in B and B′, the totalrun time of Algorithm 3 is

O(nnz(U) log n+ nnz(R) logm+ (m+ n)(|Qc|τ + |Qr|τ ) +mmax(m,n)|I ′c|) (11)

Again, this bound is pessimistic due to sparsity in the matrices U and R. In addition, note that if we update from anempty complex, then |I ′c| = n and so O(mmax(m,n)|I ′c|) = O(mnmax(m,n)), which is the same as the bound ofAlgorithm 1.

8

Page 9: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

4 Examples and Experiments

We will now turn to demonstrating the use of our algorithms in several practical situations. Our implementation buildson the implementation found in the Basic Applied Topology Subprograms (BATS) [15] (https://github.com/bnels/BATS), which provides a standard list-of-lists matrix data structure as well as a variety of options for computingpersistent homology including the standard reduction algorithm as well as the clearing [19, 23] and compression [7]optimizations. This allows us to compare to several algorithmic options without needing to worry too much aboutimplementation-specific variation. We also compare to the more highly optimized Gudhi [37] and Ripser [5] packagesas well as the commonly used Dionysus library [40]. These packages are all comparable using Python bindings forcompiled C++ code (for Ripser, we use the bindings at https://ripser.scikit-tda.org). Our timing results arecomputed using single processes on machines with Intel Xeon 6248R processors and 192GB of random access memory(memory requirements are typically much lower).

4.1 Level Set Filtrations

One common filtration used in topological data analysis is obtained through (super) level sets of a function on atopological space. Given a function f : X → R we denote a super-level set as Xa = f−1([a,∞)), and we considera filtration via the inclusions Xa ⊆ Xb if b < a. An application of this type of filtration is to single channel images,where an image is considered as a pixel intensity function on a m× n grid which is extended to a filtration on a cubicalcomplex or a simplicial complex via the Freudenthal triangulation.

We investigate level set persistence using several real and synthetic 2-dimensional image data sets:

1. MNIST [35]: A collection of handwritten digit images contains a training set of 60,000 examples, and atest set of 10,000 examples. Each image is 28 × 28 pixels. As a default we consider computing persistenthomology of each image as an update of a pixel-wise averaged image of the same size.

2. Vert-64: A 3-dimensional rotational angiography scan of a head with an aneurysm used for benchmarkingpersistent homology in [42]. This data set is a 3-dimensional array of size 512× 512× 512, and each voxel isan grey-scale integer. We obtained the data set from the repository [2]. In our experiments, we subsamplethe data to form a 64× 64× 64 image due to the memory overhead of forming the basis U . Our update testsperturbation of the pixels by random noise with mean 0 and variance 0.01.

3. S2D(σ) (sinusoid-2D): A synthetic 128× 128 image A defined as A[i, j] = sin(10πi/128)+ cos(10πj/128).The updated image adds normally distributed random noise with mean 0 and variance σ.

4. S3D(σ) (sinusoid-3D): A 3-dimensional analog of the S2D(σ) data on a 32 × 32 × 32 cube. In this case,A[i, j, k] = sin(4πi/32) + cos(4πj/32) + sin(4πk/32).

Persistent homology is often used as a feature generation technique for data. In the case of images, this requirescomputation of persistent homology for each image in the data set, which can be a bottleneck in computation in part dueto implementation and algorithmic complexity and in part due to lack of hardware acceleration seen in more popularimage processing techniques such as convolutions. We will use the MNIST handwritten digit dataset as an example asit readily admits an interpretation of topological features. For example, an image of the digit “0” typically has a robustconnected component (H0 bar) and a single robust hole (H1 bar), although smaller bars may appear due to variationsin pixel intensity (e.g. from variations in how hard a pen was pressed down when writing the digit, or from noise atdifferent points in the digitization process).

Extension Build Filtration Reduction Update TotalFull (BATS) 5.5× 10−4 3.4× 10−4 2.7× 10−3 – 3.6× 10−3

Image init. 5.2× 10−4 – – 8.6× 10−4 1.3× 10−3

Avg. init. 5.1× 10−4 – – 1.1× 10−3 1.6× 10−3

Zero init. 4.9× 10−4 – – 1.1× 10−3 1.6× 10−3

Noise init. 5.2× 10−4 – – 1.9× 10−3 2.4× 10−3

Table 2: Average time to compute persistent homology on 1000 MNIST images. The Extension column gives thetime to extend the filtration on pixels to a filtration on the complex. Our update scheme improves the total time perimage by an approximate factor of 3. Updating the factorization from an actual image is approximately 20% faster thaninitializing with a constant image or the “average image”. Updating the factorization from an image with random pixelvalues is slower, but still gives a speedup likely because of memory efficiency.

9

Page 10: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

MNIST Vert-64 S2D(0.01) S2D(0.1) S3D(0.01) S3D(0.1)Dionysus 2.5× 10−3 – 10× 10−2 14× 10−2 17× 10−1 17× 10−1

Gudhi(f) 3.8× 10−3 – 11× 10−2 13× 10−2 16× 10−1 15× 10−1

BATS(f) 4.8× 10−3 – 18× 10−2 23× 10−2 52× 10−1 70× 10−1

BATS(cl,f) 2.0× 10−3 – 8.2× 10−2 8.1× 10−2 15× 10−1 13× 10−1

BATS(u,f) 1.6× 10−3 – 5.4× 10−2 7.1× 10−2 6.7× 10−1 10× 10−1

Gudhi(c) 2.2× 10−3 2.0 2.5× 10−2 2.7× 10−2 1.6× 10−1 1.7× 10−1

BATS(c) 3.6× 10−3 76 14× 10−2 15× 10−2 14× 10−1 18× 10−1

BATS(cl,c) 2.1× 10−3 3.2 7.2× 10−2 7.8× 10−2 6.8× 10−1 6.2× 10−1

BATS(u,c) 1.2× 10−3 12 1.8× 10−2 2.8× 10−2 2.0× 10−1 2.7× 10−1

Table 3: Average time in seconds to update persistent homology of level set filtrations on synthetic and real data. Wecompare Dionysus [40], GUDHI [37], and BATS [16]. (f) dentotes the a simplicial complex built from the freudenthaltriangulation, (c) denotes a cubical complex, (cl,f) and (cl,u) denote the clearing optimization applied to each complex,and (u,f) and (u,c) denote our update scheme (Algorithm 2) applied to each complex. Timings are averaged overmultiple 1000 updates for MNIST, 1 update for Vert-64, 100 updates for S2D columns, and 20 updates for S3D columns.Timings for the Freudenthal triangulation of the Vert-64 data set are excluded due to memory constraints.

.

In Table 2, we measure the average time to compute persistent homology in dimensions 0 and 1 on 1000 randomMNIST images using a 2-dimensional Freudenthal triangulation of the 28× 28 grid for a total of 784 0-simplices, 22411-simplices, and 1458 2-simplices. We use a single initial filtration which is updated for each image. Overall, our updatescheme gives almost a 3x speedup compared to a full persistent homology computation. We observe that initializingwith an actual image produces slightly faster updates when compared to an “average image" produced by averaging eachpixel value over the data set or a constant “zero image". Note that even initializing with the constant image gives a largespeedup. Because MNIST digits have a constant background using this constant image for initialization is advantageousbecause much of the factorization can be reused over this constant region. We also measure the time to update thepersistent homology of an “image” generated from random pixel values, which still gives a noticeable speedup. We canuse this as a baseline to determine how much of the speedup using a representative image for initialization is due tomemory and implementation efficiency and how much is due to the cost of updating persistent homology from a goodstarting point vs. a bad starting point.

In Table 3 we measure the time needed to compute persistent homology on a variety of data, either from scratch or usingour update scheme. On all the spaces built on the Freudenthal triangulation of a grid, our update scheme demonstrates anoticeable improvement in run time, and for cubical complexes we outperform Gudhi on smaller and simpler updates,and are slightly outperformed on larger problems and updates. We also note that Dionyusus has a built-in function forthe Freudenthal triangulation of an image whereas Gudhi does not, so the better performance of Gudhi on persistenthomology computations is offset by the need to construct the filtration in Python. We report the results of the clearingoptimization in BATS - compression tends to perform slightly worse on these examples.

4.2 Rips Filtrations

Rips filtrations are are commonly used in conjunction with persistent homology to create features for finite dimensionalmetric spaces (point clouds). Given a metric space (X, d), a Rips complex consists of simplices with a maximumpairwise distance between vertices is less than some threshold r:

Xr = {(x0, . . . , xk) | xi ∈ X, d(xi, xj) ≤ r}.

A Rips filtration is a filtration of Rips complexes Xr ⊆ Xs if r ≤ s.The number of simplices in Rips filtrations quickly grows with the size of the data set, and much effort has gone intodeveloping efficient algorithms for computing persistent homology of Rips filtrations. While it is possible to use anapproach such as that done in Section 4.1 which is to update every simplex in a filtration, several high-performancepackages for Rips computations [5, 33] stop a filtration at the enclosing radius of the metric space, at which point thecomplex becomes contractible, which can reduce the total number of simplices in the filtration considerably withoutchanging persistent homology. In order to combine this optimization with our approach, it is necessary to be able to addand remove simplices from filtrations as well as permute their filtration order as in Algorithm 3.

10

Page 11: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

4.2.1 Updates on different data sets

In Table 4, each column records the time spent on computing persistent homology on a data set and each row representan algorithm in BATS or in other packages. We list the data sets below. In order to mimic real situation of computingpersistent homology, for synthetic data sets (1)(2), we add normal noise with standard deviation 0.001 to them; for datasets from empirical measurements and experiments (3)(4)(5), we add 1% standard normal noise of original data pointsas their measurement error.

1. Sphere1 and Sphere2 : We first randomly generate two data sets, where each with 100 points on S1 ⊂ R2

and on S2 ⊂ R3, and next add normal noise with standard deviation 0.001 to them. We update persistencefrom unnoised spheres.

2. Klein3 : The data set was introduced in [42], which samples 400 points from the Klein bottle using its“figure-8” immersion in R3. We randomly re-sample 100 points from it and then add normal noise withstandard deviation 0.001 to it.

3. Bunny: The Bunny model comes from the Stanford Computer Graphics Laboratory [1]. We use one of its 3Dscan picture with size 40256 points in R3 and (uniform) randomly sample 400 points from it and then add 1%standard normal measurement error to it.

4. Dragon: It is a 3-dimensional scan of the dragon from the Stanford Dragon graphic model [1] and in [42],they sampled 1000 and 2000 points uniformly at random. We randomly re-sample 400 points from the 1000points and then add 1% standard normal measurement error to it.

5. H3N2: The data set contains 2722 different genomic sequences of H3N2 influenza and each is a vector inR1173. We retrieved it from the repository of [42] and it is also studied using persistent homology in [18].There are many genetic distances used to measure the distance between two genomic sequence, but we willfocus Euclidean metric for illustrative purpose of our updating algorithm. We also randomly sample 400 pointsand then add 1% standard normal measurement error.

Sphere1 Sphere2 Klein3 Bunny Dragon H3N2max. PH 1 2 2 1 1 1

BATS 0.44 22.44 4.89 61.12 48.00 28.35BATS(nb) 0.24 10.60 2.92 28.48 20.31 17.63BATS(cl) 0.23 10.22 2.81 28.42 20.26 17.51BATS(co) 0.22 7.67 2.49 24.01 16.08 18.05BATS(u) 0.20 6.82 2.53 25.27 19.02 20.77

Gudhi 0.05 2.30 0.99 4.49 2.52 6.57Dionysus 0.73 37.24 – – – –

Ripser 0.01 0.17 0.08 0.08 0.08 0.08Table 4: The average time to compute persistent homology of Rips filtrations on different data sets. The row ‘max.PH’ is the maximum persistent homology dimension we compute up to. Each column is a data set and each row is analgorithm. The first 5 algorithms are all implemented in BATS. They are (1) standard Reduction algorithm denotedBATS; (2) standard Reduction Algorithm without forming U : BATS(nb); (c) Clearing: BATS(clr); (d) Compression:BATS(comp); (e) Algorithm 3: BATS(u). Reported times are averaged over 20 runs. The enclosing radius is used forcomputations.

.

In Table 4, we found that our Updating Algorithm 3 can achieve at about 2x speedup compared to the standard reductionalgorithm with basis in BATS. Although it is still slower than the clearing and compression variants in some situations,the time is comparable and has the advantage of maintaining the homology basis for purposes such as visualizinghomology representatives. Ripser demonstrates a large performance advantage over other options, but we note it isspecifically optimized for Rips Filtrations. Gudhi also performs well in comparison to BATS relative to our experimentson level set filtrations.

4.2.2 Effect of Noise Variance

In practice, although there is an upper-bound of the complexity of reduction algorithm, the empirical run time varies ondata sets even with the same size of filtration. In Table 4, we add a normal noise with standard deviation 0.001 to S1, butin Figure 1a, we experiment with the run time for larger variance. Starting with the computation of persistent homologyon a noiseless sample of S1, we investigate the time spent on recomputing persistence using the standard algorithm

11

Page 12: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

(Algorithm 1) and our Algorithm 3. When noise is small (variance less than 0.1), the filtration has not changed muchand the updating method faster is faster than recomputing. However, as the variance exceeds 0.1, recomputing becomesthe better option. Once standard deviation exceeds 1, the updating time also converges as the space starts to look likenormally distributed noise at different scales.

In Figure 1b, we visualize the run time with respect to the logarithm of number of non-zeros of U and R after reduction.We see that the number of non-zeros in the factorization using the update scheme can be much higher, producing amuch longer run time. This indicates that one of the potential drawbacks to using large updates to filtrations is fill-in inthe decomposition.

10 3 10 2 10 1 100 101 102 103

Logarithm(base 10) of standard deviation

0.25

0.50

0.75

1.00

1.25

1.50

1.75

2.00

Tim

e

RecomputeUpdate

(a)

106 2 × 106 3 × 106 4 × 106 6 × 106

Logarithm of nnz (base 10)

0.0

0.5

1.0

1.5

2.0

2.5

Tim

e

RecomputeUpdate

(b)

Figure 1: Left: The time spent on computing from scratch on points generated with different noise and updating thenoiseless sample. Right: time spent on recomputing and updating as a function of the sum of nnz(Uk) + nnz(Rk). Thesolid lines are a least squares fit.

4.2.3 Updating the Metric

As shown in the Figure 1a, if we add too much noise metric space the time used to update is much higher thanrecomputing. It illustrates that our algorithm might not work well on some cases where the filtration change dramatically.In Table 5, We compute the time of updating persistence on filtration with metric from Euclidean to Minkowski-1distance and compare it to recompute and repeat for 20 times. The updating performance is worse than the rebuildingoption.

Recompute UpdateSphere1 0.198762 0.312912Sphere2 7.434643 21.799024

Table 5: Average time to compute persistent homology on a noisy circle by recomputing and updating.

4.3 Optimization

Optimization of a function of persistent homology is another potential application for Algorithms 2 and 3. A generalframework for this is developed in [10], where functions of birth and death times in persistence diagrams for the form

E (p, q, i0; PDk) =|Ik|∑i=i0

|di − bi|p(di + bi

2

)qare used. In Table 6, we report on an experiment to maximize the sum of the lengths of 1-dimensional persistence barsstarting from a point cloud sampled uniformly from the unit square. Explicitly, we use gradient descent to maximize thefunction E (2, 0, 1; PD1) =

∑I1i=1(di − bi)2, where I1 is the number of 1-dimensional persistence pairs (bi, di). As

shown in Figure 2, after 100 iterations, points that are originally uniformly generated in the unit square are moved toform more holes.

12

Page 13: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

Our updating scheme shows an average 2x speedup compared to re-compute as shown in Table 6. Compared to otherfour algorithms, the updating function is almost equal to the fastest one – ‘compression’, but also have the advantageover all the others that we can obtain the U matrix, i.e., homology basis information, which can be used for visualizationand interpretation.

BATS(std) BATS(nb) BATS(clr) BATS(comp) BATS(upd)1.65× 10−1 9.74× 10−2 9.94× 10−2 8.88× 10−2 8.90× 10−2

Table 6: Average time over 100 iterations to maximize max∑I1i=1(di − bi)2 with 5 algorithms.

0.0 0.2 0.4 0.6 0.8 1.00.0

0.2

0.4

0.6

0.8

1.0

(a)

0.0 0.2 0.4 0.6 0.8 1.00.0

0.2

0.4

0.6

0.8

1.0

(b)

Figure 2: Left: original data set generated by uniform distribution in a square. Right: after 100 iterations of maximizingH1 length.

We have also attempted to use Algorithm 2 in the optimization of level set filtrations. While our experiments withoptimization of Rips filtrations have been encouraging, we have observed that fill-in in the RU decomposition is muchmore prohibitive in the case of level-set filtrations. One potential explanation is that by deleting columns beyond thecritical radius of the metric space in Rips filtrations there is never a large accumulation of non-zeros in columns of Ror U , but accumulation of non-zeros in levelset filtrations can grow unchecked. Strategies to deal with this issue areoutside the scope of this paper, but would be an interesting direction for future investigation.

5 Conclusion

We present two algorithms for updating persistence: one for a fixed-sized filtration and another for a general filtration.The algorithms’ asymptotic complexity is shown to be comparable to the standard reduction algorithm for computingpersistent homology in the worst case, and we provide tighter bounds based on the details of the updates. Our algorithmdemonstrates practical speedups on several experiments, especially where changes to the filtration are limited. Weimplemented our method using the data structures in the Basic Applied Topology Subprograms (BATS) library [16], inorder to obtain consistent comparisons with several variations of the reduction algorithm for persistent homology. Weshow that our update method’s performance is comparable with other speedup strategies like clearing and compression,but has the advantage of maintaining homology basis information.

While we have demonstrated the utility of our approach in certain situations, there are also some limitations to its use.Some of these are inherent, for instance our approach does not work well when filtrations change too drastically, orwhen the additional memory requirements of maintaining the matrix U are cost prohibitive. Other limitations may beimplementation-specific, for instance we see that Gudhi [37] and Ripser [5] outperform our update scheme on Ripscomputations. Some of this performance gap may be closed by adapting our algorithms to the cohomology algorithm[23] or incorporating parallelism [6].

Deciding which algorithm to use for computing persistent homology on many similar problems is context-dependent.For fixed size filtrations, as in level set persistence, using our update scheme appears to be a reasonable choice forsmaller perturbations, particularly when maintaining the basis matrix U is desirable. For geometric filtrations, werecommend using a high-performance package designed for these computations, particularly if the homology basis is

13

Page 14: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

not required. In practice, a practitioner may wish to test several options experimentally as run times can be problemdependent.

There are several directions for future investigation which may build on this work. One direction is to develop methodsto limit fill-in in the RU decomposition when performing updates, a problem related to that of finding sparse homologygenerators [41]. As we have discussed, this appears to be an important consideration in several potential applications ofour update schemes such as optimization using level set filtrations. Another direction would be to adapt our updatescheme to the cohomology algorithm. This may offer performance improvements for Rips filtrations, as has beenobserved for the standard reduction algorithm [5]. There may also be ways to adapt our methods to the context ofupdating discrete Morse vector fields [39], which may offer another way to accelerate iterated persistent homologycomputations.

Acknowledgements:

BN was supported by the Defense Advanced Research Projects Agency (DARPA) under Agreement No.HR00112190040. We are grateful for compute resources provided by the Research Computing Center (RCC) atthe University of Chicago.

References

[1] The Stanford 3D Scanning Repository. http://graphics.stanford.edu/data/3Dscanrep/. Accessed:2021-07-23.

[2] Volvis repository (archived). https://web.archive.org/web/20150307144939/http://volvis.org/.Accessed: 2021-07-23.

[3] ASAAD, A., AND JASSIM, S. Topological data analysis for image tampering detection. In Digital Forensics andWatermarking (Cham, 2017), C. Kraetzer, Y.-Q. Shi, J. Dittmann, and H. J. Kim, Eds., Springer InternationalPublishing, pp. 136–146.

[4] BAE, W., YOO, J., AND YE, J. C. Beyond deep residual learning for image restoration: Persistent homology-guided manifold simplification. 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops(CVPRW) (2017), 1141–1149.

[5] BAUER, U. Ripser: efficient computation of vietoris–rips persistence barcodes. Journal of Applied and Computa-tional Topology (2021).

[6] BAUER, U., KERBER, M., AND REININGHAUS, J. Distributed computation of persistent homology. 2014Proceedings of the Sixteenth Workshop on Algorithm Engineering and Experiments (ALENEX) (2013), 31–38.

[7] BAUER, U., KERBER, M., AND REININGHAUS, J. Clear and compress: Computing persistent homology inchunks. In Topological Methods in Data Analysis and Visualization III, P.-T. Bremer, I. Hotz, V. Pascucci, andR. Peikert, Eds. Springer International Publishing, 2014, pp. 103–117.

[8] BOISSONNAT, J.-D., AND MARIA, C. The Simplex Tree: An Efficient Data Structure for General SimplicialComplexes. Algorithmica 70, 3 (Nov. 2014), 406–427.

[9] BRÜEL GABRIELSSON, R., AND CARLSSON, G. Exposition and interpretation of the topology of neuralnetworks. In 2019 18th IEEE International Conference On Machine Learning And Applications (ICMLA) (2019),pp. 1069–1076.

[10] BRÜEL-GABRIELSSON, R., NELSON, B. J., DWARAKNATH, A., SKRABA, P., GUIBAS, L. J., AND CARLSSON,G. A topology layer for machine learning. In The 23rd International Conference on Artificial Intelligence andStatistics (AISTATS) (2020).

[11] CANG, Z., AND WEI, G. Integration of element specific persistent homology and machine learning for protein-ligand binding affinity prediction. International journal for numerical methods in biomedical engineering 34 2(2018).

[12] CANG, Z., AND WEI, G.-W. Integration of element specific persistent homology and machine learning forprotein-ligand binding affinity prediction. International Journal for Numerical Methods in Biomedical Engineering34, 2 (2018).

[13] CARLSSON, G. Topology and data. Bulletin of the American Mathematical Society 46, 2 (2009), 255–308.[14] CARLSSON, G., AND DE SILVA, V. Zigzag persistence. Foundations of Computational Mathematics 10, 4 (2010),

367–405.

14

Page 15: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

[15] CARLSSON, G., DWARAKNATH, A., AND NELSON, B. J. Persistent and Zigzag Homology: A Matrix Factoriza-tion Viewpoint. Preprint: https://arxiv.org/abs/1911.10693, 2019.

[16] CARLSSON, G., DWARAKNATH, A., AND NELSON, B. J. Persistent and Zigzag Homology: A Matrix Factoriza-tion Viewpoint. Preprint: https://arxiv.org/abs/1911.10693, 2019.

[17] CARRIÈRE, M., CHAZAL, F., IKE, Y., LACOMBE, T., ROYER, M., AND UMEDA, Y. PersLay: A neural networklayer for persistence diagrams and new graph topological signatures. Preprint: http://arxiv.org/abs/1904.09378, 2020.

[18] CHAN, J. M., CARLSSON, G., AND RABADAN, R. Topology of viral evolution. Proceedings of the NationalAcademy of Sciences 110, 46 (2013), 18566–18571.

[19] CHEN, C., AND KERBER, M. Persistent homology computation with a twist. In 27th European Workshop onComputational Geometry (2011), pp. 197–200.

[20] CHEN, C., NI, X., BAI, Q., AND WANG, Y. A topological regularizer for classifiers via persistent homology. InThe 22nd International Conference on Artificial Intelligence and Statistics (AISTATS) (2019).

[21] COHEN-STEINER, D., EDELSBRUNNER, H., AND HARER, J. Stability of persistence diagrams. In Proceedingsof the twenty-first annual symposium on Computational geometry - SCG ’05 (Pisa, Italy, 2005), ACM Press,p. 263.

[22] COHEN-STEINER, D., EDELSBRUNNER, H., AND MOROZOV, D. Vines and vineyards by updating persistencein linear time. In Proceedings of the Twenty-Second Annual Symposium on Computational Geometry (New York,NY, USA, 2006), SCG ’06, Association for Computing Machinery, p. 119–126.

[23] DE SILVA, V., MOROZOV, D., AND VEJDEMO-JOHANSSON, M. Dualities in persistent (co)homology. InverseProblems 27, 12 (2011), 124003.

[24] DEY, T., MANDAL, S., AND VARCHO, W. Improved image classification using topological persistence. In VMV(2017).

[25] DIACONIS, P. Group Representations in Probability and Statistics. Lecture Notes-Monograph Series 11 (1988),i–192.

[26] EDELSBRUNNER, H., AND HARER, J. Computational Topology - an Introduction. American MathematicalSociety, 2010.

[27] EDELSBRUNNER, H., LETSCHER, D., AND ZOMORODIAN, A. Topological persistence and simplification. InFoundations of Computer Science, 2000. Proceedings. 41st Annual Symposium on (2000), IEEE, pp. 454–463.

[28] GAO, K., NGUYEN, D., CHEN, J., WANG, R., AND WEI, G. Repositioning of 8565 existing drugs for covid-19.The Journal of Physical Chemistry Letters (06 2020).

[29] GARIN, A., AND TAUZIN, G. A topological "reading" lesson: Classification of mnist using tda, 2019.[30] GILL, P. E., MURRAY, W., AND SAUNDERS, M. A. SNOPT: An SQP algorithm for large-scale constrained

optimization. SIAM Review 47, 1 (2005), 99–131.[31] GILL, P. E., MURRAY, W., SAUNDERS, M. A., AND WRIGHT, M. H. Maintaining LU factors of a general

sparse matrix. Linear Algebra and its Applications 88-89 (1987), 239–270.[32] GIUSTI, C., GHRIST, R., AND BASSETT, D. S. Two’s company, three (or more) is a simplex: Algebraic-

topological tools for understanding higher-order structure in neural data. Journal of Computational Neuroscience41, 1 (2016), 1–14.

[33] HENSELMAN, G., AND GHRIST, R. Matroid Filtrations and Computational Persistent Homology. Preprint:https://arxiv.org/abs/1606.00199, 2016.

[34] KIM, K., KIM, J., KIM, J. S., CHAZAL, F., AND WASSERMAN, L. Efficient topological layer based on persistentlandscapes. Preprint: http://arxiv.org/abs/2002.02778, 2020.

[35] LECUN, Y., AND CORTES, C. MNIST handwritten digit database.[36] LEYGONIE, J., OUDOT, S., AND TILLMANN, U. A framework for differential calculus on persistence barcodes.

Foundations of Computational Mathematics (07 2021), 1–63.[37] MARIA, C., BOISSONNAT, J.-D., GLISSE, M., AND YVINEC, M. The gudhi library: Simplicial complexes and

persistent homology. In Mathematical Software – ICMS 2014 (2014), H. Hong and C. Yap, Eds., Lecture Notes inComputer Science, Springer, pp. 167–174.

[38] MILOSAVLJEVIC, N., MOROZOV, D., AND SKRABA, P. Zigzag persistent homology in matrix multiplicationtime. In Proceedings of the 27th annual ACM symposium on Computational geometry - SoCG ’11 (2011), ACMPress, p. 216.

15

Page 16: Bradley J. Nelson arXiv:2108.05022v1 [math.AT] 11 Aug 2021

A PREPRINT - AUGUST 12, 2021

[39] MISCHAIKOW, K., AND NANDA, V. Morse theory for filtrations and efficient computation of persistent homology.Discrete & Computational Geometry 50, 2 (2013), 330–353.

[40] MOROZOV, D. Dionysus2. Software available at https://www.mrzv.org/software/dionysus2/.[41] OBAYASHI, I. Volume-Optimal Cycle: Tightest Representative Cycle of a Generator in Persistent Homology.

SIAM Journal on Applied Algebra and Geometry 2, 4 (Jan. 2018), 508–534.[42] OTTER, N., PORTER, M. A., TILLMANN, U., GRINDROD, P., AND HARRINGTON, H. A. A roadmap for the

computation of persistent homology. EPJ Data Science 6, 1 (2017).[43] OUDOT, S. Y. Persistence Theory: From Quiver Representations to Data Analysis, vol. 209 of Mathematical

Surveys and Monographs. American Mathematical Society, 2015.[44] QAISER, T., TSANG, Y.-W., TANIYAMA, D., SAKAMOTO, N., NAKANE, K., EPSTEIN, D., AND RAJPOOT,

N. Fast and accurate tumor segmentation of histology images using persistent homology and deep convolutionalfeatures. Medical image analysis 55 (2019), 1–14.

[45] REID, J. K. A sparsity-exploiting variant of the bartels—golub decomposition for linear programming bases.Mathematical Programming 24, 1 (1982), 55–69.

[46] SAUNDERS, M. LUSOL: Sparse LU factorization and updating for Ax = b. Available online: https://stanford.edu/group/SOL/software/lusol/, 2008.

[47] ZOMORODIAN, A., AND CARLSSON, G. Computing persistent homology. Discrete & Computational Geometry33, 2 (2005), 249–274.

16