Note
This documents the development version of NetworkX. Documentation for the current release can be found here.
networkx.algorithms.core.k_shell¶

k_shell
(G, k=None, core_number=None)[source]¶ Returns the kshell of G.
The kshell is the subgraph induced by nodes with core number k. That is, nodes in the kcore that are not in the (k+1)core.
 Parameters
 GNetworkX graph
A graph or directed graph.
 kint, optional
The order of the shell. If not specified return the outer shell.
 core_numberdictionary, optional
Precomputed core numbers for the graph G.
 Returns
 GNetworkX graph
The kshell subgraph
 Raises
 NetworkXError
The kshell is not implemented for graphs with self loops or parallel edges.
See also
Notes
This is similar to k_corona but in that case only neighbors in the kcore are considered.
Not implemented for graphs with parallel edges or self loops.
For directed graphs the node degree is defined to be the indegree + outdegree.
Graph, node, and edge attributes are copied to the subgraph.
References
 1
A model of Internet topology using kshell decomposition Shai Carmi, Shlomo Havlin, Scott Kirkpatrick, Yuval Shavitt, and Eran Shir, PNAS July 3, 2007 vol. 104 no. 27 1115011154 http://www.pnas.org/content/104/27/11150.full