Abstract
Constructing $k$-nearest neighbor ($k$-NN) graphs for massive, high-dimensional datasets is computationally prohibitive using brute-force methods. This paper presents a highly efficient two-stage approach that combines multiple random hierarchical partitions with a neighborhood propagation scheme. By leveraging PCA-aligned splits and local search refinement, the method achieves near-perfect accuracy with linear scalability, outperforming existing divide-and-conquer techniques by significant margins on large-scale benchmarks like SIFT and GIST.
Introduction
The $k$-NN graph—where every data point is connected to its $k$ closest neighbors—is a foundational tool in machine learning, supporting tasks from manifold learning to image retrieval. However, building these graphs for modern datasets with millions of points is a significant challenge. A naive brute-force search requires $O(n^2 d)$ time, while exact algorithms often fail due to the "curse of dimensionality."
Existing approximate methods frequently rely on overlapping divisions to prevent neighbors from being separated by split boundaries. However, these overlaps often introduce quadratic complexities that negate the benefits of approximation. This paper proposes a two-stage framework that maintains linear complexity while achieving high accuracy.
Methodology
Stage 1: Multiple Random Divide-and-Conquer
The first stage focuses on creating a strong initial graph approximation. The dataset is hierarchically partitioned into small, non-overlapping subsets using hyperplanes. To ensure these splits capture the data's structure, the authors use Principal Component Analysis (PCA) to identify directions of high variance for the split boundaries.
Within each leaf node, an exact $k$-NN graph is constructed. Because a single partition might split true neighbors, the process is repeated multiple times. The union of these "base" graphs forms a robust initial approximation. This approach of using multiple non-overlapping partitions provides an "implicit overlap" that is computationally much cheaper than explicit overlapping methods.
Stage 2: Neighborhood Propagation
The second stage refines the initial graph by exploiting the geometric property that "neighbors of neighbors are likely to be neighbors." The authors implement a best-first search using a priority queue to explore the local neighborhood of each point.
As shown in the figure above, if point $p$ is connected to $q$, and $q$ is connected to $o$, the algorithm evaluates $o$ as a potential neighbor for $p$. This propagation allows local neighborhood information to spread across the graph, effectively fixing missing links created during the partitioning stage.
Experimental Results
The approach was evaluated on several large-scale benchmarks, including 128D SIFT features and 384D GIST features. Key findings include:
- Efficiency: On the 1M SIFT dataset, the method achieved 95% accuracy in just 1% of the time required for a brute-force search.
- High-Dimensional Performance: On the 384D GIST dataset, where other divide-and-conquer methods plateaued at 50% accuracy, this approach reached 90% accuracy within the same time budget.
- Scalability: The time cost grows linearly with both the number of points ($n$) and dimensionality ($d$), making it suitable for massive datasets.
Conclusion
By combining PCA-based random partitioning with neighborhood propagation, the authors provide a scalable solution for $k$-NN graph construction. The method effectively balances the speed of non-overlapping splits with the accuracy of local refinement. Future work may involve developing automated learning schemes to manage the propagation process more dynamically based on the "effective rate" of neighbor discovery.
Summary updated