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
254 stars 65 forks source link

Identifying the simplicies involved in forming a feature in persistence diagram #1026

Closed ryankzhu closed 7 months ago

ryankzhu commented 8 months ago

Hi,

I am using persistent homology to analyse some data:

rips = gudhi.RipsComplex(points=data)
simplex_tree = rips.create_simplex_tree(2)
persistence = simplex_tree.persistence()
gudhi.plot_persistence_diagram(persistence)

In the persistence diagram there is, for example, 1 1-dimensional feature born and dead at some specific points. I can manually determine what 1-simplicies contribute to the hole via [simplex for simplex in simplex_tree.get_filtration()] but only for simple diagrams. Is there a way to retrieve the vertices/simplicies that form the boundaries of that specific feature?

I am very new to GUDHI and probably overlook something. Many thanks!

mglisse commented 8 months ago

Hello, I think you are asking for a representative of the homology class (or a homology basis) at the time of its birth, that's the one most requested feature we are currently missing in Gudhi, we are working on it, but it is not ready yet. Some other software may be able to compute it. If your datasets aren't too big, you could even use the very short code from https://stackoverflow.com/a/76743866/1918193 . Note that the representative is not unique, and the one we eventually provide may not be as pretty as one would like. There are various ways to optimize the representative for various criteria (we don't currently have plans for those), but nothing perfect. One thing you can currently get from Gudhi is a representative just before death: the boundary of the death simplex returned by persistence_pairs. Usually not what people want, but it can be better than nothing.

ryankzhu commented 7 months ago

Yes thank you for the information! The code from stackoverflow works fine in my case.