Skip to main content

Module hnsw

Module hnsw 

Source
Expand description

HNSW (Hierarchical Navigable Small World) Index Implementation

HNSW is a graph-based approximate nearest neighbor search algorithm that provides excellent query performance with high recall. It builds a multi-layer graph where:

  • Each layer contains a subset of nodes from the layer below
  • Top layers enable fast coarse navigation
  • Bottom layers provide fine-grained search

Key parameters:

  • M: Maximum number of connections per node (default: 16)
  • ef_construction: Search width during index building (default: 200)
  • ef_search: Search width during query (default: 50)

Structsยง

HnswConfig
HNSW index configuration
HnswIndex
HNSW Index for approximate nearest neighbor search
HnswStats
Statistics about the HNSW index