5

I am using networkx library for reading and writing dot graphs. According to the documentation here, write_dot() method should be accessible, however when I try,

>>> import networkx
>>> networkx.write_dot(graph,fileName)

I get the following error.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'write_dot'

How can I solve this?

Riken Shah
  • 3,022
  • 5
  • 29
  • 56

1 Answers1

9

Try:

from networkx.drawing.nx_agraph import write_dot

or

 from networkx.drawing.nx_pydot import write_dot
Mithilesh Gupta
  • 2,800
  • 1
  • 17
  • 17
  • For later versions like for version 2 following might work - networkx.nx_pydot.write_dot(graph,fileName) – Gunjan Mar 08 '18 at 12:12