Core#

Core Number#

cugraph_error_code_t cugraph_core_number(const cugraph_resource_handle_t *handle, cugraph_graph_t *graph, cugraph_k_core_degree_type_t degree_type, bool_t do_expensive_check, cugraph_core_result_t **result, cugraph_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 CUGRAPH_SUCCESS

Returns:

error code

K-Core#

cugraph_error_code_t cugraph_k_core(const cugraph_resource_handle_t *handle, cugraph_graph_t *graph, size_t k, cugraph_k_core_degree_type_t degree_type, const cugraph_core_result_t *core_result, bool_t do_expensive_check, cugraph_k_core_result_t **result, cugraph_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 cugraph_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 CUGRAPH_SUCCESS

Returns:

error code

Core Support Functions#

enum cugraph_k_core_degree_type_t#

Enumeration for computing core number.

Values:

enumerator K_CORE_DEGREE_TYPE_IN#
enumerator K_CORE_DEGREE_TYPE_OUT#

Compute core_number using incoming edges

enumerator K_CORE_DEGREE_TYPE_INOUT#

Compute core_number using outgoing edges

cugraph_error_code_t cugraph_core_result_create(const cugraph_resource_handle_t *handle, cugraph_type_erased_device_array_view_t *vertices, cugraph_type_erased_device_array_view_t *core_numbers, cugraph_core_result_t **core_result, cugraph_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

  • 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 CUGRAPH_SUCCESS

Returns:

error code

cugraph_type_erased_device_array_view_t *cugraph_core_result_get_vertices(cugraph_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

cugraph_type_erased_device_array_view_t *cugraph_core_result_get_core_numbers(cugraph_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 cugraph_core_result_free(cugraph_core_result_t *result)#

Free core result.

Parameters:

result[in] The result from core number

cugraph_type_erased_device_array_view_t *cugraph_k_core_result_get_src_vertices(cugraph_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

cugraph_type_erased_device_array_view_t *cugraph_k_core_result_get_dst_vertices(cugraph_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

cugraph_type_erased_device_array_view_t *cugraph_k_core_result_get_weights(cugraph_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 cugraph_k_core_result_free(cugraph_k_core_result_t *result)#

Free k-core result.

Parameters:

result[in] The result from k-core