Simplex tree reference manual¶
-
class
gudhi.
SimplexTree
¶ Bases:
object
The simplex tree is an efficient and flexible data structure for representing general (filtered) simplicial complexes. The data structure is described in Jean-Daniel Boissonnat and Clément Maria. The Simplex Tree: An Efficient Data Structure for General Simplicial Complexes. Algorithmica, pages 1–22, 2014.
This class is a filtered, with keys, and non contiguous vertices version of the simplex tree.
-
__init__
()¶ SimplexTree constructor.
-
betti_numbers
()¶ This function returns the Betti numbers of the simplicial complex.
Returns: The Betti numbers ([B0, B1, ..., Bn]). Return type: list of int Note: betti_numbers function requires persistence function to be launched first.
-
dimension
()¶ This function returns the dimension of the simplicial complex.
Returns: the simplicial complex dimension. Return type: int
-
expansion
()¶ Expands the Simplex_tree containing only its one skeleton until dimension max_dim.
The expanded simplicial complex until dimension \(d\) attached to a graph \(G\) is the maximal simplicial complex of dimension at most \(d\) admitting the graph \(G\) as \(1\)-skeleton. The filtration value assigned to a simplex is the maximal filtration value of one of its edges.
The Simplex_tree must contain no simplex of dimension bigger than 1 when calling the method.
Parameters: max_dim (int.) – The maximal dimension.
-
filtration
()¶ This function returns the simplicial complex filtration value for a given N-simplex.
Parameters: simplex (list of int.) – The N-simplex, represented by a list of vertex. Returns: The simplicial complex filtration value. Return type: float
-
find
()¶ This function returns if the N-simplex was found in the simplicial complex or not.
Parameters: simplex (list of int.) – The N-simplex to find, represented by a list of vertex. Returns: true if the simplex was found, false otherwise. Return type: bool
-
get_cofaces
()¶ This function returns the cofaces of a given N-simplex with a given codimension.
Parameters: - simplex (list of int.) – The N-simplex, represented by a list of vertex.
- codimension (int.) – The codimension. If codimension = 0, all cofaces are returned (equivalent of get_star function)
Returns: The (simplices of the) cofaces of a simplex
Return type: list of tuples(simplex, filtration)
-
get_filtration
()¶ This function returns a list of all simplices with their given filtration values.
Returns: The simplices sorted by increasing filtration values. Return type: list of tuples(simplex, filtration)
-
get_skeleton
()¶ This function returns the (simplices of the) skeleton of a maximum given dimension.
Parameters: dimension (int.) – The skeleton dimension value. Returns: The (simplices of the) skeleton of a maximum dimension. Return type: list of tuples(simplex, filtration)
-
get_star
()¶ This function returns the star of a given N-simplex.
Parameters: simplex (list of int.) – The N-simplex, represented by a list of vertex. Returns: The (simplices of the) star of a simplex. Return type: list of tuples(simplex, filtration)
-
initialize_filtration
()¶ This function initializes and sorts the simplicial complex filtration vector.
Note
This function must be launched before persistence, betti_numbers, persistent_betti_numbers or get_filtration after inserting or removing simplices.
-
insert
()¶ This function inserts the given N-simplex and its subfaces with the given filtration value (default value is ‘0.0’).
Parameters: - simplex (list of int.) – The N-simplex to insert, represented by a list of vertex.
- filtration (float.) – The filtration value of the simplex.
Returns: true if the simplex was found, false otherwise.
Return type: bool
-
num_simplices
()¶ This function returns the number of simplices of the simplicial complex.
Returns: the simplicial complex number of simplices. Return type: int
-
num_vertices
()¶ This function returns the number of vertices of the simplicial complex.
Returns: The simplicial complex number of vertices. Return type: int
-
persistence
()¶ This function returns the persistence of the simplicial complex.
Parameters: - homology_coeff_field (int.) – The homology coefficient field. Must be a prime number
- min_persistence (float.) – The minimum persistence value to take into account (strictly greater than min_persistence). Default value is 0.0. Sets min_persistence to -1.0 to see all values.
Returns: The persistence of the simplicial complex.
Return type: list of pairs(dimension, pair(birth, death))
-
persistence_intervals_in_dimension
()¶ This function returns the persistence intervals of the simplicial complex in a specific dimension.
Parameters: dimension (int.) – The specific dimension. Returns: The persistence intervals. Return type: list of pair of float Note: intervals_in_dim function requires persistence function to be launched first.
-
persistent_betti_numbers
()¶ This function returns the persistent Betti numbers of the simplicial complex.
Parameters: - from_value (float.) – The persistence birth limit to be added in the numbers (persistent birth <= from_value).
- to_value (float.) – The persistence death limit to be added in the numbers (persistent death > to_value).
Returns: The persistent Betti numbers ([B0, B1, ..., Bn]).
Return type: list of int
Note: persistent_betti_numbers function requires persistence function to be launched first.
-
remove_maximal_simplex
()¶ This function removes a given maximal N-simplex from the simplicial complex.
Parameters: simplex (list of int.) – The N-simplex, represented by a list of vertex.
-
set_dimension
()¶ This function sets the dimension of the simplicial complex.
insert and remove_maximal_simplex functions do not update dimension value of the SimplexTree.
AlphaComplex, RipsComplex, TangentialComplex and WitnessComplex automatically sets the correct dimension in their create_simplex_tree functions.
Parameters: dimension (int.) – The new dimension value.
-
write_persistence_diagram
()¶ This function writes the persistence intervals of the simplicial complex in a user given file name.
Parameters: persistence_file (string.) – The specific dimension. Note: intervals_in_dim function requires persistence function to be launched first.
-