- cugraph.core_number(G, degree_type='bidirectional')#
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 a k-core but not to k+1-core. This call does not support a graph with self-loops and parallel edges.
- GcuGraph.Graph or networkx.Graph
The graph should contain undirected edges where undirected edges are represented as directed edges in both directions. While this graph can contain edge weights, they don’t participate in the calculation of the core numbers. The current implementation only supports undirected graphs.
- degree_type: str, (default=”bidirectional”)
This option determines if the core number computation should be based on input, output, or both directed edges, with valid values being “incoming”, “outgoing”, and “bidirectional” respectively.
- dfcudf.DataFrame or python dictionary (in NetworkX input)
GPU data frame containing two cudf.Series of size V: the vertex identifiers and the corresponding core number values.
Contains the vertex identifiers
Contains the core number of vertices
>>> from cugraph.datasets import karate >>> G = karate.get_graph(download=True) >>> df = cugraph.core_number(G)