6 Jul 2010 12:57

### Segmentation fault using shortest_distance

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:

#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

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
6 Jul 2010 13:12

### Re: Segmentation fault using shortest_distance

```Hi Juan,

On 07/06/2010 12:57 PM, Juan Manuel Tirado wrote:
> 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?

A segmentation fault is always a bug... Can you please give me the
output of the graph_tool.show_config() function?

Cheers,
Tiago

--
Tiago de Paula Peixoto <tiago <at> forked.de>
```
6 Jul 2010 13:19

### Re: Segmentation fault using shortest_distance

Here it is the output from the show_config()

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 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64

I am using the code from the ubuntu package, so I'm not using the latest 2.2.6 version. I will try to install and make a test with the latest version, as I see it is not available via apt-get.

On 6 July 2010 13:12, Tiago de Paula Peixoto wrote:
Hi Juan,

On 07/06/2010 12:57 PM, Juan Manuel Tirado wrote:
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?

A segmentation fault is always a bug... Can you please give me the
output of the graph_tool.show_config() function?

Cheers,
Tiago

--
Tiago de Paula Peixoto <tiago <at> forked.de>
_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
6 Jul 2010 13:48

### Re: Segmentation fault using shortest_distance

I have just made a small test. Instead of passing the filtered graph to the shortest_distance function, I have generated a copy of the filtered graph and it works fine.

It seems that exist a problem with the shortest_distance function.

On 6 July 2010 13:19, Juan Manuel Tirado wrote:
Here it is the output from the show_config()

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 2.6.32-23-generic #37-Ubuntu SMP Fri Jun 11 08:03:28 UTC 2010 x86_64

I am using the code from the ubuntu package, so I'm not using the latest 2.2.6 version. I will try to install and make a test with the latest version, as I see it is not available via apt-get.

On 6 July 2010 13:12, Tiago de Paula Peixoto wrote:
Hi Juan,

On 07/06/2010 12:57 PM, Juan Manuel Tirado wrote:
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?

A segmentation fault is always a bug... Can you please give me the
output of the graph_tool.show_config() function?

Cheers,
Tiago

--
Tiago de Paula Peixoto <tiago <at> forked.de>
_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
6 Jul 2010 20:52

### Re: Segmentation fault using shortest_distance

```On 07/06/2010 01:48 PM, Juan Manuel Tirado wrote:

> I have just made a small test. Instead of passing the filtered graph
> to the shortest_distance function, I have generated a copy of the
> filtered graph and it works fine.
>
> It seems that exist a problem with the shortest_distance function.

Yes, indeed. There was a problem with the property map initialization
in this case. The version in git now contains a fix.  Please tell me
if you find any other problems.

Cheers,
Tiago

--

--
Tiago de Paula Peixoto <tiago <at> forked.de>
```
6 Jul 2010 20:58

### Re: Segmentation fault using shortest_distance

Yes, indeed. There was a problem with the property map initialization
in this case. The version in git now contains a fix.  Please tell me
if you find any other problems.

Thanks so much.

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
7 Jul 2010 14:09

### Problems with remove_parallel_edges

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):
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

================================
2.2.C02.B
+34 91 624 6260
Computer Department
Computer Architecture Group
http://www.arcos.inf.uc3m.es
http://www.uc3m.es
================================

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
8 Jul 2010 09:51

### Re: Problems with remove_parallel_edges

```Hi Juan,

On 07/07/2010 02:09 PM, Juan Manuel Tirado wrote:
> 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.

Indeed, this was a race condition caused when OpenMP is enabled and
undirected graphs are used. I have fixed this in the git version.

If you want a quick workaround, you can disable OpenMP by setting the
environment variable:

Thanks for finding this stuff out!

Cheers,
Tiago

--

--
Tiago de Paula Peixoto <tiago <at> forked.de>

```
```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```
8 Jul 2010 11:31

### Re: Problems with remove_parallel_edges

Thanks your for great work Tiago.

Cheers,

Juan

On 8 July 2010 09:51, Tiago de Paula Peixoto wrote:
Hi Juan,

On 07/07/2010 02:09 PM, Juan Manuel Tirado wrote:
> 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.

Indeed, this was a race condition caused when OpenMP is enabled and
undirected graphs are used. I have fixed this in the git version.

If you want a quick workaround, you can disable OpenMP by setting the
environment variable:

Thanks for finding this stuff out!

Cheers,
Tiago

--
Tiago de Paula Peixoto <tiago <at> forked.de>

_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool

```_______________________________________________
graph-tool mailing list
graph-tool <at> forked.de
http://lists.forked.de/mailman/listinfo/graph-tool
```

Gmane