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)
Thanks for your help!
Best,
Liu
在 2014年4月29日星期二UTC+8下午11时13分06秒,Tiago Peixoto写道:
>
> On 04/29/2014 03:52 PM, Liu wrote:
> > Traceback (most recent call last):
> > File "/home/lockheed/PycharmProjects/cascade_failures/MAIN.py", line
> 56, in <module>
> > G.purge_vertices()
> > File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
> 1867, in purge_vertices
> > new_g = Graph(self, prune=(True, False, False))
> > File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line
> 1133, in __init__
> > _prop("v", gv, vorder))
> > ValueError: Cannot find property map type.
>
> This is a bug in graph-tool. It has been fixed in the most recent git
> version.
>
> As a workaround, you can use G.purge_vertices(in_place=True).
>
> Best,
> Tiago
>
> --
> Tiago de Paula Peixoto <[email protected] <javascript:>>
>
>_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool