Closed zhangke-zhangke closed 5 months ago
After adjusting the length of the point, it can run successfully.
Building Infomap network from a NetworkX graph... node : (32001595, 32001596) type : <class 'int'> <class 'int'>
-> Ordinary network input, using the Map Equation for first order network flows Calculating global network flow using flow model 'undirected'... -> Using undirected links. => Sum node flow: 1, sum link flow: 1 Build internal network with 2 nodes and 1 links... -> One-level codelength: 1
Two-level compression: 0% Partitioned to codelength 0 + 1 = 1 in 1 (0 non-trivial) modules.
=> Trial 1/1 finished in 7.14e-05s with codelength 1
Best end modular solution in 2 levels: Per level number of modules: [ 1, 0] (sum: 1) Per level number of leaf nodes: [ 0, 2] (sum: 2) Per level average child degree: [ 1, 2] (average: 1.66667) Per level codelength for modules: [0.000000000, 0.000000000] (sum: 0.000000000) Per level codelength for leaf nodes: [0.000000000, 1.000000000] (sum: 1.000000000) Per level codelength total: [0.000000000, 1.000000000] (sum: 1.000000000)
Found 1 modules with codelength: 1.000000 社区1,成员[32001595, 32001596] 0.25
Hi. As you may see we use unsigned integers for node ids, which in C++ are 32 bits long covering the range 0 to 4294967295. This should be enough to uniquely identify all nodes for all practical purposes. If you have larger integers to identify nodes, such as bank card numbers, you have to map those to lower integers. In NetworkX you can simply run convert_node_labels_to_integers to do that.
If you want to include such long ids in Infomap, you have to convert them to strings and use as node names instead of ids. If you already have or convert the ids to strings in NetworkX and add the graph to Infomap with add_networkx_graph, it will automatically run the above function and store the string ids as node names.
Building Infomap network from a NetworkX graph... node : (320015954360525044901, 320015963360525029312) type : <class 'int'> <class 'int'>
error : Traceback (most recent call last): File "D:/Gitlab/CommunityDetection/Infomap.py", line 225, in
a.printCom(graph)
File "D:/Gitlab/CommunityDetection/Infomap.py", line 70, in printCom
self.findCommunities(G)
File "D:/Gitlab/CommunityDetection/Infomap.py", line 46, in findCommunities
network.addLink(e)
File "D:\Anaconda3\envs\graph\lib\site-packages\infomap.py", line 2414, in addLink
return _infomap.StateNetwork_addLink(self, args)
TypeError: Wrong number or type of arguments for overloaded function 'StateNetwork_addLink'.
Possible C/C++ prototypes are:
infomap::StateNetwork::addLink(unsigned int,unsigned int,double)
infomap::StateNetwork::addLink(unsigned int,unsigned int)
infomap::StateNetwork::addLink(unsigned int,unsigned int,unsigned long)