Watch a search travel through the layered graph — from the sparse top layer (highways) down to the dense bottom layer (local roads). Drag the query point on Layer 0 and tune M / ef to see how the graph changes.
M nearest neighbors. Higher layers are sparse (few nodes, long edges = "highways"). Layer 0 is dense (all nodes, short edges = "local roads").ef: at the bottom layer, instead of stopping at the first local minimum, HNSW maintains a pool of ef best candidates and expands their neighborhoods. Larger ef → more accurate but slower.Why it's fast: the top layers act like an index over the index — you cover huge distances in just a few hops, then zoom in. For N points, search visits roughly O(log N) nodes instead of N.