Similarity#

Jaccard#

cugraph_error_code_t cugraph_jaccard_coefficients(const cugraph_resource_handle_t *handle, cugraph_graph_t *graph, const cugraph_vertex_pairs_t *vertex_pairs, bool_t use_weight, bool_t do_expensive_check, cugraph_similarity_result_t **result, cugraph_error_t **error)#

Perform Jaccard similarity computation.

Compute the similarity for the specified vertex_pairs

Note that Jaccard similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertex_pairs[in] Vertex pair for input

  • use_weight[in] If true consider the edge weight in the graph, if false use an edge weight of 1

  • do_expensive_check[in] A flag to run expensive checks for input arguments (if set to true).

  • result[out] Opaque pointer to similarity results

  • error[out] Pointer to an error object storing details of any error. Will be populated if error code is not CUGRAPH_SUCCESS

Returns:

error code

Sorensen#

cugraph_error_code_t cugraph_sorensen_coefficients(const cugraph_resource_handle_t *handle, cugraph_graph_t *graph, const cugraph_vertex_pairs_t *vertex_pairs, bool_t use_weight, bool_t do_expensive_check, cugraph_similarity_result_t **result, cugraph_error_t **error)#

Perform Sorensen similarity computation.

Compute the similarity for the specified vertex_pairs

Note that Sorensen similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertex_pairs[in] Vertex pair for input

  • use_weight[in] If true consider the edge weight in the graph, if false use an edge weight of 1

  • do_expensive_check[in] A flag to run expensive checks for input arguments (if set to true).

  • result[out] Opaque pointer to similarity results

  • error[out] Pointer to an error object storing details of any error. Will be populated if error code is not CUGRAPH_SUCCESS

Returns:

error code

Overlap#

cugraph_error_code_t cugraph_overlap_coefficients(const cugraph_resource_handle_t *handle, cugraph_graph_t *graph, const cugraph_vertex_pairs_t *vertex_pairs, bool_t use_weight, bool_t do_expensive_check, cugraph_similarity_result_t **result, cugraph_error_t **error)#

Perform overlap similarity computation.

Compute the similarity for the specified vertex_pairs

Note that overlap similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertex_pairs[in] Vertex pair for input

  • use_weight[in] If true consider the edge weight in the graph, if false use an edge weight of 1

  • do_expensive_check[in] A flag to run expensive checks for input arguments (if set to true).

  • result[out] Opaque pointer to similarity results

  • error[out] Pointer to an error object storing details of any error. Will be populated if error code is not CUGRAPH_SUCCESS

Returns:

error code

Similarty Support Functions#

cugraph_vertex_pairs_t *cugraph_similarity_result_get_vertex_pairs(cugraph_similarity_result_t *result)#

Get vertex pair from the similarity result.

Parameters:

result[in] The result from a similarity algorithm

Returns:

vertex pairs

cugraph_type_erased_device_array_view_t *cugraph_similarity_result_get_similarity(cugraph_similarity_result_t *result)#

Get the similarity coefficient array.

Parameters:

result[in] The result from a similarity algorithm

Returns:

type erased array of similarity coefficients

void cugraph_similarity_result_free(cugraph_similarity_result_t *result)#

Free similarity result.

Parameters:

result[in] The result from a similarity algorithm