GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
246 stars 65 forks source link

Make simplex insertion more natural #974

Open DavidLapous opened 9 months ago

DavidLapous commented 9 months ago

The default filtration value of the insert method being 0, and the non conservative nature of the insert method can create unnatural behavior. For instance, if one forgets to set a filtration value to a simplex to insert, the filtration of the other simplices will be erased :

import gudhi as gd
st = gd.SimplexTree()
st.insert([0], 1)
st.insert([1], 1)
st.insert([0,1])
list(st.get_simplices())
> [([0, 1], 0.0), ([0], 0.0), ([1], 0.0)]

As no filtration value is given, a more conservative option, would be to add [0,1] at the first moment when its possible, according to its faces. This would still preserve the filtration property of the simplextree.

Furthermore, I think that "adding a simplex at the first possible moment while preserving the filtration" can be an interesting behavior in practice; for instance if you want to define a filtration on a graph :

The current behavior preserve the filtration values of the edges, while this proposed behavior (see below) preserve the filtration values of the nodes. Both behaviors seem moral to me. Another motivating example is when playing with multiparameter filtrations : how to deal with incomparable filtrations values ? In that usecase, I think that a non-conservative approach can be dangerous.

A proposition is the following :

What do you think about all of this ?