Warning

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

shell_layout

shell_layout(G, nlist=None, dim=2, scale=1.0, center=None)[source]

Position nodes in concentric circles.

Parameters:
  • G (NetworkX graph or list of nodes) –
  • nlist (list of lists) – List of node lists for each shell.
  • dim (int) – Dimension of layout, currently only dim=2 is supported
  • scale (float (default 1)) – Scale factor for positions, i.e.radius of largest shell
  • center (array-like (default origin)) – Coordinate around which to center the layout.
Returns:

A dictionary of positions keyed by node

Return type:

dict

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.