#include "xf_graph_L3.hpp"
event <int> knnSimilaritySSSparse ( xf::graph::L3::Handle& handle, uint32_t sourceNUM, uint32_t* sourceIndices, uint32_t* sourceWeights, uint32_t topK, xf::graph::Graph <uint32_t, float> gr, std::string* knownLabels, std::string& label )
The single source k-nearest neighbors API for sparse graph. knnSimilarity API is based on the cosine similarity algorithm.
Parameters:
| handle | Graph library L3 handle |
| sourceNUM | Input, sourceIndices buffer length of source vertex |
| sourceIndices | Input, source vertex’s out members |
| sourceWeights | Input, weights of the source vertex’s out members |
| topK | Input, the output similarity buffer length |
| gr | Input, CSR graph of IDs’ type of uint32_t and weights’ type of float |
| knownLabels | Input, labels of each vertex in the sparse graph |
| label | Output, the predicted most similar label |