#pragma once

#include <stdio.h>
#include "utils.h"

typedef struct NSWGraph
{

} NSWGraph;

typedef struct HNSWGraph
{
    size_t layers_num; // number of layers
    NSWGraph **layers;
} HNSWGraph;

typedef struct HNSWContext
{
    size_t dim;       // dimension of dataset
    size_t len;       // size of dataset
    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);
