GUDHI/gudhi-devel

Make simplex insertion more natural

DavidLapous opened this issue · 0 comments

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 :

  • Assume that you have access to values on its node and other values on its edges.
  • Assume that these values do not form a filtration.

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 :

  • Add a flag, e.g. insert_after, in the insert method, such that :
    • if true, the simplex $\sigma$ to insert, with given filtration $f$, will be inserted at $\max\left(\max_{\tau \in \mathrm{coface}(\sigma)}f_{\tau}, f\right)$
    • If false, -> default behaviour
  • Set the default value of the flag to be f is not given (and set $f=-\infty$).

What do you think about all of this ?