Completed kNN graph construction implementation, fixed seg fault