|
|
@ -21,9 +21,22 @@ typedef struct HNSWContext |
|
|
|
HNSWGraph *graph; // graph of HNSW |
|
|
|
} HNSWContext; |
|
|
|
|
|
|
|
|
|
|
|
typedef struct { |
|
|
|
unsigned int* visited; |
|
|
|
unsigned int size; |
|
|
|
unsigned int mark; |
|
|
|
} VisitedList; |
|
|
|
|
|
|
|
// help functions |
|
|
|
|
|
|
|
// public functions |
|
|
|
HNSWContext *init_hnsw_context(const char *file_path, size_t dim, size_t len); |
|
|
|
void insert_vec(HNSWContext *ctx, VecData vec); |
|
|
|
void approximate_knn(HNSWContext *ctx, VecData *results); |
|
|
|
|
|
|
|
VisitedList* visited_list_new(int size); |
|
|
|
void visited_list_reset(VisitedList* vl); |
|
|
|
unsigned int visited_list_get_visit_mark(VisitedList* vl); |
|
|
|
unsigned int* visited_list_get_visited(VisitedList* vl); |
|
|
|
void visited_list_free(VisitedList* vl); |