I have a question about the CPython implementation by using igraph, the idea is that I want to use python to call our C/igraph igraph_community_walktrap function, the process is like following:
python data → C++ → C → python data
The reason behind this is that we are using python to develop a walktrap algorithm application, but we found that the memory usage is quite high when we call python ig.Graph.community_walktrap function:
ig.Graph.community_walktrap(face_graph, weights=“sim”, steps=4).as_clustering()
so we want to pass our python igraph graph data to C++, and calling the C/igraph library function to process our data, then return the data from C++ to python. Does anyone know is this possible by using our igraph package?
If I understand your question, you are saying that the Python function
Graph.community_walktrap() takes too much memory, therefore you are looking to call the C function
Graph.community_walktrap() is just a wrapper to
igraph_community_walktrap(), so unless there is a memory issue with the
VertexDendrogram object, there shouldn’t be a significant difference.
Ok, I got it. Thank you for your reply. But I really want to reduce the memory usage. The Graph.community_walktrap cost too much memory, and honestly this is the most memory-cosume part in my project. Do you have any good idea about how to reduce the memory cost? Thank you.
I went through the code in the C core of igraph in
src/community/walktrap and it seems like memory allocations are proportional to the number of nodes and edges in the graph, so unless you are working with super large graphs the memory usage should not be too high. How large is your graph?
My graph contains 100,000 images, so it’s a 100,000 * 100,000 size matrix, and I took the upper triangular matrix as the input adjacency matrix to generate the graph. So the graph is quite large.