-
Notifications
You must be signed in to change notification settings - Fork 66
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
mutual nearest neighbors #141
Comments
I looked a bit more at the trees and found a solution that sort of works: balltree = BallTree(points)
maxdist = 10.0
idxs = inrange(balltree, points, maxdist, true) and then you need to see if a point has more than one result. |
Maybe this is a good solution?: """
nn_mutual(points)
returns the mutual nearest neighbor distances and the index of the neares neighbor, both in matrix form.
"""
function nn_mutual(points)
kdtree = KDTree(points)
nns, nndist = knn(kdtree, points, 2)
nns = [mynn[1] for mynn in nns]
nndist = [myd[1] for myd in nndist]
return nndist, nns
end If so, should it maybe be part of the toolbox? |
You might be looking for the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the great toolbox you contributed!
I was trying to use it for the problem of picking particles in an image that need to have a minimum distance to their neighbors.
I have a list of coordinates and converted it to the required matrix form. But then I am stuck.
I can see that your toolbox answers the question to find the neighbor in dataset A, given the probe coordinates of dataset B.
But in my case these datasets are the same and I want to exclude each vector from the search.
Of course I could build a seperate
KDTree()
each time, leaving one vector out, but this sounds like a really bad idea to me for performance reasons.Can your toolbox handle the one-dataset nearest neighbor question? If not, which algorithm do I need for this and where can I find it?
Maybe the easiest is to simply do a brute-force search. Or maybe the KDTree already encodes the answer?
The text was updated successfully, but these errors were encountered: