cugraph.core_number#

cugraph.core_number(G: Graph, degree_type='bidirectional') DataFrame[source]#

Compute the core numbers for the nodes of the graph G. A k-core of a graph is a maximal subgraph that contains nodes of degree k or more. A node has a core number of k if it belongs to a k-core but not to k+1-core. This call does not support a graph with self-loops and parallel edges.

Parameters:
GcuGraph.Graph

The current implementation only supports undirected graphs. The graph can contain edge weights, but they don’t participate in the calculation of the core numbers.

degree_type: str, (default=”bidirectional”)

This option is currently ignored. This option may eventually determine if the core number computation should be based on input, output, or both directed edges, with valid values being “incoming”, “outgoing”, and “bidirectional” respectively.

Returns:
dfcudf.DataFrame

GPU data frame containing two cudf.Series of size V: the vertex identifiers and the corresponding core number values.

df[‘vertex’]cudf.Series

Contains the vertex identifiers

df[‘core_number’]cudf.Series

Contains the core number of vertices

Examples

>>> from cugraph.datasets import karate
>>> G = karate.get_graph(download=True)
>>> df = cugraph.core_number(G)
>>> df.head()
   vertex  core_number
0      33            4
1       0            4
2      32            4
3       2            4
4       1            4