Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.graph_core_number#

graph_core_number(graph, /)#

Return the core number for each node in the graph.

A k-core is a maximal subgraph that contains nodes of degree k or more.

Note

The function implicitly assumes that there are no parallel edges or self loops. It may produce incorrect/unexpected results if the input graph has self loops or parallel edges.

Parameters:

PyGraph – The graph to get core numbers

Returns:

A dictionary keyed by node index to the core number

Return type:

dict