Describe the bug
When I fed my graph data into the cdlib.algorithms.leiden() method on a 400k node graph with 600k edges, the algorithm operated correctly and identified communities in the graph. When I did this for a 1million node graph with 1.6 million edges, I get a TypeError.
Traceback (most recent call last):
File "...\main.py", line 90, in <module>
main()
File "...\main.py", line 78, in main
coms = find_coms_leiden(Graph)
File "...\main.py", line 33, in find_coms_leiden
coms = algorithms.leiden(graph_nx)
File "C:\Anaconda\lib\site-packages\cdlib\algorithms\crisp_partition.py", line 599, in leiden
g = convert_graph_formats(g_original, ig.Graph)
File "C:\Anaconda\lib\site-packages\cdlib\utils.py", line 187, in convert_graph_formats
return __from_nx_to_igraph(graph, directed)
File "C:\Anaconda\lib\site-packages\cdlib\utils.py", line 122, in __from_nx_to_igraph
gi.add_edges([(u, v) for (u, v) in g.edges()])
File "C:\Anaconda\lib\site-packages\igraph\__init__.py", line 376, in add_edges
res = GraphBase.add_edges(self, es)
TypeError: only non-negative integers, strings or igraph.Vertex objects can be converted to vertex IDs
Expected behavior
When I run with data as 400k nodes and 600k edges, the program runs, loads data, calculates communities, and writes them to file properly:
See Screenshot 2 in Screenshots Section
Running with 1M nodes and 1.6M edges is expected to output to file the same way (different data obviously).
Screenshots
Example of expected result written to file of using input data of 400k nodes and 600k edges:
Additional Context
I use nx.info(my_graph) to check how many edges and nodes are in the input graphs. This was run before cdlib.algorithms.leiden() and it successfully parsed through the data.
Describe the bug When I fed my graph data into the cdlib.algorithms.leiden() method on a 400k node graph with 600k edges, the algorithm operated correctly and identified communities in the graph. When I did this for a 1million node graph with 1.6 million edges, I get a TypeError.
To Reproduce Steps to reproduce the behavior:
Step 1 Load dataset from csv file into NetworkX graph object using the following function:
Step 2: Run cdlib.algorithms.leiden() on the NetworkX graph from Step 1 using the following function:
Step 3: Write the communities object to a file using the following function:
Step 4: Main
Expected behavior When I run with data as 400k nodes and 600k edges, the program runs, loads data, calculates communities, and writes them to file properly: See Screenshot 2 in Screenshots Section
Running with 1M nodes and 1.6M edges is expected to output to file the same way (different data obviously).
Screenshots Example of expected result written to file of using input data of 400k nodes and 600k edges:![image](https://user-images.githubusercontent.com/51759082/180829330-8e6a0e6f-6874-4040-9772-ae8e5682d2c1.png)
Additional Context I use
nx.info(my_graph)
to check how many edges and nodes are in the input graphs. This was run beforecdlib.algorithms.leiden()
and it successfully parsed through the data.