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

"IndexError: This vertex is missing, maybe hidden by a duplicate or another heavier point. " when using AlphaDTMFiltration #72

Closed
Lxion0553 opened this issue Mar 1, 2024 · 7 comments · Fixed by #73

Comments

@Lxion0553
Copy link

Hello! Thanks for your great work!
When using the AlphaDTMFiltration in DTM_filtrations.py, an IndexError: "This vertex is missing, maybe hidden by a duplicate or another heavier point." was reported. May I ask what is the cause of this error? How can I fixed it.

@mglisse
Copy link
Member

mglisse commented Mar 1, 2024

The error message says "maybe hidden by a duplicate". Did you check if you have 2 times the same point in your point set?

@mglisse
Copy link
Member

mglisse commented Mar 1, 2024

@VincentRouvreau

alpha_complex = gudhi.AlphaComplex(points=X)
st_alpha = alpha_complex.create_simplex_tree()
Y = np.array([alpha_complex.get_point(i) for i in range(N_tot)])
distances = euclidean_distances(Y) #computes the pairwise distances
DTM_values = DTM(X,Y,m) #/!\ in 3D, gudhi.AlphaComplex may change the ordering of the points

The comprehension with get_point was done to be robust against the ordering changes we used to do in 3d, but we haven't done that for a long time now. On the other hand, it isn't robust to duplicated points. Should we just use Y=X?

@VincentRouvreau
Copy link
Contributor

I was able to reproduce it by doing:

X = SampleOnNecklace(N_obs, N_out, is_plot = True)
X[1,:] = X[0,:]  # To force 2 points to be equal
# ...
simplex_tree_DTM_alpha = AlphaDTMFiltration(X, m, p, dimension_max)

# File alpha_complex.pyx:119, in gudhi.alpha_complex.AlphaComplex.get_point()
# IndexError: This vertex is missing, maybe hidden by a duplicate or another heavier point.

@VincentRouvreau
Copy link
Contributor

The comprehension with get_point was done to be robust against the ordering changes we used to do in 3d, but we haven't done that for a long time now. On the other hand, it isn't robust to duplicated points. Should we just use Y=X?

Your proposal works fine and I think this is the good way to handle it

@Lxion0553
Copy link
Author

@mglisse

The error message says "maybe hidden by a duplicate". Did you check if you have 2 times the same point in your point set?

It seems that there exist no duplicated points in my dataset, maybe two points that are too close can cause this error also?

@mglisse
Copy link
Member

mglisse commented Mar 2, 2024

It seems that there exist no duplicated points in my dataset, maybe two points that are too close can cause this error also?

I don't think it can, but it is going to be hard to say much more without a complete reproducible testcase.
Anyway, does the change in #73 help you?

@Lxion0553
Copy link
Author

I don't think it can, but it is going to be hard to say much more without a complete reproducible testcase. Anyway, does the change in #73 help you?

It does help! Thank you!

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

Successfully merging a pull request may close this issue.

3 participants