Yes, HSNWs are not <i>so</i> complex, and they work great. I wrote an implementation myself, it's 2500 lines of code (5x the one of dicroce!), but inside there is binary and int8 quantization and many advanced features (include true deletions), and I commented it as much as possible. I hope you may find it useful to read alongside the one proposed by OP:<p><a href="https://github.com/redis/redis/blob/unstable/modules/vector-sets/hnsw.c">https://github.com/redis/redis/blob/unstable/modules/vector-...</a><p>Still, to be honest, I'm reading the 500 lines of code with great interest because I didn't thought it was possible to go so small, maybe part of the trick is that's in C++ and not in C, as for instance you don't have the queue code.<p>Also the strategy used by my implementation in order to re-link the orphaned nodes upon deletion adds complexity, too. (btw any feedback on that part is especially appreciated)<p>EDIT: Ok after carefully inspection this makes more sense :D<p>1. Yes, C++ helps, the vector class, the priority queue, ...<p>2. I forgot to say that I implemented serialization other than quantization, and this also includes quite some code.<p>3. Support for threads is another complexity / code-size price to pay.<p>And so forth. Ok, now it makes a lot of sense. Probably the 500 LOC implementation is a better first-exposure experience for newcomers. After accumulating all the "but how to..." questions, maybe my C implementation is a useful read.