On Fri, Jan 25, 2013 at 12:56 AM, Tiago de Paula Peixoto <tiago@skewed.de> wrote:
1) extracting vertex clusters based on values in vertex property map?
You can improve the performance by avoiding repeated python function calls for each vertex. One way to do this is to use array expressions. For instance, instead of doing:
gv1 = gt.GraphView(g, vfilt = lambda v: v_prop[v] == cl_num)
you could do:
gv1 = gt.GraphView(g, vfilt = v_prop.a == cl_num)
The second option should be significantly faster for larger graphs.
Awesome! Thanks a lot, this solved the problem. Where could I find more information about the v_prop.a == cl_num part? It might be useful in other cases of working with graph-tool, but first need to understand it. Is it a part of NumPy? Cheers, Uldis