Warning

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

circular_layout

circular_layout(G, dim=2, scale=1, center=None)[source]

Position nodes on a circle.

Parameters:
  • G (NetworkX graph or list of nodes) –
  • dim (int) – Dimension of layout, currently only dim=2 is supported
  • scale (float) – Scale factor for positions
  • center (array-like or None) – Coordinate pair around which to center the layout.
Returns:

A dictionary of positions keyed by node

Return type:

dict

Examples

>>> G=nx.path_graph(4)
>>> pos=nx.circular_layout(G)

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