Computing Generalized Rank Invariant for 2-Parameter Persistence Modules via Zigzag Persistence and its Applications

,


Introduction
In Topological Data Analysis (TDA) one of the central tasks is that of decomposing persistence modules into direct sums of indecomposables.In the case of a persistence module M over the integers Z, the indecomposables are interval modules, which implies that M is isomorphic to a direct sum of interval modules I([b α , d α ]), for integers b α ≤ d α and α in some index set A. This follows from a classification theorem for quiver representations established by Pierre Gabriel in the 1970s.The multiset of intervals {[b α , d α ], α ∈ A} that appear in this decomposition constitutes the persistence diagram, or equivalently, the barcode of M -a central object in TDA [18,20].
There are many situations in which data naturally induce persistence modules over posets which are different from Z [4,12,13,14,17,21,26,28,29,33].Unfortunately, the situation already becomes 'wild' when the domain poset is Z 2 .In that situation, one must contend with the fact that a direct analogue of the notion of persistence diagrams may not exist [14], namely it may not be possible to obtain a lossless up-to-isomorphism representation of the module as a direct sum of interval modules.
Much energy has been put into finding ways in which one can extract incomplete but still stable invariants from persistence modules M : Z d → vec (which we will refer to as a Z d -module).Biasotti et al. [6] proposed considering the restriction of a Z d -module to lines with positive slope.This was further developed by Lesnick and Wright in the RIVET project [30] which facilitates the interactive visualization of Z 2 -modules.Cai et al. [11] considered a certain elder-rule on the Z 2 -modules which arise in multiparameter clustering.Other efforts have identified algebraic conditions which can guarantee that M can be decomposed into interval modules of varying degrees of complexity (e.g.rectangle modules etc) [7,16].
Figure 1: Generalized rank via zigzag persistence.Let M be a Z 2 -module.(A) Standard rank: Let p ≤ q in Z 2 .The rank of the structure map from p to q coincides with the multiplicity of full bars (red) over the diagonal path, which is three.(B) Generalized rank: Let I be an interval of Z 2 .Let us consider the zigzag poset ∂I : p 1 ≤ (p 0 ∨p 1 ) ≥ p 0 ≤ q 0 ≥ (q 0 ∧q 1 ) ≤ q 1 .The generalized rank of M over I is equal to the multiplicity of full bars (red) in the zigzag module M ∂I , which is two (Theorem 3.12) (note: by definition, the zigzag poset ∂I does not fully inherit the partial order on Z 2 .For example, the partial order on ∂I does not contain the pair (p 1 , q 1 ) whereas p 1 ≤ q 1 in Z 2 ).
A distinct thread has been proposed by Patel in [36] through the reinterpretation of the persistence diagram of a Z-module as the Möbius inversion of its rank function.Patel's work was then extended by Kim and Mémoli [25] to the setting of modules defined over any suitable locally finite poset.They generalized the rank invariant via the limit-to-colimit map over subposets and then conveniently expressed its Möbius inversion.In fact the limit-to-colimit map was suggested by Amit Patel to the authors of [25] who in [24] used it to define a notion of rank invariant for zigzag modules.Chambers and Letscher [15] also considered a notion of persistent homology over directed acyclic graphs using the limit-to-colimit map.Asashiba et al. [2] study the case of modules defined on an m × n grid and propose a high-level algorithm for computing both their generalized rank function and their Möbius inversions with the goal of providing an approximation of a given module by interval decomposables.Asashiba et al. [1] tackle the interval decomposability of a given Z d -module via quiver representation theory.
One fundamental algorithmic problem is that of determining whether a given Z 2 -module is interval decom-

Preliminaries
In §2.1, we review the notion of interval decomposability of persistence modules.In §2.2, we review the notions of generalized rank invariant and generalized persistence diagram.In §2.3, we discuss how to compute the limit and the colimit of a given functor P → vec.

Persistence Modules and their decompositions
We fix a certain field F and every vector space in this paper is over F. Let vec denote the category of finite dimensional vector spaces and linear maps over F.
Let P be a poset.We regard P as the category that has points of P as objects.Also, for any p, q ∈ P , there exists a unique morphism p → q if and only if p ≤ q.For a positive integer d , let Z d be given the partial order defined by (a 1 , a 2 , . . ., A (P -indexed) persistence module is any functor M : P → vec (which we will simply refer to as a P -module).In other words, to each p ∈ P , a vector space M p is associated, and to each pair p ≤ q in P , a linear map ϕ M (p, q) : M p → M q is associated.Importantly, whenever p ≤ q ≤ r in P , it must be that ϕ We say that a pair of p, q ∈ P is comparable if either p ≤ q or q ≤ p.
Definition 2.1 ([8]).An interval I of P is a subset I ⊆ P such that: (i) I is nonempty.(ii) If p, q ∈ I and p ≤ r ≤ q, then r ∈ I .(iii) I is connected, i.e. for any p, q ∈ I , there is a sequence p = p 0 , p 1 , • • • , p = q of elements of I with p i and p i +1 comparable for 0 ≤ i ≤ − 1.By Int(P ) we denote the set of all finite intervals of P .When P is finite and connected, P ∈ Int(P ) will be referred to as the full interval.
For an interval I of P , the interval module I I : P → vec is defined as Direct sums and quotients of P -modules are defined pointwisely at each index p ∈ P .
Definition 2.2.Let M be any P -module.A submodule N of M is defined by subspaces N p ⊆ M p such that ϕ M (p, q)(N p ) ⊆ N q for all p, q ∈ P with p ≤ q.These conditions guarantee that N itself is a P -module, with the structure maps given by the restrictions ϕ M (p, q)| N p .In this case we write N ≤ M .A submodule N is a summand of M if there exists a submodule N which is complementary to N , i.e.M p = N p ⊕ N p for all p.In that case, we say that M is a direct sum of N , N and write M ∼ = N ⊕ N .Note that this direct sum is an internal direct sum.Definition 2.3.A P -module M is called interval decomposable if M is isomorphic to a direct sum of interval modules, i.e. there exists an indexing set J such that M ∼ = j ∈J I I j (external direct sum).In this case, the multiset {I j : j ∈ J } is called the barcode of M , which will be denoted by barc(M ).
The Azumaya-Krull-Remak-Schmidt theorem guarantees that barc(M ) is well-defined [3].Consider a zigzag poset of n points, where ↔ stands for either ≤ or ≥.A functor from a zigzag poset to vec is called a zigzag module [12].Any zigzag module is interval decomposable [22] and thus admits a barcode.
The following proposition directly follows from the Azumaya-Krull-Remak-Schmidt theorem and will be useful in §4.
Proposition 2.4.Let M : P → vec be interval decomposable and let N ≤ M is a summand of M (Definition 2.2).Then, M /N is interval decomposable.
Proof.It suffices to show that M ∼ = N ⊕(M /N ) (since M is interval decomposable, this isomorphism and Azumaya-Krull-Remak-Schmidt's theorem [3] guarantee that M /N is also interval decomposable).Let ι : N → M be the canonical inclusion.Since N is a summand of M , there exists a complementary submodule N ≤ M with M = N ⊕ N (internal direct sum).Hence, there exists π : M N such that π • ι = id N .Hence, by the splitting lemma [35,Theorem 23.1], the exact sequence 0 → N ι → M → M /N → 0 splits, i.e.M ∼ = N ⊕ (M /N ) (external direct sum), as desired.

Generalized rank invariant and generalized persistence diagrams
Let P be a finite connected poset and consider any P -module M .Then M admits a limit lim This implies that, for every p ≤ q in P , ϕ M (p ≤ q) • π p = π q and i q • ϕ M (p ≤ q) = i p , which in turn imply i p • π p = i q • π q : L → C for any p, q ∈ P .

Definition 2.5 ([25]). The canonical limit-to-colimit map ψ
The rank of M counts the multiplicity of the fully supported interval modules in a direct sum decomposition of M .The following is a slight variation of [25,Theorem 3.14] and [2,Theorem 5.10].
Theorem 2.9.If a given M : P → vec is interval decomposable, then for all I ∈ Int(P ), dgm I (M )(I ) is equal to the multiplicity of I in barc(M ).
Proof.For I ∈ Int(P ), let µ I ∈ Z ≥0 be the multiplicity of I in barc(M ).By invoking Theorem 2.6, we have that rk I (M )(I ) = J ⊇I J ∈Int(P ) µ J [25,Proposition 3.17].By the uniqueness of dgm I (M ) mentioned in Definition 2.8, dgm I (M )(I ) = µ I for all I ∈ Int(P ).
We consider P to be a 2d-grid and focus on the setting of Z2 -modules.Definition 2.10.For any I ∈ Int(Z 2 ), we define nbd Note that nbd I (I ) is nonempty [2, Proposition 3.2].When A ⊆ nbd I (I ) contains more than one point, A ∪ I is not necessarily an interval of Z 2 .However, there always exists a unique smallest interval that contains A ∪ I which is denoted by A ∪ I .Remark 2.11 ([2,Theorem 5.3]).If in Definition 2.8 we assume that P ∈ Int(Z 2 ) then we have that for every I ∈ Int(P ), 2  dgm

Canonical constructions of limits and colimits
Let M be any P -module.
Notation 2.12.Let p, q ∈ P and let v p ∈ M p and v q ∈ M q .We write v p ∼ v q if p and q are comparable, and either v p is mapped to v q via ϕ M (p, q) or v q is mapped to v p via ϕ M (q, p).
The following proposition gives a standard way of constructing a limit and a colimit of a P -module M .Since it is well-known, we do not prove it (see for example [25, Section E]).Proposition 2.13.
(i) The limit of M is (isomorphic to) the pair W, (π p ) p∈P where: and for each p ∈ P , the map π p : W → M p is the canonical projection.An element of W is called a section of M .
(ii) The colimit of M is (isomorphic to) the pair U , (i p ) p∈P described as follows: For p ∈ P , let the map j p : M p → p∈P M p be the canonical injection.U is the quotient p∈P M p /T , where T is the subspace of p∈P M p which is generated by the vectors of the form j p (v p ) − j q (v q ), v p ∼ v q , the map i p : M p → U is the composition ρ • j p , where ρ is the quotient map p∈P M p → U .Setup 1.In the rest of the paper, limits and colimits of a P -module M will all be constructed as in Proposition 2.13.Hence, assuming that P is connected, the canonical limit-to-colimit map lim

Computing generalized rank via boundary zigzags
In §3.1 we introduce the notions of lower and upper fences of a poset.In §3.2, we introduce the boundary cap ∂I of a finite interval I of Z 2 , which is a path, a certain sequence of points in I .In §3.3, we show that the rank of any functor M : I → vec can be obtained by computing the barcode of the zigzag module over the path ∂I .

Lower and upper fences of a poset
Let P be any connected poset.Given any p ∈ P , by p ↓ , we denote the set of all elements of P that are less than or equal to p. Dually p ↑ is defined as the set of all elements of P that are greater than or equal to p. Definition 3.1.A subposet L ⊂ P (resp.U ⊂ P ) is called a lower (resp.upper) fence of P if L is connected, and for any q ∈ P , the intersection L ∩ q ↓ (resp.U ∩ q ↑ ) is nonempty and connected.Proposition 3.2.Let L and U be a lower and an upper fences of P respectively.Given any P -module M , we have lim There are multiple proofs of Proposition 3.2.One is given in an earlier version of [25] (see Proposition D.14 in the second arXiv version).A concrete and tangible proof, which utilizes the following lemma, is given below.Lemma 3.3.Let M be a P -module and let L ⊂ P be a lower fence.Let v ∈ p∈I M p .The tuple v belongs to lim ← − − M if and only if for every p ∈ P , it holds that v p = ϕ M (q, p)(v q ) for every q ∈ L such that q ≤ p.
Proof.The forward direction is straightforward from the description of lim ← − − M given in Proposition 2.13 (i).Let us show the backward direction.Again, by Proposition 2.13 (i) it suffices to show that for all r ≤ p in P it holds that v p = ϕ M (r, p)(v r ).Fix r ≤ p in P .Since L is a lower fence, there exists q ∈ L such that q ≤ r ≤ p.Then, by assumption and by functoriality of M , we have: The injectivity is clear by definition.The surjectivity follows from the forward direction of the statement in Lemma 3.3.

The canonical isomorphism lim
where for any q ∈ P , the vector w q is defined as ϕ M (p, q)(v p ) for any p ∈ L ∩ q ↓ ; the connectedness of L ∩ q ↓ guarantees that w q is well-defined.Also, if q ∈ L, then w q = v q .The inverse r := e −1 is the canonical section restriction.The other isomorphism lim for any p ∈ U and any v p ∈ M p ; the fact that this map i is well-defined will become clear from Proposition 3.10.Let us define ξ : lim where ψ M is the canonical limit-to-colimit map of M .Hence we have the fact rank(ψ M ) = rank(ξ), which is useful for proving Theorem 3.12.

Boundary cap of an interval in Z 2
Let I ∈ Int(Z 2 ), i.e.I is a finite interval of Z 2 (Definition 2.1).By min(I ) and max(I ), we denote the collections of minimal and maximal elements of I , respectively.In other words, min(I ) := {p ∈ I : there is no q ∈ I s.t.q < p}, max(I ) := {p ∈ I : there is no q ∈ I s.t.p < q}.
Note that min(I ) and max(I ) are nonempty and that min(I ) and max(I ) respectively form an antichain in I , i.e. any two different points in min(I ) (or in max(I )) are not comparable.

Remark 3.4.
(i) The least upper bound and the greatest lower bound of p, q ∈ Z 2 are denoted by p ∨ q and p ∧ q respectively.Let p = (p x , p y ) and q = (q x , q y ) in Z 2 .Then, p ∨ q = (max{p x , q x }, max{p y , q y }), p ∧ q = (min{p x , q x }, min{p y , q y }).
For the item below, let I ∈ Int(Z 2 ).Notice the following: (ii) Since min(I ) is a finite antichain, we can list the elements of min(I ) in ascending order of their x-coordinates, i.e. min(I ) := {p 0 , . . ., p k } and such that for each i = 0, . . ., k, the x-coordinate of p i is less than that of p i +1 .
Similarly, let max(I ) := {q 0 , . . ., q } be ordered in ascending order of q j 's x-coordinates.We have that p 0 ≤ q 0 (Figure 2).Definition 3.5 (Lower and upper zigzags of an interval).Let I , min(I ), and max(I ) be as in Remark 3.4 (ii).We define the following two zigzag posets (Figure 2): min Note that min ZZ (I ) and max ZZ (I ) are lower and upper fences of I respectively.For p, q ∈ P , let us write p q if p < q and there is no r ∈ P such that p < r < q.Similarly, we write p q if p > q and there is no r ∈ P such that p > r > q.Definition 3.6.Given a poset P , a path Γ between two points p, q ∈ P is a sequence of points p = p 0 , . . ., p k = q in P such that either p i ≤ p i +1 or p i ≥ p i +1 for every i ∈ [1, k − 1] (in particular, there can be a pair i = j such that p i = p j ).The path Γ is said to be monotonic if p i ≤ p i +1 for each i .The path Γ is called faithful if either p i p i +1 or p i p i +1 for each i .Relations in min ZZ (I ) and max ZZ (I ) are indicated by green and red arrows, respectively.The inequality p 0 ≤ q 0 is indicated by blue arrows unless p 0 = q 0 .Notice that ∂I , as defined in equation ( 7), has cardinality 2, 2, 6, 6, 6 in that order ((A),(B),(C),(D),(E)).Definition 3.7 (Boundary cap of an interval).We define the boundary cap ∂I of I ∈ Int(Z 2 ) as the path obtained by concatenating min ZZ (I ) and max ZZ (I ) in Eqs. ( 5) and (6).
We remark that ∂I can contain multiple copies of the same point.Namely, there can be i ∈ [0, k] and j ∈ [0, ] such that either p i = q j (Figure 2 (A)), p i = q j ∧ q j +1 (Figure 2 (C)), p i ∨ p i +1 = q j (Figure 2 (C)), or p i ∨ p i +1 = q j ∧ q j +1 (Figure 2 (D)).
Consider the following zigzag poset of the same length as ∂I : Still using the notation in Eqs.(7) we have the following order-preserving map whose image is ∂I : . ., and • 2 +1 is sent to q .

Generalized rank invariant via boundary zigzags
The goal of this section is to establish Theorem 3.12.
The map ι I : ZZ ∂I → I in Eqs. ( 9) induces a bijection between the sections of M ∂I and the sections of M along ∂I in a canonical way.Hence: Setup 2. In the rest of §3.3, we fix both I ∈ Int(Z 2 ) and a functor M : I → vec.Each element in lim ← − − M ∂I is identified with the corresponding section of M along ∂I .Also, we identify points in ( 7) and ( 8 One of our main results is the following.Theorem 3.12.rank(M ) is equal to the multiplicity of the full interval in barc(M ∂I ).
Proof.By Theorem 2.6, it suffices to show that rank(ψ M : lim Let L := min ZZ (I ) and U := max ZZ (I ) which are lower and upper fences of I respectively.Let us define the maps e, r, i and ξ as described in the paragraph after Proposition 3.2.Then, by Proposition 3.2 and the commutative diagram in (4), it suffices to prove that the rank of ξ equals the rank of ψ M ∂I .To this end, we show that there exist a surjective linear map f : lim We define f as the canonical section restriction (v q ) q∈∂I → (v q ) q∈L .We define g as the canonical map, i.e. [v q ] → [v q ] for any q ∈ U and any v q ∈ M q .By Proposition 3.10 and by construction of M ∂I , the map g is well-defined.
We now show that ψ where q 0 ∈ U is defined as in Remark 3.4 (ii).Also, we have which proves the equality ψ M ∂I = g • ξ • f . 3For simplicity, we write [v p ] and [v q ] instead of [ j p (v p )] and [ j q (v q )] respectively where j p : M p → r ∈P M r and j q : M q → r ∈P M r are the canonical inclusion maps.
We claim that f is surjective.Let r : lim ← − − M → lim ← − − M ∂I be the canonical section restriction map (v q ) q∈I → (v q ) q∈∂I .Then, the restriction r : lim can be seen as the composition of two restrictions r = f • r .Since r is the inverse of the isomorphism e in diagram (4), r is surjective and thus so is f .
Next we claim that g is injective.Let i : lim for any q ∈ ∂I and any v q ∈ M q .By Proposition 3.10 and by construction of M ∂I , the map i is well-defined.Then, for the isomorphism i in diagram (4), we have i = i • g .This implies that g is injective.
Remark 3.13.In Definition 3.7 one may consider the "lower" boundary cap ∂I , as an alternative to ∂I : The value rank(M ) also equals the multiplicity of the full interval in the barcode of the zigzag module induced over ∂I .By Theorem 3.12, we can utilize algorithms for zigzag persistence in order to compute the generalized rank invariant and the generalized persistence diagram of any Z 2 -module that is obtained by applying the homology functor to a finite simplicial bifiltration consisting of O(t ) simplices over an index set of size O(t ).For this, we complete the boundary cap of a given interval to a faithful path (i.e.we put the missing monotonic paths between every pair of consecutive points) and then simply run a zigzag persistence algorithm, say the O(t ω ) algorithm of Milosavljevic et al. [34], on the filtration restricted to this path.Remark 3.14.To compute dgm I (M )(I ) by the formula in (1), one needs to consider terms whose number depends exponentially on the number of neighbors of I .However, for any interval that has at most O(log t ) neighbors, we have 2 O(log t ) = t c terms for some constant c > 0. It follows that using O(t ω ) zigzag persistence algorithm for computing generalized ranks, we obtain an O(t ω+c ) algorithm for computing generalized persistence diagrams of intervals that have at most O(log t ) neighbors.

Computing intervals and detecting interval decomposability
When a persistence module M admits a summand N that is isomorphic to an interval module, N will be called an interval summand of M .In this section, we apply Theorem 3.12 for computing generalized rank via zigzag to different problems that ask to find interval summands of an input finite Z 2 -module: Problems 4.2, 4.5, and 4.15.
Let K be a finite abstract simplicial complex and let sub(K ) be the poset of all subcomplexes of K , ordered by inclusion.Given any poset P , an order-preserving map F : P → sub(K ) is called a simplicial filtration (of K ).Setup 3. Throughout §4, F denotes a bifiltration of a simplicial complex K defined over an interval P ∈ Int(Z 2 ).Let t := max(|K |, |P |) denote the maximum of the number of simplices in K and the number of points in P .By M F : P → vec we denote the module induced by F through the homology functor with coefficients in the field F.
Computing the dimension function.In all algorithms below, we utilize a subroutine DIM(F , P ), which computes the dimension of the vector space (M F ) p for every p ∈ P .Proof.To implement DIM, we maintain a set C which we initialize to be the empty set.We consider each p ∈ min(P ) iteratively and proceed as follows.We reach all points q ∈ p ↑ \C over faithful paths.These paths form a directed tree Q rooted at p (where the arrows do not zigzag).We run the standard persistence algorithm on the filtration F restricted to Q with a slight modification so that the branchings in the tree are taken care of.We traverse the tree Q in a depth first manner and each time we come to a branching node, we start with the matrix which was computed during the previous visit of this node.This means that we leave a copy of the reduced matrix at each node that we traverse.This entire process takes time O(t 3 p ) where t p equals the maximum of the cardinality of p ↑ \C and the number of simplices in the filtration over p ↑ \C .This is because of the following.At each node q we spend O(t 2 p ) time to copy a matrix of size O(t p ) × O(t p ).Also we spend O(t 2 p s q ) time to reduce s q columns in a matrix of size O(t p ) × O(t p ) corresponding to the new s q simplices introduced at the node q.This incurs a total cost of q O(t 2 p )s q = O(t 3 p ) because q s q ≤ t p .We then update C ← C ∪(p ↑ \C ).Taking the sum over all minimal points we see that the overall cost is of order p O(t 3 p ) = O(t 3 ) since p t p = t .

Detecting interval modules
We consider the following problem.Proof.As we commented earlier, Step 1 computing the zigzag barcode barc((M F ) ∂P ) can be implemented to run in O(t ω ) time because it runs on a filtration comprising O(t ) simplices over an index set of size O(t ) .Step 2 takes O(t 3 ) time (Proposition 4.1).Step 3 takes only time O(t ).This implies that the overall complexity is O(t 3 ) given that ω < 2.373.

Interval decomposable modules and its summands
Setup 3 still applies in §4.2.Next, we consider the problem of computing all indecomposable summands of M F under the assumption that M F is interval decomposable (Definition 2.3).Problem 4.5.Assume that M F : P → vec is interval decomposable.Find barc(M F ).
We present algorithm INTERVAL to solve Problem 4.5 in O(t ω+2 ) time.This algorithm is eventually used to detect whether a given module is interval decomposable or not (Problem 4.15).Before describing INTERVAL, we first describe another algorithm TRUEINTERVAL.The outcomes of both INTERVAL and TRUEINTERVAL are the same as the barcode of M F in Problem 4.5 (Propositions 4.9 and 4.13).Whereas TRUEINTERVAL is more intuitive, real implementation is accomplished via INTERVAL.Let us now describe a procedure TRUEINTERVAL that outputs all indecomposable summands of a given interval decomposable module.For computational efficiency, we will implement TRUEINTERVAL differently.Let M := M F .First we compute dim M p for every point p ∈ P .Iteratively, we choose a point p with dim M p = 0 and compute a maximal interval I ∈ I (M ) containing p. Since M is interval decomposable, by Propositions 4.7 and 4.8 we have that I ∈ barc(M ) and that there is a summand N ∼ = I We continue the process by replacing M with M until there is no point p ∈ P with dim M p = 0 (note that M is interval decomposable by Proposition 2.4).Since dim M := p∈P dim M p is finite, this process terminates in finitely many steps.By Propositions 2.4 and 4.8, the outcome of TRUEINTERVAL is a list of all intervals in barc(M ) with accurate multiplicities: Proposition 4.9.Assume that M F is interval decomposable.Let I i , i = 1, . . ., k be the intervals computed by TRUEINTERVAL.For each i = 1, . . ., k, let µ I i := rk I (M F )(I i ).Then, we have Next, we describe an algorithm INTERVAL that simulates TRUEINTERVAL while avoiding explicit quotienting of M F by its summands.
We associate a number d (p) and a list list(p) of identifiers of intervals I ⊆ P to each point p ∈ P .The number d (p) equals the original dimension of (M F ) p minus the number of intervals peeled off so far (counted with their multiplicities) which contained p.It is initialized to dim(M F ) p .Each time we compute a maximal interval I ∈ I (M F ) with multiplicity µ I that contains p, we update d (p) := d (p)−µ I keeping track of how many more intervals containing p would TRUEINTERVAL still be peeling off.
With each interval I that is output, we associate an identifier id(I ).The variable list(p) maintains the set of identifiers of the intervals containing p that have been output so far.While searching for a maximal interval I , we maintain a variable list for I that contains the set of identifiers common to all points in I .Initializing list with list(p) of the initial point p, we update it as we explore expanding I .Every time we augment I with a new point q, we update list by taking its intersection with the set of identifiers list(q) associated with q.
We assume a routine COUNT that takes a list as input and gives the total number of intervals counted with their multiplicities whose identifiers are in the list.This means that if list = {id(I 1 ), . . ., id(I k )}, then COUNT(list) returns the number c : Notice that, while searching for a maximal interval starting from a point, we keep considering the original given module M F since we do not implement the true 'peeling' (i.e.quotient M F by a submodule).However, we modify the condition for checking the maximality of an interval I .We check whether rk I (M F )(I ) > c, that is, whether the generalized rank of M F over I is larger than the total number of intervals containing I that would have been peeled off so far by TRUEINTERVAL.This idea is implemented in the following algorithm.For every q ∈ I set d (q) := d (q) − µ I and list(q) := list(q) ∪ {id(I )} The output of INTERVAL can be succinctly described as: Output: {(I i , µ I i ) : i = 1, . . ., k} where I i ∈ Int(P ) and µ i is a positive integer for each i .Remark 4.10.For each p ∈ P , dim M p coincides with I i p µ i .
We will show that if M F is interval decomposable, then the output of INTERVAL coincides with the barcode of M F (Propositions 4.9 and 4.13).
Details for Example 4.11.We illustrate how the barcode of M F is obtained as the output of INTERVAL.In Step 1, for p = (2, 2), we have d (p) = 3 and list(p) = .For the first round of the while loop in Step 2, note that q = (2, 1) belongs to nbd I ({p}) and thus q can be added to I = {p}.After several rounds of the while loop, we obtain I 1 with µ I 1 = 1, and for every q ∈ I 1 (including p = (2, 2)), d (q) is decreased by 1. Next, suppose that another search begins at I = {p} and it tries to include q = (2, 1).We obtain rk I (M F )(I ∪{q}) = 1 as in the previous round, but now COUNT(list(p)∩list(q)) also returns 1 in Step 2.2(i) because the previously detected interval I 1 contains both p and q.Then, the test rk I (M F )(I ∪ {q}) > (c = 1) in Step 2.2(ii) fails and the search proceeds with other points.Again, after several iterations of successful and unsuccessful attempts to expand I , we obtain the interval I 2 with µ I 2 = 1.After obtaining (I 2 , µ 2 ), only p = (2, 2) has d (p) = 1 because of which another round of while loop starting at p outputs the interval I 3 = {p}.Example 4.12 (INTERVAL with non-interval-decomposable input).Suppose that N := M F ∼ = N ⊕I I 2 as depicted in Figure 3 (B).N is an indecomposable module that is not an interval module.One possible final output of INTERVAL is {(J 1 , 1), (J 2 , 1), (J 3 , 1)} as depicted in Figure 4 (B).Note however that, depending on the choices of p in Step 2 and the neighbors q in Step 2.2, the final outcome can be different.

Proof. ('if'):
We induct on the list of intervals in the order they are computed by TRUEINTERVAL.We prove two claims by induction: (i) TRUEINTERVAL can be run to explore the points in P in the same order as INTERVAL while searching for maximal intervals, (ii are the intervals computed by TRUEINTERVAL with this chosen order, then INTERVAL also outputs these intervals with the same multiplicities.Clearly, for i = 1, INTERVAL computes the maximal interval on the same input module M F as TRUEINTERVAL does.So, clearly, TRUEINTERVAL can be made to explore P as INTERVAL does and hence their outputs are the same.Assume inductively that the hypotheses hold for i ≥ 1.Then, TRUEINTERVAL operates next on the module M i +1 := M F /(I by Proposition 4.8).We let TRUEINTERVAL explore P in the same way as INTERVAL does.This is always possible because the outcome of the test for exploration remains the same in both cases as we argue.The variable d (p) at this point has the value dim(M i +1 ) p and thus both TRUEINTERVAL and INTERVAL can start exploring from the point p if d (p) > 0.
So, we let TRUEINTERVAL compute the next maximal interval I i +1 starting from the point p if INTERVAL starts from p. Now, when INTERVAL tests for a point q to expand the interval I , we claim that the result would be the same if TRUEINTERVAL tested for q.First of all, the condition whether I ∪ {q} is an interval or not does not depend on which algorithm we are executing.Second, the list supplied to COUNT in Step 2.2 (i) exactly equals the list of intervals containing I ∪{q} that INTERVAL has already output.By the inductive hypothesis, this list is exactly equal to the list of intervals that TRUEINTERVAL had already 'peeled off'.Therefore, the test rk I (M F )(I ∪ {q}) > c that INTERVAL performs in Step 2.2 (ii) is exactly the same as the test rk I (M i +1 )(I ∪{q}) > 0 that TRUEINTERVAL would have performed for the module M i +1 .This establishes that INTERVAL computes the same interval I i +1 with the same multiplicity as TRUEINTERVAL would have computed on M i +1 using the same order of exploration as the inductive hypothesis claims.
('only if'): We already know that INTERVAL computes all intervals that TRUEINTERVAL computes.We claim that it does not compute any other interval.For intervals computed by TRUEINTERVAL, one has that dim(M F ) p = i (I Proof.Each iteration in the while loop executes a traversal of the graph underlying the poset P starting from a point p.Each time, we reach a new point q in this traversal, we execute a zigzag persistence computation on the boundary cap ∂(I ∪ {q}).This means, the number of times a zigzag persistence is computed equals the number of times a point in the poset is considered by the while loop.We claim that this number is O(t 2 ).Each time a point p is considered by the while loop, either we include it in an interval that is output (a successful attempt), or we don't include it in the expansion of the current interval (unsuccessful attempt) and q appears as a point in the neighborhood of an interval that is output.The number of times a point is involved in a successful attempt is at most t because a point can be contained in at most t intervals (dim(M F ) p ≤ t ).Similarly, the number of times a point is involved in an unsuccessful attempt is at most 4t because the point can be in the neighborhood of at most 4t intervals (at most t intervals for each of its ≤ 4 neighbors).Therefore, each point participates in at most O(t ) computations of zigzag persistence over the entire while loop.Each zigzag computation takes time O(t ω ) since the filtration F | ∂(I ∪{q}) restricted to the boundary cap has length at most t comprising at most t simplices.It follows that the total cost due to zigzag persistence computation is bounded by O(t ω+2 ).Now, we analyze the cost of maintaining the lists with each point and with the intervals under construction.Notice that dim(M F ) = p∈P dim(M F ) p = O(t 2 ) because there are at most t points in P with dim(M F ) p ≤ t for each p ∈ P since F has at most t simplices.Each while loop iteration maintains a global list, calls COUNT on this list, and updates list(q) for some points q ∈ P .The cost of this counting and updates cannot be more than the order of the final total size p list(p) of the lists, which in turn is no more than dim(M F ) = O(t 2 ).Thus, over the entire while loop we incur O(t 4 ) cost for maintenance of the lists and for the counting based on them.Thus, we have a worst-case complexity of O(t 4 + t ω+2 ) = O(t ω+2 ) because it is known that ω ≥ 2.

Interval decomposability
Setup 3 still applies in §4.3.We consider the following problem.If the input module M F is interval decomposable, then the algorithm INTERVAL computes all intervals in the barcode.However, if the module M F is not interval decomposable, then the algorithm is not guaranteed to output all interval summands.We show that INTERVAL still can be used to solve Problem 4.15.For this we test whether each of the output intervals I with multiplicity µ I indeed supports a summand N ∼ = I To do this we run Algorithm 3 in Asashiba et al. [1] for each of the output intervals of INTERVAL.Call this algorithm TESTINTERVAL which with an input interval I , returns µ I > 0 if the module I µ I I is a summand of M and 0 otherwise.
For each of the intervals I with multiplicity µ I returned by INTERVAL(F , P ) we test whether TESTINTERVAL(I ) returns a non-zero µ I .The first time the test fails, we declare that M F is not interval decomposable.This gives us a polynomial time algorithm (with complexity O(t 3ω+2 )) to test whether a module induced by a given bifiltration is interval decomposable or not.It is a substantial improvement over the result of Asashiba et al. [1] who gave an algorithm for tackling the same problem.Their algorithm cleverly enumerates the intervals in the poset to test, but still tests exponentially many of them and hence may run in time that is exponential in t .Because of our algorithm INTERVAL, we can do the same test but only on polynomially many intervals.
Algorithm ISINTERVALDECOMP (F , P ) Proof.By the contrapositive of Proposition 4.9, if for any of the computed interval(s) is not a summand of M F , then M F is not interval decomposable.On the other hand, if every such interval module is a summand of M F , then we have that ) p for every p ∈ P .

INTERVAL produces partial sections of indecomposable summands
The algorithm INTERVAL produces all intervals of an input interval decomposable module.A natural question is what does the algorithm INTERVAL return on a module that is not interval decomposable (Figure 4 (B)).We show that the intervals returned by the algorithm support "partial" sections of indecomposable summands: Proposition 4.17.Let I be the set of intervals computed by INTERVAL(F ,P ).Then, for every I ∈ I , there exists a section supported over I of an indecomposable summand of M F .Moreover, for every p ∈ P , dim(M F ) p = I ∈I dim(I The above result follows from the proposition below since INTERVAL outputs an interval I only if rk(M F )(I ) > 0.
Proposition 4.18.Let P be a finite connected poset.Let M be a P -module with an indecomposable decomposition M ∼ = j ∈L M j for some finite set L. Let I ∈ Int(P ).If rk(M )(I ) = c > 0, there are j 1 , . . ., j c ∈ L such that for each t = 1, . . ., c, there exists a section v of M j t | I that is fully supported, i.e. v p = 0 for all p ∈ I . 5roof.By the assumption, we have Note that M j | I can be decomposable for each j .Let M j | I have an indecomposable decomposition i.e. each M j k is an indecomposable I -module.Then M | I has an indecomposable decomposition Since I is a finite poset and M p is finite dimensional for each p ∈ P , we have that lim ← − − M | I is finite dimensional.Hence the notions of direct product and direct sum coincide in the category of I -indexed modules.This implies that lim Therefore, there exist exactly c distinct pairs ( j , k) such that M j k ∼ = I I .Hence, for each of such ( j , k), we can find a section v := v j k of M j k that is fully supported over I .Since M j k is a summand of M j | I , v is also a section of M j | I , as desired.Suppose that a collection C := {(I i , µ I i )} i belongs to E(M ).We consider the interval decomposable module We remark that rk(I C )(J ) is equal to i µ i where the sum is taken over all i such that I i ⊇ J .
A single output of the algorithm INTERVAL may fail to capture the rank invariant or generalized rank invariant of M ; in Example 4.12, the rank invariant of the module N is different from the rank invariant of 3 i =1 I J i .Nevertheless, the barcode ensemble E(M ) recovers the generalized rank invariant of the input module M : Proposition 4.20.For every interval J ⊆ P , we have: By the design of the algorithm INTERVAL, the above equality is clearly true when rk(M )(J ) = 0.
Proof.(≥) Let m := rk(M )(J ) and pick any C = {(I i , µ i ))} i in E(M ).By the design of the algorithm INTERVAL, it is not possible for the sum i I i ⊃J µ i (= rk(I C )) to be greater than m.Since C was arbitrarily chosen in E(M ), we have rk(M )(J ) ≥ E(M )(J ).
(≤) Assume that m := E(M )(J ).This implies that there exists C = {(I i , µ i )} i in E(M ) such that rk(I C )(J ) = m.We prove the desired inequality by contradiction.Suppose that rk(M )(J ) > m.Then, by starting the algorithm INTERVAL at any point p ∈ I (in Step 2) and inductively adding points to {p} from I \ {p} whenever possible (in Step 2.2), the algorithm will output intervals I j containing J with multiplicity µ j such that the sum j µ j is larger than m.Let C be the output obtained in this strategy.Then, we have that rk(I C )(J ) m which contradicts the definition of E(M )(J ).

Discussion
Some open questions that follow are:(i) Can we generalize Theorem 3.12 to d -parameter persistent homology for d > 2? (ii) Can the complexity of the algorithms be improved?(iii) In particular, can we improve the interval decomposability testing by improving TESTINTERVAL which currently uses an algorithm of Asashiba et al.?

A Limits and Colimits
We recall the notions of limit and colimit from category theory [31].Recall that a poset P can be viewed as a category whose objects are the elements of P and morphisms are the comparable pairs p ≤ q in P .Although limits and colimits are defined for functors indexed by small categories we restrict our attention to poset-indexed functors.Let C be any category.
Definition A.1 (Cone).Let F : P → C be a functor.A cone over F is a pair L, (π p ) p∈P consisting of an object L in C and a collection (π p ) p∈P of morphisms π p : L → F (p) that commute with the arrows in the diagram of F , i.e. if p ≤ q in P , then π q = F (p ≤ q) • π p in C , i.e. the diagram below commutes.

F (p)
F (q) L F (p≤q) π p π q (10) In Definition A.1, the cone L, (π p ) p∈P over F is sometimes denoted simply by L, suppressing the collection (π p ) p∈P of morphisms if no confusion can arise.A limit of F : P → C is a terminal object in the collection of all cones over F : It is possible that a functor does not have a limit at all.However, if a functor does have a limit then the terminal property of the limit guarantees its uniqueness up to isomorphism.For this reason, we sometimes refer to a limit as the limit of a functor.
Cocones and colimits are defined in a dual manner: Definition A.3 (Cocone).Let F : P → C be a functor.A cocone over F is a pair C , (i p ) p∈P consisting of an object C in C and a collection (i p ) p∈P of morphisms i p : F (p) → C that commute with the arrows in the diagram of F , i.e. if p ≤ q in P , then i p = i q • F (p ≤ q) in C , i.e. the diagram below commutes.

C F (p) F (q)
i p F (p≤q) i q (11) In Definition A.3, a cocone C , (i p ) p∈P over F is sometimes denoted simply by C , suppressing the collection (i p ) p∈P of morphisms.A colimit of F : P → C is an initial object in the collection of cocones over F : It is possible that a functor does not have a colimit at all.However, if a functor does have a colimit then the initial property of the colimit guarantees its uniqueness up to isomorphism.For this reason, we sometimes refer to a colimit as the colimit of a functor.It is well-known that if P is finite, then any functor F : P → vec admits both limit and colimit in vec.Assume that P is also connected.Then, by the commutativity in (10) and (11), once a cone and a cocone of F are specified, there exists the canonical map from the cone to the cocone, leading to Definition 2.5.
Remark A.5.Let P be a finite and connected poset.Let Q be a finite and connected subposet of P .Let us fix any F : P → vec.
(i) For any cone L , (π p ) p∈P over F , its restriction L , (π p ) p∈Q is a cone over the restriction Therefore, by the terminal property of the limit lim ← − − F | Q , (π q ) q∈Q , there exists the unique morphism u : L → lim ← − − F | Q such that π q = π q • u for all q ∈ Q.
(ii) For any cocone C , (i p ) p∈P over F , its restriction C , (i p ) p∈Q is a cocone over the restriction F | Q : Q → vec.Therefore, by the initial property of lim − − → F | Q , there exists the unique morphism u : lim − − → F | Q → C such that i q = u • i q for all q ∈ Q.
(iii) By the previous two items, there exist linear maps π : lim

Theorem 2 . 6 (Definition 2 . 7 .Definition 2 . 8 .
[15, Lemma 3.1]).The rank of M is equal to the number of indecomposable summands of M which are isomorphic to the interval module I P .The (Int)-generalized rank invariant of M is the map rk I (M ) : Int(P ) → Z + defined as I → rank(M | I ), where M | I is the restriction of M to I .The (Int)-generalized persistence diagram of M is the unique 1 function dgm I (M ) : Int(P ) → Z that satisfies, for any I ∈ Int(P ), rk I (M )(I ) = J ⊇I J ∈Int(P ) dgm I (M )(J ).

Problem 4 . 2 .Proposition 4 . 3 .Proposition 4 . 4 .
Determine whether M F is isomorphic to the direct sum of a certain number of copies of I P and if so, report the number of such copies.AlgorithmISINTERVAL solves Problem 4.2.The correctness of the algorithm follows from Proposition 4.3.Below, for an interval I ∈ Int(Z 2 ) and for m ∈ Z ≥0 we define I m I := I I ⊕ I I ⊕ • • • ⊕ I I m .In particular, I 0 I is defined to be the trivial module.Let us recall that (M F ) ∂P denotes the zigzag module along the boundary cap ∂P (Definition 3.11).Algorithm ISINTERVAL(F , P ) • Step 1. Compute zigzag barcode barc((M F ) ∂P ) and let m be the multiplicity of the full interval.• Step 2. Call DIM(F , P ) (Computes dim(M F ) p for every p ∈ P ) • Step 3. If dim(M F ) p == m for each point p ∈ P return m, otherwise return 0 indicating M F has a summand which is not an interval module supported over P .Assume that a given M : P → vec has the indecomposable decomposition M ∼ = m i =1 M i .Then, every summand M i is isomorphic to the interval module I P if and only if rk I (M )(P ) = dim M p = m for all p ∈ P .Proof.By Theorem 2.6, the forward direction is straightforward.Let us show the backward direction.Since rk I (M )(P ) = m, by Theorem 2.6, we have that M ∼ = I m P ⊕ M where M admits no summand that is isomorphic toI P .Fix any p ∈ P .Then, m = dim(M p ) = dim((I m P ) p ) + dim(M p ) = m + dim(M p ), and hence dim(M p ) = 0. Since p was chosen arbitrarily, M must be trivial.Algorithm ISINTERVAL can be run in O(t 3 ) time.

Definition 4 . 6 .Proposition 4 . 7 .(− 1 )Proposition 4 . 8 .
Let I (M F ) := {I ∈ Int(P ) : rk I (M F )(I ) > 0}.We call I ∈ I (M F ) maximal if there is no J I in Int(P ) such that rk I (M F )(J ) is nonzero.Assume that M F is interval decomposable and let I ∈ I (M F ) be maximal.Then, I belongs to barc(M F ) and the multiplicity of I in barc(M F ) is equal to rk I (M F )(I ).Proof.By assumption, all summands in the sumA⊆nbd I (I )∩P A = |A| rk I (M F ) I ∪ A corresponding to the second term of (1) are zero.Hence, dgm I (M F )(I ) = rk I (M F )(I ) > 0. Since M F is interval decomposable, by Theorem 2.9, dgm I (M F )(I ) is equal to the multiplicity of I in barc(M F ). Therefore, not only does I belong to barc(M F ), but also the value rk I (M F )(I ) is equal to the multiplicity of I in barc(M F ).The following proposition is a corollary of Proposition 4.7.Assume that M F is interval decomposable and let I ∈ I (M F ) be maximal.Let µ I := rk I (M F )(I ).Then, M F admits a summand N which is isomorphic to I µ I I .

I
of M .Consider the quotient module M := M /N .Clearly, this 'peeling off' of N reduces the total dimension of the input module.Namely, dim M p = dim M p − µ I , p ∈ I dim M p , p ∉ I .

Figure 4 : 12 Proposition 4 . 13 .
Figure 4: An illustration for Examples 4.11 and 4.12 or equivalently dim(M F ) p = I ∈{I 1 ,...,I k }s.t .I p µ I .The algorithm INTERVAL decreases the variable d (p) exactly by the amount on the right-hand side of the equation and is intialized to dim(M F ) p .Therefore, every d (p) becomes equal to dim(M F ) p after INTERVAL computes the intervals that TRUEINTERVAL computes.The condition d (p) > 0 in the while loop prohibits INTERVAL to compute any other interval.Proposition 4.14.INTERVAL(F , P ) runs in O(t ω+2 ) time.

Problem 4 . 15 .
Determine whether the module M F is interval decomposable or not.

4. 5 Corollary 4 . 19 .
Barcode ensemble from INTERVALFix a P -module M as an input to the algorithm INTERVAL.Recall that an output of INTERVAL with the input M is a collection {(I i , µ I i )} i .This collection may change with different choices available during the exploration for computing maximal intervals.The collection E(M ) of all possible outputs of INTERVAL will be called the barcode ensemble of M .Proposition 4.13 implies: If E(M ) contains more than one collection, then M is not interval decomposable.

Definition A. 2 (
Limit).Let F : P → C be a functor.A limit of F is a cone over F , denoted by lim ← − − F, (π p ) p∈P or simply lim ← − − F , with the following terminal property: If there is another cone L , (π p ) p∈P of F , then there is a unique morphism u : L → lim ← − − F such that π p = π p • u for all p ∈ P .

Definition A. 4 (
Colimit).Let F : P → C be a functor.A colimit of F is a cocone, denoted by lim − − → F, (i p ) p∈P or simply lim − − → F , with the following initial property: If there is another cocone C , (i p ) p∈P of F , then there is a unique morphism u : lim − − → F → C such that i p = u • i p for all p ∈ P .
ISINTERVALDECOMP(F , P ) returns true if and only if M F is interval decomposable.It takes O(t 3ω+2 ) time.
Time complexity: By Proposition 4.14, Step 1 runs in time O(t ω+2 ).We claim that dim(M F ) = O(t 2 ) (see Proof of Proposition 4.14).Therefore, INTERVAL returns at most O(t 2 ) intervals.According to the analysis in Asashiba et al. [1], each test in Step 2.1 takes O(((dim M F ) ω + t )t ω ) = O(t 3ω ) time and thus O(t 3ω+2 ) in total over all O(t 2 ) tests which dominates the time complexity of ISINTERVALDECOMP.