Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.algorithms.core.k_crust

k_crust(G, k=None, core_number=None)[source]

Return the k-crust of G.

The k-crust is the graph G with the k-core removed.

Parameters:
  • G (NetworkX graph) – A graph or directed graph.
  • k (int, optional) – The order of the shell. If not specified return the main crust.
  • core_number (dictionary, optional) – Precomputed core numbers for the graph G.
Returns:

G – The k-crust subgraph

Return type:

NetworkX graph

Raises:

NetworkXError – The k-crust is not implemented for graphs with self loops or parallel edges.

Notes

This definition of k-crust is different than the definition in [1]. The k-crust in [1] is equivalent to the k+1 crust of this algorithm.

Not implemented for graphs with parallel edges or self loops.

For directed graphs the node degree is defined to be the in-degree + out-degree.

Graph, node, and edge attributes are copied to the subgraph.

See also

core_number()

References

[1](1, 2) A model of Internet topology using k-shell decomposition Shai Carmi, Shlomo Havlin, Scott Kirkpatrick, Yuval Shavitt, and Eran Shir, PNAS July 3, 2007 vol. 104 no. 27 11150-11154 http://www.pnas.org/content/104/27/11150.full