[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

Hi Mendhi,

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:
> http://www.boost.org/doc/libs/1_40_0/libs/graph/doc/small_world_generator.html
> Would there be any way to call that inside graph-tool as a faster
> alternative?

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...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
URL: <https://lists.skewed.de/pipermail/graph-tool/attachments/20110806/6afda6a8/attachment.asc>

More information about the graph-tool mailing list