Labeling Functions#

2025-05-20

3 min read time

Applies to Linux

Weakly Connected Components#

hipgraph_error_code_t hipgraph_weakly_connected_components(
const hipgraph_resource_handle_t *handle,
hipgraph_graph_t *graph,
hipgraph_bool_t do_expensive_check,
hipgraph_labeling_result_t **result,
hipgraph_error_t **error,
)#

Labels each vertex in the input graph with its (weakly-connected-)component ID.

The input graph must be symmetric. Component IDs can be arbitrary integers (they can be non-consecutive and are not ordered by component size or any other criterion).

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

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

  • result[out] Opaque pointer to labeling results

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

Strongly Connected Components#

hipgraph_error_code_t hipgraph_strongly_connected_components(
const hipgraph_resource_handle_t *handle,
hipgraph_graph_t *graph,
hipgraph_bool_t do_expensive_check,
hipgraph_labeling_result_t **result,
hipgraph_error_t **error,
)#

Labels each vertex in the input graph with its (strongly-connected-)component ID.

The input graph may be asymmetric. Component IDs can be arbitrary integers (they can be non-consecutive and are not ordered by component size or any other criterion).

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

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

  • result[out] Opaque pointer to labeling results

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

Labeling Support Functions#

hipgraph_type_erased_device_array_view_t *hipgraph_labeling_result_get_vertices(
hipgraph_labeling_result_t *result,
)#

Get the vertex ids from the labeling result.

Parameters:

result[in] The result from a labeling algorithm

Returns:

type erased array of vertex ids

hipgraph_type_erased_device_array_view_t *hipgraph_labeling_result_get_labels(
hipgraph_labeling_result_t *result,
)#

Get the label values from the labeling result.

Parameters:

result[in] The result from a labeling algorithm

Returns:

type erased array of label values

void hipgraph_labeling_result_free(
hipgraph_labeling_result_t *result,
)#

Free labeling result.

Parameters:

result[in] The result from a labeling algorithm