Core#

2025-05-20

3 min read time

Applies to Linux

Core Number#

rocgraph_status rocgraph_core_number(
const rocgraph_handle_t *handle,
rocgraph_graph_t *graph,
rocgraph_k_core_degree_type degree_type,
rocgraph_bool do_expensive_check,
rocgraph_core_result_t **result,
rocgraph_error_t **error,
)#

Perform core number.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • degree_type[in] Compute core_number using in, out or both in and out edges

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

  • result[out] Opaque pointer to core number 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

K-Core#

rocgraph_status rocgraph_k_core(
const rocgraph_handle_t *handle,
rocgraph_graph_t *graph,
size_t k,
rocgraph_k_core_degree_type degree_type,
const rocgraph_core_result_t *core_result,
rocgraph_bool do_expensive_check,
rocgraph_k_core_result_t **result,
rocgraph_error_t **error,
)#

Perform k_core using output from core_number.

Parameters:
  • handle[in] Handle for accessing resources

  • graph[in] Pointer to graph

  • k[in] The value of k to use

  • degree_type[in] Compute core_number using in, out or both in and out edges. Ignored if core_result is specified.

  • core_result[in] Result from calling rocgraph_core_number, if NULL then call core_number inside this function call.

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

  • result[out] Opaque pointer to k_core 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

Core Support Functions#

enum rocgraph_k_core_degree_type#

Enumeration for computing core number.

Values:

enumerator rocgraph_k_core_degree_type_in#

Compute core_number using incoming edges

enumerator rocgraph_k_core_degree_type_out#

Compute core_number using outgoing edges

enumerator rocgraph_k_core_degree_type_inout#

Compute core_number using both incoming and outgoing edges

rocgraph_status rocgraph_core_result_create(
const rocgraph_handle_t *handle,
rocgraph_type_erased_device_array_view_t *vertices,
rocgraph_type_erased_device_array_view_t *core_numbers,
rocgraph_core_result_t **core_result,
rocgraph_error_t **error,
)#

Create a core_number result (in case it was previously extracted)

Parameters:
  • handle[in] Handle for accessing resources

  • vertices[in] The result from core number

  • core_numbers[in] The result from core number

  • core_result[out] Opaque pointer to core number 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

rocgraph_type_erased_device_array_view_t *rocgraph_core_result_get_vertices(
rocgraph_core_result_t *result,
)#

Get the vertex ids from the core result.

Parameters:

result[in] The result from core number

Returns:

type erased array of vertex ids

rocgraph_type_erased_device_array_view_t *rocgraph_core_result_get_core_numbers(
rocgraph_core_result_t *result,
)#

Get the core numbers from the core result.

Parameters:

result[in] The result from core number

Returns:

type erased array of core numbers

void rocgraph_core_result_free(
rocgraph_core_result_t *result,
)#

Free core result.

Parameters:

result[in] The result from core number

rocgraph_type_erased_device_array_view_t *rocgraph_k_core_result_get_src_vertices(
rocgraph_k_core_result_t *result,
)#

Get the src vertex ids from the k-core result.

Parameters:

result[in] The result from k-core

Returns:

type erased array of src vertex ids

rocgraph_type_erased_device_array_view_t *rocgraph_k_core_result_get_dst_vertices(
rocgraph_k_core_result_t *result,
)#

Get the dst vertex ids from the k-core result.

Parameters:

result[in] The result from k-core

Returns:

type erased array of dst vertex ids

rocgraph_type_erased_device_array_view_t *rocgraph_k_core_result_get_weights(
rocgraph_k_core_result_t *result,
)#

Get the weights from the k-core result.

Returns NULL if the graph is unweighted

Parameters:

result[in] The result from k-core

Returns:

type erased array of weights

void rocgraph_k_core_result_free(
rocgraph_k_core_result_t *result,
)#

Free k-core result.

Parameters:

result[in] The result from k-core

struct rocgraph_core_result_t#
#include <rocgraph_core_result_t.h>

Opaque core number result type.

Public Members

int32_t align_#

alignment variable

struct rocgraph_k_core_result_t#
#include <rocgraph_k_core_result_t.h>

Opaque k-core result type.

Public Members

int32_t align_#

alignment variable