onion_layers#
- onion_layers(G)[source]#
Returns the layer of each vertex in an onion decomposition of the graph.
The onion decomposition refines the k-core decomposition by providing information on the internal organization of each k-shell. It is usually used alongside the
core numbers
.- Parameters:
- GNetworkX graph
A simple graph without self loops or parallel edges
- Returns:
- od_layersdictionary
A dictionary keyed by vertex to the onion layer. The layers are contiguous integers starting at 1.
- Raises:
- NetworkXError
The onion decomposition is not implemented for graphs with self loops or parallel edges or for directed graphs.
See also
Notes
Not implemented for graphs with parallel edges or self loops.
Not implemented for directed graphs.
References
[1]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) http://doi.org/10.1038/srep31708
[2]Percolation and the effective structure of complex networks A. Allard and L. Hébert-Dufresne Physical Review X 9, 011023 (2019) http://doi.org/10.1103/PhysRevX.9.011023