[graph-tool] Performance question
guillaume at mitotic-machine.org
Fri Mar 21 11:05:37 CET 2014
Sure, that escaped me!
Thanks for pointing this out (and now I might need to look back at my
code to see if I don't do that kind of thing ;-))
Le 21/03/2014 11:00, Tiago de Paula Peixoto a écrit :
> On 03/21/2014 10:10 AM, Guillaume Gay wrote:
>> There is a propertymap that contains the out degrees of each vertex, it might be much faster to access it, i.e.:
>> `i_degree = graph.degree_property_map('out')[i]`
> This is not a good idea, since "g.degree_property_map('out')" will
> create an entire property map anew (which is O(N)) each time you want a
> single degree (which should be O(1)). It is best to compute the property
> map before the loop, and just look it up when you need it.
> d = graph.degree_property_map('out') # this is O(N)
> k = d[v] # this is O(1)
> graph-tool mailing list
> graph-tool at skewed.de
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the graph-tool