#include "hnsw.h"


VisitedList* visited_list_new(int size) {
    VisitedList* vl = malloc(sizeof(VisitedList));
    vl->size = size;
    vl->mark = 1;
    vl->visited = calloc(size, sizeof(unsigned int));
    return vl;
}

void visited_list_reset(VisitedList* vl) {
    if (++vl->mark == 0) {
        vl->mark = 1;
        memset(vl->visited, 0, sizeof(unsigned int) * vl->size);
    }
}

unsigned int visited_list_get_visit_mark(VisitedList* vl) {
    return vl->mark;
}

unsigned int* visited_list_get_visited(VisitedList* vl) {
    return vl->visited;
}

void visited_list_free(VisitedList* vl) {
    free(vl->visited);
    free(vl);
}