NSW(Navigable Small World)算法的纯Python实现
import random
import nsw
graph = nsw.NSWGraph(10)
points = [[random.random(), random.random(), random.random()] for _ in range(10)]
graph.add_nodes(points)
query_node = nsw.Node(None, [0.1, 0.2, 0.3])
graph.find_nearest(query_node)
该项目的NSW(Navigable Small World)算法实现基于以下论文:
@misc{malkov2018efficient,
title={Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs},
author={Yu. A. Malkov and D. A. Yashunin},
year={2018},
eprint={1603.09320},
archivePrefix={arXiv},
primaryClass={cs.DS}
}
论文链接: https://arxiv.org/abs/1603.09320
该项目签署了Apache-2.0 授权许可,详情请参阅 LICENSE