← All questions
Retrieval & EmbeddingsMedium· HNSW· Data Structures· Algorithms

How do you derive HNSW from a skip list, and how many l...

The derivation requires shifting from a linear ordering to a graph-based structure. The height of the graph is determined by the probability distribution of node promotion (Pr[ℓ ≥ j] = M^-j). With M=16, the structure results in six layers, with the top layer being sparse, allowing for efficient navigation toward the target.

Code playground (Python)