KGraph
 All Classes Namespaces Functions Pages
Public Member Functions | List of all members
kgraph::SearchOracle Class Referenceabstract

Search oracle. More...

#include <kgraph.h>

Inheritance diagram for kgraph::SearchOracle:
kgraph::MatrixOracle< DATA_TYPE, DIST_TYPE >::SearchOracle

Public Member Functions

virtual unsigned size () const =0
 Returns the size of the dataset.
 
virtual float operator() (unsigned i) const =0
 Computes similarity. More...
 
unsigned search (unsigned K, float epsilon, unsigned *ids, float *dists=nullptr) const
 Search with brutal force. More...
 

Detailed Description

Search oracle.

The search oracle is the user-supplied plugin that computes the distance between the query and a arbitrary object in the dataset. It is used for online k-NN search.

Member Function Documentation

virtual float kgraph::SearchOracle::operator() ( unsigned  i) const
pure virtual

Computes similarity.

0 <= i < size() are the index of an objects in the dataset. This method return the distance between the query and object i.

Implemented in kgraph::MatrixOracle< DATA_TYPE, DIST_TYPE >::SearchOracle.

unsigned kgraph::SearchOracle::search ( unsigned  K,
float  epsilon,
unsigned *  ids,
float *  dists = nullptr 
) const

Search with brutal force.

Search results are guaranteed to be ranked in ascending order of distance.

Parameters
KReturn at most K nearest neighbors.
epsilonOnly returns nearest neighbors within distance epsilon.
idsPointer to the memory where neighbor IDs are returned.
distsPointer to the memory where distance values are returned, can be nullptr.

The documentation for this class was generated from the following file: