planar_layout(G, scale=1, center=None, dim=2)¶
Position nodes without edge intersections.
G (NetworkX graph or list of nodes) – A position will be assigned to every node in G. If G is of type PlanarEmbedding, the positions are selected accordingly.
- G (NetworkX 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.
- 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.
pos – A dictionary of positions keyed by node
Return type: Raises:
nx.NetworkXException– If G is not planar
>>> G = nx.path_graph(4) >>> pos = nx.planar_layout(G)