Hierarchical Navigable Small World (HNSW) is a graph-based data structure and algorithm for approximate nearest neighbor (ANN) search, designed for high recall and low latency in high-dimensional vector spaces. It constructs a multi-layered graph where the top layer contains few, long-range connections for fast navigation, and lower layers contain progressively more, shorter-range connections for precise search, mimicking the 'small world' property of social networks. This hierarchical design enables a search complexity of O(log n), making it exceptionally efficient for semantic search in vector databases like Weaviate, Qdrant, and Milvus.
