method_hnsw function

An internal function to use HNSW algorithm via the RcppHNSW package.