NearestNeighbors.jl icon indicating copy to clipboard operation
NearestNeighbors.jl copied to clipboard

Support for Neighbor Pairs Searching

Open zhujunmian opened this issue 5 years ago • 3 comments

The scipy KDTree package provides a method query_pairs (in this link) which returns all the pairs within a distance for the given tree. This package seems only to provide nearest neighbor searching for a given point by the inrange function, rather than for pairs.

Such feature could also be implemented in this Julia package and should be helpful for users.

zhujunmian avatar May 26 '20 06:05 zhujunmian

What would be a good algorithm for doing this?

I imagine a naive solution might be to loop over all data points and for each data point, call inrange to get a list of nearby data points then append them to a set storing (i, j) index pairs where i < j.

ali-ramadhan avatar Nov 27 '20 17:11 ali-ramadhan

I think you can do better by basically searching and pruning two trees against each other. I think I had an implementation of that but don't recall why I didn't put it in, maybe it didn't improve performance much over the naive version.

KristofferC avatar Nov 27 '20 22:11 KristofferC