K Nearest neighbor join algorithms for spatial data using compact and plain data structures in main memory
Abstract The K Nearest Neighbors Query ( K NNQ) is a fundamental distance-based query with applications in Geographic Information Systems (GIS) and many other domains. The K Nearest Neighbors Join Query ( K NNJQ) combines K NNQ with the join operation to find the K nearest neighbors from a dataset P to every object in another dataset Q . Due to the large number of distance computations involved, K NNJQ is an expensive operation that poses a challenge for in-memory systems. In this paper, we propose and evaluate novel in-memory algorithms for K NNQ and K NNJQ using the compact data structure $$k^2$$ -tree. The proposed algorithms exploit hierarchical spatial decomposition together with grouping, pre-processing and progressive pruning techniques. In addition, we develop two new plane-sweep algorithms for K NNQ and K NNJQ, that improve the brute-force algorithms by reducing redundant computations. We conduct an extensive experimental evaluation using real-world spatial datasets to evaluate the performance of our K NNQ and K NNJQ algorithms, comparing them with KD-tree and R*-tree based algorithms. Our results highlight the efficiency of pruning techniques in $$k^2$$ -trees, which reduce distance computations and response time by up to an order of magnitude in K NNJQ, in comparison with the equivalent KD-tree, R*-tree and plane-sweep algorithms.
Authors
- Antonio Corral (ORCID: https://orcid.org/0000-0002-0069-4642)
- Guillermo de Bernardo (ORCID: https://orcid.org/0000-0002-6020-7092)
- Miguel R. Penabad (ORCID: https://orcid.org/0000-0001-5455-6088)
- Michael Vassilakopoulos (ORCID: https://orcid.org/0000-0003-2256-5523)
- Nieves R. Brisaboa
Institutions
- Universidade da Coruña (ES)
- University of Thessaly (GR)
- University of Almería (ES)
Publication Details
- Journal
- GeoInformatica
- Published
- 2026-09-10
- DOI
- https://doi.org/10.1007/s10707-026-00591-1
- Primary Topic
- Data Management and Algorithms
- Type
- article
- Field-Weighted Citation Impact
- 0.00