MORSE REDUCTION FOR ZIGZAG COMPLEXES

A paper by Mischaikow and Nanda [14] uses filtered acyclic matchings to form a Morse filtration for a filtered complex. The Morse filtration is smaller in size, yet has persistent homology equivalent to that of the original. We give an extension of acyclic matchings to the case of zigzag complexes and prove that the Morse zigzag complex similarly obtained has zigzag homology isomorphic to that of the original. We present an algorithm to compute a Morse zigzag complex for a given zigzag complex and some numerical examples. Since the Morse zigzag complex is smaller in size, calculations of its zigzag homology tend to complete faster than those for the original zigzag complex.


Introduction
In this paper, we bring together two recent developments in the study of the persistence of topological features of data.One, zigzag persistence [3], is motivated by the need to apply the powerful ideas of persistent homology to more general relationships between data, which we describe below.The other, motivated by the practical need to compute these topological information, is the development and usage of efficient algorithmic techniques [13] and reductions.We focus on reductions [14,15] that reduce the size of the input even before homology computations are performed.
In recent years, persistent homology [2,8] is becoming a popular tool to understand data through the lens of algebraic topology.Several applications in different fields are being done; for example in image processing [4], in sensor networks [7], neurobiology [5], and cosmology [17], among others.
A typical workflow is the following.On the input data, which is usually a point cloud (a set of points in some R n ), we construct a space.For the purposes of computation, we want a finite and discrete representation of this space, preferably something combinatorial.One choice is the use of complexes, which are sets of cells together with some incidence data that, intuitively, connects cells to their boundaries.A particular example of a complex is a simplicial complex [16].There are many available methods to construct simplicial complexes from point clouds, such as Vietoris-Rips complexes and Cěch complexes [16], alpha shapes [9], and witness complexes [1,6], among others.These complexes can be seen as attempts to answer the question, "What is the shape of a point cloud?" On the complex constructed on the data, one can compute the generators of its homology groups, a classical computation from algebraic topology [12,16].These provide some geometric information about the complex, and can be interpreted as loops, voids, and higher-dimensional analogues.Theory poses no objection to such interpretations, but for practical applications, the resulting information is not robust under noise.Moreover, since all of the simplicial complexes cited above are dependent on some parameter, another problem is choosing an "optimal" parameter value.
Persistent homology addresses these limitations by considering a nested sequence of complexes called a filtered complex and computing what topological features, the aforementioned loops and voids, persist throughout the sequence.A commonly used method to obtain such a nesting is to vary the parameter used in the construction of the complex.In many of the construction methods, this results in a nested sequence of complexes.Doing so, we also avoid the need to choose an optimal parameter value.The result of persistent homology computations [18] can be drawn as a barcode, a multiset of intervals that represents the lifespans of the detected features.The features with long persistence (long intervals) can be interpreted as significant, since, one can argue, they survive under a wide range of parameter values in the construction of the filtered complex.
In some applications, however, filtered complexes may not capture the sort of persistence we are trying to study.Carlsson and de Silva's paper [3] gives some examples of cases where a filtered complex may not be an appropriate model.They extend persistent homology to zigzag complexes where each p i , allowed to vary independently, can point in either direction: X i ֒→ X i+1 or X i ←֓ X i+1 .By allowing the arrows to go in either direction, we can study more general relationships in data than just those expressed by nested sequences of complexes.By reinterpreting Gabriel's theorem [11] from quiver theory in the context of applied topology, Carlsson and de Silva show that a zigzag module over a field F has decomposition that can be represented by a barcode.As a specific case, taking the zigzag homology modules with coefficients in F of a zigzag complex produces zigzag modules over F.
Because they are non-nested, zigzag complexes are in general larger than filtered complexes of similar length with each individual complex of similar size.This suggests that reducing the size of the input is even more critical in this setting.
We follow Mischaikow and Nanda's [14] strategy of forming an acyclic matching, a pairing of cells such that all the pairs can be removed from the complex to yield a new complex, with appropriately modified incidence function, called a Morse complex.It is known that the Morse complex has homology groups isomorphic to those of the original complex.In paper [14], they extend these ideas to filtered complexes.
The main contribution of this paper is to extend their work to zigzag complexes, of which a filtered complex is a specific case.We define zigzag acyclic matchings for zigzag complexes, from which we obtain a Morse zigzag complex with zigzag homology modules isomorphic to those of the original.In this manner, one can use the computation of the Morse zigzag complex as a preprocessing step, in order to reduce the size of the input that goes into the homology computations.

Background
2.1.Complexes and homology.Fix a principal ideal domain R. The type of input we consider is called a complex over R, a pair (X, κ) of a graded set and an incidence function.The graded set X = ⊔ q∈Z ≥0 X q is a disjoint union ⊔ over the nonnegative integers Z ≥0 .We call the elements of X as cells, and to each cell ξ ∈ X we associate its dimension by In this work, we consider only finite complexes (2) For ξ, ξ ′′ ∈ X, Let us define a face partial order on a complex by setting ξ ′ < ξ if and only if κ(ξ, ξ ′ ) = 0 and defining as the transitive closure of <.If ξ ′ ξ, we say that ξ ′ is a face of ξ.A subcomplex of a complex (X, κ) is a subset X ′ ⊂ X with an incidence function defined by restriction such that all faces of its cells are also in the subcomplex.That is, This implies that if η ∈ X ′ , then κ(η, ξ) = 0 for any ξ ∈ X \ X ′ .It is easy to show that a subcomplex (X ′ , κ| X ′ ×X ′ ) of a complex (X, κ) is also a complex.
This complex can be geometrically realized as a triangle, as in Figure 1.In this example, the incidence function κ contains information about how the different cells of X are pasted together.Let us compute the effect of the boundary operator on σ.We have equal to the formal sum of the edges on the geometric boundary of the triangle.
A complex that is geometrically a triangle.
From the chain complex (C * (X), ∂ * ) and for q ≥ 0, we define the qth homology module of X with coefficients in R by taking the quotient One can check that ∂ q ∂ q+1 = 0, which guarantees that im ∂ q+1 ⊂ ker ∂ q .
A chain map φ between chain complexes (C * (X), ∂ * ) and (C * (Y ), ∂ * ) is a sequence of homomorphisms φ = {φ q : C q (X) → C q (Y )} such that {φ q } commutes with the boundary operators, as in the following: The following fact relating subcomplexes and their corresponding chain complexes will be useful later when we discuss zigzag chain complexes.Let (X, κ) be a complex and (X ′ , κ ′ ) a subcomplex.If (C * (X), ∂ * ) and (C * (X ′ ), ∂ ′ * ) are the chain complexes of (X, κ) and (X ′ , κ ′ ), respectively, then there is a chain map ι : (C * (X ′ ), ∂ ′ * ) → (C * (X), ∂ * ) induced by the inclusion X ′ ֒→ X.To be specific, we define ι = {ι q } by setting the homomorphism ι q : C q (X ′ ) = R(X ′ q ) −→ C q (X) = R(X q ) as the inclusion of R(X ′ q ) in R(X q ) for each q ≥ 0. In general, there is a category of chain complexes with objects where C q are modules over R and the boundary maps for q ≥ 0 are homomorphisms that satisfy the property ∂ q ∂ q+1 = 0.The morphisms in this category, called chain maps, are homomorphisms that commute with boundary operators.We define the qth homology module of a chain complex (C * , ∂ * ) by A chain map φ : (C * , ∂ * ) → (D * , ∂ * ) induces a homomorphism in the homology level by In the language of category theory, this defines a functor H q from the category of chain complexes with coefficients in R to the category of modules over R that takes (C * , ∂ * ) to H q (C * ) and A chain homotopy between two chain maps φ, ψ : (C * , ∂ * ) → (D * , ∂ * ) is a sequence of homomorphisms θ = {θ q : C q → D q+1 } satisfying θ q−1 ∂ q + ∂q+1 θ q = φ q − ψ q for every q ≥ 0. If there is a chain homotopy between φ and ψ, we say that φ and ψ are chain homotopic.
Two chain maps φ : (C * , ∂ * ) → (D * , ∂ * ) and ψ : (D * , ∂ * ) → (C * , ∂ * ) are said to be chain equivalences if φψ is chain homotopic to the identity on D * , and ψφ to the identity on C * .If these two conditions are satisfied, then it is known that for all q ≥ 0. We refer the reader, for example, to the book by Munkres [16] for proofs of these statements.
In the particular case of the chain complex of a complex, we denote the qth homology module of (C * (X), ∂ * ) by H q (C * (X)) = H q (X).This notation agrees with our initial definition of the homology modules of a complex.2.2.Acyclic matchings and the Morse complex.We recall some definitions from the paper [14].Definition 2.1.A partial matching of a complex (X, κ) consists of a partition of X into three sets A, K, and Q along with a bijection w : Q → K such that for each Q ∈ Q, the incidence κ(w(Q), Q) is a unit in R. We denote this partial matching by (A, w : Q → K).
Given a partial matching of (X, κ), we set a relation ≪ on Q by extending transitively the relation ✁ defined by A gradient path p is a nonempty sequence of cells with The index of p is defined as The following theorem is from [14], but follows originally from Forman's work [10] on discrete Morse theory.
Theorem 2.2.Let (X, κ) be a complex over R and (A, w : Q → K) be a fixed acyclic matching of X.With grading A q = A ∩ X q , (A, κ) is also a complex over R. Furthermore, H q (X) ∼ = H q (A) for all q ≥ 0.
We call (A, κ) the Morse complex of (X, κ) generated by the acyclic matching (A, w : Q → K).Cells of A are called critical cells.
Let us see this theorem in action.Suppose we have a complex (X, κ) represented by Figure 2, with an acyclic matching such that After removing all the matched cells, as in Figure 3, we get the incidence κ(A, A ′ ) of each pair A, A ′ ∈ A by adding to κ(A, A ′ ) the multiplicities of all connections from A to A ′ .In particular, there is only one connection p = (e 0 , t 0 , e 1 , t 1 , e 2 , t 2 ) from a to b.The change in incidence κ(a, b) can be visualized by dragging the removed right edge of a to the edge b along the connection p.In fact, that right edge of a is also dragged along other connections as indicated by the arrows.Note that in general though, there may be more than one connection from A to A ′ .
We have representing one hole in both X and A, as seen in Figure 4.The main technique of the proof, which we do not repeat here, is the sequential removal of pairs of cells.We define for some According to some total ordering in Q, we remove pairs sequentially and obtain a sequence of complexes X, X Q1 , X Q1Q2 , and so on until This total ordering is different from the partial order ≪.Now, we have an incidence function κ for A as written in equation ( 2) and κ Q1Q2...Qn obtained by inductively applying equation (3).The paper [14] shows that κ = κ Q .
It can be shown that there are chain equivalences It is known that a composition of chain equivalences is also a chain equivalence.
One main result of the paper [14] is to extend Theorem 2.2 to the case of filtered complexes with filtered acyclic matchings.In this work, we give a generalization of this theorem to zigzag complexes with zigzag acyclic matchings.
2.3.Zigzag structures.A type of length N is an (N − 1) sequence of symbols f and b, for forwards and backwards.A zigzag complex X of type τ is a sequence of complexes together with inclusions, written as where, for i = 1, . . ., N − 1, s i is the subcomplex inclusion X i ֒→ X i+1 if the ith symbol of τ is f or the subcomplex inclusion X i ←֓ X i+1 otherwise.A filtered complex is a zigzag complex with type τ consisting entirely of f 's.An example of a zigzag complex of type τ = f bf is Here, (X 1 , κ 1 ) and (X 3 , κ 3 ) are subcomplexes of (X 2 , κ 2 ) and (X 3 , κ 3 ) is a subcomplex of (X 4 , κ 4 ).Rather than counting the number of symbols in τ , the length of this τ is 4, counting the number of complexes in this zigzag complex.
A zigzag chain complex of type τ is a sequence of chain complexes such that each p i is a chain map with direction indicated by the ith symbol of τ , as above.
In general, these form the objects of the category ZC τ of zigzag chain complexes with type τ .A morphism φ : C → D in ZC τ , called a zigzag chain map, is a sequence of chain maps φ = (φ i : C i * → D i * ) that respects the zigzag structure: for all i and depending on whether τ i is f or b, one of following commutative diagrams commutes: pi Let φ, ψ : C → D be zigzag chain maps.A zigzag chain homotopy between φ and ψ is a sequence of chain homotopies θ i between φ i and ψ i for all i.If there is such a zigzag chain homotopy, we say that φ and ψ are zigzag chain homotopic.
If φ : C → D and ψ : D → C are zigzag chain maps such that φψ and ψφ are zigzag chain homotopic to the identities of D and C, respectively, we say φ and ψ are zigzag chain equivalences and that C and D are zigzag chain equivalent.
A zigzag module M of type τ is a sequence of R modules, M i , written as where each module homomorphism p i has direction indicated by the ith symbol of τ .These form the objects of the category of type τ zigzag modules over R, denoted by ZM τ .A morphism f : that respects the zigzag structure.
Two zigzag modules M 1 and M 2 are said to be equivalent if there are morphisms f : M 1 → M 2 and g : M 2 → M 1 such that f g is the identity on M 2 and gf is the identity on M 1 .In this case, we write For C ∈ ZC τ , we can construct a zigzag module by applying the homology functor H q to every C i * and p i .We call this the qth zigzag homology module of the zigzag chain complex C.
Moreover, a zigzag chain map φ : C → D induces a homomorphism defined by (φ # ) i = φ i # for every i.These fit into the commutative diagrams for every i, where the direction of the arrows p i # and pi # depends on the ith symbol of τ .
Thus the homology functor extends to a functor ZC τ → ZM τ from zigzag chain complexes to zigzag modules.Functoriality is a consequence of the functoriality of the homology functor on each slice.
The next lemma follows almost immediately from the definitions.
Lemma 2.3.Given C and D zigzag chain equivalent, we have for every q ≥ 0.
Proof.The existence of zigzag chain equivalences φ = {φ i } and ψ = {ψ i } between C and D implies that for every slice i, C i * and D i * are chain equivalent, with chain equivalences φ i and ψ i .Thus we have isomorphisms of modules in each slice: # } and ψ # = {ψ i # } respect the zigzag structure, because commutativity in the zigzag chain complex level implies commutativity in the zigzag homology level.Thus H q (C) ∼ = H q (D).
We only consider objects of ZC τ generated by zigzag complexes.Let X be a zigzag complex with and let C(X) be defined by where for every i, (C * (X) i , ∂ i * ) is the chain complex of (X i , κ i ) and each ι i is induced by the corresponding subcomplex inclusion in the zigzag complex level.As we have noted above, each ι i is a chain map and thus C(X) is a zigzag chain complex.In this setting, we denote the zigzag homology module H q (C(X)) simply by H q (X).

Main results
3.1.Zigzag acyclic matching.We define a zigzag acyclic matching for a zigzag complex X as an acyclic matching (A i , w i : Q i → K i ) for every slice X i such that these matchings are consistent across inclusions.By consistency, we mean for the case X i ֒→ X i+1 or the case X i ←֓ X i+1 , respectively.We have the following equivalent formulation.Lemma 3.1.Let X be a zigzag complex and let (A i , w i : i=1 be an acyclic matching for every X i .These acyclic matchings form a zigzag acyclic matching for X if and only if for the case X i ֒→ X i+1 or the case X i ←֓ X i+1 , respectively.
Proof.We only prove this for the case X i ←֓ X i+1 .We show that Here, The proof of the converse is easy.
3.2.Morse zigzag complex.Given a zigzag acyclic matching on a zigzag complex, we form the Morse zigzag complex which is a zigzag complex in its own right by the following lemma.
Lemma 3.2.Let X be a zigzag complex with a zigzag acyclic matching (A i , w i : Then, A as defined above is a zigzag complex. Proof.By Theorem 2.2, each (A i , κi ) is a complex.We prove that when X i ←֓ X i+1 , A i+1 is a subcomplex of A i .The proof for the opposite direction is similar.
By definition, we have Because w i restricted to Q i+1 is the same as w i+1 , we have The definition of a gradient path implies that Q 2 < w i (Q 1 ).Hence Q 2 is also an element of X i+1 .By repeating this argument for all the cells of the connection, we conclude that p ⊂ X i+1 and that A ′ ∈ A i+1 .For every slice i, the incidence function of the Morse complex where the sum is taken over all connections p in X i from A to A ′ .One of the requirements for A i+1 to be a subcomplex of A i is the compatibility of the incidence functions, namely, κi Taking the difference, we have κi Since A ∈ A i+1 and by the arguments above, all connections starting from A stay in X i+1 .Hence, all the paths over which we take the first summation are the same as the paths in the second, leading to a difference of 0. This proves the compatibility of incidence functions.
The second requirement is It suffices to show that for every η ∈ A i+1 , ξ ∈ A i with ξ < η implies ξ ∈ A i+1 .Here, < is not necessarily the one inherited by A i from X i , but is generated by the incidence function of A i : Let η ∈ A i+1 and ξ ∈ A i with κi (η, ξ) = 0.By the definition of κi , either κ i (η, ξ) = 0 or there is a connection η p ❀ ξ.The first implies ξ < η as elements of X i .Since η ∈ A i+1 ⊂ X i+1 , we infer that ξ ∈ X i+1 by the subcomplex property of X i+1 .On the other hand, if there is a connection p in X i from η ∈ A i+1 , then p is contained in X i+1 by the above arguments, implying ξ ∈ X i+1 .
Since A is a zigzag complex, its qth zigzag homology module H q (A) = H q (C(A)) is defined.By Theorem 2.2, for every slice i, H q (X i ) ∼ = H q (A i ).
However, this is not enough to show the equivalence of zigzag homology modules, H q (X) ∼ = H q (A).We find chain equivalences ψ i and φ i for every slice such that ψ = {ψ i } and φ = {φ i } respect the zigzag structure.
We explicitly write out the chain equivalences ψ i and φ i as used in [14].Let (Q j , w i (Q j )) n j=1 be any fixed ordering of pairs Q j ∈ Q i , w i (Q j ) ∈ K i of removed cells, where the pair (Q 1 , w i (Q 1 )) is removed first, and so on.We have the chain equivalences defined by linear extension of for η ∈ X i Q1...Qj−1 .We define In the reverse direction, we have the chain equivalences for η ∈ X i Q1...Qj .We define 3.3.Consistent ordering for each Q i .To ensure that the resulting sequences of chain equivalences φ = {φ i } and ψ = {ψ i } respect the zigzag structure, we fix an order in each Q i such that these orders are compatible across and a similar statement when One possibility is taking the union ∪ i Q i , fixing an order in this set, and letting each Q i inherit from that order.However, this is not a good choice, as we see in the following.Let X 1 ←֓ X 2 ֒→ X 3 be a zigzag complex represented by Figure 5, with zigzag acyclic matching By our definition of zigzag acyclic matchings, there is no problem in having v matched to different elements in the slices X 1 and X 3 .We only require neighboring slices to have compatible matchings.Since they are matched to different cells, we should consider v ∈ X 1 and v ∈ X 3 to be different.With this zigzag acyclic matching, it is clear that the corresponding chain equivalences will also be different; where the disjoint union is written as and the equivalence ∼ is the transitive closure of ≈ defined by (Q, i) We fix some total order on Q.This induces a total order in Q i for every i by the following: for any pair Note that transitivity and totality follows from transitivity and totality of in Q.To show antisymmetry, suppose that Lemma 3.3.Let X be a zigzag complex with a zigzag acyclic matching and let ∼ be the equivalence relation defined on as above.Moreover, suppose that Q has a total order .Then, we have the following properties. ( (3) The orders in each Q i induced by are compatible across the inclusions.
Proof.The first property follows from the definition.If (Q, i) ∼ (Q ′ , j), then Q = Q ′ and since ∼ is the transitive extension of ≈, it suffices to prove the second property for (Q, i) ≈ (Q, j).Without loss of generality, j = i + 1 and Here is a recap of what we have so far.Our goal is to create zigzag chain equivalences ψ = {ψ i } and φ = {φ i } in order to show the equivalence of zigzag homology modules.Since for every i, both ψ i and φ i are defined iteratively through the removal of pairs of cells Q j ∈ Q i , w i (Q j ) ∈ K i , we need to order the cells of each Q i .Moreover, these orders have to be compatible across each The set Q allows us to talk of the set of all cells of {Q i } N i=1 and order all cells at the same time.
We are now ready to prove our main theorem.
Theorem 3.4.Given a zigzag complex X and a zigzag acyclic matching on X, let A be the resulting Morse zigzag complex.Then, C(X) and C(A) are zigzag chain equivalent and thus H q (X) ∼ = H q (A) for q ≥ 0.
Proof.By the above discussion, we fix orders in each Q i that are compatible across inclusions.For every slice i, we have chain equivalences ψ i and φ i defined by compositions of ψ i Q and φ i Q for Q ∈ Q i , as in equations ( 5) and (7).To show that ψ = {ψ i } and φ = {φ i } define zigzag chain equivalences, we only need to show commutativity with the inclusions in the zigzag chain complex level.We do this for the case where X i ←֓ X i+1 .An analogous proof can be given for the case where where the pair {Q 1 , w i (Q 1 )} is the first to be removed from X i , {Q 2 , w i (Q 2 )} the second, and so on.Since we have a zigzag acyclic matching, Q i+1 is the set for some 1 ≤ l 1 < l 2 < . . .< l m ≤ n.By consistency of the orders, we have Recall that Here, we suppress distinguishing w i and w i+1 since they are equal on Q i+1 .It should be clear from context when we mean w i .
Since Q i+1 is a subset of Q i , it is possible that not all of the removed cells {Q 1 , w(Q 1 ), . . ., Q j , w(Q j )} are in X i+1 .By interpreting the subscript as set complement, we abuse notation and write , where l h is the largest of the l 1 , l 2 , . . ., l m not greater than j.Since the orders on Q i for i from 1 to N are all fixed, this notation does not cause any ambiguity.
With this notation, we claim that Expanding X i+1 Q1...Qj−1 \ {Q j , w(Q j )}, we have where l h is the largest of the l 1 , l 2 , . . ., l m not greater than j − 1.
since the largest of the l 1 , . . ., l m not greater than j is , implying that ( 9) is equal to Moreover, j / ∈ {l 1 , l 2 , . . ., l m } and the largest of the l 1 , l 2 , . . ., l m not greater than j is still l h .Thus, in either case, the set ( 9) is equal to X i+1 Q1...Qj .The commutativity of , where ι is the chain map induced by the inclusion A i ←֓ A i+1 .Now, for every Q j ∈ Q i , let us compute .
We split the computation into the cases where Q j ∈ Q i \Q i+1 and where is the inclusion where l h is the largest of the l 1 , l 2 , . . ., l m not greater than j − 1.The various equalities in the bottom are due to the fact that Q j / ∈ Q i+1 .On the other hand, suppose that Q j ∈ Q i+1 .We claim that we have a commutative diagram Recall that ψ i Qj : C * (X i Q1...Qj−1 ) → C * (X i Q1...Qj ) is defined by linear extension of Since we have a zigzag acyclic matching, and when ξ ∈ X i Q1...Qj \ X i+1 Q1...Qj , we have by the subcomplex property.We can take the summation over Thus for η ∈ X i+1 Q1...Qj−1 , This is the same as in the definition for ψ i+1 Qj : Finally, we take Q j ∈ Q i for j = 1, . . ., n and inductively attach, from left to right, a diagram of the form (10) The top row of the resulting diagram (12) then contains the composition (6) for ψ i .In the bottom row, whenever we encounter a Q j ∈ Q i+1 , a ψ i+1 Qj term appears.Thus, the bottom row contains the composition in the correct order by consistency of orders in Q i and Q i+1 .By commutativity of diagram (12), we have commutativity of proceeds in exactly the same manner.
For every i, we rename each cell x ∈ X i as [(x, i)] and suitably modify the incidence function by defining It is clear that after this renaming, we have the same zigzag complex.Hereafter, we do not specify the equivalence class [(x, i)] but just write x for cells in X.Without loss of generality, the renaming allows us to impose the extra condition that if x, y ∈ X i ∩ X j , then κ i (x, y) = κ j (x, y).By this property, for every x, y ∈ X, we can unambiguously define κ(x, y) by κ(x, y) = κ i (x, y), if x, y ∈ X i for some i, 0, otherwise.
By the considerations above, given an arbitrary zigzag complex X, the collection of all of its cells is C = X and for each x ∈ C, κ(x, •) is unambiguously defined.4.2.Algorithm.We describe some of the variables used in the algorithm.Let D = max{dim x|x ∈ C} be the largest dimension of the input cells.At initialization, P = C is the set of all cells of the zigzag complex, but as we run the algorithm, cells will be removed from P .We define for b in some indexing set B of birth types, so that P = ∪ b∈B P b .
Following the paper [15], we define an elementary coreduction pair as a pair of cells (ξ, η) such that κ(ξ, η) is a unit in R and η is the unique cell in the boundary of ξ.What we mean here by boundary is A .This sets into motion the rest of the algorithm.As we remove cells, new elementary coreduction pairs are potentially created.We keep track of candidates by queuing the removed cells' coboundary cells in Que.The coboundary in the queue.By the time the algorithm terminates, each cell will have either been made critical or removed by RemovePair.Thus for every i, A i , Q i , K i partitions X i .
When a pair (ξ, η) is sent to RemovePair, η is the last remaining cell in the boundary of ξ.Since Q ✁ η is equivalent to Q < w(η) = ξ, this means that any other Q ✁ η apart from η itself has already been removed.In other words, the algorithm removes Q's in order of strictly increasing ✁, and ≪ is a partial order.Thus we obtain a zigzag acyclic matching (A i , w i : i=1 .We need to show that g(A) carries the correct information for the incidence function in the Morse zigzag complex.That is, then all the cells in the chain g(ζ) are also in X i .Then, from the proof of Proposition 5.2 in [14], we have Eventually, when a cell A is removed by MakeCritical, we get into which we can recursively apply the previous formula to obtain κi (A, A ′ ) in the right hand side.For this recursive argument to be valid, by the time we decide to make A critical, we need all Q ∈ Q i with dim Q = dim A − 1 to have already been processed by RemovePair.That is, we cannot decide to make some A critical and then later create more connections originating from A by removing some new pair Q ∈ Q i , K ∈ K i .The outermost loop guarantees that all those lower-dimensional cells Q have already been processed before we make A critical.
4.3.Numerical example.Suppose that R = F is a field.In such a case, what we call as the qth zigzag homology module of a zigzag complex with type τ is a τ -module, in the terminology of [3].They show that a τ -module can be written as the direct sum of intervals and define its zigzag persistence, analogous to the persistence of filtered complexes.We implement both the algorithm for computing zigzag persistence as presented in the paper [3] and the Morse reduction algorithm above, with R = Z 2 .
To test how Morse reduction can decrease computation times, we randomly generate zigzag complexes by the procedure CreateZigzagComplex.Given a number N of complexes, we randomly choose a type τ of length N .We then fix a set of candidate vertices V ; we write cells x ∈ C as subsets of V .Note that since we are choosing the cells x randomly, the set of vertices of the output zigzag complex may be smaller than V .The parameter D controls the maximum dimension of the cells x.We also set a parameter M that controls the number of cells.Once the number of cells created exceeds M , we stop the algorithm.
function CreateZigzagComplex C = ∅ while |C| < M do Randomly choose: q such that 0 ≤ q ≤ D Randomly choose: x = {v 0 , . . ., v q } ⊂ V , and b compatible with τ CreateCell(x, b) end while return C end function In the subroutine CreateCell, we have the operation (b(x) i ∨b i ) that computes the logical-or of b(x) i and b i taken as Boolean values.By this operation, we are increasing the number of indices i with b(x) i = 1; in other words, indices i with x ∈ X i .Moreover, every time we go into the subroutine CreateCell, we recursively do the same for faces of x, updating birth types for each of those faces as well.For each i = 1, . . ., N we set X i = {x ∈ C|b(x) i = 1} and grade each X i by X i q = {x|x ∈ X i , |x| = q + 1}.
In other words, we are setting dim x = q if and only if |x| = q + 1.For every pair of cells x, y with b(x) i = 1 = b(y) i , we define κ i : X i × X i → Z 2 by κ i (x, y) = 1, if y ⊂ x and dim x = dim y + 1, 0, otherwise.
It is easy to show that each (X i , κ i ) is a complex.The first property for κ i to be an incidence function follows from definition.The second follows from the fact that if we have nonzero terms in the sum y∈X i κ i (x, y)κ i (y, z) for fixed x, z ∈ X i , then x y z with dim x = dim y + 1, dim y = dim z + 1.Consequently, x has two more vertices than z, say x = z ∪ {v 0 , v 1 }, and the sum above reduces to κ i (x, y 0 )κ i (y 0 , z) + κ i (x, y 1 )κ i (y 1 , z) = 1 + 1 = 0, where y 0 = z ∪ {v 0 } and y 1 = z ∪ {v 1 }.By construction, y 0 , y 1 ∈ X i .Note that we are working over the field R = Z 2 .
Since the component-wise logical-or of two birth types compatible with τ is still compatible with τ , each x in the output C has birth type b(x) compatible with τ .By this fact, for every i = 1, . . ., N − 1 if τ i = f , we have X i ⊂ X i+1 , and if τ i = b, then X i ⊃ X i+1 .We show that if τ i = f , then (X i , κ i ) is a subcomplex of (X i+1 , κ i+1 ).The proof for the case where τ i = b is similar.That κ i+1 | X i ×X i = κ i follows from the definition of κ i .Now, we show that for all η ∈ X i with dim η > 0, {ξ ∈ X i+1 |ξ η} ⊂ X i .
As before, it suffices to consider ξ < η.In this construction, this implies ξ ⊂ η and dim ξ = dim η − 1.Since η ∈ X i , at some point in the algorithm, the subroutine CreateCell(η, b) was called with b i = 1.Before returning from that call, the subroutine runs CreateCell(ξ, b ′ ) with b ′ i either equal to b i or equal to bi ∨ b i for some other birth type b.In either case, b ′ i = 1 and thus ξ ∈ X i .Thus, from the algorithm CreateZigzagComplex, we obtain the zigzag complex X : (X 1 , κ 1 ) (X 2 , κ 2 ) . . .(X N , κ N ).
For our experiments, we set N = 8 complexes in each zigzag complex with maximum dimension D = 3, V = {1, . . ., 45}, and M = 2000 cells, and create 10 random zigzag complexes by the above procedure.For each zigzag complex so generated, two computations are performed: (1) Do persistence computations (zigzag persistence of its qth zigzag homology module) using algorithm from [3] For simplicity we compute only the zigzag persistence of the 1st zigzag homology module of each zigzag complex.Our goal is to showcase the effect of Morse reductions, and the only difference between computations (1) and ( 2) is the use of these reductions.We implement the algorithms in the C++ language and compile using the GNU C++ compiler with optimization level O3.Computations were performed on an Intel Core i7 2.7Ghz machine.
In Table 1, we record the time taken for computation (1) in column ZZ, and for computation (2) in MR+ZZ.The zigzag homology module of each zigzag complex is isomorphic to the zigzag homology of its Morse zigzag complex by our main theorem.Thus, computations (1) and ( 2) yield the same zigzag persistence.Nevertheless, we observe that performing the Morse reductions first before computing zigzag persistence takes less time in total.

Figure 2 .Figure 3 .
Figure 2. A complex with a matching

Figure 4 .
Figure 4.After modifying the incidence function

Figure 5 .
Figure 5. Cell v can be matched to different cells the boundary relative to the cells remaining in P .As we perform the algorithm, elementary coreduction pairs (ξ, η) such that ξ and η have equal birth type b are identified and removed from P b (and thus P ) by the subroutine RemovePair.Initialize P A = ∅, into which we place critical cells.Similar to P , we partition P A into P b A for b ∈ B. The subroutine MakeCritical removes a cell A ′ from P b and places it into P b

function
CreateCell(x, b) if x ∈ C then for i = 1, . . ., N do b(x) i ← (b(x) i ∨ b i ) end for else b(x) ← b C ← C ∪ {x} end if if dim x > 0 then for ∅ = y x, dim y = dim x − 1 do CreateCell(y, b(x)) end for end if end function

Table 1 .
.(2) Do MorseReduce, then do persistence computations (same implementation as above) on the obtained Morse zigzag complex.Comparison of run times