zhiyzuo / python-modularity-maximization

Python implementation of Newman's spectral methods to maximize modularity.
MIT License
45 stars 25 forks source link

Error #3

Closed lesterlitch closed 6 years ago

lesterlitch commented 6 years ago

In community_newman.py:

nx.set_edge_attributes(G=network, name='weight', values={edge:1 for edge in network.edges})

should be: nx.set_edge_attributes(G=network, name='weight', values={edge:1 for edge in network.edges()})

Should it not? Otherwise I get "TypeError: 'instancemethod' object is not iterable"

zhiyzuo commented 6 years ago

it depends on your networkx version. if you use networkx>=2.0 then you should be fine. check out my readme file: https://github.com/zhiyzuo/python-modularity-maximization/blob/master/README.rst

thanks for pointing this out though!