Find the k-cores of a graph.

The k-core is found by recursively pruning nodes with degrees less than k.

See the following references for details:

An O(m) Algorithm for Cores Decomposition of Networks Vladimir Batagelj and Matjaz Zaversnik, 2003.

Generalized Cores Vladimir Batagelj and Matjaz Zaversnik, 2002.

For directed graphs a more general notion is that of D-cores which looks at (k, l) restrictions on (in, out) degree. The (k, k) D-core is the k-core.

D-cores: Measuring Collaboration of Directed Graphs Based on Degeneracy Christos Giatsidis, Dimitrios M. Thilikos, Michalis Vazirgiannis, ICDM 2011.

Multi-scale structure and topological anomaly detection via a new network statistic: The onion decomposition L. Hébert-Dufresne, J. A. Grochow, and A. Allard Scientific Reports 6, 31708 (2016)


Returns the core number for each node.

k_core(G[, k, core_number])

Returns the k-core of G.

k_shell(G[, k, core_number])

Returns the k-shell of G.

k_crust(G[, k, core_number])

Returns the k-crust of G.

k_corona(G, k[, core_number])

Returns the k-corona of G.

k_truss(G, k)

Returns the k-truss of G.


Returns the layer of each vertex in an onion decomposition of the graph.