1
许多显然与NetworkX一起使用的方法似乎并未导入。例如,根据该网站,我应该能够使用:缺少python方法NetworkX
的transitive_closure()
方法。
但是当我运行python.py文件,
import networkx as nx
G = nx.DiGraph()
G.add_edges_from([
('a', 'c'),
('b', 'c'),
('c', 'd'),
])
C = nx.transitive_closure(G)
我得到的错误
C = nx.transitive_closure(G)
AttributeError: 'module' object has no attribute 'transitive_closure'