Expand description
HNSW (Hierarchical Navigable Small World) Index
§Table of Contents
- HnswIndex: Main HNSW graph structure for ANN search
- HnswNode: Node in the HNSW graph with multi-layer connections
- HnswConfig: Configuration parameters (M, ef_construction, ef_search)
- Search Algorithm: Greedy beam search with layer traversal
§Algorithm Overview
HNSW builds a multi-layer graph where:
- Higher layers have fewer nodes (exponential decay)
- Each node connects to M neighbors per layer
- Search starts from top layer, greedily descends
- Bottom layer search uses beam width ef_search for recall