On 03/21/2014 10:30 AM, Hang Mang wrote:
Indeed out_degree() is very very slow. I just replaced it with a constant and it finished the computation in 0.5 seconds compared to the 2.7 minutes!!! But I guess what you mentioned is also slow since 'graph.degree_property_map('out')[i]' since assumes 'i' is a vertex object and not the index of the vertex. In that case I need to call graph.vertex(index) and get the vertex and then call degree_property_map('out')[vertex]. I guess this is still very slow!
You can also access scalar property maps with indexes instead of descriptors. The following two are equivalent: d = g.degree_property_map("out") k = d[g.vertex(0)] # degree of vertex 0 k = d.a[0] # degree of vertex 0 Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>