8typedef float (*DistanceFunc)(Pointer a, Pointer b);
16int compareGraphVertices(Pointer vertex1, Pointer vertex2);
18int compareGraphVertexPairs(Pointer p1, Pointer p2);
106int compareVertexPairsEuclidean(Pointer first, Pointer second);
155 DistanceFunc distance);
Abstract undirected graph with weighted edges.
ADTVector implementation using a dynamic array.
Definition ADTGraph.hpp:17
ADT Priority Queue.
Definition ADTPQueue.hpp:19
ADT Vector.
Definition ADTVector.hpp:58
Functions for the creation of a K-NN graph.
Definition cppdescent.hpp:15
float euclideanDistance(Pointer a, Pointer b)
Returns the Euclidean distance between two points of arbitrary dimension.
Definition cppdescent.cpp:623
Graph * readBinGraph(const char *fp, int dimensions)
Reads a graph from a binary file. To work correctly, the file needs to be first created from the 'wri...
Definition cppdescent.cpp:127
Graph * KNNBruteForceGraph(Vector *data, int K, CompareFunc compare)
Computes the K-NN graph using brute force.
Definition cppdescent.cpp:193
PQueue * NNDescent_Query(Graph *graph, int K, CompareFunc compare, Vector *query)
Computes the K Nearest Neighbors of the query point in the graph.
void writeBinGraph(const char *fp, Graph *graph, int K)
Writes a computed graph to a binary file.
Definition cppdescent.cpp:85
int compareEdgesEuclidean(Pointer first, Pointer second)
Compare edges using the euclideanDistance function.
Definition cppdescent.cpp:640
int compareEdgesManhattan(Pointer first, Pointer second)
Compare edges using the manhattanDistance function.
Graph * NNDescent_KNNGraph(Vector *data, int K, int D, int Trees, float delta, float rho, DistanceFunc distance)
Computes the K-NN graph for the given dataset using the NN-Descent algorithm.
Definition cppdescent.cpp:458
float manhattanDistance(Pointer a, Pointer b)
Returns the Manhattan distance between two points of arbitrary dimension.
void RPTree(Graph *graph, Vector *vec, int K, int D, int dimensions)
Creates a graph using random projection trees.
Definition cppdescent.cpp:660
Vector * readBinData(const char *fp, int dimensions)
Reads the data from a binary file.
Definition cppdescent.cpp:58
float recall(Graph *bfGraph, Graph *nnGraph, int N, int K)
Returns the recall of the graph computed by NN-Descent, compared to the brute force graph.
Definition cppdescent.cpp:167