Note

This documents the development version of NetworkX. Documentation for the current release can be found here.

networkx.drawing.nx_agraph.graphviz_layout

graphviz_layout(G, prog='neato', root=None, args='')[source]

Create node positions for G using Graphviz.

Parameters
GNetworkX graph

A graph created with NetworkX

progstring

Name of Graphviz layout program

rootstring, optional

Root node for twopi layout

argsstring, optional

Extra arguments to Graphviz layout program

Returns
Dictionary of x, y, positions keyed by node.

Notes

This is a wrapper for pygraphviz_layout.

Examples

>>> G = nx.petersen_graph()
>>> pos = nx.nx_agraph.graphviz_layout(G)
>>> pos = nx.nx_agraph.graphviz_layout(G, prog="dot")