NumPy allowed · plain Python earns 10 bonus points
Cosine-like similarity scores ranked before context assembly
Implement one greedy-descent step of HNSW's real search algorithm: from the current node, move to whichever unvisited neighbor is closest to the query, or stop if none improves.
Implement hnsw_greedy_hop(current_dist, neighbor_dists, visited). neighbor_dists maps neighbor id -> its distance to the query. Among neighbors NOT in visited, find the one with the smallest distance. If that smallest distance is < current_dist, return that neighbor's id (the hop to take); otherwise return None (local minimum reached, search stops). Ties among equally-close neighbors broken by id ascending.
hnsw_greedy_hop(current_dist: float, neighbor_dists: dict[str, float], visited: set) -> str | None