networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
shell_layout(G, nlist=None, rotate=None, scale=1, center=None, dim=2)

Notes

This algorithm currently only works in two dimensions and does not try to minimize edge crossings.

Parameters

G : NetworkX graph or list of nodes

A position will be assigned to every node in G.

nlist : list of lists

List of node lists for each shell.

rotate : angle in radians (default=pi/len(nlist))

Angle by which to rotate the starting position of each shell relative to the starting position of the previous shell. To recreate behavior before v2.5 use rotate=0.

scale : number (default: 1)

Scale factor for positions.

center : array-like or None

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.

Raises

ValueError

If dim != 2

Returns

pos : dict

A dictionary of positions keyed by node

Position nodes in concentric circles.

Examples

>>> G = nx.path_graph(4)
... shells = [[0], [1, 2, 3]]
... pos = nx.shell_layout(G, shells)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.drawing.nx_pylab.draw_shell networkx.drawing.layout.shell_layout

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/drawing/layout.py#176
type: <class 'function'>
Commit: