Tri-Partitions and Bases of an Ordered Complex

Generalizing the decomposition of a connected planar graph into a tree and a dual tree, we prove a combinatorial analog of the classic Helmholz-Hodge decomposition of a smooth vector field. Specifically, we show that for every polyhedral complex, $K$, and every dimension, $p$, there is a partition of the set of $p$-cells into a maximal $p$-tree, a maximal $p$-cotree, and a collection of $p$-cells whose cardinality is the $p$-th Betti number of $K$. Given an ordering of the $p$-cells, this tri-partition is unique, and it can be computed by a matrix reduction algorithm that also constructs canonical bases of cycle and boundary groups.


Introduction
Given a connected graph embedded on the sphere, it is well known that we can split the graph into a spanning tree and a dual tree whose nodes are the faces. This is best visualized by rotating each edge that is not in the spanning tree, making sure they meet at points chosen to represent the faces. This split is similar in spirit to the Helmholtz decomposition of a smooth vector field on the sphere into a rotation-free component and a divergence-free component [14]. If the graph is embedded on a surface with non-zero genus, then the split does not exhaust all edges and the unused ones correspond to the third, harmonic component of the Helmholtz-Hodge decomposition on this surface [15]. Thinking of this split as a theorem about the edges of a connected planar graph, we are interested in its generalization to complexes and to cells of any dimension. Such a generalization promises a geometric interpretation of algebraic concepts in homology and their relations. Beyond this theoretical interest in the structure of complexes, we are motivated by geometric modeling tasks in which holes are of central importance. An example are cell membrane proteins with functional channels for ion transport. We believe that our structural results can be helpful in discovering and manipulating hole systems, but this is the topic of future work.
Two examples. Our results are combinatorial and algorithmic. To get a first impression, consider the planar graph forming a wheel of n 0 = 17 vertices and n 1 = 32 edges drawn in the left panel of Figure 1. Every spanning tree consists of n 0 − 1 = 16 edges, and if we interpret this tree as a barrier between the n 2 = 17 2-dimensional regions defined by the embedding of the graph, then each non-tree edge splits the regions into two connected collections. In other words, the regions form a dual tree, drawn with blue edges crossing the dotted non-tree edges. To get a maximal cotree, we add one of the dashed edges to the cotree.
As already noted in [2,21], the bi-partition of the edges is best generalized to a tri-partition if the graph is embedded on a closed surface with positive genus. To further free ourselves from the implicit definition of regions, we consider complexes in which the 2-dimensional cells are explicitly specified, so it no longer matters where the complex is embedded. An example is the complex of n 0 = 16 vertices, n 1 = 24 edges, and n 2 = 8 quadrangles drawn in the right panel of Figure 1. An unpleasant consequence is that the dual is no longer necessarily closed as it may have edges with missing endpoints. The appropriate formalism is therefore cohomology, where we worry about edges and their incident regions rather than their incident vertices. In this formalism, a cocycle is a set of edges such that every region in the complex is incident to an even number of edges in this set, and a cotree is a set of edges that does not contain a cocycle. Returning to the annulus in Figure 1, we notice that the spanning tree cannot go completely around the 'hole', so we get a cocycle that connects the outer boundary with the inner boundary. In other words, the complement of the spanning tree is a cotree-with-a-single-cocycle. Alternatively, we could add one edge of the cocycle to the tree to get a tree-with-a-single-cycle whose complement is a genuine cotree. Better yet, we partition the edges into a maximal tree, a maximal cotree, and one leftover edge. In the general case, there can be more leftover edges, namely one for each 'hole'.
Results and prior work. The partition of the edge set has been studied for connected graphs embedded on orientable closed surfaces. Biggs proved in 1971 that such a graph splits into a spanning tree and a complementary subgraph of the dual that contains a spanning tree of the dual [2]. Rosenstiehl and Read sharpened the result in 1978 by observing that the complementary subgraph of the dual splits into a (dual) spanning tree and 2g additional edges, in which g is the genus of the surface [21]. The first result of this paper generalizes this split to complexes and to cells beyond edges. Specifically, we prove that for every polyhedral complex, K, and for every dimension, p, the set of p-cells can be partitioned into a maximal p-tree, a maximal p-cotree, and a set of leftover p-cells whose cardinality is the p-th reduced Betti number of K. These properties suggest that the tri-partition is a discrete analog of the Helmholtz-Hodge decomposition of a smooth vector field into a rotation-free component, a divergence-free component, and a harmonic component whose dimension is the rank of the homology group [14,15] but see also [1,20]. An algebraic analog of this decomposition was introduced by Eckmann in 1945, namely that the p-th chain group satisfies C p B p ⊕ B p ⊕H p [8] but see also [7,12].
The tools for establishing the tri-partition are the matrix reduction algorithms developed in the context of persistent homology [9], the theorem on the invariance of birth-death pairs proved in [4], and the duality between homology and relative cohomology noted in [6]. Importantly, the tri-partition implies canonical bases of the cycle, boundary, and homology groups as well as of their counterparts in cohomology. More specifically, for each monotonic ordering of a polyhedral complex, there is a unique tri-partition and a unique collection of bases.
Outline. Section 2 provides background from algebraic topology, including algorithms for the ranks of homology and cohomology groups. Section 3 introduces the tri-partition of a polyhedral complex. Section 4 describes the related bases in homology and cohomology and proves their properties. Section 5 concludes this paper. Appendix A proves that the tri-partitions form matroids.

Background
We will make frequent use of homology and cohomology groups; see [13,18] for general background on these topics. To keep the discussion elementary, we use Z/2Z coefficients so that cycles and cocycles can be treated as sets.
Polyhedral complexes. A p-cell, σ, is a p-dimensional convex polytope, and we write dim σ = p for its dimension. A hyperplane supports σ if it has a non-empty intersection with the polytope and the polytope is contained in a closed half-space bounded by the hyperplane. A face of σ is the intersection with a supporting hyperplane; it is a convex polytope of dimension at most p. We call σ a coface of its faces. A polyhedral complex, K, is a collection of cells that is closed under taking faces such that the intersection of any two cells is a face of both. By convention, we require that the empty cell is part of K; its dimension is −1 and it is a face of every cell. A cell is maximal if it has no proper coface in K. The dimension of K is the maximum dimension of any of its cells. The p-skeleton contains all cells of dimension p or less and is denoted K (p) . We write K p = K (p) \ K (p−1) for the set of p-cells in K, and n p = |K p | for its cardinality, noting that n p = 0 for p smaller than −1 and larger than dim K. The Euler characteristic is the alternating sum of cell numbers, and since the empty cell is included, we decorate it with a tilde:χ = p (−1) p n p . The Euler-Poincaré Formula asserts that the Euler characteristic is the alternating sum of Betti numbers and therefore a topological invariant. We formally state the result now and provide the definition of the Betti numbers later.
Proposition 1 (Euler-Poincaré). Every polyhedral complex satisfiesχ = p (−1) pβ p . To represent a polyhedral complex in the computer, it is common to order the cellsarbitrarily or otherwise -and to store the face relation in matrix form. Letting σ 0 , σ 1 , . . . , σ m be the ordering, the boundary matrix, ∂[0..m, 0..m], is defined by In words: column j of ∂ stores the codimension 1 faces of σ j and row i stores the codimension 1 cofaces of σ i . Throughout this paper, we use monotonic orderings in which every cell is preceded by its faces. The boundary matrix of a monotonically ordered polyhedral complex is upper-triangular. A filtration of K is a nested sequence of subcomplexes that ends with K. An example are the prefixes of a monotonic ordering: K = {σ 0 , σ 1 , . . . , σ } is a complex, for every 0 ≤ ≤ m, and Homology. Since we use Z/2Z coefficients, we define a p-chain as a subset of the p-cells, c p ⊆ K p . Accordingly, the sum of two p-chains is their symmetric difference, and this operation defines a group, denoted C p (K). The boundary of a p-chain is the (p − 1)-chain, ∂c p , that consists of all (p − 1)-cells shared by an odd number of p-cells in c p . A p-cycle is a p-chain with empty boundary, and a p-boundary is the boundary of a (p + 1)-chain.
Since we include the empty cell, the boundary of a vertex is this empty cell and therefore not empty. In contrast to conventional homology theory, a single vertex is therefore not a 0-cycle, but a pair of vertices is. The p-boundaries and p-cycles form subgroups of C p , and because taking the boundary twice always gives the empty set, the former is a subgroup of the latter: is sometimes referred to as trivial, and two p-cycles are homologous if they differ by a p-boundary. The p-th (reduced) homology group consists of all classes of homologous p-cycles: The p-th (reduced) Betti number is the rank of the p-th homology group. Since we use modulo-2 arithmetic, this rank is the binary logarithm of the cardinality, and we writẽ β p =β p (K) = rankH p (K) = log 2 |H p (K)|. We call K acyclic if all Betti numbers vanish.
The smallest polyhedral complex is K = {∅}, withβ −1 = 1 and all other Betti numbers zero. The smallest acyclic polyhedral complex consists of a vertex and the empty cell.
Cohomology. While we collect information about the complex using homology, we collect information about the complement using relative cohomology; see also [6]. We begin with the definitions for cohomology. A p-cochain is a subset of the p-cells, c p ⊆ K p . Its coboundary, δc p , consists of all (p + 1)-cells that have an odd number of faces in c p . A p-cocycle is a p-cochain with empty coboundary, and a p-coboundary is the coboundary of a (p − 1)cochain. Again we get groups, B p (K) ⊆ Z p (K) ⊆ C p (K), which we distinguish from the boundary, cycle, and chain groups by writing the dimension as superscript. The p-th (reduced) cohomology group consists of all classes of cohomologous p-cocycles: We will see shortly thatβ p =β p for all p, so K is acyclic iffβ p = 0 for all dimensions p. As a general intuition,β p is the number of cuts needed to remove all non-trivial p-th cohomology. Relative cohomology is similar but defined for a pair, (K, L), in which L is a subcomplex of K. The relative p-cochains are the p-cochains in K \ L, and we notice that their coboundaries are also in K \ L. We therefore define the relative p-cocycles as the p-cocycles in K \ L, and the relative p-coboundaries as the p-coboundaries in K \ L. As before, we get three nested groups, is isomorphic to the conventional cohomology group in which K does not contain the empty cell. For relative cohomology, we writeβ p (K, L) = rankH p (K, L) = log 2 |H p (K, L)|.
Matrix reduction. The classic algorithm for homology and cohomology reduces the boundary matrix to Smith normal form; see [18, §11]. For modulo-2 arithmetic, this simplifies to Gaussian elimination. We introduce special versions of this algorithm that are easy to relate to the pertinent algebraic information, including the ranks of the groups. To compute homology, we initialize R = ∂ and U = Id and reduce R using left-to-right column additions while maintaining the relation R = ∂U . Write low(j) for the row index of the lowest non-zero item in column j of R, and set low(j) = −∞ if the column is zero.
Exhaustive column reduction algorithm: We call this algorithm exhaustive because it attempts to remove non-zero entries in column j even after the lowest such entry has been established. While this strategy has also been used in [11], it is different from the standard reduction algorithm used in persistent homology, which proceeds to column j + 1 as soon as low(j) is established. An important difference is that for the exhaustive reduction algorithm, the produced matrices R and U can be uniquely defined in terms of their algebraic structure, so they do not depend on the algorithm that computes them. In contrast, the standard reduction algorithm returns matrices R and U that are generally not unique and depend on the chosen order of column additions. To relate the algorithm to the homology group of K, we interpret the reduction of column j as adding σ j to the complex. Since we assume a monotonic ordering, we have a polyhedral complex after every addition. There are two possible outcomes when we add σ j with dim σ j = p: column j is reduced to zero, in which caseβ p increases by 1; column j remains non-zero, in which caseβ p−1 decreases by 1; see [5]. In the first case, we say σ j gives birth to a p-cycle, and in the second case, we say σ j gives death to a (p − 1)-cycle, namely the one given birth to by σ i with i = low(j); see [9,Chapter VII]. At completion,β p is the number of p-cells, σ j , such that column j of R is zero and j = low( ) for all . Writing n • p for the number of p-cells that give birth and n • p for the number that give death, we have n p = n • p + n • p andβ p = n • p − n • p+1 . We can therefore express n • p and n • p in terms of the n q and theβ q , and since the Betti numbers are topological invariants, we conclude that the n • p and the n • p neither depend on the particular reduction algorithm nor on the ordering of the cells.
To compute cohomology, we initialize Q = ∂ and V = Id and reduce Q using bottomto-top row operations while maintaining the relation Q = V ∂. Write left(i) for the column index of the leftmost non-zero entry in row i of Q, and set left(i) = ∞ if the row is zero.
Exhaustive row reduction algorithm: Similar to before, we distinguish between two possible outcomes: that a row is reduced to zero and that it remains non-zero. To relate the algorithm to cohomology, we interpret the state of Q after reducing σ i as the relative cohomology of the pair, (K, L), in which L ⊆ K consists of cells σ 0 to σ i−1 . The reduction of a row is therefore akin to moving a cell from L to K \ L. The two possible outcomes correspond again to births and deaths, this time of relative cocycles. Writing n p • and n p • for the numbers of p-cells of the two types, we have , and as before these numbers neither depend on the particular reduction algorithm nor on the ordering of the cells.
Duality. The births and deaths recorded in R and in Q are not the same but they are closely related. This is not surprising since a classic result in algebraic topology asserts that the Z/2Z ranks of the homology and the cohomology groups coincide; see e.g. [13,18].
We formally state this result for later reference, and we relate it to the above reduction algorithms.

Proposition 2 (Duality). Every polyhedral complex satisfiesβ p =β p , for all dimensions p.
Proof. We compare the ranks, which we read off the reduced boundary matrices, R and Q. As implied by a more general theorem in [4], R and Q have the same birth-death pairs; that is: , and the rank of the p-th reduced cohomology group is , which we can now see are equal.

Tri-partition
This section presents the first result of this paper: the tri-partition of a polyhedral complex in which the three sets represent unique aspects of the complex' topology. We begin with the introduction of the sets.
Trees, cotrees, and else. Letting K be a polyhedral complex, we recall that a p-chain is a subset of its p-cells. A p-tree is a p-chain, A p ⊆ K p , that does not contain any non-empty p-cycle; compare with the definition of a generalized tree in [16]. Sometimes these generalized trees are referred to as acycles [22], which motivates our notation. A p-tree is maximal if it is not properly contained in another p-tree. Similarly, a p-cotree is a p-cochain, A p ⊆ K p , that does not contain any non-empty p-cocycle, and it is maximal if it is not properly contained in another p-cotree. As examples consider the complexes in Figure 1. Adding the triangles, quadrangles, and the outer face to the graph in the left panel, we get a 2-dimensional complex with 32 edges. Half the edges form a maximal 1-tree, with the other half forming a maximal 1-cotree. Moving from the left to the right panel, we get the annulus by removing the center vertex together with the incident edges and triangles as well as the outer region. The remaining 24 edges contain a maximal 1-tree of size 15 and a maximal 1-cotree of size 8, leaving one edge unused. Our sole requirement for the third set of p-cells, E p , is that its cardinality be |E p | =β p . Since we talk about partitions, we have A p ∩ A p = ∅ and E p = K p \ A p \ A p , which we will see implies the existence ofβ p p-cycles that generateH p and ofβ p p-cocycles that generatẽ H p such that each p-cell in E p belongs to exactly one of these cycles and to exactly one of these cocycles; see Section 4 for details.

Statement and proof.
We give a constructive proof that K p permits a tri-partition as described. More specifically, we construct such a tri-partition for every ordering of the p-cells. The ordering of the other cells is not important as long as the overall ordering of K is monotonic.

Theorem 3 (Tri-partition). Let K be a polyhedral complex. Then there exist tri-partitions
It is possible to argue the existence of the tri-partition in terms of column-and row-spaces of the boundary matrix. Our proof is along the same lines but more specific and designed to reveal additional properties that will be exploited in the construction of bases in Section 4.

Proof.
We get the tri-partition in three steps: assuming a fixed monotonic ordering of K, we first construct A p , we second construct A p , and we let E p contain the remaining p-cells.
To get started, we sort the rows and columns of the boundary matrix according to the monotonic ordering of K. For the first step, we use the exhaustive column reduction algorithm formally stated in Section 2. Proceeding from left to right, column j is either a combination of preceding columns, in which case it gets reduced to zero, or it is independent of the preceding columns, in which case it remains non-zero. In the latter case, we add the j-th cell to A p , in which p is the dimension of this cell. At termination, A p is a maximal p-tree and |A p | = n • p by construction. For the second step, we use the exhaustive row reduction algorithm also formally stated in Section 2. Proceeding from bottom to top, row i is either a combination of succeeding (lower) rows, in which case it gets reduced to zero, or it is independent of the succeeding rows, in which case it remains non-zero. In the latter case, we add the i-th cell to A p , in which p is the dimension of this cell. At termination, A p is a maximal p-cotree and |A p | = n p • by construction. It remains to prove that A p ∩ A p = ∅ and that E p = K p \ A p \ A p has cardinalityβ p . To prove disjointness, we note that k = low( ) after column reduction iff = left(k) after row reduction; see [4]. Writing σ i for the i-th cell in the monotonic ordering, we have σ i ∈ A p iff p = dim σ i and left(i) < ∞. Writing j = left(i), this is equivalent to i = low(j), which implies that σ i gives birth to the p-cycle that σ j destroys. Hence, σ i ∈ A p , as desired. The symmetric argument shows that A p contains no cells of A p , which implies A p ∩ A p = ∅. Setting E p = K p \ A p \ A p , we observe that it contains a p-cell iff neither the corresponding row nor the corresponding column contains a birth-death pair. In other words, each such p-cell gives birth to an essential p-cycle in homology and, equivalently, it gives birth to an essential p-cocycle in cohomology. There areβ p =β p of each kind, hence |E p | =β p , as claimed.
The proof shows slightly more than claimed in Theorem 3, namely that there is a unique tri-partition for every monotonic ordering of K. On the other hand, two different monotonic orderings do not necessarily have different tri-partitions. For example, the tri-partition in dimension p is invariant as long as we retain the ordering among the p-cells, rearranging the other cells at will provided the overall ordering remain monotonic. This suggests we consider the collection of tri-partitions generated by monotonic orderings of K. Looking at its three constituents, we note that the collections of sets A p , of sets A p , and of sets E p are three matroids; see the formal claim and the proof in Appendix A.

Tri-partitions and persistence diagrams.
It is interesting to compare the tri-partition with the persistence diagram for the same monotonic ordering. Let σ 0 , σ 1 , . . . , σ m be such an ordering and write K = {σ 0 , σ 1 , . . . , σ } for every 0 ≤ ≤ m. The persistence diagram consists of all points (i, j) for which R[., i] = 0 and i = low(j) and all points (k, ∞) for which R[., k] = 0 but k = low( ) for all 0 ≤ ≤ m; see Figure 2 and refer to [9] for details. Importantly, the number of points in upper-left quadrants anchored at points on the diagonal give the reduced Betti numbers of complexes in the filtration. Specifically,β p (K ) is the number of points (i, j) with dim σ i = p that satisfy i ≤ < j, which includes the case j = ∞. As we slide the quadrant to the right and up the diagonal, we can read the reduced Betti numbers of all complexes in the filtration. With a few modifications, we can also read the ranks of the relative cohomology groups: reverse the two axes and exchange birth with death, move the points at infinity from north to west by reflecting them across the minor diagonal, and exchange the closed and open sides of the quadrant, which we slide to the left and down the diagonal.
The persistence diagram implies the tri-partition but not the other way round. Specifically, for every finite point (i, j) with dim σ i = p in the diagram, we have σ i ∈ A p and σ j ∈ A p+1 ,

Figure 2
The persistence diagram of a monotonic ordering reveals the ranks of the reduced homology groups of all complexes K , and after reflecting the points at infinite from top to left, it reveals also the ranks of the reduced relative cohomology groups of all pairs (K, K ). and for every point (k, ∞) with dim σ k = p we have σ k ∈ E p . In other words, the tri-partition records which cells give birth, which of those are essential, and which cells give death, but it does not determine the pairing that defines the persistence diagram.
Incremental construction. We conclude this section with a brief discussion of the incremental construction of the tri-partition. Suppose we have the tri-partition of K , how can we modify it to get the tri-partition of K +1 ? There are only two cases, depending on whether R[., + 1] = 0 after column reduction or not. Let p = dim σ +1 .
Case R[., + 1] = 0. Then σ +1 gives birth to a p-cycle, so we add σ +1 to E p , leaving A p and A p untouched.
Case R[., + 1] = 0. Then σ +1 gives death to a (p − 1)-cycle, and we add σ +1 to A p . Letting k = low( + 1), we have σ k ∈ E p−1 and since its class just got killed, we move it to A p−1 .
Note the asymmetry between the trees and the cotrees revealed by the incremental construction. Particularly perplexing, at first, is the move of σ k ∈ E p−1 -which signifies a birth in relative cohomology -to σ k ∈ A p−1 -which signifies a death in relative cohomology. The reason for this drastic change is of course the difference in direction, which is from left to right in the incremental construction, and from right to left in the computation of relative cohomology.

Bases
Besides constructing tri-partitions of a polyhedral complex, the exhaustive reduction algorithms compute canonical bases in homology and in cohomology. This section describes these bases and proves some of their properties.

Cycles and chains.
Fixing a monotonic ordering of a polyhedral complex, K, we write K p = A p A p E p for the corresponding tri-partition of the p-cells. For each σ j ∈ K p , we define a unique p-cycle or a unique p-chain with non-empty boundary. Specifically, if σ j ∈ A p E p , then there is a unique p-cycle z p (σ j ) ⊆ A p {σ j }, which we refer to as the canonical p-cycle of σ j . If σ j ∈ A p , then there is a unique p-chain, c p (σ j ) ⊆ A p , whose boundary is the sum of canonical (p − 1)-cycles that is rendered trivial by the addition of σ j to K j−1 , which we refer to as the canonical p-chain of σ j . Symmetrically, for every σ i ∈ K p , we define the canonical p-cocycle, We prove a technical lemma.
Lemma 4 (Off-diagonal Entries). Let R = ∂U and Q = V ∂ be the matrix equations after exhaustive reduction.
Proof. To prove that all non-zero off-diagonal entries in U belong to rows of cells in A q , for some q, we note that this is trivially true at the start of the reduction algorithm, when U = Id. A column is added to column j only if < j and R[., ] is non-zero. Since the algorithm proceeds from left to right, this implies that σ ∈ A q . Assuming inductively that also all off-diagonal non-zero entries in U [., ] belong to rows of q-cells in A q , we see that the column operation maintains the claim about off-diagonal entries.
The argument why all non-zero off-diagonal entries in V belong to columns of cells in A q is symmetric and omitted.
The technical lemma is useful to shed light on the connection between the canonical cycles, chains, cocycles, cochains and the matrices after exhaustive reduction.

Lemma 5 (Columns and Rows).
After exhaustive column reduction of R = ∂U , the columns of U store the canonical cycles and chains, and after exhaustive row reduction of Q = V ∂, the rows of V store the canonical cocycles and cochains: Proof. Because of symmetry, it suffices to prove the claims about the cycles and chains. Consider first the case in which σ j ∈ A p E p . After completing the reduction of column j, U [., j] stores a cycle. All cells in this cycle have the same dimension as σ j , which is p. Lemma 4 implies that this cycle is a subset of A p {σ j }. There is only one such cycle, namely z p (σ j ), which implies that U [., j] stores this cycle, as claimed. Consider second the case in which σ j ∈ A p . To show that U [., j] stores c p (σ j ), we note that all non-zero entries in column j of U belong to rows of cells in A p , and this includes the diagonal entry. Writing c ⊆ A p for this chain and z = ∂c for its boundary, we note that z is stored in column j of R. Separating the birth-giving from the death-giving (p − 1)-cells, we write z = z bth z dth . Note that z bth ⊆ z ⊆ A p−1 z bth and that there is only one such (p − 1)-cycle, namely the sum of the canonical (p − 1)-cycles of the σ ∈ z bth . Hence, z = σ∈z bth z p−1 (σ). Since the column reduction algorithm is exhaustive, each (p − 1)-cycle in the sum is born before σ j and dies after σ j . Any other sum of non-trivial canonical (p − 1)-cycles is non-homologous to z. By construction, z goes from non-trivial to trivial when we add σ j , which implies that U [., j] stores c p (σ j ), as claimed.
Canonical bases. The columns of U and R provide bases for the cycle, the boundary, and the homology groups, and the rows of V and Q provide bases for the cocycle, the coboundary, and the cohomology groups. These bases depend on the ordering of the cells, but they are canonical in the sense that they are defined in terms of their algebraic properties and do not depend on the algorithms that compute them. Theorem 6 (Canonical Bases). Assume a monotonic ordering of a polyhedral complex, K, and let K p = A p A p E p be the corresponding tri-partition. Then Proof. Because of symmetry, we can limit ourselves to the first three claims, which are about cycles and chains. We prove these claims in sequence. To see that the z p (σ j ), over all σ j ∈ A p E p , form a basis of Z p (K), we note that these cycles are clearly independent. Let z be an arbitrary p-cycle, and write z j = z p (σ j ) for every σ j ∈ (A p E p ) ∩ z. Then z = j z j , for if they were different, then z + j z j would be a p-cycle contained in A p , which contradicts the acyclicity of A p .
Recall that a homology class is essential if it is non-trivial in K. By construction, when σ j ∈ E p , then z p (σ j ) generates an essential class, and when σ j ∈ A p , then z p (σ j ) is trivial or homologous to a sum of cycles defined by p-cells in E p . SinceH p (K) requiresβ p generators and there are onlyβ p cells in E p , each homology class represented by such a cell must be a generator ofH p (K).
To see that the ∂c p (σ j ), over all σ j ∈ A p , form a basis of B p−1 (K), we note that these cycles are independent. Indeed, if they were not independent, then we had a non-empty sum of chains with empty boundary, which contradicts that the chains are all contained in A p since A p contains no cycle by construction. To show that the ∂c p (σ j ) span the (p − 1)-dimensional boundary group, we recall that the number of (p − 1)-cycles ∂c p (σ j ) is |A p | = n • p . For comparison, the rank of B p−1 (K) is equal to the rank of Z p−1 (K) minus the rank ofH p−1 (K), which is n Since this is the same as the number of (p − 1)-cycles, we conclude that the ∂c p (σ j ) indeed form a basis of B p−1 .
Theorem 6 implies the algebraic analog of the Helmholtz-Hodge decomposition, namely that the p-th chain group satisfies C p B p−1 ⊕ B p+1 ⊕H p for every dimension p. This is the algebraic way of saying that each p-cell either kills a (p − 1)-cycle, gives birth to a p-cycle that later dies, or gives birth to an essential p-cycle. Indeed, if we construct the filtration in reverse while maintaining the relative cohomology, the second of these three options correspond to killing a (p + 1)-cocycle. To get the algebraic decomposition in standard form, C p B p ⊕ B p ⊕H p , we note B p−1 B p and B p+1 B p as needed.

Intersections of basis vectors.
To study the relation between the various basis vectors, we consider the matrix product, V U , which we compute over Z so that 1 + 1 = 2. To predict its entries, we begin with the special case in which the column of U stores a dead cycle and the row of V stores a dead cocycle. Lemma 7 (Two Crossings). Assume a monotonic ordering of a polyhedral complex, K, let K p = A p A p E p be the corresponding tri-partition, and suppose σ i ∈ A p and σ j ∈ A p . Then σ i ∈ z p (σ j ) iff σ j ∈ z p (σ i ).
Proof. Recall that σ j ∈ A p implies that σ j gives birth to a p-cycle that dies before the filtration ends. The p-cycle born when we add σ j to K j−1 is z p (σ j ), and we write c p+1 for the (p + 1)-chain that gives death to this p-cycle. The death occurs either because the cycle becomes trivial or it becomes homologous to another cycle.
Consider first the easier case, when ∂c p+1 = z p (σ j ). Suppose σ i ∈ z p (σ j ). Since z p (σ i ) is a cocycle, every (p + 1)-cell in c p+1 has an even number of p-faces in z p (σ i ). The sum of these even numbers, over all (p + 1)-cells in c p+1 , is of course even, and this even number is also the sum over all p-cells in z p (σ i ) of their numbers of cofaces in c p+1 . This number of cofaces is odd for every p-cell in z p (σ j ), and even for every other p-cell. Now σ j is the only p-cell in z p (σ j ) that does not belong to A p , which implies that σ j is the only p-cell of z p (σ j ) -other than σ i -that is possibly in z p (σ i ). Since σ i has an odd number of cofaces in c p+1 and the sum is even, this implies that σ j ∈ z p (σ i ), as desired.
Consider second the case in which ∂c p+1 = z p (σ j ) + k∈Λ z p (σ k ) for a non-empty index set Λ. By construction, k < j for every k ∈ Λ. This implies σ k ∈ E p at time j. To get a contradiction, we assume σ k ∈ z p (σ i ). Recall that σ k ∈ E p implies that z p (σ k ) has empty intersection with A p , so σ i ∈ z p (σ k ). Let z p = z p (σ i ) + z p (σ k ), which is again a p-cocycle that contains σ i . But now we have two p-cocycles in A p {σ i }, which contradicts that A p is a cotree. Repeating the argument of the first case, we conclude that σ j ∈ z p (σ i ) since none of the σ k belongs to z p (σ i ), as desired.
The above lemma covers only one of the nine possible combinations. In each case, the number of cells in which the chain and the cochain overlap is either 0, 1, or 2. To formulate this claim in greater detail, we write x p for c p or z p and x p for c p and z p in cases in which the parameter decides which of the two functions applies.

Theorem 8 (Intersection Patterns). Assume a monotonic ordering of a polyhedral complex, K, and let
Proof. We illustrate the argument in Figure 3, which shows V , U , V U together with the rows for one cell in A p and the columns for one cell in A p . Recall that U and V are both upper-triangular, with all diagonal entries equal to 1. It follows that V U is upper-triangular, with all diagonal entries equal to 1 as well. To prove (4) for the off-diagonal entries of V U , we recall Lemma 4 and note that it implies Indeed, if σ i ∈ A p , then V [i, i] = 1 is the only non-zero entry in row i that belongs to a column of a cell in A p . Multiplying this row with U has the effect of copying row i of U to V U ; see the shaded rows in Figure 3. Symmetrically, if σ j ∈ A p , then U [j, j] = 1 is the only non-zero entry in column j that belongs to a row of a cell in A p . Multiplying V with this column has the effect of copying column j of V to V U ; see the shaded columns in Figure 3. The shaded rows and columns are added in V U , so the entries in their intersections can be 0, 1, or 2. By Lemma 7, they can only be 0 or 2, which implies the first line in (4). The remaining entries in the shaded rows and columns of V U are as in V and in U , and all other off-diagonal entries in V U are zero, which implies the second and the third line in (4).

Consider for example the case (σ
In words, each p-cell of E p belongs to exactly one generating p-cycle ofH p and to exactly one generating p-cocycle ofH p , and there are no other intersections between the basis vectors ofH p and the basis vectors ofH p . Figure 3 We get V U by multiplying V -whose rows contain the basis vectors in cohomologywith U -whose columns contain the basis vectors in homology. To compute the off-diagonal entries of V U , only the columns of cells in A p of V and the rows of cells in Ap of U are relevant.

Discussion
The main contributions of this paper are the construction of a tri-partition of a polyhedral complex and the analysis of the corresponding bases in homology and in cohomology. For a given monotonic ordering, the tri-partition is unique and so are the corresponding bases. We mention a few questions suggested by the work reported in this paper: Our constructions generalize to situations in which homology and cohomology are defined for field coefficients. Do they also generalize to non-field coefficients, for example the integers? Can the analogy between the tri-partition and the Helmholtz-Hodge decomposition of a smooth vector field be used to gain insights on either side? For example, does the tri-partition lead to a fast algorithm for constructing harmonic cycles, that is, whose Laplacian is zero? Can the tri-partitions be used to shed light on the stochastic properties of simplicial complexes as studied in [17]?
Applications of tri-partitions outside of mathematics are at least as important as finding connections within mathematics; see [10] for a first step. Particularly interesting is the use of the trees and cotrees to explore cave systems, such as within biomolecules and the molecular structure of materials.

A Matroids
The fact that the greedy algorithm succeeds in constructing maximal trees and maximal cotrees is not surprising since both form matroids [19]. We recall what this means. Let E be finite and F a collection of subsets of E. We call (F, E) an abstract simplicial complex if ∅ ∈ F and F is closed under taking subsets. It is a matroid if, in addition, (F, E) satisfies the exchange property: F, G ∈ F with |G| < |F | implies the existence of e ∈ F such that G ∪ {e} ∈ F. Traditionally, the sets in F are called independent, and the exchange property implies that all maximal independent sets in F have the same cardinality. It is often convenient to focus on the maximal sets as all others are implied by inclusion. The exchange property can be replaced by the following, equivalent property: if F, G are different maximal independent sets of F and a ∈ F \ G, then there exists b ∈ G \ F such that F \ {a} ∪ {b} ∈ F. Given a polyhedral complex, K, we write A p , A p , and E p for the collections of p-trees, p-cotrees, and p-dimensional leftover, which we recall are sets of p-cells. We note that all these sets arise in tri-partitions of K constructed for some monotonic ordering. Indeed, every A p ∈ A p arises as a subset of the maximal p-tree if we order the p-cells in A p before all others. Symmetrically, every A p ∈ A p arises as a subset of the maximal p-cotree if we order the p-cells in A p after all others. To see that every E p ∈ E p arises as a leftover constructed for some ordering, we recall that there are collections D p = {z p (σ) | σ ∈ E p } and D p = {z p (σ) | σ ∈ E p } that satisfy Theorem 8; see in particular the remark following the proof of this theorem. Writing D p and D p for the p-cells that belong to the cycles and cocycles in the two collections, we note that D p \ E p and D p \ E p are disjoint, so we can make sure that the p-cells in D p \ E p precede the p-cells in E p , and the latter precede the p-cells in D p \ E p . Adding the remaining p-cells arbitrarily, we get E p as the leftover for the ordering.
It is well known that the trees and the cotrees have matroid structure. We add that the same is true for the leftover sets.
Lemma 9 (Tri-matroids). Let K be a polyhedral complex. Then (A p , K p ), (A p , K p ), and (E p , K p ) are matroids for every dimension p.
Proof. We prove the claim for p-trees as a warm-up exercise, skipping the argument for p-cotrees, which is almost verbatim the same. Let F, G ∈ A p be maximal, and let a ∈ F \ G. Adding a to G creates a unique p-cycle, A ⊆ G ∪ {a}. Adding a p-cell b ∈ A \ F to F creates again a unique p-cycle, which for the purpose of this proof we refer to as an elementary p-cycle in F ∪ A. The elementary p-cycles span the entire space of p-cycles of F ∪ A, which includes A. We have a ∈ A, so a must belong to at least one elementary p-cycle. Letting b ∈ A \ F be a p-cell whose elementary p-cycle contains a, we get F \ {a} ∪ {b} as an independent set. Noting that b ∈ G, this implies that (A p , K p ) is a matroid, as claimed.
To prove that (E p , K p ) is a matroid, we use the fact that (A p , K p ) and (A p , K p ) are matroids, and that for each maximal E p ∈ E p there are maximal A p ∈ A p and A p ∈ A p such that A p A p E p = K p . Let E p ∈ E p be maximal and different from E p , and let A p , A p be a maximal p-tree and a maximal p-cotree with A p A p E p = K p . Let a ∈ E p \ E p and assume without loss of generality that a ∈ A p . We add a to A p and let b = a be any p-cell of the thus created unique p-cycle. Removing b from A p ∪ {a}, we get again a p-tree. If b ∈ E p , then we proceed to the next step, else b ∈ A p , we add b to A p , and we iterate with a p-cell c in the thus created unique p-cocycle. Continuing this way, we eventually get a p-cell z in E p . Indeed, every step makes A p more similar to A p or it makes A p more similar to A p , so the process must terminate. By construction, z ∈ E p and E p \ {a} ∪ {z} is a maximal independent set of E p , which implies that (E p , K p ) is a matroid, as claimed.
We note that the matroid structure implies that the greedy algorithm can be used to construct optimal trees, cotrees, and leftovers efficiently. This is in contrast to optimal bases, which for many objective functions are NP-hard to construct [3].
The proof that (E p , K p ) is a matroid extends to general partitions of a ground-set. Fixing an integer k and a set E, we consider partitions E = F 1 F 2 . . . F k such that for each