DOI: 10.18129/B9.bioc.BiocNeighbors  

This package is for version 3.17 of Bioconductor; for the stable, up-to-date release version, see BiocNeighbors.

Nearest Neighbor Detection for Bioconductor Packages

Bioconductor version: 3.17

Implements exact and approximate methods for nearest neighbor detection, in a framework that allows them to be easily switched within Bioconductor packages or workflows. Exact searches can be performed using the k-means for k-nearest neighbors algorithm or with vantage point trees. Approximate searches can be performed using the Annoy or HNSW libraries. Searching on either Euclidean or Manhattan distances is supported. Parallelization is achieved for all methods by using BiocParallel. Functions are also provided to search for all neighbors within a given distance.

Author: Aaron Lun [aut, cre, cph]

Maintainer: Aaron Lun <infinite.monkeys.with.keyboards at>

Citation (from within R, enter citation("BiocNeighbors")):


To install this package, start R (version "4.3") and enter:

if (!require("BiocManager", quietly = TRUE))


For older versions of R, please refer to the appropriate Bioconductor release.


To view documentation for the version of this package installed in your system, start R and enter:



HTML R Script 1. Detecting exact nearest neighbors
HTML R Script 2. Detecting approximate nearest neighbors
HTML R Script 3. Detecting neighbors within range
PDF   Reference Manual
Text   NEWS


biocViews Classification, Clustering, Software
Version 1.18.0
In Bioconductor since BioC 3.8 (R-3.5) (5 years)
License GPL-3
Imports Rcpp, S4Vectors, BiocParallel, stats, methods, Matrix
LinkingTo Rcpp, RcppHNSW
Suggests testthat, BiocStyle, knitr, rmarkdown, FNN, RcppAnnoy, RcppHNSW
SystemRequirements C++11
Depends On Me OSCA.advanced, OSCA.workflows, SingleRBook
Imports Me batchelor, bluster, CellMixS, cydar, imcRtools, miloR, mumosa, scater, scDblFinder, scMerge, SpatialFeatureExperiment, UCell
Suggests Me concordexR, TrajectoryUtils, TSCAN
Links To Me SingleR
Build Report  

Package Archives

Follow Installation instructions to use this package in your R session.

Source Package BiocNeighbors_1.18.0.tar.gz
Windows Binary (64-bit only)
macOS Binary (x86_64) BiocNeighbors_1.18.0.tgz
macOS Binary (arm64) BiocNeighbors_1.18.0.tgz
Source Repository git clone
Source Repository (Developer Access) git clone
Bioc Package Browser
Package Short Url
Package Downloads Report Download Stats

Documentation »


R / CRAN packages and documentation

Support »

Please read the posting guide. Post questions about Bioconductor to one of the following locations: