English

Computing the k Nearest-Neighbors for all Vertices via Dijkstra

Data Structures and Algorithms 2016-07-27 v1

Abstract

We are given a directed graph G=(V,E)G = (V,E) with nn vertices and mm edges, with positive weights on the edges, and a parameter k>0k >0. We show how to compute, for every vertex vVv \in V, its kk nearest-neighbors. The algorithm runs in O(k(nlogn+m))O( k ( n \log n + m ) ) time, and follows by a somewhat careful modification of Dijkstra's shortest path algorithm. This result is probably folklore, but we were unable to find a reference to it -- thus, this note.

Keywords

Cite

@article{arxiv.1607.07818,
  title  = {Computing the k Nearest-Neighbors for all Vertices via Dijkstra},
  author = {Sariel Har-Peled},
  journal= {arXiv preprint arXiv:1607.07818},
  year   = {2016}
}
R2 v1 2026-06-22T15:04:50.054Z