lmcinnes / pynndescent

A Python nearest neighbor descent for approximate nearest neighbors
BSD 2-Clause "Simplified" License
899 stars 105 forks source link

how to create a plot for HNSW #248

Closed jianshu93 closed 1 month ago

jianshu93 commented 1 month ago

Dear pynndescent team,

Just curious how the animate here (https://pynndescent.readthedocs.io/en/latest/how_pynndescent_works.html) was created. I want to create a similar one for HNSW (another nearest neighbor graph search algorithm) with hierarchical layers. I understand the algorithm itself is different but at least a similar idea can be used to create the plot?

Best, Jianshu

lmcinnes commented 1 month ago

Unfortunately the notebooks I had for making those animations were lost in a hard drive crash. They were just generated using the matplotlib animation tools however, and didn't involve anything too fancy -- just stepping through the algorithm and updating the plots accordingly. I even did an NSW animation which was in this talk at 33 minutes in. Unfortunately that animation was lost along with the notebooks (the other animations got mirrored elsewhere).

jianshu93 commented 1 month ago

Thanks anyway, I can imagine for HNSW, in a certain layer, the search path should be similar but faster since the long range links will speed up the search but for KNN, there are no long range links.

Best, Jianshu