Reputation: 1264
I'm trying to use the networkx blockmodel function, but Python keeps saying there is no attribute 'blockmodel'. I am using the example code in the documentation in the link here.
I do have networkx installed, and many other functions are working. Only this one seems to complain. Help is much appreciated.
Upvotes: 3
Views: 638
Reputation: 25299
The blockmodel
function has been replaced in the latest version of networkx (you are looking at older documentation) with quotient_graph
.
Here is an example of generating a blockmodel
>>> 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)]
See https://networkx.github.io/documentation/stable/reference/algorithms/generated/networkx.algorithms.minors.quotient_graph.html?highlight=blockmodel for the updated documentation.
Upvotes: 4