This is a golang binding of hnswlib. For more information, please follow hnswlib and Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs..
CGO is required to be enabled and c, c++ compiler is required to build this package.
go get github.com/oligo/hnswgo
See example/example.go
or test codes to see usage.
For detailed information, please refer to the project's documentation at pkg.go.dev.
Some important arguments are listed below:
argument | type | |
---|---|---|
dim | int | vector dimension |
M | int | seeALGO_PARAMS.md |
efConstruction | int | seeALGO_PARAMS.md |
randomSeed | int | random seed for hnsw |
maxElements | int | max records in data |
spaceType | str |
spaceType | distance |
---|---|
ip | inner product |
cosine | cosine similarity |
l2 | l2 |
HNSWGO implements the main hnsw API,Brute force index is not implemented as it is rarely used.
For more information, please consult documents of the hnswlib projects.
Malkov, Yu A., and D. A. Yashunin. "Efficient and robust approximate nearest neighbor search using Hierarchical Navigable Small World graphs." TPAMI, preprint: [https://arxiv.org/abs/1603.09320]