mrzv / dionysus

Library for computing persistent homology
http://mrzv.org/software/dionysus2
Other
144 stars 31 forks source link

cycle position #49

Closed abst0603 closed 3 years ago

abst0603 commented 3 years ago

Hi, I tried to write down a code in python to extract cycle position based on "d.zigzag_homology_persistence" and observing intermediate steps using "callback = detail". The code works as expected but the performance is about 5 to 10 times slower than what is provided through the "TDA R package" for the Dionysus toolbox. I only wonder if there is clear documentation on how to extract cycle position using python and Dionysus2. Or is there a faster code somewhere to do this job? Thanks in advance for your answer, I can also share my code if needed.

mrzv commented 3 years ago

I'm not sure how TDA R package works, but I assume it implements the functionality in C++. The callback path is slow and was added as an afterthought. If you can implement it in C++, that's the best path. If not, then I'd want to know what is the best interface to expose to Python to get such information.

abst0603 commented 3 years ago

I'm also familiar with C++. Can you give me a hint that from which example I can start to make the program? I aim to apply alpha filtration on 3D data and then compute persistent homology and locate the cycles. I'm not sure if alpha filtration is implemented in this toolbox.

mrzv commented 3 years ago

Alpha filtrations are implemented in diode. How are you planning to use zigzags with the alpha filtration?

abst0603 commented 3 years ago

If I'm not mistaken zigzags are a way of computing persistence homology, and through this procedure, you also keep track of the cycle formation and destruction. Right? For me, it is important to find this cycle position (x,y,z coordinates of border points in 3D) as fast as possible since I'm repeating the procedure several times to make a tighter cycle. I know the cycle position in this implementation is the vertices that build the cycle at birth time. Thanks for mentioning "diode". I'll use it.

mrzv commented 3 years ago

You can get cycle positions with ordinary persistent homology. I'm asking why do you want zigzags specifically.

abst0603 commented 3 years ago

I see. The reason I'm using "d.zigzag_homology_persistence" is that I was able to find the cycle location using the "detail callback" in Python based on your documentation. That is why I use zigzag PH. But in general, I don't need the Zigzag specifically. I search for a practical example or hint to extract cycles' position during the computation of PH in C++ using any technique.

mrzv commented 3 years ago

Ah, we finally get to your real question. This topic has come up on the mailing list. I suggest you look there. For example, here.

abst0603 commented 3 years ago

Thank you! This issue in the mailing list was what I was searching for. I realized as you said I don't need zigzag.