簡體   English   中英

模塊'networkx'沒有屬性'blockmodel'?

[英]Module 'networkx' has no attribute 'blockmodel'?

我正在嘗試使用networkx blockmodel函數,但Python一直說沒有屬性'blockmodel'。 我在這里的鏈接文檔中使用示例代碼。

我確實安裝了networkx,還有很多其他功能正在運行。 只有這一個似乎抱怨。 非常感謝幫助。

blockmodel函數已在最新版本的networkx(您正在查看較舊的文檔)中使用quotient_graph替換。
以下是生成塊模型的示例

>>> 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM