{"id":33938533,"url":"https://github.com/rust-cv/hnsw","last_synced_at":"2026-04-06T07:01:37.761Z","repository":{"id":41499381,"uuid":"198009353","full_name":"rust-cv/hnsw","owner":"rust-cv","description":"HNSW ANN from the paper \"Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs\"","archived":false,"fork":false,"pushed_at":"2025-08-08T18:26:45.000Z","size":164,"stargazers_count":249,"open_issues_count":20,"forks_count":21,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-12-14T03:12:01.052Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rust-cv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-21T03:52:31.000Z","updated_at":"2025-12-01T22:11:53.000Z","dependencies_parsed_at":"2025-01-24T18:30:04.394Z","dependency_job_id":null,"html_url":"https://github.com/rust-cv/hnsw","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/rust-cv/hnsw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fhnsw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fhnsw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fhnsw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fhnsw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rust-cv","download_url":"https://codeload.github.com/rust-cv/hnsw/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rust-cv%2Fhnsw/sbom","scorecard":{"id":790452,"data":{"date":"2025-08-11","repo":{"name":"github.com/rust-cv/hnsw","commit":"c5edaa0d7f60aedcad6429463ad3e5d74923c8f8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/24 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"1 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lints.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/lints.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lints.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/lints.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lints.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/lints.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lints.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/lints.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/no-std.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/no-std.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/no-std.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/no-std.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/no-std.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/no-std.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/unit-test.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/unit-test.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/rust-cv/hnsw/unit-test.yml/main?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   9 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lints.yml:1","Warn: no topLevel permission defined: .github/workflows/no-std.yml:1","Warn: no topLevel permission defined: .github/workflows/unit-test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 9 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T07:22:43.093Z","repository_id":41499381,"created_at":"2025-08-23T07:22:43.094Z","updated_at":"2025-08-23T07:22:43.094Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31463015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-05T21:22:52.476Z","status":"online","status_checked_at":"2026-04-06T02:00:07.287Z","response_time":112,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-12-12T15:02:14.635Z","updated_at":"2026-04-06T07:01:37.743Z","avatar_url":"https://github.com/rust-cv.png","language":"Rust","funding_links":[],"categories":["Sdks \u0026 Libraries","Search"],"sub_categories":[],"readme":"# hnsw\n\n\n[![Discord][dci]][dcl] [![Crates.io][ci]][cl] ![MIT/Apache][li] [![docs.rs][di]][dl] ![LoC][lo]\n\n[ci]: https://img.shields.io/crates/v/hnsw.svg\n[cl]: https://crates.io/crates/hnsw/\n\n[li]: https://img.shields.io/crates/l/specs.svg?maxAge=2592000\n\n[di]: https://docs.rs/hnsw/badge.svg\n[dl]: https://docs.rs/hnsw/\n\n[lo]: https://tokei.rs/b1/github/rust-cv/hnsw?category=code\n\n[dci]: https://img.shields.io/discord/550706294311485440.svg?logo=discord\u0026colorB=7289DA\n[dcl]: https://discord.gg/d32jaam\n\nHierarchical Navigable Small World Graph for fast ANN search\n\nEnable the `serde` feature to serialize and deserialize `HNSW`.\n\n## Tips\n\nA good default for M and M0 parameters is 12 and 24 respectively. According to the paper, M0 should always be double M,\nbut you can change both of them freely.\n\n## Example\n\nTo see how this might be used with hamming space, see `tests/simple_discrete.rs`. To see how this might be used with euclidean space, see `tests/simple.rs`.\n\nNote that the euclidean implementation in the test may have some numerical errors and fail to implement the triangle inequality, especially on high dimensionality. Use a [Kahan sum](https://en.wikipedia.org/wiki/Kahan_summation_algorithm) instead for proper usage. It also may not utilize SIMD, but using an array may help with that.\n\nPlease refer to the [`space` documentation](https://docs.rs/space/) for the trait and types regarding distance. It also contains special `Bits128` - `Bits4096` tuple structs that wrap an array of bytes and enable SIMD capability. Benchmarks provided use these SIMD impls.\n\n## Benchmarks\n\nHere is a recall graph that you can [compare to its alternatives](http://ann-benchmarks.com/sift-256-hamming_10_hamming.html):\n\n![Recall Graph](http://vadixidav.github.io/hnsw/839611966a1550d5cba599c78002ee68311e4c37/nn10_256bit_10000_m24.svg)\n\nFor more benchmarks and how to benchmark, see [`benchmarks.md`](./benchmarks.md).\n\n## Implementation\n\nThis is based on the paper [\"Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs\"](https://arxiv.org/pdf/1603.09320.pdf) by Yu. A. Malkov and D. A. Yashunin. This paper builds on the [original paper for NSW](http://www.iiis.org/CDs2011/CD2011IDI/ICTA_2011/PapersPdf/CT175ON.pdf). There are multiple papers written by the authors on NSW, which preceeded HNSW.\n\nFor more details about parameters and details of the implementation, see [`implementation.md`](./implementation.md).\n\n## Credit\n\nThis is in no way a direct copy or reimplementation of [the original implementation](https://github.com/nmslib/hnswlib/blob/master/hnswlib/hnswalg.h). This was made purely based on [the paper](https://arxiv.org/pdf/1603.09320.pdf) without reference to the original headers. The paper is very well written and easy to understand, with some minor exceptions. Thank you to the authors for your valuable contribution.\n\n## Questions? Contributions? Excited?\n\nPlease visit the [Rust CV Discord](https://discord.gg/d32jaam).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cv%2Fhnsw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frust-cv%2Fhnsw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frust-cv%2Fhnsw/lists"}