Similarity#
2025-05-20
3 min read time
Jaccard#
- rocgraph_status rocgraph_jaccard_coefficients(
- const rocgraph_handle_t *handle,
- rocgraph_graph_t *graph,
- const rocgraph_vertex_pairs_t *vertex_pairs,
- rocgraph_bool use_weight,
- rocgraph_bool do_expensive_check,
- rocgraph_similarity_result_t **result,
- rocgraph_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 ROCGRAPH_SUCCESS
- Returns:
error code
Sorensen#
- rocgraph_status rocgraph_sorensen_coefficients(
- const rocgraph_handle_t *handle,
- rocgraph_graph_t *graph,
- const rocgraph_vertex_pairs_t *vertex_pairs,
- rocgraph_bool use_weight,
- rocgraph_bool do_expensive_check,
- rocgraph_similarity_result_t **result,
- rocgraph_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 ROCGRAPH_SUCCESS
- Returns:
error code
Overlap#
- rocgraph_status rocgraph_overlap_coefficients(
- const rocgraph_handle_t *handle,
- rocgraph_graph_t *graph,
- const rocgraph_vertex_pairs_t *vertex_pairs,
- rocgraph_bool use_weight,
- rocgraph_bool do_expensive_check,
- rocgraph_similarity_result_t **result,
- rocgraph_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 ROCGRAPH_SUCCESS
- Returns:
error code
Similarty Support Functions#
- rocgraph_vertex_pairs_t *rocgraph_similarity_result_get_vertex_pairs(
- rocgraph_similarity_result_t *result,
Get vertex pair from the similarity result.
- Parameters:
result – [in] The result from a similarity algorithm
- Returns:
vertex pairs
- rocgraph_type_erased_device_array_view_t *rocgraph_similarity_result_get_similarity(
- rocgraph_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 rocgraph_similarity_result_free(
- rocgraph_similarity_result_t *result,
Free similarity result.
- Parameters:
result – [in] The result from a similarity algorithm