Complexes of Tournaments, Directionality Filtrations and Persistent Homology

Complete digraphs are referred to in the combinatorics literature as tournaments. We consider a family of semi-simplicial complexes, that we refer to as"tournaplexes", whose simplices are tournaments. In particular, given a digraph $\mathcal{G}$, we associate with it a"flag tournaplex"which is a tournaplex containing the directed flag complex of $\mathcal{G}$, but also the geometric realisation of cliques that are not directed. We define several types of filtrations on tournaplexes, and exploiting persistent homology, we observe that flag tournaplexes provide finer means of distinguishing graph dynamics than the directed flag complex. We then demonstrate the power of these ideas by applying them to graph data arising from the Blue Brain Project's digital reconstruction of a rat's neocortex.

The idea of this article arose from considering topological objects associated to digraphs. Given a digraph G, one may associate with it the directed flag complex [13], that is, the complex whose simplices are the directed cliques in G. The directed flag complex was used successfully in [13] as a way of gaining information about structural and functional properties of the Blue Brain Project reconstruction of the neocortical microcircuitry of a juvenile rat [8]. However, this construction raises two natural problems. The first is that, while edge orientation is used in the construction of the complex, it is neglected completely in performing computations such as homology or homotopy type on the complex. A second problem is that the directed flag complex does not give a proper topological representation to cliques that are not directed, i.e. those cliques whose vertices are not linearly ordered via the orientation of their edges.
Complete digraphs are referred to in the combinatorics literature as tournaments. Tournaments have been studied since the 1940's by many authors from an applicable point of view [1,4,10,5], as well as theoretically [9]. Tournaments naturally lend themselves to be considered as standard simplices, since an induced subgraph of a tournament is clearly also a tournament. This lead us to the idea that there is a natural family of complexes that are built out of tournaments. We refer to such complexes as tournaplexes. The directed flag complex of a digraph, and in fact any ordered simplicial complex is in particular a tournaplex. By analogy to the flag complex of a graph and the directed flag complex of a digraph, we introduce the flag tournaplex associated to a digraph. The flag tournaplex of a digraph G contains the directed flag complex of G as a subcomplex, as well as other naturally occurring subcomplexes.
The number of non-isomorphic tournaments clearly grows extremely fast with the number of vertices, and we are not aware of a complete invariant that classifies them up to isomorphism. One simple numerical invariant is the directionality of a tournament, a concept first used in [13] and will be developed further here. In this paper we define three types of directionality, two that are local in nature and do not depend on an ambient tournaplex the tournament is a part of, and a third that does depend on the containing tournaplex. Directionality divides tournaments into equivalence classes, and will allow us to define filtrations on tournaplexes. Thus a natural algebraic invariant one can use to study topological properties of tournaplexes is persistent homology [2]. Combining these concepts provides an interesting family of spaces that naturally lend themselves to applications in neuroscience, network theory, and in general any subject that involves digraphs.
After introducing the concept of a tournaplex in Section 1, we proceed in Section 2 by defining several types of directionality. We mainly discuss three types: local directionality, 3-cycle directionality and global directionality. We concentrate on the first two, which are closely related to each other, as demonstrated in Proposition 2.3. We then discuss some basic properties of local and 3-cycle directionality, and in particular derive in Proposition 2.10 a probabilistic formula for the expectation of tournaments of a given order (number of vertices) and local directionality in a random digraph. We then observe that each isomorphism type of a tournament gives rise to a directionality invariant on tournaplexes. This is similar to the idea behind 3-cycle directionality, which is basically an invariant that associates with a tournament the number of regular 3-tournaments it contains.
In Section 3 we show how directionality can be used to define three types of filtrations on tournaplexes. In particular we produce simple examples that show the potential these filtrations have to distinguish tournaplexes with the use of persistent homology in cases where the homotopy types of the corresponding geometric realisations are identical. In particular we observe that different directionality filtrations can be used in conjunction to achieve a greater separation power among tournaplexes. Furthermore, the variety of directionality filtrations on tournaplexes suggests the possibility of associating multidimensional persistence modules to them. This of course raises the question whether a multi-dimensional persistence module may contain more information about the tournaplex than each of the filtrations used to create it individually. We demonstrate by means of a simple example two 8-tournaments whose local directionality filtration and 3-cycle filtration each give isomorphic 1-dimensional persistence modules, while taken together they are distinguished by their corresponding 2-dimensional persistence modules.
Finally in Section 4 we give two examples of applications, where we use the flag tournaplex of a digraph and the associated local directionality filtration as a classifier of certain families of graphs.
The first family is one of random graphs generated by a specific regime that depends on two parameters p and q. We show that applying the method to 200 such random graphs with a fixed value of p and four different values of q, we obtain an almost perfect separation of the graphs into four families using a technique as simple as k-means clustering. This is used as a test case, which shows that the technique we develop here is indeed sensitive to network structure.
A second example is taken from data that was generated by the Blue Brain Project for the paper [13]. Here we have response signals of a digital reconstruction of neocortical tissue of a rat [8] to a collection of stimuli that depend on two parameters and appear in 5 seeds (repeats of the same experiment). This gives 45 spike train datasets, which we then use to generate a family of 450 tournaplexes. Once more, k-means clustering is applied to separate the signals almost perfectly with respect to one of the two parameters and across all seeds. In both cases we compare the performance of this technique to that of a similar approach using only the Betti numbers of the corresponding directed flag complex (as was done, using a much larger spiking dataset and without an attempt at classification, in [13]), and observe that using tournaplexes with local directionality filtration gives much better results.
Most of our computations were carried out by purpose designed modification of the software package Flagser [7], designed for computation of persistent homology of directed flag complexes. The package which we named Tournser is designed specifically for the computation and manipulation of flag tournaplexes associated to digraphs. Flagser and Tournser are freely available at [6] and [15], respectively, and interactive online versions are available at [17] and [16].
As a "spin-off" project, the first named author investigated the homotopy types that may arise as directed flag complexes associated to tournaments. He showed in particular that this gives an invariant of tournaments that provides a finer partition within a given directionality class of tournaments [3]. The methods in this paper were instrumental in finding the example in Section 3 demonstrating that a multi-parameter persistence module of tournaplexes associated to two or more directionality invariants can be more informative than the the corresponding 1-dimensional modules associated to each of them separately.
The authors acknowledge support from EPSRC, grant EP/P025072/ -"Topological Analysis of Neural Systems", and from École Polytechnique Fédérale de Lausanne via a collaboration agreement with the second named author.

Tournaments and Tournaplexes
We start by defining the basic objects of study and some of their properties. Definition 1.1. An n-tournament is a complete graph on n vertices, in which every edge has an orientation. If Γ n = (V, E) is a complete graph on n vertices, then the structure of a tournament is determined by an injective orientation function where ∆ V is the diagonal.
We will typically write σ = (Γ n , δ) to denote an n-tournament, or simply use Greek letters such as σ, τ , etc., without reference to the orientation function, unless needed for clarity. If e is an edge in a tournament σ, with δ(e) = (v 1 , v 2 ), we say that v 1 is the source of e and v 2 is the target of e. We will sometimes say that an n-tournament σ is an odd tournament or an even tournament according to n being odd or even. Definition 1.2. An n-tournament σ is said to be transitive if, considered as a digraph, it represents a total ordering on its vertex set. An n-tournament is said to be semi-regular if for each vertex v ∈ σ its in-degree and out-degree differ by at most 1. An n-tournament is said to be regular if for each vertex v ∈ σ its in-degree and out-degree are equal.
Clearly a regular tournament must be odd, and a regular tournament is always semiregular. A tournament containing a vertex whose out-degree and in-degree differ by exactly one must be even.
Let σ = (Γ n , δ) be an n-tournament. Then the restriction of δ to any induced subgraph of Γ ⊆ Γ n is an orientation function δ on Γ . Hence σ = (Γ , δ ) is a sub-tournament of σ with fewer vertices. Such sub-tournaments will be referred to as the faces of σ.
We can now define complexes built out of tournaments in a way that is totally analogous to the definition of an ordinary abstract simplicial complex. Definition 1.3. A tournaplex is a collection X of tournaments, such that if σ ∈ X and σ is a face of σ, then σ ∈ X.
If X is a finite tournaplex, then the dimension of X is the largest integer n, such that X contains at least one (n + 1)-tournament and no k-tournaments for k > n + 1. Thus we will sometimes refer to (n + 1)-tournaments as n-dimensional.
1.1. Geometric realisation. One may think of tournaplexes abstractly as in Definition 1.3. It is also possible to associate a topological space, a chain complex and homology with a tournaplex. To do so, the simplest way is to think of tournaplexes as semi-simplicial sets.
Let X be a tournaplex. Let X n denote the set of all (n + 1)-tournaments in X. As a semi-simplicial set, the elements of X n are the n-simplices of X. To define face operators, fix a total order on the set of vertices X 0 . Then for every tournament σ ∈ X, the vertices of σ inherit a total order, which is compatible with taking faces. Thus we obtain for all n > 0 face operators ∂ i : X n → X n−1 , where 0 ≤ i ≤ n, satisfying the usual simplicial face relations. The geometric realisation of a tournaplex is defined to be the geometric realisation of the corresponding semi-simplicial set. Clearly, up to isomorphism of semi-simplicial sets, this does not depend on the choice of total ordering on X 0 . The chain complex of X and its homology are simply the usual chain complex and homology of the corresponding semisimplicial set.
We proceed with some naturally occurring examples.
Example 1.4. Let X be an abstract simplicial complex, and let X 1 denote the collection of its 1-simplices. Fix an arbitrary orientation on each simplex τ ∈ X 1 . Thus every simplex σ ∈ X inherits an orientation function which turns it into a tournament, and turns X into a tournaplex. Notice that the homeomorphism type of the geometric realisation of the resulting tournaplex is independent of the choice of orientations on the 1-simplices. It is in fact just that of the original simplicial complex. Example 1.5. Let X be an ordered simplicial complex, i.e. a collection of finite ordered sets that is closed under subsets. Then each ordered simplex σ ∈ X can be thought of as a transitive tournament. Hence ordered simplicial complexes are special cases of tournaplexes in which every tournament is transitive. Definition 1.6. Let G be a digraph. The flag tournaplex associated to G is the tournaplex tFl(G), whose n-simplices are the subgraphs of G that are (n + 1)-tournaments.
The directed flag complex associated to a digraph G is the ordered simplicial complex dFl(G) whose simplices are the transitive tournaments in G. Thus dFl(G) ⊆ tFl(G), where equality holds if and only if every tournament in G is transitive. Moreover, if G has no reciprocal edges then tFl(G) is isomorphic to the flag complex of the underlying undirected graph.
We end this section with a comment on the number of tournaments up to digraph isomorphism. In low dimensions the numbers are small: the number of non isomorphic tournaments on 2, 3, 4 and 5 vertices is 1, 2, 4, and 12, respectively. However the numbers grow rapidly with dimension with nearly 200,000 non isomorphic tournaments on 9 vertices and nearly 10 million of them on 10 vertices. It is clear therefore that it may be useful to find invariants that can divide tournaments into a relatively small number of classes in a meaningful way. This is what we aim to do in Section 2.

Directionality invariants of tournaments
Given a digraph G = (V, E), one may associate with each vertex v ∈ V its signed directionality. This allows us to define certain integer valued functions on the set of simplices of a tournaplex. This in turn gives natural ways of filtering tournaplexes, and as such they become natural candidates for analysis by means of techniques of persistent homology.
ii) Define the directionality of U relative to G by Let U be a finite set, and let RU be the real vector space generated by U , and let RU * be the dual space of linear functionals RU → R. Equip RU * with an inner product defined by for α, β ∈ RU * . If U is the vertex set of a digraph G, then the functions indeg, outdeg and sd can be extended to functionals indeg G , outdeg G , sd G ∈ RU * , and Dr G (U ) = (sd G , sd G ). In the norm on RU * defined by the inner product, Dr G (U ) is the square length of the functional sd G , or equivalently the square distance between the functionals indeg G (U ) and outdeg G (U ).
Clearly, if f : G → H is an isomorphism of digraphs, and W = f (U ), then sd G (U ) = sd H (W ) and Dr G (U ) = Dr H (W ). We now use these constructions to define graph invariants on tournaments. Figure 1. A digraph consisting of two 5-tournaments "glued" along a 1-face. The flag tournaplex (Definition 1.6) of this graph consists of two 4-simplices glued along an edge, and as such is contractible. By contrast, the directed flag complex of the graph has the homotopy type of a wedge of two circles and a 2-sphere. However, the topology of the directed flag complex that is embedded in the flag tournaplex can be revealed using the 3-cycle filtration (see Section 3). Definition 2.2. For any n-tournament σ in a graph G, let V σ denote the vertex set of σ, and define: ii) 3-cycle directionality: Let c 3 (σ) denote the number of regular 3-sub-tournaments in σ.
iii) Global directionality: Notice that local directionality and the 3-cycle directionality are both invariants of a single tournament, independent from the ambient graph containing it. Global directionality on the other hand takes into account the general connectivity of the ambient graph. Next, we observe that the local directionality of a tournament is strongly related to its 3-cycle directionality.
Proposition 2.3. Let σ be an n-tournament. Then Proof. For n = 3 the tournament σ is either transitive or regular. In the first case Dr(σ) = 8 and in the other Dr(σ) = 0. Thus the claim follows. Proceed by induction on n. Assume (1) holds for all (n − 1)-tournaments and prove for n-tournaments. Choose a vertex v 0 ∈ σ, and let σ denote the face of σ corresponding to removing v 0 . We split the vertices V σ of σ into two parts: Define σ in to be the subgraph of σ induced by V in , and let σ out be the subgraph induced by V out . Let σ in−out be the subgraph with vertex set V σ , and whose edges are incident to one vertex in V in and the other in V out . Now, write: Note that v∈V X sd X (v) = 0 for any graph X with vertex set V X , since this is equivalent to sum of all in-degrees minus the sum of all out-degrees. So we can rewrite the second and third term as follows: where |V in ||V out | arises as the number of all edges in σ in−out and is the number of edges v 1 → v 2 with v 1 ∈ V in and v 2 ∈ V out . Therefore, Using the inductive hypothesis, this simplifies to Finally, observe that is precisely the number of regular 3-tournaments in σ that are not already present in σ , and the proof is complete.
Note that Proposition 2.3 can be derived from the first corollary to [9,Theorem 4]. However, we include the above proof as we feel it gives a simpler combinatorial understanding of the link between local directionality and the 3-cycle directionality.
with equality obtained if and only if σ is transitive.
Corollary 2.5. Let σ be an n-tournament, and let σ be a face of codimension 1. Then Proof. Let σ be an (n − 1)-face of σ, and let v 0 ∈ V σ be the vertex not present in V σ . Partition V σ into two disjoint subsets V in and V out , where V in contains the vertices v ∈ V σ such that the edge between v 0 and v is oriented towards v, and , that is, the number of directed 3-cycles in σ that are not in σ , is obtained if every edge between a vertex v ∈ V in and a vertex v ∈ V out is oriented from v to v , and that number is (n − 1 − ) = − 2 + (n − 1) . This quadratic function of obtains its maximum exactly when = n−1 2 , and so the maximal number of directed 3-cycles that can appear in σ and are not present in σ is n−1 2 2 .
Example 2.6. If σ is an n-tournament and τ is a k-face of σ, then it is not true in general that Dr(τ ) ≤ Dr(σ). For instance a regular 3-tournament has local directionality 0 but each of its 2-faces has local directionality 2. Similarly a semi-regular 4-tournament has local directionality 4 but has two 3-faces with local directionality 8.
One natural question in view of Proposition 2.3 is whether every number that can theoretically appear as the local directionality of a tournament, is indeed realisable as such. The answer to this question follows from three theorems by Kendall and Babington-Smith in their 1940 paper [4, 8.(1)-(3)]. Using our terminology these results read as follows: ii) For any integer k between 0 and the upper bounds in i), there exists at least one ntournament σ such that c 3 (σ) = k.
Corollary 2.8. For each pair of non-negative integers n and k, where k is at most as large as the bounds in Theorem 2.7, there exists at least one n-tournament σ such that Corollary 2.9. For any n ≥ 0 there exists an n-tournament σ of minimal local directionality that is regular if Dr(σ) = 0 (n odd) and semi-regular if Dr(σ) = n (n even).
2.1. Distribution of tournaments in digraphs by directionality. The motivation for introducing tournaplexes is the idea that tournaments are basic building blocks in a geometric object that can be associated to a digraph. Rather than ignoring edge orientation and considering the ordinary flag complex, or neglecting cliques that are not linearly ordered and considering the directed flag complex, the flag tournaplex allows us to consider all tournaments as simplices, and as such forms a topological object that is richer in structure, and better informing about properties of the digraph in question. However, the vast number of isomorphism types of tournaments in higher dimensions makes using them as individual data units quite impractical. We have thus introduced directionality as one way of taking advantage of general tournaments, without the constraints imposed by the large number of isomorphism types.
To demonstrate the potential of tournaments to inform on network structure, we examined a number of networks, and recorded the distribution of tournaments by local directionality in Figure 2. In particular the probability of each possible value of directionality of a random tournament in a fixed dimension is known up to n = 10, by calculations of Alway [1] and Kendall and Babington-Smith [4]. More generally it was shown by Moran [10] that the distribution of the number of 3-cycles in a random n-tournament tends to normal for n sufficiently large (see also [9,Theorem 6]). All these results are stated in terms of the number of 3-cycles in a tournament.
Let T n,j be the number of all n-tournaments σ on a fixed vertex set, such that c 3 (σ) = j. One can compute the distribution of local directionality in n-tournaments and T n,j recursively [1]. The following gives the said distributions for n ≤ 5. Using T n,j we can express the expected number of tournaments of various 3-cycle directionalities in Erdős-Rényi graphs.
Proposition 2.10. Let G be a directed Erdős-Rényi graph with n vertices and connection probability p. Let X k be the total number of k-tournaments that occur in G and let X k,j be the total number of k-tournaments containing exactly j 3-cycles that occur in G. Then the expected values of X k and X k,j are given by the formulas Proof. First note that the number of all possible k-tournaments on an n-vertex set is given by as each one is obtained by choosing k out of n vertices and then orienting each of the k 2 edges in one of two possible ways.
The number of all possible k-tournaments on an n-vertex set containing exactly j 3-cycles is given by n k T k,j , as we have to choose k vertices and then by definition T k,j is the number of tournaments on that vertex set containing exactly j 3-cycles.
Now, any specific k-tournament σ will occur in G with probability , as it has exactly k 2 edges, each of which occurs independently with probability p. Let Y σ be the random variable which takes value 1 if σ occurs in G and 0 otherwise. It follows that . Note that X k is just the sum of Y σ over all possible k-tournaments σ. Similarly, X k,j is the sum of Y σ over all possible k-tournaments σ containing exactly j 3-cycles. Therefore, the result follows by linearity of expectation.
We can consider T k,j as the theoretical distribution of k-tournaments σ with c 3 (σ) = j. In Figure 2 we show the distribution of tournaments in all values of local directionality in a number of sample networks. Notice the rather accurate estimates in the case of Erdős-Rényi graphs. It is also worth noticing how close the distribution of local directionality values is between the connectivity graph of C. Elegans [18] and that of the Blue Brain Project microcircuit simulating a section of the neocortex of a rat.

Filtrations
In this section we discuss three different ways to define a filtration on a tournaplex using the idea of directionality.
Let K be a tournaplex with vertex set V . An increasing filtration on K is an increasing sequence of sub-tournaplexes An increasing filtering weight function on K is a function W : K → R with the property that if σ is a tournament in K and σ ⊆ σ is a face, then W (σ ) ≤ W (σ). Similarly one defines decreasing filtrations and decreasing filtering weight functions.
An increasing filtering weight function W on a tournaplex K naturally gives rise to increasing filtrations on K as follows: Fix an increasing sequence of real numbers r 1 < r 2 < · · · < r n−1 . Set F 0 (K) = ∅, F n (K) = K, and Similarly a decreasing filtering weight function gives rise to a decreasing filtration on K. If the weight fucntion on K is a step function, the one has an obvious choice for the sequence defining the filtration, namely the sequence of all possible values of the fucntion in increasing order. We now use local, 3-cycle and global directionality as ways of defining filtrations on any tournaplex.
We start with local directionality. As pointed out in Example 2.6, it is not generally the case that if σ is a tournament and τ is a face of σ, then Dr(τ ) ≤ Dr(σ). Thus one is led to make the following definition.
Definition 3.1. Let K be a tournaplex. For each n-tournament σ ∈ K define the local directionality weight of σ to be W Dr (σ) def = Dr(σ) + 2 n 3 .
Lemma 3.2. Let K be a tournaplex and let W Dr : K → N be the local directionality weight function. Then W Dr defines an increasing filtration on K.
Proof. It suffices to show that if σ is an n-tournament for n > 2 and τ ⊆ σ is a face of codimension 1, then W Dr (τ ) ≤ W Dr (σ). By Proposition 2.3 and Corollary 2.5 The claim follows.
Notice that it is possible for an n-tournament σ to have a face τ of codimension larger than 1, whose directionality is larger than that of all codimension 1 faces. This justifies adding the maximal possible directionality of a codimension 1 face to the local directionality in order to create a filtration. See Figure 3 for such an example.  Clearly if σ is a tournament and τ is a face of σ, then c 3 (τ ) ≤ c 3 (σ), and hence this defines a filtration on any tournaplex. Observe that tournaplexes may be naturally filtered in many other ways that are similar to the 3-cycle filtration. For instance, if K is a tournaplex, define W T : K → R by letting W T (σ) be the number of transitive 3-tournaments in σ. Pushing this idea further, one can consider any fixed (small) tournament τ , and filter K by the number of times τ appears as a face in each σ ∈ K. This automatically yields a filtration, and relates nicely to well known approaches that regard the prevalence of certain motifs in networks as a determining factor in the emerging dynamics (see for instance [14]). By Proposition 2.3, the 3-cycle weight function and the local directionality weight function on an arbitrary n-tournament σ are related by the formula: However, these two functions are far from inducing similar filtrations. The local directionality filtration starts with the vertices of the tournaplex in question, proceeds by adding all edges and then adds on tournaments of higher dimension according to their local directionality. By definition, transitive tournaments are added in the local directionality filtration one dimension at a time. By contrast, the 3-cycle filtration starts with the subcomplex of transitive tournaments and proceeds by adding on tournaments with increasing number of 3cycles. In Figure 4 we have four digraphs whose flag tournaplexes realise the same homotopy type, but which are distinguished by the associated persistence diagrams with respect to local directionality filtration. Similarly it is easy to see that each of the four digraphs contains a different number of 3-cycles, and hence they are also distinguished by their persistence diagrams corresponding to their 3-cycle filtration. There are however examples of graphs that cannot be distinguished by local directionality or 3-cycle filtration, as in Figure 5.
Definition 3.4. Let K be a tournaplex. For each tournament σ ∈ K, define the global directionality weight of σ to be W K (σ) = Dr K 1 (V σ ) = v∈Vσ sd K 1 (v) 2 , where K 1 is the 1-skeleton of K considered as a digraph.
The global directionality weight function is clearly an increasing filtering function and as such induces an increasing filtration on a tournaplex. Its properties are quite different Figure 4. Four non-isomorphic digraphs and their local directionality filtrations reflected in their persistence diagrams. The signed degree of each vertex in each digraph is 0. Hence the global directionality filtration cannot distinguish these graphs. H 0 , H 1 and H 2 are denoted in the diagrams by blue, orange and red dots, respectively, and the numbers next to some dots correspond to rank. All four tournaplexes have the homotopy type of a 2-sphere. These graphs can however be distinguished by the homotopy type of their directed flag complexes.
from the local and the 3-cycle directionality functions in that any positive integer value can be achieved as the global directionality of a tournament in some digraph. See Figure 5 for an example of some digraphs whose flag tournaplexes can be distinguished by the global directionality filtration, but not by the local or the 3-cycle filtrations. On the other hand, the digraphs in Figure 4 cannot be distinguished by global directionality.
The multitude of directionality filtrations on tournaplexes suggest that two or more of them can be used in conjunction to create associated higher dimensional persistence modules. We examined this idea with respect to local directionality and 3-cycle filtrations. Let G 1 and G 2 be the 8-tournaments depicted in Figure 6. The flag tournaplexes tFl(G 1 ) and tFl(G 2 ) have identical 1-dimensional persistence modules with respect to 3-cycle directionality filtration, which can be seen in the bottom row of Figure 3.1, and with respect to local directionality filtration which is given by the following: where X is tFl(G i ) with local directionality filtration, for i = 1, 2. However taking the two filtrations together yields two distinct 2-dimensional persistence modules. Considering the Figure 5. Four non-isomorphic digraphs and their global directionality filtrations. The numbers on the vertices denote the corresponding squared signed directionality, and the chart below each digraph is the persistence diagram corresponding to the global directionality filtration on the corresponding tournaplex. H 0 , H 1 and H 2 are denoted in the diagrams by blue, orange and red dots, respectively. The numbers next to some dots correspond to rank. Each 3-tournament in all four tournaplexes is transitive. Hence these graphs cannot be distinguished by local directionality filtration or by 3-cycle filtration. 7 Figure 6. The two tournaments G 1 (left) and G 2 (right), whose 2Dpersistence module is given in Figure 3.1. With their common edges shaded grey, and differing edges in black.
bifiltration of the geometric realisation of each tournaplex, and applying the homotopy theoretic techniques used in [3], we were able to compute the homotopy types of each bifiltration pair which are displayed in Figure 3.1. The difference between tFl(G 1 ) and tFl(G 2 ) reveals itself in bifiltration (44, 3).

Applications
The flag complex associated to a graph reveals higher order properties of the graph as they are encoded in its topology. Similarly, the directed flag complex does the same for digraphs. However, as already pointed out, the directed flag complex "sees" tournaments  Table 3.1. The homotopy types of all bifiltration stages of tFl(G 1 ) and tFl(G 2 ). Here * n represents the disjoint union of n points, whereas m n represents the wedge of n copies of the m-sphere. The homotopy types of tFl(G 1 ) and tFl(G 2 ) are in red and blue, respectively, and in black when they are the same.
that are not transitive in the graph only by neglecting them, and as such they may or may not be expressed as homology classes in the resulting complex. We introduced the flag tournaplex, motivated exactly by the idea that it will contain more information about the digraph in question than the directed flag complex. This point is clear even without any empirical evidence since in any tournaplex X, the subcomplex of transitive tournaments appears as the 0-th stage in the 3-cycle filtration. Thus if X is a flag tournaplex, then any higher filtration can only add on the information present in the directed flag complex. In this section we demonstrate by several examples that this is indeed the case.
We consider the flag tournaplexes arising from two data sets. The first is a set of directed Erdős-Rényi type digraphs, and the second is a collection of activity simulation data from the Blue Brain Project that was used in [13]. In both cases we consider a set of digraphs divided into subsets by some known parameters, and examine the capability of the topological metrics one can associate to flag tournaplexes with the local directionality filtration to cluster the data into distinct classes, and compare the performance to that of the metrics associated to the directed flag complex.
Given a collection G of digraphs we wish to partition these graphs into groups of graphs with similar properties. In order to do this we must first map each graph G ∈ G to a feature vector V (G) of length k for a suitable positive integer k. We shall produce such a vector by two methods. The first is based on a computation of the Betti numbers of directed flag complexes of the graphs in question. The second uses the persistent homology of the flag tournaplex tFl(G) with the local directionality filtration. Each method produces a matrix with as many rows as the number of graphs to be clustered and k columns. The rows of these matrices are fed into a k-means clustering algorithm to produce our results, as explained below.

4.1.
Erdős-Rényi type digraphs with varying local directionality distributions. This is a data set of random graphs denoted G(n, p, q) where n is the number of vertices, indexed 1, . . . , n, and p and q are probability parameters. An instantiation of G(n, p, q) is generated by adding a directed edge (i, j) with probability We constructed 50 instantiations in 4 groups with n = 250, p = 0.25 and q = 0, 0.025, 0.05 and 0.075, a total of 200 graphs, which we denote by G ER . To check that this procedure achieved different distributions of local directionality, we computed the average distribution by dimension and directionality. The result is summarised in Figure 7. We then applied Algorithm 1 to produce the matrix V 6 T (G ER ).

2:
Compute persistent homology T (G i ) of tFl(G i ) with respect to W Dr for all G i ∈ G

3:
Set T = n i=1 T (G i ), and fix an arbitrary ordering t 1 , . . . , t r on its elements

4:
Set M = (m i,j ) as the n × r matrix with m i,j = N G i (t j )

5:
Compute the standard deviation of each column of M (considered as a set of integers)

6:
Let C 1 , . . . , C k be the k columns with the largest standard deviation 7: Return the n × k matrix V k T (G), given by concatenating the columns C 1 · · · C k Let V 6 β (G ER ) denote the matrix where the i-th row is the vector V 6 β (G i ) def = [β 0 , β 1 , . . . , β 5 ] of Betti numbers of the directed flag complex of G i ∈ G ER . Next, we applied k-means clustering to the rows of each of the matrices V 6 T (G ER ) and V 6 β (G ER ), using python package scikitlearn [11]. The results are displayed in Figure 8. Comparing the results to the distribution of directionalities in Figure 7, one notices that the distribution of transitive tournaments remains roughly the same regardless of q. Hence, it is to be expected that the Betti numbers of the directed flag complex will perform poorly in clustering the four families, which is indeed the case. By contrast, the associated tournaplexes, filtered by local directionality give almost perfect separation, which is particularly remarkable in the cases q = 0.05 and q = 0.075 that give very similar distributions in Figure 7. This demonstrates that the topology of the tournaplex holds more information about the orientation of the edges in a digraph, compared to the directed flag complex.  We select k = 6 in this computation for two reasons. Firstly, the Betti numbers are always zero for dimension 6 and above in the directed flag complex. Secondly, for k-means clustering to give reliable results we require that the size of the vectors to be clustered is significantly smaller than the size of the data set. Also, we use k-means clustering as it is a simple well known technique, but we get similar results using decision tree learning or linear discriminant analysis.  Figure 8. The cluster assignment of k-means clustering applied to the columns of the matrices V 6 T (G) (top) and V 6 β (G) (bottom), where G is a set of 200 directed Erdős-Rényi type graphs with parameters p = 0.25 and varying q. The four colours represent the different clusters, each row corresponds to a different value of q.

4.2.
Brain activity simulation digraphs. The data in this example was taken from Blue Brain Project's reconstruction of the neocortical column of a juvenile rat [8]. The same Compute transmission-response graphs G i j def = G D i j with parameters {t 1 , t 2 }

5:
Compute persistent homology T (G i j ) of tFl(G i j ) with respect to W Dr

6:
Set T = ∪ i,j T (G i j ) and fix an arbitrary ordering t 1 , . . . , t l on its elements 7: Let M be the concatenation of the matrices M 1 , M 2 , . . . , M L/t 1

9:
Compute the standard deviation of each column of M (considered as a set of integers) 10: Let C 1 , . . . , C m be the m columns with the largest standard deviation 11: Return the n × m matrix V m T (D) given by concatenating the columns C 1 · · · C m data set was used in [13] to demonstrate the capability of the homology of the directed flag complex to express certain properties of the simulations. In this data set nine different stimuli were applied to the Blue Brain Project microcircuit. These stimuli can be distinguished by two properties, their class and their grouping, with three possible values for each property. Each class, denoted 5, 15 or 30, represents a different temporal input of the stimulus, and each grouping, denoted a, b or c, represents a different spatial input of the stimulus. See [13, Figure 4A] for further information about the stimuli. Rather than using the entire microcircuit, we extracted spike trains only from L5TTPC1 neurons [8]. The structural data is publicly available at [12].
We consider five repetitions of each experiment, referred to as seed s, for s = 1, . . . , 5. Thus we have 45 distinct data sets, each consisting of a 250ms spike train, that is a list of pairs (t, g) where t is a time (in resolution of 0.1ms) and g is a neuron (vertex) that spiked at time t. Each data set is then converted to a sequence of digraphs, using the transmissionresponse method introduced in [13]. The construction relies on three items of input: 1) the underlying structural graph G, 2) a spike train data set D and 3) a pair of integers t 1 and t 2 . We then split the spike train into time bins of size t 1 -ms, and construct a graph G r for each time bin, where G r has the same vertices of G and the edge (i, j) if all of the following conditions hold: (a) (i, j) is an edge in G, (b) neuron i fired at time t 0 in the r-th time bin, and (c) neuron j fired at time t 0 < t ≤ t 0 + t 2 .
See [13] for further background on transmission-response graphs.
A typical collection D of spike train data sets consists of n distinct instantiations, denoted by D r , r = 1, . . . , n, each of length L ms. Out of this collection we produce an n × m feature matrix V m T (D), for some natural number m. The rows of this matrix are then fed into a k-means clustering algorithm. To obtain V m T (D) we apply Algorithm 2, which is a similar procedure to Algorithm 1, but is adapted for use with functional data. As noted above, for the collection D at our disposal we have n = 45 and L = 250, and we set m = 6 so that the size of our vectors is suitable compared to the size of the data set (see Remark 4.2).  For the directed flag complex we compute V m β (D) by applying Algorithm 3, which is very similar to Algorithm 2, but using the Betti numbers instead of persistent pairs. We only use the first three Betti numbers (d = 3 in the algorithm), as in this data set all higher Betti numbers were zero.
Once we have computed both V 6 β (D) and V 6 T (D), we apply k-means clustering to their rows. The results of this are displayed in Figure 9. Here too one sees that the data is split into three classes almost perfectly using k-means clustering on the corresponding flag tournaplexes filtered by local directionality, while applying the analogous clustering method on the Betti numbers of the directed flag complexes yields poorer separation. This suggests once more that the tournaplex construction stores different, and possibly more detailed information about the network than the directed flag complex.