On 24.01.2017 08:59, Snehal Shekatkar wrote:
Hello all,
I am working on the generation of some random graph model in which probability of having an edge between two given vertices is some complicated function. Hence I cannot use in-built models to generate this graph. Thus, I am using nested for loops to generate it. However, this makes the code extremely slow. Is it possible to iterate over all the pairs of vertices efficiently in graph-tool so that there would be sufficient increase in the speed?
There is no magic bullet. If you have to iterate using Python, it will be slow. I will be writing some documentation explaining how to write C++ extensions for graph-tool. In the mean time, depending on your algorithm, you may be able to increase speed by representing your graph as a sparse matrix (using adjacency()). You may also try numba, but it will not speedup the interaction with graph-tool. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>