Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return indices of birth/death generating edges #11

Open
killianfmeehan opened this issue May 20, 2022 · 2 comments
Open

return indices of birth/death generating edges #11

killianfmeehan opened this issue May 20, 2022 · 2 comments

Comments

@killianfmeehan
Copy link

Hello and thank you for this library! I have it installed and running with no problems. What I'd like to know is if I can get more than just the birth/death times to be returned by the main "run" function. (I'm not literate in C++, so I'm running this through python with the tools helpfully included in the library -- thanks for that by the way.)

Specifically, I would like to be able to access the information of where that birth/death time came from. Ideally, I'm looking for the precise edge (row/column indices of the distance matrix) from which the birth or death time is being derived. Alternatively, knowing the simplex responsible for a birth/death time (as long as that information can in turn tell me which data points/indices of the distance matrix gave rise to that simplex) would work too.

Whatever you're able to tell me, thanks so much for your time.

@simonzhang00
Copy link
Owner

simonzhang00 commented May 24, 2022

Hi,

You will have to modify the CUDA code in order to get back the vertex indices from the distance matrix.

I suggest you look into the simplex data structure diameter_index_t_struct:
https://github.com/simonzhang00/ripser-plusplus/blob/master/ripserplusplus/ripser%2B%2B.cu#L122

Since the pairs are being determined on these lines:
https://github.com/simonzhang00/ripser-plusplus/blob/master/ripserplusplus/ripser%2B%2B.cu#L2139
https://github.com/simonzhang00/ripser-plusplus/blob/master/ripserplusplus/ripser%2B%2B.cu#L2176

and printed at these lines:
https://github.com/simonzhang00/ripser-plusplus/blob/master/ripserplusplus/ripser%2B%2B.cu#L2183

You should be able to retrieve the indexs instead of just the diameters by forming the struct {column_to_reduce.index,pivot.index}
This index is just the combinatorial index, which is used to encode a high dimensional simplex as a single integer. You can use some of the existing code to extract the list of vertex indices from a combinatorial index (decode).

Good luck!

@killianfmeehan
Copy link
Author

That's perfect -- thanks so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants