这报的是什么错啊?代码如下:

>>> import networkx as nx
>>> G1=nx.DiGraph
>>> G1.add_edge(1,2)
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
G1.add_edge(1,2)
TypeError: unbound method add_edge() must be called with DiGraph instance as first argument (got int instance instead)

阿波罗的战车
浏览 113回答 2
2回答

翻过高山走不出你

第二行改一下:G1=nx.DiGraph()

有只小跳蛙

G1=nx.DiGraph()缺了()
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python