Rik*_*hah 2 python graph dot networkx
我正在使用networkx库来读取和写入dot图形。根据此处的文档,write_dot()方法应该可以访问,但是当我尝试时,
>>> import networkx
>>> networkx.write_dot(graph,fileName)
Run Code Online (Sandbox Code Playgroud)
我收到以下错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'write_dot'
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
尝试:
from networkx.drawing.nx_agraph import write_dot
Run Code Online (Sandbox Code Playgroud)
或者
from networkx.drawing.nx_pydot import write_dot
Run Code Online (Sandbox Code Playgroud)