Core Functions#
2025-05-20
4 min read time
Core Number#
- hipgraph_error_code_t hipgraph_core_number(
- const hipgraph_resource_handle_t *handle,
- hipgraph_graph_t *graph,
- hipgraph_k_core_degree_type_t degree_type,
- hipgraph_bool_t do_expensive_check,
- hipgraph_core_result_t **result,
- hipgraph_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 HIPGRAPH_SUCCESS
- Returns:
error code
K-Core#
- hipgraph_error_code_t hipgraph_k_core(
- const hipgraph_resource_handle_t *handle,
- hipgraph_graph_t *graph,
- size_t k,
- hipgraph_k_core_degree_type_t degree_type,
- const hipgraph_core_result_t *core_result,
- hipgraph_bool_t do_expensive_check,
- hipgraph_k_core_result_t **result,
- hipgraph_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 hipgraph_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 HIPGRAPH_SUCCESS
- Returns:
error code
Core Support Functions#
- enum hipgraph_k_core_degree_type_t#
Enumeration for computing core number.
Values:
- enumerator HIPGRAPH_K_CORE_DEGREE_TYPE_IN#
- enumerator HIPGRAPH_K_CORE_DEGREE_TYPE_OUT#
Compute core_number using incoming edges
- enumerator HIPGRAPH_K_CORE_DEGREE_TYPE_INOUT#
Compute core_number using outgoing edges
- hipgraph_error_code_t hipgraph_core_result_create(
)#
- const hipgraph_resource_handle_t *handle,
- hipgraph_type_erased_device_array_view_t *vertices,
- hipgraph_type_erased_device_array_view_t *core_numbers,
- hipgraph_core_result_t **core_result,
- hipgraph_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 HIPGRAPH_SUCCESS
- Returns:
error code
- hipgraph_type_erased_device_array_view_t *hipgraph_core_result_get_vertices(
)#
- hipgraph_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
- hipgraph_type_erased_device_array_view_t *hipgraph_core_result_get_core_numbers(
)#
- hipgraph_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 hipgraph_core_result_free(
)#
- hipgraph_core_result_t *result,
Free core result.
- Parameters:
result – [in] The result from core number
- hipgraph_type_erased_device_array_view_t *hipgraph_k_core_result_get_src_vertices(
)#
- hipgraph_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
- hipgraph_type_erased_device_array_view_t *hipgraph_k_core_result_get_dst_vertices(
)#
- hipgraph_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
- hipgraph_type_erased_device_array_view_t *hipgraph_k_core_result_get_weights(
)#
- hipgraph_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 hipgraph_k_core_result_free(
)#
- hipgraph_k_core_result_t *result,
Free k-core result.
- Parameters:
result – [in] The result from k-core