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

Write DotfileΒΆ

Write a dot file from a networkx graph for further processing with graphviz.

You need to have either pygraphviz or pydot for this example.



Now run: neato -Tps >

import networkx as nx

# This example needs Graphviz and either PyGraphviz or pydot.
# from networkx.drawing.nx_pydot import write_dot
from networkx.drawing.nx_agraph import write_dot

G = nx.grid_2d_graph(5, 5)  # 5x5 grid
write_dot(G, "")
print("Now run: neato -Tps >")

Total running time of the script: ( 0 minutes 0.005 seconds)

Gallery generated by Sphinx-Gallery