namespace L3

// classes

class Handle

louvainModularity

#include "xf_graph_L3.hpp"
void louvainModularity (
    std::shared_ptr <xf::graph::L3::Handle> handle,
    int flowMode,
    GLV* glv,
    GLV* pglv,
    LouvainPara* para_lv
    )

louvain algorithm is implemented.

Parameters:

handle Graph library L3 handle
flowMode flowMode of multi louvain kernel. LOUVAINMOD_PRUNING_KERNEL = 1 is a 1cu kernel design fit for u50 LOUVAINMOD_2CU_U55C_KERNEL = 2 a 2cu kernel design fit for u55c the performance of one compute unit by different board is the same
glv the original graph info before partition.
pglv one of the partitioned sub-graph info to input to kernel.
para_lv parameters of louvain kernel

twoHop

#include "xf_graph_L3.hpp"
event <int> twoHop (
    xf::graph::L3::Handle& handle,
    uint32_t* numPart,
    uint64_t** pairPart,
    uint32_t** resPart,
    xf::graph::Graph <uint32_t, float> g
    )

twoHop algorithm is implemented.

Parameters:

handle Graph library L3 handle
numPart Number of pairs of each part to be counted.
pairPart Source and destination pairs of each part to be counted.
resPart result of each part. The order matches the order of the input pairPart.
g Input, CSR graph of IDs’ type of uint32_t and weights’ type of float

pageRankWeight

#include "xf_graph_L3.hpp"
event <int> pageRankWeight (
    xf::graph::L3::Handle& handle,
    float alpha,
    float tolerance,
    int maxIter,
    xf::graph::Graph <uint32_t, float> gr,
    float* pagerank
    )

pageRank algorithm is implemented.

Parameters:

handle Graph library L3 handle
alpha Damping factor, normally 0.85
tolerance Converge tolerance
maxIter Max iteration
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
pagerank Output, float type rank values of each vertex

shortestPath

#include "xf_graph_L3.hpp"
event <int> shortestPath (
    xf::graph::L3::Handle& handle,
    uint32_t nSource,
    uint32_t* sourceID,
    bool weighted,
    xf::graph::Graph <uint32_t, float> gr,
    float** result,
    uint32_t** predecent
    )

The single source shortest path algorithm is implemented, the input is the matrix in CSR format.

Parameters:

handle Graph library L3 handle
nSource Number of source vertices
sourceID IDs of giving source vertices
weighted Bool type flag, when weighted is flag 0, all weights are treated as 1, and when weighted flag is 1, the weights in the gr will be used
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
result The distance result from giving source vertices for each vertex
predecent The result of parent index of each vertex from giving source vertices for each vertex

cosineSimilaritySSSparse

#include "xf_graph_L3.hpp"
event <int> cosineSimilaritySSSparse (
    xf::graph::L3::Handle& handle,
    uint32_t sourceNUM,
    uint32_t* sourceIndices,
    uint32_t* sourceWeights,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t* resultID,
    float* similarity
    )

The single source cosine similarity API for sparse graph.

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
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

jaccardSimilaritySSSparse

#include "xf_graph_L3.hpp"
event <int> jaccardSimilaritySSSparse (
    xf::graph::L3::Handle& handle,
    uint32_t sourceNUM,
    uint32_t* sourceIndices,
    uint32_t* sourceWeights,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t* resultID,
    float* similarity
    )

The single source jaccard similarity API for sparse graph.

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
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

cosineSimilarityAPSparse

#include "xf_graph_L3.hpp"
event <int> cosineSimilarityAPSparse (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t** resultID,
    float** similarity
    )

The all-pairs cosine similarity API for sparse graph.

Parameters:

handle Graph library L3 handle
topK Input, the output similarity buffer length
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
resultID Output, the topK highest similarity IDs of all vertices in the sparse graph
similarity Output, similarity values of all vertices in the sparse graph

jaccardSimilarityAPSparse

#include "xf_graph_L3.hpp"
event <int> jaccardSimilarityAPSparse (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t** resultID,
    float** similarity
    )

The all-pairs jaccard similarity API for sparse graph.

Parameters:

handle Graph library L3 handle
topK Input, the output similarity buffer length
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
resultID Output, the topK highest similarity IDs of all vertices in the sparse graph
similarity Output, similarity values of all vertices in the sparse graph

cosineSimilaritySSDense

#include "xf_graph_L3.hpp"
event <int> cosineSimilaritySSDense (
    xf::graph::L3::Handle& handle,
    uint32_t sourceNUM,
    uint32_t* sourceWeights,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t* resultID,
    float* similarity
    )

The single source cosine similarity API for dense graph.

Parameters:

handle Graph library L3 handle
sourceNUM Input, sourceWeights buffer length of source vertex
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
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

cosineSimilaritySSDenseMultiCardBlocking

#include "xf_graph_L3.hpp"
int cosineSimilaritySSDenseMultiCardBlocking (
    xf::graph::L3::Handle& handle,
    int32_t deviceNm,
    int32_t sourceNUM,
    int32_t* sourceWeights,
    int32_t topK,
    xf::graph::Graph <int32_t, int32_t>** gr,
    int32_t* resultID,
    float* similarity
    )

The Multi-cards’ single source cosine similarity API for dense graph.

Parameters:

handle Graph library L3 handle
deviceNm FPGA card ID
sourceNUM Input, sourceWeights buffer length of source vertex
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 int32_t and weights’ type of int32_t
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

cosineSimilaritySSDenseMultiCard

#include "xf_graph_L3.hpp"
std::vector <event <int>> cosineSimilaritySSDenseMultiCard (
    xf::graph::L3::Handle& handle,
    int32_t deviceNm,
    int32_t sourceNUM,
    int32_t* sourceWeights,
    int32_t topK,
    xf::graph::Graph <int32_t, int32_t>** g,
    int32_t** resultID,
    float** similarity
    )

The Non-blocking Multi-cards’ single source cosine similarity API for dense graph.

Parameters:

handle Graph library L3 handle
deviceNm FPGA card ID
sourceNUM Input, sourceWeights buffer length of source vertex
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 int32_t and weights’ type of int32_t
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

jaccardSimilaritySSDense

#include "xf_graph_L3.hpp"
event <int> jaccardSimilaritySSDense (
    xf::graph::L3::Handle& handle,
    uint32_t sourceNUM,
    uint32_t* sourceWeights,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t* resultID,
    float* similarity
    )

The single source jaccard similarity API for dense graph.

Parameters:

handle Graph library L3 handle
sourceNUM Input, sourceWeights buffer length of source vertex
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
resultID Output, the topK highest similarity IDs
similarity Output, similarity values corresponding to theirs IDs

cosineSimilarityAPDense

#include "xf_graph_L3.hpp"
event <int> cosineSimilarityAPDense (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t** resultID,
    float** similarity
    )

The all-pairs cosine similarity API for dense graph.

Parameters:

handle Graph library L3 handle
topK Input, the output similarity buffer length
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
resultID Output, the topK highest similarity IDs of all vertices in the sparse graph
similarity Output, similarity values of all vertices in the sparse graph

jaccardSimilarityAPDense

#include "xf_graph_L3.hpp"
event <int> jaccardSimilarityAPDense (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    uint32_t** resultID,
    float** similarity
    )

The all-pairs jaccard similarity API for dense graph.

Parameters:

handle Graph library L3 handle
topK Input, the output similarity buffer length
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of float
resultID Output, the topK highest similarity IDs of all vertices in the sparse graph
similarity Output, similarity values of all vertices in the sparse graph

knnSimilaritySSSparse

#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

knnSimilarinyAPSparse

#include "xf_graph_L3.hpp"
event <int> knnSimilarinyAPSparse (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    std::string* knownLabels,
    std::string* label
    )

The all-pairs k-nearest neighbors API for sparse graph. knnSimilarity API is based on the cosine similarity algorithm.

Parameters:

handle Graph library L3 handle
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 labels of all vertices in the sparse graph

knnSimilaritySSDense

#include "xf_graph_L3.hpp"
event <int> knnSimilaritySSDense (
    xf::graph::L3::Handle& handle,
    uint32_t sourceNUM,
    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 dense graph. knnSimilarity API is based on the cosine similarity algorithm.

Parameters:

handle Graph library L3 handle
sourceNUM Input, sourceIndices buffer length of source vertex
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 dense graph
label Output, the predicted most similar label

knnSimilarityAPDense

#include "xf_graph_L3.hpp"
event <int> knnSimilarityAPDense (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    std::string* knownLabels,
    std::string* label
    )

The all-pairs k-nearest neighbors API for dense graph. knnSimilarity API is based on the cosine similarity algorithm.

Parameters:

handle Graph library L3 handle
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 dense graph
label Output, the predicted most similar labels of all vertices in the dense graph

knnSimilarityAPSparse

#include "xf_graph_L3.hpp"
event <int> knnSimilarityAPSparse (
    xf::graph::L3::Handle& handle,
    uint32_t topK,
    xf::graph::Graph <uint32_t, float> gr,
    std::string* knownLabels,
    std::string* label
    )

The all-pairs k-nearest neighbors API for sparse graph. knnSimilarity API is based on the cosine similarity algorithm.

Parameters:

handle Graph library L3 handle
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 dense graph
label Output, the predicted most similar labels of all vertices in the dense graph

triangleCount

#include "xf_graph_L3.hpp"
event <int> triangleCount (
    xf::graph::L3::Handle& handle,
    xf::graph::Graph <uint32_t, uint32_t> gr,
    uint64_t& nTriangle
    )

triangleCount the triangle counting algorithm is implemented, the input is the matrix in CSC format.

Parameters:

handle Graph library L3 handle
gr Input, CSR/CSC graph of IDs’ type of uint32_t and weights’ type of uint32_t
nTriangle Return triangles number

labelPropagation

#include "xf_graph_L3.hpp"
event <int> labelPropagation (
    xf::graph::L3::Handle& handle,
    uint32_t maxIter,
    xf::graph::Graph <uint32_t, uint32_t> gr,
    uint32_t* labels
    )

labelPropagation the label propagation algorithm is implemented

Parameters:

handle Graph library L3 handle
maxIter Max iteration
gr Input, CSR/CSC graph of IDs’ type of uint32_t and weights’ type of uint32_t
labels Output labels

bfs

#include "xf_graph_L3.hpp"
event <int> bfs (
    xf::graph::L3::Handle& handle,
    uint32_t sourceID,
    xf::graph::Graph <uint32_t, uint32_t> gr,
    uint32_t* predecent,
    uint32_t* distance
    )

bfs Implements the directed graph traversal by breath-first search algorithm

Parameters:

handle Graph library L3 handle
sourceID The source vertex ID in this search, starting from 0
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of uint32_t
predecent The result of parent index of each vertex
distance The distance result from giving source vertex for each vertex

wcc

#include "xf_graph_L3.hpp"
event <int> wcc (
    xf::graph::L3::Handle& handle,
    xf::graph::Graph <uint32_t, uint32_t> gr,
    uint32_t* result
    )

connectedComponents Computes the connected component membership of each vertex only for undirected graph

Parameters:

handle Graph library L3 handle
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of uint32_t
result Ouput, result buffer with the vertex label containing the lowest vertex id in the strongly connnected component containing that vertex

scc

#include "xf_graph_L3.hpp"
event <int> scc (
    xf::graph::L3::Handle& handle,
    xf::graph::Graph <uint32_t, uint32_t> gr,
    uint32_t* result
    )

stronglyConnectedComponents Computes the strongly connected component membership of each vertex only for directed graph, and label each vertex with one value containing the lowest vertex id in the SCC containing that vertex.

Parameters:

handle Graph library L3 handle
gr Input, CSR graph of IDs’ type of uint32_t and weights’ type of uint32_t
result Ouput, result buffer with the vertex label containing the lowest vertex id in the strongly connnected component containing that vertex

convertCsrCsc

#include "xf_graph_L3.hpp"
event <int> convertCsrCsc (
    xf::graph::L3::Handle& handle,
    xf::graph::Graph <uint32_t, uint32_t> gr1,
    xf::graph::Graph <uint32_t, uint32_t> gr2
    )

Convert from CSR to CSC, now it supports only CSR to CSC of unweighted graph.

Parameters:

handle Graph library L3 handle
gr1 Input, CSR/CSC graph of IDs’ type of uint32_t and weights’ type of uint32_t
gr2 Output, CSC/CSR graph of IDs’ type of uint32_t and weights’ type of uint32_t