English

Chromatic $k$-Nearest Neighbor Queries

Computational Geometry 2022-05-03 v1

Abstract

Let PP be a set of nn colored points. We develop efficient data structures that store PP and can answer chromatic kk-nearest neighbor (kk-NN) queries. Such a query consists of a query point qq and a number kk, and asks for the color that appears most frequently among the kk points in PP closest to qq. Answering such queries efficiently is the key to obtain fast kk-NN classifiers. Our main aim is to obtain query times that are independent of kk while using near-linear space. We show that this is possible using a combination of two data structures. The first data structure allow us to compute a region containing exactly the kk-nearest neighbors of a query point qq, and the second data structure can then report the most frequent color in such a region. This leads to linear space data structures with query times of O(n1/2logn)O(n^{1 / 2} \log n) for points in R1\mathbb{R}^1, and with query times varying between O(n2/3log2/3n)O(n^{2/3}\log^{2/3} n) and O(n5/6polylogn)O(n^{5/6} {\rm polylog} n), depending on the distance measure used, for points in R2\mathbb{R}^2. Since these query times are still fairly large we also consider approximations. If we are allowed to report a color that appears at least (1ε)f(1-\varepsilon)f^* times, where ff^* is the frequency of the most frequent color, we obtain a query time of O(logn+loglog11εn)O(\log n + \log\log_{\frac{1}{1-\varepsilon}} n) in R1\mathbb{R}^1 and expected query times ranging between O~(n1/2ε3/2)\tilde{O}(n^{1/2}\varepsilon^{-3/2}) and O~(n1/2ε5/2)\tilde{O}(n^{1/2}\varepsilon^{-5/2}) in R2\mathbb{R}^2 using near-linear space (ignoring polylogarithmic factors).

Keywords

Cite

@article{arxiv.2205.00277,
  title  = {Chromatic $k$-Nearest Neighbor Queries},
  author = {Thijs van der Horst and Maarten Löffler and Frank Staals},
  journal= {arXiv preprint arXiv:2205.00277},
  year   = {2022}
}

Comments

37 pages, 9 figures

R2 v1 2026-06-24T11:03:30.455Z