mapequation / infomap

Multi-level network clustering based on the Map Equation
https://mapequation.org/infomap
GNU General Public License v3.0
425 stars 88 forks source link

Can't iterate on nodes if run with `no_infomap=True` #345

Open danieledler opened 11 months ago

danieledler commented 11 months ago

To replicate:

edges = [
    [1,2],
    [1,3],
    [2,3],
    [3,4],
    [4,5],
]
G = nx.Graph()
G.add_edges_from(edges)

im = infomap.Infomap(silent=True, no_infomap=True)
im.add_networkx_graph(G)
im.run()
for node in im.nodes:
    print(node.node_id, node.data.flow)

Output is

0 0.0

With no_infomap=False, the output is

3 0.30000000000000004
1 0.2
2 0.2
4 0.2
5 0.1