diff --git a/README.md b/README.md index 503d75c2..9bcb6775 100644 --- a/README.md +++ b/README.md @@ -317,7 +317,8 @@ To run test **with** updates (from `build` directory) - Visual search engine for 1M amazon products (MXNet + HNSW): [website](https://thomasdelteil.github.io/VisualSearch_MXNet/), [code](https://github.com/ThomasDelteil/VisualSearch_MXNet), demo by [@ThomasDelteil](https://github.com/ThomasDelteil) ### References - +HNSW paper: +``` @article{malkov2018efficient, title={Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs}, author={Malkov, Yu A and Yashunin, Dmitry A}, @@ -328,3 +329,6 @@ To run test **with** updates (from `build` directory) year={2018}, publisher={IEEE} } +``` + +The update algorithm supported in this repository is to be published in "Dynamic Updates For HNSW, Hierarchical Navigable Small World Graphs" US Patent 15/929,802 by Apoorv Sharma, Abhishek Tayal and Yury Malkov. diff --git a/hnswlib/bruteforce.h b/hnswlib/bruteforce.h index 24260400..6074c5f9 100644 --- a/hnswlib/bruteforce.h +++ b/hnswlib/bruteforce.h @@ -78,7 +78,8 @@ namespace hnswlib { dict_external_to_internal.erase(cur_external); labeltype label=*((labeltype*)(data_ + size_per_element_ * (cur_element_count-1) + data_size_)); - dict_external_to_internal[label]=cur_c; + if (cur_external != label) + dict_external_to_internal[label]=cur_c; memcpy(data_ + size_per_element_ * cur_c, data_ + size_per_element_ * (cur_element_count-1), data_size_+sizeof(labeltype));