我正在使用networkx
库来阅读和编写dot
图表。根据{{3}},write_dot()
方法应该是可访问的,但是当我尝试时,
>>> import networkx
>>> networkx.write_dot(graph,fileName)
我收到以下错误。
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'write_dot'
我该如何解决这个问题?
答案 0 :(得分:4)
尝试:
{
"name": "flaschard-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"babel-preset-es2015": "^6.22.0",
"babel-preset-react": "^6.22.0",
"babelify": "^7.3.0",
"live-server": "^1.2.0",
"watchify": "^3.9.0"
},
"devDependencies": {
"tern-react": "^0.1.0"
},
"scripts": {
"build": "watchify src/app.js -o public/bundle.js -t [babelify --presets [react es2015]]",
"server": "cd public; live-server --port=1234 --entry-file=index.html"
},
"keywords": [],
"author": "",
"license": "ISC"
}
或
from networkx.drawing.nx_agraph import write_dot