A multilayer graph organizes vector embeddings into progressively denser layers. Higher layers contain sparse node subsets, and every higher-layer node also appears below. section 8.5.2
Use the layered structure to narrow vector similarity searches:
- Start at the highest, sparsest layer. section 8.5.2
- Follow nodes closest to the query embedding while descending through denser layers. section 8.5.2
- Finish at the lowest layer, where additional nearby embeddings produce the final results. section 8.5.2
Movie recommendation search
For “May the force be with you,” the search begins with four upper-layer movies, selects A New Hope and The Mandalorian, then focuses lower-layer traversal on Star Wars movies. A PostgreSQL HNSW index supports the query with vector cosine ordering. section 8.5.2
Figure 8.9 Sample HNSW index with movie embeddings
Inspect the layered movie-embedding diagram, then compare it with the HNSW creation statement and execution plan. section 8.5.2
