Hi Tiago,
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

Hi Tiago,
I'm experimenting some problems with the remove_parallel_edges function. It
seems that some edges are removed randomly. I attach some reproducible code
to test.
Let's suppose the following dot graph file:
graph G{
1--2
2--1
1--3
3--1
2--3
3--2
}
It is basically an undirected graph with a triangle shape with parallel
edges. The following code loads the graph, removes parallel edges and
calculate clustering coefficient. I repeat it ten times.
for i in range(0,10):
aux = gt.load_graph("/tmp/sampleGraph.dot",format="dot")
gt.remove_parallel_edges (aux)
clust=gt.local_clustering (aux)
gt.vertex_average (aux,clust)
This operation is supposed to generate a tuple (1.0, 0.0), the problem is
that randomly the generated output is wrong. For example:
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (0.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
Out[111]: (1.0, 0.0)
I have plotted the graph and I have found, that sometimes one edge is
completely removed modifying the final result.
I attach my show_config output.
gt.show_config ()
version: 2.2.5 (commit 3ba24072, Sun Feb 21 00:46:41 2010 +0100)
gcc version: 4.4.1
compilation flags: -I/usr/include/python2.6 -I/usr/include
-I/usr/lib/python2.6/dist-packages/numpy/core/include/numpy
-I/usr/lib/python2.6/dist-packages/scipy -O3 -Wall -ftemplate-depth-150
-Wno-deprecated -O99 -fvisibility=default -fvisibility-inlines-hidden
-fopenmp -Wl,-Bsymbolic-functions -L/usr/lib/python2.6 -lpython2.6
install prefix: /usr
python dir: /usr/lib/python2.6/dist-packages
graph filtering: True
openmp: True
uname: Linux host 2.6.31-22-generic #60-Ubuntu SMP Thu May 27 02:41:03 UTC
2010 x86_64
Kind regards,
Juan
================================
Juan Manuel Tirado
2.2.C02.B
+34 91 624 6260
Computer Department
Computer Architecture Group
http://www.arcos.inf.uc3m.es
University Carlos III of Madrid
http://www.uc3m.es
================================