Expand description
§Anda-DB HNSW Vector Search Library
A high-performance implementation of Hierarchical Navigable Small World (HNSW) algorithm for approximate nearest neighbor search in high-dimensional spaces.
HNSW is a graph-based indexing algorithm that creates a multi-layered structure to enable fast and accurate nearest neighbor search in high-dimensional spaces.
§Features
- Fast approximate nearest neighbor search;
- Multiple distance metrics (Euclidean, Cosine, Inner Product, Manhattan);
- Configurable index parameters;
- Thread-safe implementation with concurrent read/write operations;
- Serialization and deserialization support;
- Support for bf16 (brain floating point) vector storage for memory efficiency.
Re-exports§
pub use half;
Structs§
- Hnsw
Config - Tunable HNSW parameters. Defaults are suitable for 384–768-dim sentence embeddings; see the crate-level docs for guidance on tuning.
- Hnsw
Index - Concurrent, persistable HNSW index for approximate nearest-neighbor search.
- Hnsw
Metadata - Index metadata.
- Hnsw
Node - One node of the HNSW graph.
- Hnsw
Stats - Runtime statistics exported alongside the metadata.
- Layer
Gen - Random layer generator for HNSW.
Enums§
- Distance
Metric - Distance metric used for similarity computation.
- Hnsw
Error - Errors that can occur when working with HNSW index.
- Select
Neighbors Strategy - Neighbor selection strategies used both during graph construction and when pruning over-connected nodes.
Functions§
- serialize_
node - Serializes a node to CBOR. Used by
HnswIndex::store_dirty_nodesand by external tools that snapshot individual nodes.