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: g.vertex(numpy.random.randint(g.num_vertices())) 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. Cheers, Tiago -- Tiago de Paula Peixoto <ti...@skewed.de>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list graph-tool@skewed.de http://lists.skewed.de/mailman/listinfo/graph-tool