networkx.drawing.layout.shell_layout¶
-
shell_layout(G, nlist=None, scale=1, center=None, dim=2)[source]¶ Position nodes in concentric circles.
- Parameters
G (
NetworkX graphorlistofnodes) – A position will be assigned to every node in G.nlist (
listoflists) – List of node lists for each shell.scale (
number (default:1)) – Scale factor for positions.center (
array-likeorNone) – Coordinate pair around which to center the layout.dim (
int) – Dimension of layout, currently only dim=2 is supported. Other dimension values result in a ValueError.
- Returns
pos – A dictionary of positions keyed by node
- Return type
- Raises
ValueError – If dim != 2
Examples
>>> G = nx.path_graph(4) >>> shells = [[0], [1, 2, 3]] >>> pos = nx.shell_layout(G, shells)
Notes
This algorithm currently only works in two dimensions and does not try to minimize edge crossings.