[graph-tool] Functions producing small-world / scale free / ER networks
Tiago de Paula Peixoto
tiago at skewed.de
Sat Aug 6 09:32:43 CEST 2011
On 08/06/2011 04:17 AM, Mehdi Khoury wrote:
> Hi Tiago,
> thanks for the feedback.
> I have followed your advice for the scale-free and er network and
> there are no pb for these. The watts-strogatz network version I have
> implemented works, but is very very slow.
Yes, indeed. Doing it in C++ would be much faster.
But there are ways to improve your code:
- Do not call the range() function, since it is O(N). In loops, you
should call xrange() instead.
- To sample a random vertex, you can do something like:
This is much faster than using choice().
> I have noticed that the boost library has a small-world graph
> generator see:
> Would there be any way to call that inside graph-tool as a faster
Yes, I will implement this as soon as I have some time.
Tiago de Paula Peixoto <tiago at skewed.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 554 bytes
Desc: OpenPGP digital signature
More information about the graph-tool