Skip to content

RcppHNSW

0.7.0Package record

'Rcpp' Bindings for 'hnswlib', a Library for Approximate Nearest Neighbors

5packages dependsuggested by 2
520.8Kdownloads / year
82.3%test coverage
12/13flavors OK

Overview

About

'Hnswlib' is a C++ library for Approximate Nearest Neighbors. This package provides a minimal R interface by relying on the 'Rcpp' package. See https://github.com/nmslib/hnswlib for more on 'hnswlib'. 'hnswlib' is released under Version 2.0 of the Apache License.

Changes in 0.7.0

New features

  • New class: HnswEuclidean. This uses Euclidean distances internally and will

be returned from hnsw_build when distance = "euclidean" is specified. This

fixes an issue where if you created an index with hnsw_build and

distance = "euclidean" (the default), then after saving, you would be unable

to reload the index and have it find Euclidean distances. You would have to

create it as an HsnwL2 object and take the square root of the distances

yourself (<https://github.com/jlmelville/rcpphnsw/issues/21>).

  • The Hnsw constructors and the hnsw_build and hnsw_knn functions now

expose a random_seed parameter that you can use to set the random seed used

in constructing the HNSW index. If not provided, the the hnswlib default of

100 is used (and should preserve previous behavior). Based on a request by

Show all changes in 0.7.0Hide the rest of the changes in 0.7.0

From NEWS.md in the release

Install

Health

CRAN checks
1ERROR12OK
Check messages
ERRORtestsr-patched-linux-x86_64
Running ‘testthat.R’ [3s/4s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(RcppHNSW)
  > 
  > test_check("RcppHNSW")
  Saving _problems/test_parallel-45.R
  Saving _problems/test_parallel-46.R
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 81 ]
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Failure ('test_parallel.R:45:1'): (code run outside of `test_that()`) ───────
  Expected `mean(knn_0$dist - knn_2$dist)` < 1e-04.
  Actual comparison: 0.0001025 >= 0.0001000
  Difference: 0.0000025 >= 0
  ── Failure ('test_parallel.R:46:1'): (code run outside of `test_that()`) ───────
  Expected `mean(knn_1$dist - knn_2$dist)` < 1e-04.
  Actual comparison: 0.0001025 >= 0.0001000
  Difference: 0.0000025 >= 0
  
  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 81 ]
  Error:
  ! Test failures.
  Execution halted

CRAN check page ↗

Slowest check: 3.3 min · r-devel-windows-x86_64
Status changes
  • ERROR12 OK, 1 ERROR2026-10-22
  • OK13 OK2026-09-21
  • ERROR12 OK, 1 ERROR2026-09-20
  • OK13 OK2026-09-08
  • ERROR12 OK, 1 ERROR2026-09-07
Show 6 earlier changesHide 6 earlier changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK12 OK2026-04-25
  • NOTE12 OK, 2 NOTE2026-04-22
  • ERROR11 OK, 2 NOTE, 1 ERROR2026-04-18
  • NOTE12 OK, 2 NOTE2026-03-10
Advisories

none known

Documentation

In release 0.7.0
README· In the repository, left out of the releaseVignettesNoNEWSYes · 100% structured · mentions 0.7.0Citation fileNo

The repository also keeps web-only articles.

Help pages
4includes a package overview page
Examples that run
100%3 run in a plain check
Exported functions with examples
100%
Documented parameters
not tracked
Return-value docs
not tracked
Help pages citing references
50%

Downloads

520.8K
CRAN downloads in the past year
Rank #520 · ~1.4K/day · ~43.4K/mo
Daily download trend is not available in this view yet.
45K30 days
137.6K90 days
520.8K1 year
Compare downloads with other packages →
Also on23.6K r2u6 autocran185K conda_forge63 c2d4u

Repository

42Stars
11Forks
2Open issues
0Open PRs
11Releases
346Commits
8Commit identities
rrcppapproximate-nearest-neighbor-searchnmslibhnswk-nearest-neighborsnearest-neighbor-searchknn
License file reads as GPL-3.0 · 346 commits · Last activity 2026-10-18 · 0% stars, 30d · Default branch at 0.7.0.9001, ahead of CRAN 0.7.0 (checked 2026-10-18)
Responsiveness
How these are sampled
PRs merged (all time)
96%
Median days to close, 50 most recently updated closed issues
40
Median days to close, 50 most recently updated closed PRs
1

Stars over time

2025-06-18 · 372026-07-07 · 42
PracticesBeta

12 development-tooling and community-health practices detected across 6 families in the upstream repository

Checks run against github.com/jlmelville/rcpphnsw on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (3)
pkgdown

GitHub Pages site last deployed 2026-10-18 · The repository has a site deploy workflow

Coverage (1)
Coverage reporting (Codecov)
CRAN release process (1)
cran-comments.md
Show all practicesHide 2 practices
Automation and maintenance (1)
Dependabot
Lint, format, editor (4)
lintrLint workflowAirRStudio project
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
4 external dependencies (excludes base and recommended)

Installing RcppHNSW adds 1 package (1 with compiled code, 1.8 MB of source tarballs). Heaviest: Rcpp 1.8 MB.

Depends (0)
none
Imports (2)
methodsRcpp
LinkingTo (1)
Suggests (2)
Enhances (0)
none
Reverse dependencies
5direct
49indirect
Imports 5
Suggested by 2
Depends, Imports or LinkingTo, most downloaded first
Suggests, most downloaded first

People & History

People (5)
Author, Maintainer since 0.1.0 (2019), Copyright holder
Contributor · added in 0.3.0
Contributor · added in 0.3.0
Contributor
Contributor · added in 0.3.0
Releases (8)

Pick two releases to compare their code metrics.

  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • 0.7.0Latest
    record
    2024-02-04 · current release · diff ↗
  • 0.6.0
    record
    2024-02-04 · diff ↗
  • 0.5.0
    record
    2023-09-19 · diff ↗ ·
    removed 6 exports
    hnsw_knn, hnsw_build, hnsw_search, HnswL2, HnswCosine, HnswIp
    added 1 export
    pattern:^[Hh]nsw
  • R
    R 4.3.0 released · 2023-04-21
  • 0.4.1
    record
    2022-07-18 · diff ↗
  • 0.4.0
    record
    2022-07-17 · diff ↗
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • 0.3.0
    record
    2020-09-06 · diff ↗
  • R
    R 4.0.0 released · 2020-04-24
  • 0.2.0
    record
    2019-09-20 · diff ↗
  • R
    R 3.6.0 released · 2019-04-26
  • 0.1.0
    record
    2019-01-22
Show 1 earlier eventHide 1 earlier event
  • R
    R 3.5.0 released · 2018-04-23

Package metadata

First published
2019-01-22
Total releases
8 / 7 yrs
License
GPL (>= 3) OSI
Download size
38 KB

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("RcppHNSW")
Melville, J., Granjeaud, S., Liao, Y., Lun, A., & Selivanov, D. (2026). RcppHNSW: 'Rcpp' Bindings for 'hnswlib', a Library for Approximate Nearest Neighbors (Version 0.7.0) [Computer software]. https://doi.org/10.32614/CRAN.package.RcppHNSW

This package has no citation file, so citation() returns this entry built from DESCRIPTION.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for RcppHNSW version 0.7.0 [Data set]. HJJB, LLC. Data release v2026-10-22. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy