Build a vector search engine
Stage 4 of 5v1 · 6cc4172d

Build the HNSW graph

Assign reproducible levels and connect nearby neighbours per layer.

A navigable layered graph

Add build with m and seed. Build a simplified HNSW index: insert ids in lexicographic order, assign levels with your own pseudo-random generator, and connect each node to at most m nearby available neighbours on every shared level.

The public contract does not prescribe representation or expose edges; it does require reproducible construction. build returns built, nodes, m, and seed. stats reports nodes, dimension, whether the index is current, and its m.

Every upsert or delete invalidates the index, including replacing an id. Do not rebuild silently.

Acceptance criteria

  • m is an integer from 1 through 64 and seed is an integer.
  • The same input and seed produce the same graph.
  • Mutations set indexed:false.