SIMPLE ALGORITHMS FOR ENUMERATING INTERPOINT DISTANCES AND FINDING k NEAREST NEIGHBORS
Matthew T. Dickerson, Robert L. Scot Drysdale, Jörg-Rüdiger Sack · International Journal of Computational Geometry & Applications · 1992
We present an O(n log n+k log k) time and O(n+k) space algorithm which takes as input a set of n points in the plane and enumerates the k smallest distances between pairs of points in nondecreasing order. We also present an O(n log n+kn log k) solution to the problem of finding the k nearest neighbors for each of n points. Both algorithms are conceptually very simple, are easy to implement, and are based on a common data structure: the Delaunay triangulation. Variants of the algorithms work for any convex distance function metric.