[graph-tool] Bug in Graph pruning?

Sebastian Weber sebastian.weber at frias.uni-freiburg.de
Mon May 30 16:18:37 CEST 2011


I just discovered a quite strange behavior of graph-tool. I want to keep only the largest component of my network and the following code

comp = label_largest_component(G)
    lc = comp.a == 1
    Gv = Graph(GraphView(G, vfilt=lc), prune=True)

simply gives wrong results. It deletes vertices which are in the LC and have comp[v]==1 !!!
Instead, the much slower

G.remove_vertex_if(lambda v: comp[v] == 0)

call works just fine. The version of graph-tool is something close to 2.2.12, but I haven't seen any changes on git which seems to relate to this issue. It is quite scary that vertex deletion is somewhat unpredictable or I am doing something wrong here.

Any help would be great here.

Sebastian Weber
Group of Cell Communication and Control
Freiburg Institute for Advanced Studies - FRIAS
School of Life Sciences - LIFENET
Albert-Ludwigs-Universität Freiburg
Albertstr. 19
79104 Freiburg
T.: +49-761-203-97237

More information about the graph-tool mailing list