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

Segmentation Fault #314

Closed Nadianw36 closed 1 year ago

Nadianw36 commented 2 years ago

Segmentation Fault Error I'm running into a Segmentation Fault even when I run it on a very small network -- I actually run it on the example code given on the documentation page. Error/Output:

Infomap v2.5.0 starts at 2022-07-11 13:16:10 -> Input network: -> No file output! -> Configuration: two-level directed zsh: segmentation fault python3 -m pdb test_clustering.py

Code:

im.add_link(0, 1)
im.add_link(0, 2)
im.add_link(0, 3)
im.add_link(1, 0)
im.add_link(1, 2)
im.add_link(2, 1)
im.add_link(2, 0)
im.add_link(3, 0)
im.add_link(3, 4)
im.add_link(3, 5)
im.add_link(4, 3)
im.add_link(4, 5)
im.add_link(5, 4)
im.add_link(5, 3)
print("graph created")
im.run()

I stepped through the code using pdb and saw that it occurs after this line return _infomap.InfomapWrapper_run(self, *args) so I think it's something about the way the args are being converted between python to C++.

Is there something wrong with the way I downloaded infomap, or does anyone have insight on what is going wrong?

danieledler commented 2 years ago

Hi, thanks for reaching out. Can you show your code from the beginning where you import infomap and creating im?

You should have something like:

from infomap import Infomap

im =  Infomap(two_level=True, directed=True)