On 04/30/2014 03:28 AM, Liu wrote:
Dear Tiago,
I used G.purge_vertices(in_place=True). But the vertex filter didn't work.
G.set_vertex_filter(prop=exist) G.purge_vertices(in_place=True)
gt.graph_draw(G, pos=pos) # step 1 largest component in network A UA = gt.GraphView(G, vfilt=v_type)
line 45:LCA = gt.label_largest_component(UA) exist.a = False for v in G.vertices(): if LCA[v]: exist[v] = True for n in v.all_neighbours(): if not v_type[n]: exist[v] = True
G.set_vertex_filter(exist) G.purge_vertices(in_place=True)
Console warns that, Traceback (most recent call last): File "/home/lockheed/PycharmProjects/cascade_failures/MAIN.py", line 45, in <module> LCA = gt.label_largest_component(UA) File "/usr/lib/python2.7/dist-packages/graph_tool/topology/__init__.py", line 814, in label_largest_component label.a = (c.a == h.argmax()) & (vfilt.a ^ inv) ValueError: operands could not be broadcast together with shapes (248) (256)
This seems to be something else. Could you please provide a full working example, so I can investigate? Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>