I am trying to calculate the shortest distances of a graph after applying a filter. I have a code that looks like this:

g=gt.load_graph("myGraph.xml",format="xml")

#for later use

distances = gt.shortest_distance(g)

#extract the components of the graph

comp = g.label_components(g)

#This splits the graph in several components

#I want to calculate the shortest distances

#for the component 2 for example

filtering = g.new_vertex_property("boolean")

for v in g.vertices():

if comp[v]==2:

filtering[v]=True

else:

filtering[v]=False

#set the vertex filter

g.set_vertex_filter(filtering)

distances_comp=gt.shortest_distance(g)

The last line of code rises a segmentation fault. I have plotted the graph with the filtered graph and its correct, also I can calculate the local_clustering_coefficient without problems. Am I doing something wrong? Is there any other way to filter the graph and calculate the shortest distances? Is this a bug?

Thanks so much,

Juan