ZJULearning / nsg

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

Build逻辑中,InterInsert函数实现有问题 #32

Open liql2007 opened 3 years ago

liql2007 commented 3 years ago

https://github.com/ZJULearning/nsg/blob/4da5ee5947193b4d6ab0338d5ce90e0455345a50/src/index_nsg.cpp#L332

根据三角不等式裁边之后, 遗留的边的个数,即result中的元素个数,很可能小于range,此时需要将末尾下一个元素的distance置为-1.

即,需要在 for 循环之后,加上代码: if (result.size() < range) { des_pool[result.size()].distance = -1; }