networkx.drawing.layout.planar_layout

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

Position nodes without edge intersections.

Parameters
GNetworkX graph or list of nodes

A position will be assigned to every node in G. If G is of type nx.PlanarEmbedding, the positions are selected accordingly.

scalenumber (default: 1)

Scale factor for positions.

centerarray-like or None

Coordinate pair around which to center the layout.

dimint

Dimension of layout.

Returns
posdict

A dictionary of positions keyed by node

Raises
NetworkXException

If G is not planar

Examples

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