Similarity#

Functions

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

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

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

cugraph_error_code_t cugraph_cosine_similarity_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 cosine similarity computation.

Compute the similarity for the specified vertex_pairs

Note that cosine 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

cugraph_error_code_t cugraph_all_pairs_jaccard_coefficients(
const cugraph_resource_handle_t *handle,
cugraph_graph_t *graph,
const cugraph_type_erased_device_array_view_t *vertices,
bool_t use_weight,
size_t topk,
bool_t do_expensive_check,
cugraph_similarity_result_t **result,
cugraph_error_t **error
)#

Perform All-Pairs Jaccard similarity computation.

Compute the similarity for all vertex pairs derived from the two-hop neighbors of an optional specified vertex list. This function will identify the two-hop neighbors of the specified vertices (all vertices in the graph if not specified) and compute similarity for those vertices.

If the topk parameter is specified then the result will only contain the top k highest scoring results.

Note that Jaccard similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertices[in] Vertex list for input. If null then compute based on all vertices in the graph.

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

  • topk[in] Specify how many answers to return. Specifying SIZE_MAX will return all values.

  • 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

cugraph_error_code_t cugraph_all_pairs_sorensen_coefficients(
const cugraph_resource_handle_t *handle,
cugraph_graph_t *graph,
const cugraph_type_erased_device_array_view_t *vertices,
bool_t use_weight,
size_t topk,
bool_t do_expensive_check,
cugraph_similarity_result_t **result,
cugraph_error_t **error
)#

Perform All Pairs Sorensen similarity computation.

Compute the similarity for all vertex pairs derived from the two-hop neighbors of an optional specified vertex list. This function will identify the two-hop neighbors of the specified vertices (all vertices in the graph if not specified) and compute similarity for those vertices.

If the topk parameter is specified then the result will only contain the top k highest scoring results.

Note that Sorensen similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertices[in] Vertex list for input. If null then compute based on all vertices in the graph.

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

  • topk[in] Specify how many answers to return. Specifying SIZE_MAX will return all values.

  • 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

cugraph_error_code_t cugraph_all_pairs_overlap_coefficients(
const cugraph_resource_handle_t *handle,
cugraph_graph_t *graph,
const cugraph_type_erased_device_array_view_t *vertices,
bool_t use_weight,
size_t topk,
bool_t do_expensive_check,
cugraph_similarity_result_t **result,
cugraph_error_t **error
)#

Perform All Pairs overlap similarity computation.

Compute the similarity for all vertex pairs derived from the two-hop neighbors of an optional specified vertex list. This function will identify the two-hop neighbors of the specified vertices (all vertices in the graph if not specified) and compute similarity for those vertices.

If the topk parameter is specified then the result will only contain the top k highest scoring results.

Note that overlap similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertices[in] Vertex list for input. If null then compute based on all vertices in the graph.

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

  • topk[in] Specify how many answers to return. Specifying SIZE_MAX will return all values.

  • 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

cugraph_error_code_t cugraph_all_pairs_cosine_similarity_coefficients(
const cugraph_resource_handle_t *handle,
cugraph_graph_t *graph,
const cugraph_type_erased_device_array_view_t *vertices,
bool_t use_weight,
size_t topk,
bool_t do_expensive_check,
cugraph_similarity_result_t **result,
cugraph_error_t **error
)#

Perform All Pairs cosine similarity computation.

Compute the similarity for all vertex pairs derived from the two-hop neighbors of an optional specified vertex list. This function will identify the two-hop neighbors of the specified vertices (all vertices in the graph if not specified) and compute similarity for those vertices.

If the topk parameter is specified then the result will only contain the top k highest scoring results.

Note that cosine similarity must run on a symmetric graph.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • vertices[in] Vertex list for input. If null then compute based on all vertices in the graph.

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

  • topk[in] Specify how many answers to return. Specifying SIZE_MAX will return all values.

  • 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

struct cugraph_similarity_result_t#
#include <similarity_algorithms.h>

Opaque similarity result type.

Public Members

int32_t align_#