Skip to main content

Crate anda_db_hnsw

Crate anda_db_hnsw 

Source
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§

HnswConfig
Tunable HNSW parameters. Defaults are suitable for 384–768-dim sentence embeddings; see the crate-level docs for guidance on tuning.
HnswIndex
Concurrent, persistable HNSW index for approximate nearest-neighbor search.
HnswMetadata
Index metadata.
HnswNode
One node of the HNSW graph.
HnswStats
Runtime statistics exported alongside the metadata.
LayerGen
Random layer generator for HNSW.

Enums§

DistanceMetric
Distance metric used for similarity computation.
HnswError
Errors that can occur when working with HNSW index.
SelectNeighborsStrategy
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_nodes and by external tools that snapshot individual nodes.

Type Aliases§

BoxError