Building Efficient and Compact Data Structures for Simplicial Complexes

The Simplex Tree (ST) is a recently introduced data structure that can represent abstract simplicial complexes of any dimension and allows efficient implementation of a large range of basic operations on simplicial complexes. In this paper, we show how to optimally compress the Simplex Tree while retaining its functionalities. In addition, we propose two new data structures called the Maximal Simplex Tree (MxST) and the Simplex Array List (SAL). We analyze the compressed Simplex Tree, the Maximal Simplex Tree, and the Simplex Array List under various settings.


Introduction
Simplicial complexes are widely used in combinatorial and computational topology, and have found many applications in topological data analysis and geometric inference. The most common representation uses the Hasse diagram of the complex that has one node per simplex and an edge between any pair of incident simplices whose dimensions differ by one. A few attempts to obtain more compact representations have been reported recently.
Attali et al. [2] proposed the skeleton-blockers data structure which represent a simplicial complex by its 1-skeleton together with its set of blockers. Blockers are the simplices which are not contained in the complex but whose proper subfaces are. Flag complexes have no blockers and the skeleton-blocker representation is especially efficient for complexes that are "close" to flag complexes. An interesting property of the skeleton-blocker representation is that it enables efficient edge contraction.
Boissonnat and Maria [8] have proposed a tree representation called the Simplex Tree that can represent general simplicial complexes and scales well with dimension. The nodes of the tree are in bijection with the simplices (of all dimensions) of the simplicial complex. In this way, the Simplex Tree explicitly stores all the simplices of the complex but it does not represent explicitly all the incidences between simplices that are stored in the Hasse diagram. Storing all the simplices is useful (for example, one can then attach information to each simplex or store a filtration efficiently). Moreover, the tree structure of the Simplex Tree leads to efficient implementation of the basic operations on simplicial complexes (such as retrieving incidence relations, and in particular retrieving the faces or the cofaces of a simplex).
In this paper, we propose a way to compress the Simplex Tree so as to store as few nodes and edges as possible without compromising the functionality of the data structure. The new compressed data structure is in fact a finite automaton (referred to in this paper as the Minimal Simplex Automaton) and we describe an optimal algorithm for its construction. Previous works have looked at trie compression and have tried to establish a good trade-off between speed and size, but in most of the works, the emphasis is on one of the two. Two examples of work where the speed is of main concern are [3] where the query time is improved by reducing the number of levels in a binary trie (which corresponds to truncating the Simplex Tree at a certain height) and [4] where trie data structures are optimized for computer memory architectures. Other popular compact representations for tries in connection with predictive text compression are discussed in [27], but they only include (all) substrings of constant length that exist in a text and also do not focus on supporting efficient access in the compressed trie. Therefore, such representations are not useful here, due to the loss of significant information.
When the size of the structure is of primary concern, the focus is usually on automata compression. For instance, in the context of natural language data processing, significant savings in memory space can be obtained if the dictionary is stored in a directed acyclic word graph (DAWG), a form of a minimal deterministic automaton, where common suffixes are shared [1]. However, theoretical analysis of compression is seldom done (if at all), in any of these works.
In this paper, we analyze the size of the Minimal Simplex Automaton and also demonstrate (through experiments) that compression works especially well for Simplex Tree due to the structure of simplicial complexes: namely, that all subfaces of a simplex in the complex also belong to the complex. Additionally, we consider the influence of the labeling of the vertices on compression, which can be significant. Further, we show that it is hard to find an optimal labeling for the compressed Simplex Tree and for the Minimal Simplex Automaton.
We introduce two new data structures for simplicial complexes called the Maximal Simplex Tree (MxST) and the Simplex Array List (SAL).MxST is a subtree of the Simplex Tree whose leaves are in bijection with the maximal simplices (i.e., simplices with no cofaces) of the complex. We show that this data structure is compact and that it allows efficient operations. MxST is augmented to obtain SAL where every node uniquely represents an edge. A nice feature of SAL is its invariance over labeling of vertices. We show that SAL supports efficient basic operations and that it is compact when the dimension of the simplicial complex is fixed, a case of great interest in Manifold Learning and Topological Data Analysis.

Simplicial Complex: Definitions and a Lower Bound
A simplicial complex K is defined over a (finite) vertex set V whose elements are called the vertices of K and is a set of non-empty subsets of V that is required to satisfy the following two conditions: Each element σ ∈ K is called a simplex or a face of K and, if σ ∈ K has precisely s + 1 elements (s ≥ −1), σ is called an s-simplex and the dimension of σ is s. The dimension of the simplicial complex K is the largest d such that it contains a d-simplex.
A face of a simplex σ = {p 0 , ..., p s } is a simplex whose vertices form a subset of {p 0 , ..., p s }. A proper face is a face different from σ and the facets of σ are its proper faces of maximal dimension. A simplex τ ∈ K admitting σ as a face is called a coface of σ.
In this paper, the class of d dimensional simplicial complexes on n vertices with m simplices, of which k are maximal, is denoted by K(n, k, d, m), and K denotes a simplicial complex in K(n, k, d, m). At times, we say K θ ∈ K θ (n, k, d, m) (where θ : V → {1, 2, ..., |V |} is a labeling of the vertex set V of K) when we want to emphasize that some of the data structures seen in this paper are influenced by the labeling of the vertices.
A maximal simplex of a simplicial complex is a simplex which is not contained in a larger simplex of the complex. A simplicial complex is pure, if all its maximal simplices are of the same dimension. Also, a free pair is defined as a pair of simplices (τ, σ) in K where τ is the only coface of σ. In Figure 1, we have a simplicial complex on vertex set {1, 2, 3, 4, 5, 6} which has three maximal simplices: the two tetrahedra 1-3-4-5 and 2-3-4-5, and the triangle 1-3-6. We use this complex as an example through out the paper. The flag complex of an undirected graph G is defined as an abstract simplicial complex, whose simplices are the sets of vertices in the cliques of G. Let (P, d) be a metric space where P is a discrete point set. Given a positive real number r > 0, the Rips complex is the abstract simplicial complex R r (P ) where a simplex σ ∈ R r (P ) if and only if d(p, q) ≤ r for every pair of vertices of σ. Note that the Rips complex is a special case of a flag complex. This completes the definition of the complexes which will be used in this paper.
We would like to note here that the case when k = O(n), is of particular interest. It can be observed in flag complexes, constructed from planar graphs and expanders [15], and in general, from nowhere dense graphs [18], and also from chordal graphs [16]. Generalizing, for all flag complexes constructed from graphs with degeneracy O(log n) (degeneracy is the smallest integer r such that every subgraph has a vertex of degree at most r), we have that k = n O(1) [15]. This encompasses a large class of complexes encountered in practice. Now, we obtain a lower bound on the space needed to represent simplicial complexes by presenting a counting argument on the number of distinct simplicial complexes.
Theorem 1 Consider the class of all simplicial complexes on n vertices of dimension d, containing k maximal simplices, where d ≥ 2 and k ≥ n + 1, and consider any data structure that can represent the simplicial complexes of this class. Such a data structure requires log ( n/2 d+1 ) k−n bits to be stored. For any constant ε ∈ (0, 1) and for 2 ε n ≤ k ≤ n (1−ε)d and d ≤ n ε/3 , the bound becomes Ω(kd log n).
Proof The proof of the first statement is by contradiction. Let us define h = k− n ≥ 1 and suppose that there exists a data structure that can be stored using only s < log α def = log ( n/2 d+1 ) h bits. We will construct α simplicial complexes, all with the same set P of n vertices, the same dimension d, and with exactly k maximal simplices. By the pigeon hole principle, two different simplicial complexes, say K and K , are encoded by the same word. So any algorithm will give the same answer for K and K . But, by the construction of these complexes, there is a simplex which is in K and not in K . This leads to a contradiction.
The simplicial complexes are constructed as follows. Let P ⊂ P be a subset of cardinality n/2, and consider the set of all possible simplicial complexes of dimension d with vertices in P that contain h maximal simplices. We further assume that all maximal simplices have dimension d exactly. These complexes in number, since the total number of maximal d dimensional simplices is n/2 d+1 and we choose h of them. Let us call them Γ 1 , . . . , Γ α . We now extend each Γ i so as to obtain a simplicial complex whose vertex set is P and has exactly k maximal simplices. The maximal simplices will consist of the h maximal simplices of dimension d already constructed plus a number of maximal simplices of dimension 1. The set of vertices of Γ i , vert(Γ i ), may be a strict subset of P . Let its cardinality be n 2 − r i and observe that 0 ≤ r i < n 2 . Consider now the complete graph on the n 2 + r i vertices of P \ vert(Γ i ). Any spanning tree of this graph gives n 2 + r i − 1 edges and we arbitrarily choose n 2 − r i + 1 edges from the remaining edges of the graph to obtain n distinct edges spanning over the vertices of P \ vert(Γ i ). We have thus constructed a 1-dimensional simplicial complex K i on the n 2 + r i vertices of P \ vert(Γ i ) with exactly n maximal simplices. Finally, we define the complex Λ i = Γ i ∪ K i that has P as its vertex set, dimension d, and k maximal simplices. The set of Λ i , i = 1, · · · , α, is the set of simplicial complexes we were looking for.
The second statement in the theorem is proved through the following computation: = Ω(kd log n) We note that in the above computation, the first inequality is obtained by applying the following bound on binomial coefficients: n d ≥ n d d .
We can adapt the above proof to build n maximal simplices on P \ vert(Γ i ) each of dimension d, to ensure the lower bound applies also to pure simplicial complexes. This is done by first building |P \vert(Γi)| d+1 disjoint maximal simplices of dimension d on vertices of P \ vert(Γ i ) and then, building one maximal simplex which contains all the remaining vertices. We would complete the construction of k maximal simplices in the complex by choosing Theorem 1 applies particularly to the case of pseudomanifolds of fixed dimension where we have k ≤ n d 2 (i.e., ε = 1 2 suffices) [5]. The case where d is small is important in Manifold Learning where it is usually assumed that the data live close to a manifold of small intrinsic dimension. The dimension of the simplicial complex should reflect this fact and ideally be equal to the dimension of the manifold.

Compression of the Simplex Tree
Let K ∈ K(n, k, d, m) be a simplicial complex whose vertices are labeled from 1 to n and ordered accordingly. We can thus associate to each simplex of K a word on the alphabet set {1, . . . , n}. Specifically, a j-simplex of K is uniquely represented as the word of length j+1 consisting of the ordered set of the labels of its j + 1 vertices. Formally, let σ = {v 0 , . . . , v j } be a simplex, where v i are vertices of K and i ∈ {1, . . . , n} and 0 < · · · < j . σ is represented by the word [σ] = [ 0 , · · · , j ]. The last label of the word representation of a simplex σ will be called the last label of σ and denoted by last(σ). The simplicial complex K can be defined as a collection of words on an alphabet of size n. To compactly represent the set of simplices of K, we store the corresponding words in a tree satisfying the following properties: 1. The nodes of the tree are in bijection with the simplices (of all dimensions) of the complex. The root is associated to the empty face. 2. Each node of the tree, except the root, stores the label of a vertex. Specifically, the node N associated to a simplex σ = ∅ stores the label of the vertex last(σ). 3. The vertices whose labels are encountered along a path from the root to a node N associated to a simplex σ, are the vertices of σ. The labels are sorted by increasing order along such a path, and each label appears exactly once.
This data structure is called the Simplex Tree of K [8] and denoted by ST(K) or simply ST when there is no ambiguity. It may be seen as a trie [10] on the words representing the simplices of the complex. The depth of the root is 0 and the depth of a node is equal to the dimension of the simplex it represents plus one. Also, in this paper we assume that ST is directed from the root to the leaves.
We give a constructive definition of ST. Starting from an empty tree, insert the words representing the simplices of the complex in the following manner. When inserting the word [σ] = [ 0 , · · ·, j ] start from the root, and follow the path containing successively all labels 0 , · · ·, i , where [ 0 , · · ·, i ] denotes the longest prefix of [σ] already stored in the Simplex Tree. Next, append to the node representing [ 0 , · · ·, i ] a path consisting of the nodes storing labels i+1 , · · ·, j . In Figure 2, we give ST for the simplicial complex shown in Figure 1. If K consists of m simplices (including the empty face), the associated ST contains exactly m nodes. Thus, we need Θ(m log n) space/bits to represent ST (since each node stores a vertex which needs Θ(log n) bits to be represented). We can compare this to the lower bound of Theorem 1. In particular, if k = O(1) then, ST requires at least Ω(2 d log n) bits where as Theorem 1 proves the necessity of only Ω(d log n) bits. Therefore, while the Simplex Tree is an efficient data structure for some basic operations such as determining membership of a simplex and computing the r-skeleton of the complex, it requires storing every simplex explicitly through a node, leading to combinatorial redundancy. To overcome this, we introduce a compression technique for the ST.

Compressed Simplex Tree
Consider the ST in Figure 3 and note that the red shaded region appears twice. The goal of the compression is to identify these common parts and store them only once. More concretely, if the same subtree is rooted at two different nodes in ST then, the subtree is stored only once and the two root nodes now point to the unique copy of the subtree. As a consequence, the nodes are no longer in bijection with the nodes of the complex (as it was in the case of ST), but we still have the property that the paths from the root are in bijection with the simplices. We see in Figure 4, the compressed ST of the simplicial complex described in Figure 1. In the rest of the paper, we denote by C, this action of compression. Also, unless otherwise stated |ST| and |C(ST)| refer to the number of edges in ST and C(ST) respectively. Answering simplex membership queries and other queries that only require traversing ST from root to leaves can be implemented in C(ST) exactly as in ST [8]. Allowing upward traversal in ST is also possible (with additional pointers from children to parents), and this has been shown to improve the efficiency of some operations, such as face or coface retrieval. However, in C(ST), parents are not unique. To account for this, we mark the parents that were accessed, and use this to go back in the upward direction. This implies an additional storage of O(d log n) while traversing, but a node (simplex) having many parents can assist to locate cofaces much faster.
Next, we will introduce an automaton perspective of the above compression and show how to deduce the optimal compression algorithm for ST. We will also describe insertion and removal operations on C(ST) through the automaton perspective.

Minimal Simplex Automaton
A Deterministic Finite state Automaton (DFA) recognizing a language is defined by a set of states and labeled transitions between these states to detect if a given word is in a predefined language or not. ST can be seen as a DFA: and v contains the vertex a. We define the Simplex Automaton of K (denoted by SA(K)) as the automaton described above (cf. Figure 5). SA is basically the same data structure as ST except that the labels are not put on the nodes but on the edges entering these nodes and thus, basic operations in SA can be implemented as in ST. Also, by construction of SA, it is obvious that the number of states and transitions of SA are equal to the number of nodes and edges in ST respectively. It is known [24] that if a language L is regular (accepted by a DFA) then, L has a unique minimal automaton. DFA minimization is the task of transforming a given DFA into an equivalent DFA that has a minimum number of states. We represent the action of performing DFA minimization by M. For any K ∈ K θ (n, k, d, m), let us define the Minimal Simplex Automaton (M(SA)) as the minimal deterministic automaton which recognizes the language L K θ . Compressing ST can be seen as DFA minimization since merging identical subtrees corresponds to merging indistinguishable states in the automaton. It is possible to get C(ST) from M(SA) by duplicating the states such that for each node, the labels of all its incoming edges are the same, and then by moving the labels from the edges to the next node. Also, it should be observed that the number of edges in C(ST) and the number of transitions in M(SA) may not be the same. The reason is that states in M(SA) having identical set of outgoing paths can merge even when the incoming set of transitions are different for each of these states, while such nodes in C(ST) would not have merged.
Algorithmic aspects of DFA minimization have been well studied. For instance, Hopcroft's algorithm [19] minimizes an automaton with m transitions over an alphabet of size n in O(m log m log n) steps and needs at most O(m log n) space. This running time is shown in [19] to be optimal over the set of regular languages. Additionally, Revuz showed that acyclic automaton (which SA indeed is) can be minimized in linear time [25]. Also, in Appendix A we describe an adapted Hopcroft's algorithm to optimally compress ST. In  While there are delicate differences between M(SA) and C(ST), we will see below that performing basic operations on M(SA) is not very different from the way it is done for C(ST).

Operations on the Minimal Simplex Automaton
The set of all paths originating from the root are the same in both ST and M(SA). All operations which involve only traversal along ST are performed with equal (if not better) efficiency in M(SA) as, for every such operation on ST, we start by traversing from the root. As an example, consider the operation of determining if a simplex σ is in the complex. Let us adapt the algorithm described in [8] to M(SA). Note that there is a unique path from the initial state which identifies σ in M(SA). If σ = v 0 − · · · − v dσ then, from the initial state we go through d σ + 1 states by following the transitions 0 , . . . , dσ in that order. If at some point the requisite transition is not found then, declare that the simplex is not in the complex. Hence, performing all static operations i.e., all operations where we don't change the M(SA) in any way, can be carried out in very much the same way in both M(SA) and ST, although it might be more efficient for M(SA) as discussed earlier for C(ST) in subsection 3.1.
Addition and deletion of simplexes can be trickier in M(SA) than in ST. We can always expand M(SA) to SA, (locally) perform the operation and recompress. If the nature of the operation is itself expensive (i.e., worst-case Ω(m)) then, the worst-case cost does not change, which is indeed the case for operations such as removal of cofaces, edge contraction and elementary collapses.

Complexity Measure of Size for the Minimal Simplex Automaton
Our complexity measure in the paper would be minimizing SA to obtain M(SA) with minimum number of states. We know from Myhill-Nerode theorem that there is a unique minimal DFA. Thus, if there was an automaton with less transitions than M(SA) then, it should have more states than M(SA). Let A be an automaton with a minimal number of transitions and let us run Hopcroft's algorithm on A. Since, at no point in Hopcroft's algorithm, we increase the number of transitions, the output has to be an automaton whose numbers of states and transitions are both minimal. It follows that the unique automaton output by Hopcroft's algorithm must have both a minimal number of states and a minimal number of transitions. This is proved more formally as Proposition 1 in [22].
In the rest of the paper, we denote by |SA| and |M(SA)|, the number of states in SA and M(SA) respectively. While we consider the number of states as a complexity measure of the size of SA and M(SA), we will still use the number of edges as a complexity measure of the size of ST and C(ST) because the bounds obtained relating the number of edges in C(ST) and the number of nodes in C(ST) are not satisfactory. The size of M(SA) will be discussed in detail in section 5, after introducing a new data structure in the next section. This is done to put the impact of compression in better perspective.

Maximal Simplex Tree
We define the Maximal Simplex Tree MxST(K) as an induced subgraph of ST(K). All leaves in the Simplex Tree corresponding to maximal simplices and the nodes encountered on the path from the root to these leaves are kept in the Maximal Simplex Tree and the remaining nodes are removed. MxST(K) is constructed as follows. We start from an empty tree and then insert the words representing the maximal simplices of K. Specifically, when inserting the word [σ] = [ 0 , · · ·, j ], we start from the root, and follow the path containing successively all labels 0 , · · ·, i , where [ 0 , · · ·, i ] denotes the longest prefix of [σ] already stored in the Maximal Simplex Tree. We then append to the node representing [ 0 , · · ·, i ] a path consisting of the nodes storing labels i+1 , · · ·, j . Figure 7 shows the MxST of the simplicial complex given in Figure 1. In MxST(K), the leaves are in bijection with the maximal simplices of K. Any path starting from the root provides the vertices of a simplex of K. However, in general, not all simplices in K can be associated to a path from the root in MxST(K). By the above construction of MxST, we add at most d + 1 nodes per maximal simplex. Hence, MxST(K) has at most k(d + 1) + 1 nodes and at most k(d + 1) edges (therefore requiring O(kd log n) space). We denote by |MxST| the number of edges in MxST. Since MxST is a factor of ST, the size of MxST is usually much smaller than the size of ST. Further, it always meets the lower bound of Theorem 1, making it a compact data structure. We discuss below the efficiency of MxST in answering queries.

Operations on the Maximal Simplex Tree
In [8] some important basic operations (with appropriate motivation) have been discussed for ST. We will bound now the cost of these operations using MxST. Note that any node in MxST(K) has O(n) children and we can search for a particular child of a node in time O(log n) (using red-black trees). We summarize in Table 1, the asymptotic cost of some basic operations (details of this analysis is provided in Appendix B) and note that it is already better than ST for some operations.

Operation
Cost Identifying maximal cofaces of a simplex σ / Determining membership of σ Moreover, we can augment the structure of MxST without paying for a lot of extra memory space, so that the above operations can be performed more efficiently. This is explained in section 6.

Results on Minimization of the Simplex Automaton
In this section we will see some results, both theoretical and experimental on the minimization of SA.

Bounds on the Number of States of the Minimal Simplex Automaton
We observe below that the number of leaves in ST is large and grows linearly w.r.t. the number of nodes in ST. The proof follows by a simple induction argument on n. Similar to M(SA), we may define M(MxSA(K)) as the minimal DFA which recognizes only maximal simplices as words. Then, the following inequality follows: Proof Let K be a pure simplicial complex. Let s i be the initial state and S f be the set of the states of outdegree zero. To each state we associate its depth, which is the the length of the longest directed path from s i to this state.
We define another automaton B. The states of B are the states of SA(K). The state s i is still the initial state and, the new final states are {s ∈ S f | depth(s) = d + 1}. Finally, there is a transition between states u and v labeled by a if and only if this transition exists in SA(K) and if depth(v) = depth(u)+ 1. Let us prove that B recognizes exactly the maximal simplices of K.
Let w be a word recognized by B. Then w is a word of length d + 1 which was recognized by SA(K). Then, it corresponds to a simplex of K of dimension d. It is a maximal simplex of K.
On the other direction, let σ be a maximal simplex of K. Hence the word σ is accepted by SA(K) and of length d + 1. If any transition which appears during this detection appears also in B then, σ is also accepted by B. Thus, let us assume for a contradiction that during the detection of the word σ, the simplex automaton SA(K) uses a transition from a state u to a state v such that depth(v) = depth(u) + 1 (let us choose the first transition where it happens). By definition of the depth of a state, we get δ 1 = depth(v) > depth(u) + 1 = δ 2 + 1. This means that there exists a word w of length δ such that by reading w from the initial state, we arrive into v. Then, w, σ s (where σ s is the suffix of σ of length d − δ 2 ) is also accepted by SA(K). Consequently K contains a simplex of dimension d + δ 1 − δ 2 − 1 > d and we have reached a contradiction.
In fact, one can prove that for a large class of simplices the equality does not hold. For instance, consider K ⊂ K(n, k, d, m) such that for any K ∈ K we have that there exists two maximal simplices which have different first letters (i.e., when the simplices are treated as words) but have the same letter at position i, for some i that is not the last position. For this subclass the equality does not hold. Observe also that Lemma 3 holds only for pure simplicial complexes because, if all complexes were allowed then, we will have complexes like in Example 1 where |M(SA(K))| < |M(MxSA(K))|.

Conditions for Compression
We would like to analyze two possible sources of compression in ST. A first type of compression may happen when a simplex σ belongs to several maximal simplices and its vertices appear as the last vertices of those maximal simplices. Then compression will factorize σ so that it will appear only once as a common suffix of several words. A second type of compression occurs when considering a single maximal simplex. Here too, ST stores many different words with common suffixes and compression will factorize these common suffixes. Intuitively, the first type captures compression solely in MxST (i.e., because of the input and the labeling on vertices we have defined) and the second source analyzes possible compression because of the rich structure of ST. Now, we will see a result which guarantees compression for pure simplicial complexes regardless of the labeling of the vertices: Lemma 4 For any pure simplicial complex K ∈ K(n, k, d, m), we have that |M(SA)| is always less than |SA| when k < d and d ≥ 2.
Proof Let K be a pure simplicial complex. Let σ = v 1 , . . . , v d , v d+1 be a maximal simplex. Let us define ν = {v 1 , . . . , v d−1 } and, M = {m ∈ K | m is maximal and v d ∈ m}. We also define P ν ⊆ P(ν) as the projection of M on to ν, which is more formally written as: We notice that ν ∈ P ν . Since d > k ≥ |M | ≥ |P ν |, it follows that there exists b ⊆ ν such that |b| = |ν| − 1 and which is not in P ν . Let s ν and s b be the states in SA(K) reached by reading the words ν ∪ v d and b ∪ v d . As the language is closed by subwords and as b ⊆ ν, any accepting word from the state s ν is also an accepting word from the state s b . Reciprocally, if w is an accepting word from the state The projection of m on ν contains b and by definition of b is strictly larger. Hence ν ⊆ m, and so, ν ∪ v d ∪ w ∈ K. Consequently the states s ν and s b are equivalent and can be merged.
In fact, the above result is close to tight: in Example 4, we have a pure simplicial complex with k = d and |ST| = |C(ST)|. We remark here that in cases of impossibility of compression we will analyze the compression of ST rather than the minimization of SA through out this section because analyzing ST provides better insight into the combinatorial structures which hinder compression.
Intuitively, it seems natural that if the given simplicial complex has a large number of maximal simplices then, regardless of the labeling we should be able to compress some pairs of nodes in MxST. However, Example 2 says otherwise.
Example 2 Consider the simplicial complex on 2n vertices of dimension n/2 defined by the set of maximal simplices given by: where g is a bijective map from {1, 2, . . . , n n/2 } to the set of all simplices on n vertices of dimension n/2 − 1 and g r corresponds to picking the r th vertex (in lexicographic order).
In both Examples 2 and 4, we saw simplicial complexes of large dimension which cannot be compressed, but this is due to the way the vertices were labeled. Now, we state a lemma which says that there is always a labeling which ensures compression.
Proof Let m = v 0 · · · v d be a maximal simplex in K θ . We construct π by swapping d−1 and d with n − 1 and n respectively. In ST(K π•θ ), note that the node under root with label n − 1 and the node corresponding to simplex v π( 0 ) · · · v π( d−1 ) are identical and thus can be merged.
We would have liked to obtain better bounds for the size of M(SA) through conditions just based on n, k, d and m, but sadly this is a hard combinatorial problem. Also, while there is always a good labeling, we show in section 7 that it is NP-Hard to find it.

Experiments
We define two parameters here, ρ ST and ρ MxST . The first one is given by the ratio of |ST| and |C(ST)| and the second by the ratio of |MxST| and |C(MxST)|. All experiments performed below record the extent of compression of ST. Ideally, we would have liked to record the extent of minimization of SA since M(SA) is more compact than C(ST). Unfortunately, this has not been possible due to the lack of available libraries able to handle very large automata. The results below for C(ST) are nonetheless positive, substantiating our claim that compression of ST leads to a compact data structure. Data Set 1: The set of points were obtained through sampling of a Klein bottle in R 5 and constructing the Rips Complex with parameter r using libraries provided by the GUDHI project on input of various values for r. We record in Table 2, |C(ST)| and |C(MxST)| for the various complexes constructed.
10,000 0. 15   First, observe that |MxST| is considerably smaller than |ST|. This is expected, as it is likely that k is polynomially related to n for Rips complexes. Also, while we observe insignificant compression in MxST, ρ ST increases rapidly as r is increased. This indicates that compression strongly exploits the combinatorial redundancy of ST (i.e., storing each simplex explicitly through a node) and works particularly well for the Simplex Tree. Data Set 2: All experiments conducted above are for Rips complexes with d n small. We now check the extent of compression for simplicial complexes with large d n . To this aim, we look at flag complexes generated using a random graph G n,p on n vertices where a pair of vertices share an edge with probability p, and record in Table 3  Here we observe staggering values for ρ ST which increases as the simplicial complex grows larger. This is primarily because random simplicial complexes don't behave like pathological simplicial complexes (such as Examples 2 and 4) which hinder compression.

Simplex Array List
In this section, we build a new data structure which is a hybrid of ST and MxST. The Simplex Array List SAL(K) is a (rooted) directed acyclic graph on at most k d(d+1) 2 + 1 nodes with maximum out-degree d, which can be obtained by modifying MxST or can be constructed from the maximal simplices of K. We describe the construction of SAL below.

Construction
We will first see how to obtain SAL from MxST by performing three operations which we define below.
1. Unprefixing (U): Excluding the root and the leaves, for every node v in MxST with outdegree d v , duplicate it into d v nodes with outdegree 1, (one copy of v for each of its children) by starting from the parents of the leaves and recursively moving up in the tree.   R(T (U(MxST))) is the Simplex Array List. From the construction of SAL, it is clear that each node in SAL uniquely represents an edge in the simplicial complex. Figure 11 shows SAL representation of the simplicial complex given in Figure 1. We will now see an equivalent construction of SAL from its maximal simplices and it is this construction we will use to perform operations. For a given maximal simplex σ = v 0 · · · v j , associate a unique key between 1 and k generated using a hash function H and then introduce j(j+1) 2 + 1 new nodes in SAL. We build a set of j(j+1) 2 + 1 labels and assign uniquely a label to each node. The set of labels is defined as the union of the following two sets (cf. Figure 12 for an example): where ϕ denotes an empty label. We introduce an edge from node with label ( p , p , H(σ)) to node with label ( q , q , H(σ)) if and only if p = q. Additionally, we introduce an edge from every node with label ( p , j , H(σ)) in S 1 to the node with label ( j , ϕ, H(σ)) in S 2 . Thus, in SAL we represent a maximal j-simplex using a connected component containing |S 1 | + |S 2 | = j(j+1) 2 + 1 nodes and j(j 2 +5) 6 directed edges. To perform basic operations efficiently, we embed SAL on the number line such that for every i ∈ {1, 2, . . . , n}, we have an array A i of nodes which has labels of the form (i, i , z) for some z ∈ {1, . . . , k} and i ∈ {i + 1, . . . , n, ϕ}. Sort each A i based on i and in case of ties, sort them based on z.
The resultant graph obtained after removing the root in R(T (U(MxST))) is the same as the one described in the previous paragraph. Labels (as described above) for the nodes in R(T (U(MxST))) can be easily given by just looking at the vertex represented by the node, and its children.
We remark here that we use hash function H to generate keys for simplices because it is an efficient way to reuse keys (in case of multiple insertions and removals).

Some
Observations about the Simplex Array List SAL(K) has at most k d(d+1) 2 + 1 nodes. Also, for each maximal simplex of dimension d σ , the outdegree of any node in the connected component corresponding to the maximal simplex, is at most d σ . Therefore, the total number of edges in SAL(K) is at most k d 2 (d+1) 2 + d . Further, in each node we store the labels of two vertices (which requires log n bits) and a hashed value (which requires log k bits). Hence, the space required to store SAL(K) is O(kd 2 (d + log n + log k)). Also, unless otherwise stated |SAL| refers to number of edges in SAL. Since SAL is constructed from U(MxST), we have the following lemma: Lemma 6 The number of nodes and edges in SAL are both invariant over the labeling of the vertices in the simplicial complex.
Intuitively, SAL is representing K by storing all the edges of K explicitly as nodes in SAL(K) and the edges in SAL(K) are used to capture the incidence relations between simplices. More precisely, a path of length j in SAL(K) corresponds to a unique j-simplex in K. We now see that, differently from MxST, the simplices of K are all associated with paths in SAL(K). We say a path p is associated to a simplex σ if the sequence of numbers obtained by  Lemma 7 Any path in SAL(K) is associated to a simplex of K and any simplex of K is associated to at least one such path.
Proof For any path in SAL(K), it belongs to a connected component of SAL(K). In particular, there exists a maximal simplex m such that all nodes in this component are of the form (a, b, H(m)) for some a, b such that v a is a vertex of m. Consequently, all vertices read during this path belong to m, it means that the corresponding simplex is a face of m, so it belongs to K.
On the other hand, if σ = v 1 · · · v r is a simplex of K, it belongs to some maximal simplex m = v 1 · · · v dm where we have { 1 , 2 , . . . , r } ⊆ { 1 , . . . , dm }. In SAL(K), we look at the connected component associated with m. While we can associate any node with label (a, b, z) uniquely to edge a − b, we can also uniquely identify to vertex a. We associate σ to the path: for some x ∈ { r + 1, . . . , n, ϕ}. The existence of the path is confirmed because of the way we introduced edges in the connected component.
Observe that several paths can provide the same simplex since a simplex may appear in several maximal simplices. Hence, the vertices of a given simplex cannot be accessed in a deterministic way. The previous lemma together with this observation implies that SAL is a non-deterministic finite automaton (NFA). NFA are a natural generalization of DFA. The size of a NFA is smaller than that of a DFA detecting the same language, but the operations on NFA take in general more time. We demonstrate the above fact using Example 4.
Building SAL(K) can be seen as partially compressing the Simplex Tree ST(σ) associated to each maximal simplex σ (where σ and its subfaces are seen as a subcomplex). Compressing ST(σ) will lead to a subtree which is exactly the same as the transitive closure of MxST(σ). Therefore, collecting all C(ST)(σ) for all maximal simplices σ and merging the roots is the same as T (U(MxST(K))). Now applying R on T (U(MxST(K))) can be seen as an act of uncompression. We apply R once to ensure that for every node, all its children represent the same vertex and thus belong to the same A i . If R is applied multiple times then, it is equivalent to duplicating nodes (seen as an act of uncompression) to get all children of a node closer together inside A i . Next, we discuss below how to perform operations in SAL at least as efficiently as in ST.

Operations on the Simplex Array List
Let us now analyze the cost of performing basic operations on SAL (the motivation behind these operations are well described in [8]). Denote by Γ j (σ, τ ) the number of maximal simplices that contain a j-simplex τ which is in σ. Define Γ j (σ) = max τ Γ j (σ, τ ) and Γ j = max σ∈K Γ j (σ). It is easy to see that k ≥ Γ 0 ≥ Γ 1 ≥ · · · ≥ Γ d = 1. In the case of SAL, we are interested in the value of Γ 1 which we use to estimate the worst-case cost of basic operations in SAL. Membership of Simplex. To determine membership of σ = v 0 ···v dσ in K, first determine the contiguous subarrays of A 0 , . . . , A dσ , say B 0 , . . . , B dσ such that every B i contains all nodes with labels of the form ( i , i+1 , z), for some z (B i 's indeed form a contiguous subarray because of the way elements in A i were sorted). We emphasize here that we determine each B i only by its starting and ending location in A i and do not explicitly read the contents of each element in B i . Thus, if P is a projection function such that P (( i , i+1 , z)) = z then, we see each P (B i ) as a subset of To remove all such faces of σ which were previously maximal takes time at most O(d 4 σ Γ 1 ). Therefore, total time for insertion is To remove a face σ, obtain the maximal simplices which contain it (can be done through a membership query in O(d σ Γ 1 log(Γ 0 d)) time). Next, remove the above maximal simplices and then insert the facets of the above maximal simplices which do not contain σ. More precisely, for each of the above obtained maximal simplices make d σ copies of the corresponding connected component, and in the i th copy delete all nodes with label (σ i , x, y) for some x, y, and where σ i denotes the label of the i th vertex of σ. Thus, the total running time is O(d σ d 3 Γ 1 log(Γ 0 d)) = O(d σ d 3 Γ 1 log(kd)). Elementary Collapse. A simplex τ is collapsible through one of its faces σ, if τ is the only coface of σ. Such a pair (σ, τ ) is called a free pair, and removing both faces of a free pair is an elementary collapse. Given a pair of simplices (σ, τ ), to check if it is a free pair is done by obtaining the list of all maximal simplices which contain σ, through the membership query (costs O(d σ Γ 1 log(Γ 0 d)) time) and then checking if τ is the only member in that list. If yes, remove τ and insert the facets (except σ) which are now maximal after removing τ . This takes time ). Edge Contraction. Here we cannot do better than entirely rebuilding the parts of SAL corresponding to maximal simplices which contain the vertices in the edge to be contracted and therefore the cost of the operation is O(Γ 0 (d(Γ 1 log(kd)+d 2 ))), as the number of maximal simplices a vertex may be part of is at most Γ 0 (by definition) and checking if a simplex remains maximal after the edge contraction can be done through the membership query.
We summarize in Table 4 the asymptotic cost of basic operations discussed above and compare it with ST and MxST, through which the efficiency of SAL is established. Remarkably, even if k is not small but d is small then, SAL is a compact data structure as given by the lower bound in Theorem 1. This is because O(kd 2 (d + log n + log k)) bits are sufficient to represent SAL and the lower bound is met when d is fixed (as it translates to needing O(k log n) bits to represent SAL). Also, it is worth noting here that Γ 0 is usually a small fraction of k and since Γ 1 is at most Γ 0 , the above operations are performed considerably faster than in MxST where almost always the only way to perform operations is to traverse the entire tree. Indeed SAL was intended to be efficient in this regard as even if k is not small the construction of SAL replaces the dependence on k by a dependence on a more local parameter Γ 1 that reflects some "local complexity" of the simplicial complex. As a simple demonstration, we estimated Γ 0 , Γ 1 , Γ 2 , and Γ 3 for the simplicial complexes of Data Set 1 (see section 5.3). These values are recorded in Table 5.
10,000 0. 15   It is interesting to note that the size of SAL is larger than the size of C(ST) but much smaller than the size of ST. This is expected, as SAL promises to perform most basic operations more efficiently than ST while compromising slightly on size. Further our intuition, as described previously, was that Γ 0 should be much smaller than k, which is supported by the above results. Also, we note that for larger simplicial complexes such as complexes No 3 and 4, there is a noticeable gap between Γ 0 and Γ 1 . Since complexity of basic operations using SAL is parametrized by Γ 1 (and not Γ 0 ), the above results support our claim that SAL is an efficient data structure.
Local Sensitivity of Simplex Array List. It is worth noting that while the cost of basic operations are bounded using Γ 1 , we could use local parameters such as γ and Z ∆ (see previous paragraphs on Membership of Simplex and Insertion for definition) to get a better estimate on the cost of these operations. γ captures local information about a simplex σ sharing an edge with other maximal simplices of the complex. More precisely, it is the minimum, over all edges of σ, of the largest number of maximal simplices that contain the edge. If σ has an edge which is contained in a few maximal simplices then, γ is small. Z ∆ captures another local property of a simplex σ -the set of all maximal simplices that contain the edge σ ∆ . Therefore, SAL is sensitive to the local structure of the complex.

A Sequence of Representations for Simplicial Complexes
We can use the operation R to generate a sequence of data structures, each more powerful than the previous ones (but also bulkier). More formally, consider the sequence of data structures Λ , where Λ −1 = MxST, Λ 0 = U(MxST) and Λ i = R i (T (U(MxST))), for all i ∈ N. Note that Λ 1 = SAL. Further, for all i ∈ N, we will refer to the data structure Λ i by the name i-SAL (we will continue to refer to 1-SAL as SAL).
Further, we see that in the i th element of the sequence, every node which is not a leaf (sink) in the data structure corresponds to a unique i-simplex in the simplicial complex. Also for all i-SAL, i ∈ N, we have that it is a NFA recognizing all the simplices in the complex. As we move along the sequence, the size of the data structure blows up by a factor of d at each step. But in return, we gain efficiency in searching for simplices as the membership query depends on Γ i which decreases as i increases.
In section 6.4.1, we will see how to construct 0-SAL (i.e., U(MxST)) from the maximal simplices of a simplicial complex and in section 6.4.2, we will see how to construct R(R(T (U(MxST)))) = 2-SAL from the maximal simplices of a simplicial complex, and this would help to demonstrate the construction of data structures which appear later in the sequence Λ .

Unprefixed Maximal Simplex Tree
The Unprefixed Maximal Simplex Tree U(MxST) or 0-SAL is a directed acyclic graph which can be obtained by modifying MxST or can be constructed from the maximal simplices of K. We will describe the latter here. We initially have n empty arrays A 1 , . . . , A n and for every maximal simplex σ = v 0 · · · v j , associate a unique key between 1 and k generated using a hash function H and insert H(σ) in the arrays A 0 , . . . , A j . Thus determining membership of a simplex again reduces to computing set intersection and insertion and removal of simplices are performed as in MxST but here we are equipped with a faster search operation (i.e., more efficient membership query). We summarize in Table 6 the asymptotic cost of basic operations for 0-SAL and compare it with MxST.

Operation
Cost for MxST 1-SAL has two advantages over 0-SAL. First, 1-SAL stores all simplices through its paths (Lemma 7) and this may help in storing filtrations. In addition, it is likely that Γ 1 is significantly smaller than Γ 0 .

2-Simplex Array List
The 2-Simplex Array List 2-SAL(K) is a directed acyclic graph which can be obtained by modifying MxST (i.e., 2-SAL = R(R(T (U(MxST))))) or can be constructed from the maximal simplices of K. We will describe the latter here. For a given maximal simplex σ = v 0 · · · v j , associate a unique key between 1 and k generated using a hash function H and then introduce j(j 2 +5) 6 + 1 new nodes in 2-SAL. We build a set of j(j 2 +5) 6 + 1 labels and assign uniquely a label to each node. The set of labels is defined as the union of the following three sets (cf. Figure 13 for an example): where ϕ denotes an empty label. Now introduce an edge between two nodes with labels ( i1 , ( i2 , i3 ), H(σ)) and ( i4 , ( i5 , i6 ), H(σ)) if and only if i 2 = i 4 and i 3 = i 5 . Next, introduce an edge between two nodes with labels ( i1 , ( i2 , i3 ), H(σ)) and ( i4 , ( j , ϕ), H(σ)) if and only if i 2 = i 4 and i 3 = j. Finally, introduce an edge from every node with label in S 2 to the node with label in S 3 . Thus, in 2-SAL we represent a maximal j-simplex using a connected component containing |S 1 | + |S 2 | + |S 3 | = j(j 2 +5) 6 + 1 nodes. To perform basic operations efficiently, embed 2-SAL on the number line such that for every i ∈ {1, 2, . . . , n} on the number line we have an array A i of nodes which has labels of the form (i, (a, b), z) for some z ∈ {1, . . . , k} and a, b ∈ {i + 1, . . . , n, ϕ}. Sort each A i based on a and in case of ties, sort them based on b and in case of further ties sort them based on z.  2-SAL(K) has at most k d(d 2 +5) 6 + 1 nodes and, for each maximal simplex of dimension d σ , the outdegree of any node in the connected component is at most d σ . Therefore, the total number of edges in 2-SAL(K) is at most k d 2 (d 2 +5) 6 + d . Hence, the space required to store 2-SAL(K) is O(kd 3 (d + log n + log k)).
We summarize in Table 7 the asymptotic cost of basic operations for 2 -SAL and compare it with SAL. All the basic operations are performed similar to the way we did in SAL except that here we have more structure and thus searching becomes more efficient (Γ 1 is replaced by the smaller Γ 2 ) but pay extra in size because we have to maintain the additional structure.

Operation
Cost for SAL Table 7: Cost of performing basic operations on 2-SAL which is compared with cost of such operations on SAL.

The Bottom Line
A natural question to resolve is which element in Λ should one pick for representing a simplicial complex. This indeed depends on the nature of data and the type of complex. For instance, consider the case of a Rips complex whose vertex set is a good sample of a smooth manifold of low intrinsic dimension. Then, we would settle for either Λ 0 or Λ 1 as we expect Γ 0 itself to be quite low. However if the simplicial complex is of high dimension and if there are central simplices on which most maximal simplices are built on then, it might be better to look at elements higher up in the sequence as Γ might be quite high in the beginning and can collapse quickly after some point.

Labeling Dependency
In this section, we discuss how the labeling of the vertices affects the size of the data structures discussed in this paper. In particular, the size of both ST and SAL are invariant over the labeling of vertices in a simplicial complex (see Lemma 6). However, this is not the case with MxST and M(SA). To see this, consider a simplicial complex which contains a maximal triangle and a maximal tetrahedron, sharing an edge. We could label the triangle and tetrahedron as 1-2-3 and 1-2-4-5, or as 1-3-4 and 2-3-4-5 respectively. Note that the two labelings give two M(SA) (and MxST) of different sizes. In all of the hardness results we will see, the reduction will be from vertex cover for some specific graphs, where graphs are considered as 1-dimensional simplicial complexes. More formally, given a graph G on vertex set V and edge set E, the associated 1-dimensional simplicial complex is defined on the vertex set V which admits all edges in E as 1-dimensional simplices. When there is no confusion, we will refer to this simplicial complex also as G.
We observe that MxST(G) is of height 2. In layer 0 we have the root, and in layer 2 we have all the leaves (we may have some leaves in layer 1 if there are vertices in G of degree zero). Since the number of leaves in the MxST is equal to the number of maximal simplices in G which is in turn equal to the number of edges in G (plus the number of zero-degree vertices), regardless of the ordering on vertices in G, the number of nodes in layer 0 and 2 are fixed to 1 and |E| respectively. Further note that vertices on layer 1 form a vertex cover of G.
We will similarly analyze C (ST(G)). ST(G) can be obtained from MxST(G) by introducing nodes on layer 1 (and edges from the root to these nodes) such that all vertices appear in nodes of layer 1 of ST(G). This means that in ST(G), we have the root in layer 0, |V | nodes on layer 1, and |E| nodes on layer 2. We recapitulate here that the size of ST is invariant over the ordering of vertices (as can be observed above -|ST(G)| = |V | + |E|). More importantly, for 1dimensional simplicial complexes we have that |C(ST)| = |ST|. Therefore to analyze the impact of labeling on the size of C(ST), we will have to move to higher dimensional complexes (which we indeed do).

Optimal Labeling for the Maximal Simplex Tree
The size of MxST is very sensitive to the labeling of the vertices. For instance, in Example 5, by reversing the labeling of vertices, we increase the size of MxST(K) by a factor of order k.
First, we formalize the label ordering problem on MxST: Given an integer α and a simplicial complex K θ ∈ K θ (n, k, d, m), does there exist a permutation π of 1, 2, . . . , n such that |MxST(K π•θ )| ≤ α? Let us refer to this problem as MxSTMINIMIZATION(K θ , α) and from Theorem 17 of [9], we know that it is NP-Complete even for 1-dimensional complexes.

Theorem 2 ([9]) MxSTMINIMIZATION is NP-Complete.
Proof Clearly MxSTMINIMIZATION is in NP. We will now show that it is NP-Hard as well. Given a connected graph G on vertex set V (with θ being a labeling of the vertices from 1 to |V |) and edge set E, we define K θ to be the 1-dimensional simplicial complex associated to G. Since G is connected, we have that all the leaves in MxST(K θ ) appear in layer 2. Thus finding a vertex cover for G of size at most α is equivalent to finding an ordering π on the vertices in K θ (to determine which of these should appear in nodes in layer 1 of the MxST) such that |MxST(K π•θ )| ≤ α + |E|. Since vertex cover problem is NP-Hard [20], we have that MxSTMINIMIZATION is also NP-Hard. Thus MxSTMINIMIZATION is NP-Complete.

Corollary 1 CMxSTMINIMIZATION is NP-Complete.
Proof It is clear that CMxSTMINIMIZATION is in NP. We know from the proof of Theorem 2 that it is NP-Hard to decide MxSTMINIMIZATION even for pure simplicial complexes of dimension 1. We will thus show a reduction from MxSTMINIMIZATION for such simplicial complexes to CMxSTMINIMIZATION. For any pure simplicial complex K of dimension 1 under any labelling θ of its vertices, the size of MxST and C(MxST) for K θ are the same. Thus any solution for an instance of MxSTMINIMIZATION is also a solution for the same instance for CMxSTMINIMIZATION and vice versa.

Optimal Labeling for the Minimal Simplex Automaton
To prove that finding a good labeling for M(SA) is hard, we use a reduction from another instance of vertex cover for a special class of graphs. We say a graph G is square-free if, for every two vertices u, v in G, the number of common neighbors in G is at most 1.
Lemma 8 Vertex Cover problem on square-free graphs is NP-Hard.
Proof We observe that in the reduction from SAT to 3-SAT (Theorem 3.1. of [17]), every clause has exactly three distinct variables (where x andx are considered as the same variable). Next, we observe that if every clause has exactly three distinct variables then, in the reduction from 3-SAT to Vertex Cover (Theorem 3.3. of [17]), the graph constructed does not have a cycle of length four.
We will now formalize the decision problem for M(SA). Given an integer α and K θ ∈ K θ (n, k, d, m), does there exist a permutation π of 1, 2, . . . , n such that |M(SA)(K π•θ )| ≤ α? Let us refer to this problem as MSAMINIMIZATION(K θ , α). We work with square-free graphs because by using such graphs for building simplicial complexes, we would overcome scenarios in which we have two states in M(SA) with identical set of outgoing transitions but have different sets of incoming transitions.

Theorem 3 MSAMINIMIZATION is NP-Complete.
Proof It is clear that MSAMINIMIZATION is in NP. We will now show that it is NP-Hard as well. Given a square-free graph G on vertex set V and edge set E, and a labeling θ from 1 to |V | on the vertices, we define K θ to be the 1dimensional simplicial complexes associated to G. In the following paragraphs we will prove that G has a vertex cover of size at most α if and only if there exists an ordering π on the vertices of K θ such that |M(SA(K π•θ ))| ≤ α + 2.
First, we prove the forward direction. We define the height of a state as the length of the longest sequence of transitions from the initial state to that state. We define the height of an automaton as the maximum over the height of all states in the automaton. Thus M(SA(K θ )) is of height 2. At height 0 we have the initial state, and at height 2 we have a single state. Transitions from states in height 1 to height 2 correspond to the edges of G regardless of the ordering on the vertices in K θ . Note that vertices at height 1 form a vertex cover of G. Thus if G has a vertex cover of size at most α then, we can construct an ordering π on the vertices of K θ (by allowing all vertices appearing in the vertex cover to appear before the remaining vertices) such that |M(SA(K π•θ ))| ≤ α + 2. Now, we prove the reverse direction. Suppose there exists an ordering π on the vertices of K θ such that |M(SA(K π•θ ))| ≤ α + 2. If there is a state s in M(SA(K π•θ )) at height 1 which has more than one incoming transition then, it cannot have more than one outgoing transition because G is square-free. In this case, the outgoing transition of s is rewired to be the incoming transition from the initial state and the incoming transitions are rewired to be the outgoing transitions from s to the single state at height 2. Once this swapping (i.e., rewiring) is done for each state at height 1, we have ensured that the number of incoming transitions for such states is one (because the number of outgoing transitions from these states before rewiring was one). Additionally, we note that by performing the above rewiring in M(SA(K π•θ )) we have not introduced (or removed) any new states, and thus the size of M(SA(K π•θ )) has not changed (and it is computing the same language as before). Therefore, choosing the set of all labels of outgoing transitions from the initial state to states at height 1 gives a subset of the vertex set of size at most α and does indeed form a vertex cover of G. From Lemma 8 we know that vertex cover is NP-Hard for square-free graphs, which implies that MSAMINIMIZATION is also NP-Hard. Thus MSAMINIMIZATION is NP-Complete.
We believe that to obtain reasonably small sized MxST and M(SA) one has to label vertices in decreasing order of k v def = number of maximal simplices containing vertex v. Thus, in practice one may use this heuristic to find a good labeling.

Optimal Labeling for the Compressed Simplex Tree
We had observed in Section 3.2 the delicate relationship between the sizes of M(SA) and C(ST). Additionally, we have that the complexity measure of sizes for M(SA) and C(ST) are not coherent and thus, we will not be able to use Theorem 3 here to prove hardness result. On the other hand, we cannot (trivially) extend the reduction from MxSTMINIMIZATION to that of finding good labelings for C(ST) because, as stated earlier, for 1-dimensional simplicial complexes we have |C(ST)| = |ST|. Instead we append the simplicial complex (associated to) G and construct 2-dimensional complexes which we then use to prove hardness result for finding good labelings for C(ST).
Let us first formalize the decision problem. Given an integer α and a simplicial complex K θ ∈ K θ (n, k, d, m), does there exist a permutation π of 1, 2, . . . , n such that |C(ST(K π•θ ))| ≤ α? Let us refer to this problem as CSTMINIMIZATION(K θ , α). To prove the hardness result for CSTMINIMIZATION, we provide a reduction from a special instance of vertex cover problem which will be shown to be NP-hard. Specifically, we restrict vertex cover problem to a special class of graphs we call as the King-Maker graphs. A graph G is called a King-Maker graph if there exists two vertices u, v in G such that u is connected to all vertices in G (and thus we shall fondly refer to this vertex as the king) and v is of degree 1.
Lemma 9 Vertex Cover problem on King-Maker graphs is NP-Hard.
Proof Given a graph G on vertex set V and edge set E, we build a King-Maker graph G by adding two new vertices u and v, and adding an edge between every vertex in G and u, and an edge between u and v. If G has a vertex cover of size α then, G has a vertex cover of size α + 1 and vice versa.
We are now equipped to prove NP-Hardness of CSTMINIMIZATION and follow a reduction similar to that described in proof of Theorem 2 and the reduction from King-Maker graphs, helps us ensure that (i) there exists a vertex cover of smallest size which contains the king, and (ii) every vertex of the graph (except the king) appears in nodes of layer 2 of C(ST). Also, we append the simplicial complex (associated to) G by introducing a new vertex and extend G through insertion of triangles.

Theorem 4 CSTMINIMIZATION is NP-Complete.
Proof It is clear that CSTMINIMIZATION is in NP. We will now show that it is NP-Hard as well. Let G be a King-Maker graph on vertex set V and edge set E, and θ be a labeling of the vertices from 1 to |V |. We define K θ to be the 1-dimensional simplicial complex associated to G. We then introduce a new vertex v in K θ with label |V | + 1 and form maximal triangles, each consisting of v together with a maximal edge of K θ . We denote this appended K θ by K + θ . Thus, we still have the same number of maximal simplices but the dimension has increased by 1 and C(ST(K + θ ) is of height 3 (see Figure 14 for a demonstration). The rest of the proof will focus on proving the following claim: G has a vertex cover of size at most α if and only if there exists a permutation π + of the vertices of K + θ such that |C(ST(K + π + •θ )| is at most 2|V | + |E| + α. Consider a vertex cover V of G of size at most α. We construct a permutation π of the labels of the vertices of K θ so that all vertices in V appear before any other vertex in V . Further, we assume that the king is in V . This is no loss of generality since, if a vertex cover excludes the king, we can always find another vertex cover of the same size which includes the king. Further, we set the label of the king under π to 1. In C(ST(K π•θ )), we distinguish three layers. Layer 1 consists of the root, the vertices of V appear in layer 2, and all vertices but the king appear in layer 3. There are |V | edges from layer 1 to layer 2, |E| edges from layer 2 to layer 3 and |V | − |V | edges from layer 1 to layer 3. Now, we extend π to construct a permutation π + of labels of the vertices of K + θ by setting π(|V | + 1) = |V | + 1 and keeping the same labels as in π for the remaining vertices. We can see C(ST(K + π + •θ )) as adding one new node and some edges to C(ST(K π•θ )). Node with label |V | + 1 is put on layer 4 and we introduce an edge from all vertices in layers 1, 2 and 3 to this node in layer 4. Thus we have |C( To prove the other direction of the equivalence, we claim that suppose the vertices of K + θ can be labeled under a permutation π + such that the size of C(ST) is at most 2|V | + |E| + α then, we can find a vertex cover of G of size at most α. In order to find this vertex cover, we observe that the structure of an optimal C(ST) under π + will have only one node in layer 4 and this will contain the vertex v, i.e., the new vertex introduced in K θ with label |V | + 1. This is formally stated below as Claim 1. Thus, the structure of C(ST) is the one we had previously encountered and can extract the vertex cover of G by looking at the nodes on layer 2 (layer 2 can have at most α nodes since we will observe later that in an optimal C(ST), the king will appear with label 1 under π + ). We will now see that under any permutation if the label of v is not in the last position then, we can find a new permutation which leads to C(ST) of smaller size with the label of v being at the last position.
Claim 1 Given a permutation π + such that π + (|V | + 1) = |V | + 1, we can construct a new permutation ρ + which is obtained by moving |V | + 1 to the last position such that: where we see π + and ρ + as strings of length |V | + 1 obtained by their action on 1, 2, . . . , |V | + 1, and by 'moving' we mean to remove an element from its current position and insert it in the new position.
Thus, if we have a permutation π + such that |C(ST(K + π + •θ ))| < 2|V |+|E|+ α, we may assume that π + (|V | + 1) = |V | + 1 and we can select the vertex cover of G by considering the vertices on layer 2 of C(ST(K + π + •θ )). Next, we argue that in π + , we may assume π + (1) = 1 (i.e., the king gets label 1 under π + ), since otherwise, we can always move it to the first position and it does not affect the size of C(ST). It is now easy to see that the size of layer 2 is less than α as the king is on layer 2.
We know from Lemma 9 that the vertex cover problem for King-Maker graphs is NP-Hard, and this implies that CSTMINIMIZATION is also NP-Hard. Thus, we have that CSTMINIMIZATION is NP-Complete.
Proof of Claim 1 Let C(ST(K + π + •θ )) \ v denote the graph obtained if we delete all the nodes (and all entering or exiting edges incident on these nodes) containing the label of v in C(ST(K + π + •θ )). Note that C(ST(K + π + •θ )) \ v is exactly the same as C(ST(K π•θ )) whose size was invariant over π (because K is a 1-dimensional simplicial complex). Therefore, it suffices to show that the sum of the number of edges entering or leaving all nodes containing label of v in C(ST(K + π + •θ )) is at least the sum of the number of edges entering or leaving all nodes containing the label of v in C(ST(K + ρ + •θ )). Let L (resp., R) denote the set of all vertices in G whose label under π • θ appear before (resp., after) π + (θ(v)). Let ∆ be the number of edges between L and R in G. Then, we claim that |C(ST(K + π + •θ ))| − |C(ST(K + ρ + •θ ))| = ∆ ≥ 0. To see why the claim is true, let us try to analyze the position of the nodes containing label of v in C(ST(K + π + •θ )). Write L v for the label of vertex v, i.e., L v = π + (|V | + 1). If there is an edge between two nodes in R then, we will have a node with label L v in layer 2. If there is an edge between two nodes in L then, we will have a node with label L v in layer 4. Finally, if there is an edge between a node in R and a node in L then, we will have a node with label L v in layer 3. By moving the position of v to the last position, we are getting rid of the appearance of nodes with label L v from layer 2 and 3. Now, the king is either in L or in R, and in both cases, we know that there are edges from the king to every other node in L ∪ R. Therefore, the disappearance of nodes in layer 3, reduces by ∆, the number of edges because all edges between nodes in L in layer 2 and node containing label L v in layer 4, and all edges between nodes in R in layer 2 and node containing label L v in layer 4 were already existing in C(ST(K + π + •θ )).

Discussion and Conclusion
In this paper, we introduced a compression technique for the Simplex Tree without compromising on functionality. Additionally, we have proposed two new data structures for simplicial complexes -the Maximal Simplex Tree and the Simplex Array List. We observed that the Minimal Simplex Automaton is generally smaller than the Simplex Automaton. Further, we showed that the Maximal Simplex Tree is compact and that the Simplex Array List is efficient (and compact when d is fixed). This is summarized in Table 4.
The transitive closure of MxST may have a node, with as many as kd outgoing edges to neighbors containing the same label. SAL reduces the number of outgoing edges to such neighbors with the same label from kd to d, making it much more powerful. In short, it reduces the non-determinism of their equivalent automaton representation. Also, most complexes observed in practice have k to be a low degree polynomial in n. Example 4 and Lemma 4 both deal with complexes where k is small. Further, all hardness results in section 7 are for complexes of dimension at most 2. Thus, complexes where either k or d is small are interesting to study and for these cases, SAL is very efficient.
Marc Glisse and Sivaprasad in private communication let us know that they implemented SAL for Data Set 1 on some values of r, and then performed insertion and removal of random simplices, and contracted randomly chosen edges. They made the following observations: -In all their experiments (n ≈ 10000, r ∈ [0.2, 0.5]), size of 1-SAL was significantly smaller than size of ST, and in most cases ST would run out of memory. -They found that 1-SAL outperformed 0-SAL in low dimensions. However, 0-SAL performed better than 1-SAL in higher dimensions. -They modified 1-SAL by storing fewer edges and this was noted to save a factor of two in size (in dimension 30), over the 1-SAL proposed in this paper.
Therefore, it would be worth exploring for which class of simplicial complexes, i−SAL is the best data structure in the SAL family (for every i ∈ N). Trie Compression, like that of M(SA), are efficient techniques when the trie is assumed to be static. However, over the last decade, this has been extended using Dynamic Minimization -the process of maintaining an automaton minimal when insertions or deletions are performed. This has been well studied in [11] and [26], and extended to acyclic automata in [14] which would be of particular interest to us. Interestingly, it appears that in all of the works above, the finiteness of the language plays no special role and, for the specific case of SA, results may be made sharper.
Another direction, is to look at approximate data structures for simplicial complexes, i.e., we store almost all the simplices (introducing an error) and gain efficiency in compression (i.e., little storage). This is a well explored topic in automata theory called hyperminimization [21] and since our language is finite, k−minimization [6] and cover automata [13] might give efficient approximate data structures by hyperminimizing SA. We motivate this with the help of building complexes from a random sample of a large data set. By sampling we are bound to lose information and, instead of taking a random sampling we can look at constructing hyperminimized SA over the entire data set dynamically. It will be interesting to know if the power of randomness can overcome 'smart' approximations.
Theorem 3 can be generalized to give the following hardness result: Given a word w on alphabet set Σ and lexicographic ordering θ on Σ, let L θ be an operation which removes all duplicate letters in the word and rearranges the letters of the word in lexicographic order given by θ. Given a language L on alphabet set Σ, we define L θ (L) = {L θ (w) | w ∈ L}. Therefore with these definitions, we give the following general result: Theorem 5 Given a finite language L (explicitly through the words in L) on alphabet set Σ and an integer x, it is NP-Hard to decide if there exists an ordering θ on Σ such that the size of the smallest DFA recognizing L θ (L) is less than x.
Theorem 4 and 5 provide a new dimension to the hardness results obtained by Comer and Sethi in [12]. It would be worth exploring this direction further. Also, it would be interesting to find approximation algorithms for MSAMINIMIZATION.
Performance of i-SAL depends on the value of Γ i -are there any interesting bounds on Γ i for some subset of nice simplicial complexes of K(n, k, d, m)? Finally, proving better bounds on extent of compression remains an open problem and may be geometric constraints will eliminate pathological examples which hinder in proving good bounds on compression.

A Adapted Hopcroft's Algorithm
We precisely describe here Hopcroft's algorithm adapted to the compression of ST to provide as output C(ST). The idea is to write the Simplex Tree as the Simplex Automaton: each vertex of the tree becomes a state in the automaton. Then, one just needs to reduce the Simplex Automaton using Hopcroft's algorithm and finally obtain the compressed Simplex Tree by partitioning the states of the Minimal Simplex Automaton. We see in Figure 4, the compressed Simplex Tree of the simplicial complex described in Figure 1. Pop one element (C, v) in S. 8: for each B ∈ P such that there exists n 1 and n 2 in B such that there is an edge in T from n 1 to a node of C labelled by v, and it is not the case for n 2 do 9: B ← {n ∈ B|there is an edge from n to a node in C labelled by v} 10: B ← {n ∈ B|there is no edge from n to a node in C labelled by v} 11: Replace B by B and B in P. 12: for w ∈ V do 13: if (B, w) ∈ S then 14: Replace (B, w) by (B , w) and (B , w) in S. Pop an element (B, w) in V. 28: for v ∈ V do 29: Let b be an element in B. \* It will be a representative of B.

30:
Let a be (if it exists) the node in T reached from b by reading v.

31:
Let A be the part in P which contains a.

B.1 Identifying the Maximal Cofaces of a Simplex
As seen in section 4, a simplex σ ∈ K is implicitly stored in MxST(K) as a face of its (at most k) maximal cofaces. Identifying the maximal cofaces of a simplex means to find the leaves of MxST(K) that contain the maximal cofaces of σ and also to find, on each path from the root to such a leaf, the location of the vertices of σ.
We formalize this by first defining a bijection f from the set of all maximal simplices of K to the set of all leaves in MxST(K) and also define a function g that maps every simplex σ ∈ K to the set of all maximal simplices in K which contain σ (thus if f (σ) = ∅ then σ / ∈ K). For simplicity, we will denote f (g(σ)) by L(σ) and |L(σ)| by kσ from now on. Since identifying a simplex σ reduces to traversing MxST(K), this operation costs O(kdT MxST ) = O(kd log n).

B.2 Insertion
Let σ be a simplex not in K and let K be the complex obtained by adding σ and its subsimplices to K. Observe that σ is necessarily maximal in K and write dσ for the dimension of σ. We describe how to insert σ in MxST. We first check if there exists maximal simplices in MxST(K) that are contained in σ. This can be done in O(kdσT MxST ) time, by looking at the MxST truncated to depth dσ. If such simplices exist, we will need to delete them before inserting σ, which takes time at most O(kdσT MxST ) (see analysis of step 3 of Algorithm 2). Then, we insert σ in MxST. This takes at most O(dσT MxST ) time, which is significantly better than the time taken for the Simplex Tree, which needs O(2 dσ T MxST ) time. We conclude that the time for inserting σ is O(kdσT MxST ) = O(kdσ log n).

B.3 Removing a Face
Given a simplex σ, we have to remove it (and its cofaces) from the MxST. We can perform the operation of removing simplices (the simplex and its cofaces) as described in Algorithm 2.