ZJULearning / nsg

Navigating Spreading-out Graph For Approximate Nearest Neighbor Search
MIT License
621 stars 148 forks source link

Why not optimize tree_grow function by union-find-set in Build function? #24

Closed op-hunter closed 4 years ago

op-hunter commented 4 years ago

Learn much posture of C++ programing from your code. But I think there is still space for optimizing the performance by using union-find-set to judge the connectivity of the NSG. emm.. maybe can economize a non-recursive DFS function, am i right:)

DelightRun commented 4 years ago

Yes, DFS can be optimized using union-find-set, BFS, etc. However, the time cost of DFS is negligible compare to the main process of building NSG, optimization for DFS will not make much improvement for the whole building process.