2017-10-15 58 views
0

我想使用networkx blockmodel函数,但是Python总是说没有属性'blockmodel'。我在链接here的文档中使用示例代码。模块'networkx'没有属性'blockmodel'?

我确实安装了networkx,许多其他功能正在工作。只有这一个似乎抱怨。非常感谢帮助。

回答

2

blockmodel功能已被quotient_graph替换为最新版本的networkx(您正在查看较早的文档)。
这里是产生块模型

>>> G = nx.path_graph(6) 
>>> partition = [{0, 1}, {2, 3}, {4, 5}] 
>>> M = nx.quotient_graph(G, partition, relabel=True) 
>>> list(M.edges()) 
[(0, 1), (1, 2)] 

参见https://networkx.github.io/documentation/stable/reference/algorithms/generated/networkx.algorithms.minors.quotient_graph.html?highlight=blockmodel 用于更新的文档的一个例子。

相关问题