Dear Tiago, I just send full working example to you. The Network_Prepare.py is to generate a ER-ER interdependent network as it shows. The MAIN.py is to simulate the cascading failure in interdependent network. I will try the newest code on github later. Thank u. best, Liu 在 2014年4月30日星期三UTC+8下午3时44分48秒,Tiago Peixoto写道:
On 04/30/2014 09:37 AM, Tiago de Paula Peixoto wrote:
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?
I've fixed a related problem in the git version. Please try with that. If it does not work, please send the full working example, and I'll check it out.
Best, Tiago
-- Tiago de Paula Peixoto <ti...@skewed.de <javascript:>>