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 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@forked.de
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 tiago@forked.de 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@forked.de _______________________________________________ graph-tool mailing list graph-tool@forked.de http://lists.forked.de/mailman/listinfo/graph-tool
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 jtirado@inf.uc3m.es 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 tiago@forked.de 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@forked.de _______________________________________________ graph-tool mailing list graph-tool@forked.de http://lists.forked.de/mailman/listinfo/graph-tool
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
Hi Tiago,
I seem to have a similar problem as Juan had a few years back. Using shortest_distance leads to a segmentation fault. The code below works fine if I build random networks with less than 100 nodes, but if I increase the number of nodes to 150 the segmentation fault occurs almost always.
#!/usr/bin/env python from graph_tool.all import * show_config() g = random_graph(150, lambda: (poisson(3), poisson(3))) print 'try shortest distance' s = shortest_distance(g) #seg fault occurs here print 'success!'
This returns:
/system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.py:1464: RuntimeWarning: Error importing Gtk module: No module named gi; GTK+ drawing will not work. warnings.warn(msg, RuntimeWarning) version: 2.12 (commit 1d6bf978, Fri Nov 6 15:54:18 2015 +0100) gcc version: 4.9.2 compilation flags: -I/system/software/linux-x86_64/lib/boost/python2.7/1_55_0/include -I/system /software/linux-x86_64/lib/cgal/4.3/include -I/system/software/linux-x86_64/lib/mpfr/3.1.2/include -I/system/software/linux-x86_64/lib/gmp/5.1.3/include -I/system/software/linux-x86_64 /lib/sparsehash/gcc-4.8.2/2.0.2/include -I/system/software/linux-x86_64/python/2.7.8__gcc- 4.8.2/include/python2.7 -I/system/software/linux-x86_64/lib/boost/python2.7/1_55_0/include
-I/system/software/linux-x86_64/lib/python2.7/site-packages/numpy/core/include
-DSPARSEHASH_PREFIX=/system/software/linux-x86_64/lib/sparsehash/gcc-4.8.2/2.0.2/include /sparsehash -Wall -Wextra -ftemplate-backtrace-limit=0 -O3 -mavx -std=gnu++14 -DNDEBUG -ftemplate-depth-250 -Wno-deprecated -Wno-unknown-pragmas -O3 -fvisibility=default -fvisibility- inlines-hidden -fopenmp -DSPARSEHASH_PREFIX=/system/software/linux-x86_64/lib/sparsehash /gcc-4.8.2/2.0.2/include/sparsehash -L/system/software/linux-x86_64/lib/boost/python2.7 /1_55_0/lib -lboost_python -lboost_iostreams -lboost_regex -lboost_graph -L/system/software/linux- x86_64/python/2.7.8/lib -lpython2.7 -L/system/software/linux-x86_64/lib/cgal/4.3/lib -L/system /software/linux-x86_64/python/2.7.8__gcc-4.8.2/lib -lpython2.7 install prefix: /system/software/linux-x86_64/graph-tool/2.12 python dir: /system/software/linux-x86_64/python/2.7.8__gcc-4.8.2/lib/python2.7/site-packages graph filtering: True openmp: True uname: Linux login11 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 try shortest distance Segmentation fault (core dumped)
I am wondering if this is a bug or has something to do with how graph-tool was installed on the computing facilities that I use. The admin told me that there were some compiler compatibility issues with installing graph-tool. I've included his notes on the installation process below.
Best, Alice
# Notes: # a) the installation was successful (on arcus to be usable across all systems) # b) a couple of trickes were needed, both brought on by the fact that the source # has to be compiled with a compiler compliant with the 2014 c++ standard # (this is gcc ver 4.9.2); the tricks are marked clearly in the recipe below # c) the python cairo bindings have to be installed (so that "import cairo" works) # this is from the library py2cairo (for python 2.7)
# ===== Common ===== #
# version GRAPH_VER=2.12
# prepare source tar -jxf graph-tool-${GRAPH_VER}.tar.bz2 cd graph-tool-${GRAPH_VER}/
export CFLAGS="-O3 -mavx" export CXXFLAGS=${CFLAGS}
CGAL_ROOT=/system/software/linux-x86_64/lib/cgal/4.3 MPFR_ROOT=/system/software/linux-x86_64/lib/mpfr/3.1.2 GMP_ROOT=/system/software/linux-x86_64/lib/gmp/5.1.3 SPARSEHASH_ROOT=/system/software/linux-x86_64/lib/sparsehash/gcc-4.8.2/2.0.2
PKG_CONFIG_PATH=/system/software/linux-x86_64/lib/cairomm/1.12.0/lib/pkgconfig PKG_CONFIG_PATH=/system/software/linux-x86_64/lib/pixman/0.32.8/lib/pkgconfig:$PKG_CONFIG_PATH PKG_CONFIG_PATH=/system/software/linux-x86_64/lib/cairo/1.14.6/lib/pkgconfig:$PKG_CONFIG_PATH PKG_CONFIG_PATH=/system/software/linux-x86_64/lib/sigc++/2.6.2/lib/pkgconfig:$PKG_CONFIG_PATH export PKG_CONFIG_PATH
# # ===== Python 2.* ===== #
# python / compiler combo module load python/2.7__gcc-4.8 module swap gcc/4.8.2 gcc/4.9.2 ### TRICK 1
# python / boost combo PYTHON_ROOT=/system/software/linux-x86_64/python/2.7.6__gcc-4.8.2 BOOST_ROOT=/system/software/linux-x86_64/lib/boost/python2.7/1_55_0
# includes and libraries export CPPFLAGS="-I${BOOST_ROOT}/include -I${CGAL_ROOT}/include -I${MPFR_ROOT}/include -I${GMP_ROOT}/include -I${SPARSEHASH_ROOT}/include" export LDFLAGS="-L${BOOST_ROOT}/lib -lboost_python -lboost_iostreams -lboost_regex -lboost_graph -L${PYTHON_ROOT}/lib -lpython2.7 -L${CGAL_ROOT}/lib" export CGAL_LIBADD="-L${CGAL_ROOT}/lib"
export LD_LIBRARY_PATH=${BOOST_ROOT}/lib:${LD_LIBRARY_PATH}
make install
# # ===== Python 3.* ===== #
# python / compiler combo module load python/3.3__gcc-4.8
# python / boost combo PYTHON_ROOT=/system/software/linux-x86_64/python/3.3.2__gcc-4.8.2 BOOST_ROOT=/system/software/linux-x86_64/lib/boost/python3.3/1_55_0
# includes and libraries export CPPFLAGS="-I${BOOST_ROOT}/include -I${CGAL_ROOT}/include -I${MPFR_ROOT}/include -I${GMP_ROOT}/include -I${SPARSEHASH_ROOT}/include" export LDFLAGS="-L${BOOST_ROOT}/lib -lboost_python -lboost_iostreams -lboost_regex -lboost_graph -L${PYTHON_ROOT}/lib -lpython3.3m -L${CGAL_ROOT}/lib" export CGAL_LIBADD="-L${CGAL_ROOT}/lib"
export LD_LIBRARY_PATH=${BOOST_ROOT}/lib:${LD_LIBRARY_PATH}
# # ===== Common ===== #
# configure ./configure \ --prefix=/system/software/linux-x86_64/graph-tool/${GRAPH_VER} \ --enable-openmp \ --with-boost=${BOOST_ROOT} \ --with-sparsehash-prefix=${SPARSEHASH_ROOT}/include/sparsehash
NOTE: The prefix furnished to configure is for installing documentation. Deleted after installation.
# build and install make -j 8 make install
### TRICK 2 mv /system/software/linux-x86_64/python/2.7.8__gcc-4.8.2/lib/python2.7/site-packages/graph_tool \ /system/software/linux-x86_64/lib/python2.7/site-packages
Juan Manuel Tirado wrote
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
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 20.03.2016 09:25, alice wrote:
Hi Tiago,
I seem to have a similar problem as Juan had a few years back. Using shortest_distance leads to a segmentation fault. The code below works fine if I build random networks with less than 100 nodes, but if I increase the number of nodes to 150 the segmentation fault occurs almost always.
#!/usr/bin/env python from graph_tool.all import * show_config() g = random_graph(150, lambda: (poisson(3), poisson(3))) print 'try shortest distance' s = shortest_distance(g) #seg fault occurs here print 'success!'
This returns:
/system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/draw/cairo_draw.py:1464: RuntimeWarning: Error importing Gtk module: No module named gi; GTK+ drawing will not work. warnings.warn(msg, RuntimeWarning) version: 2.12 (commit 1d6bf978, Fri Nov 6 15:54:18 2015 +0100) gcc version: 4.9.2 compilation flags: -I/system/software/linux-x86_64/lib/boost/python2.7/1_55_0/include -I/system /software/linux-x86_64/lib/cgal/4.3/include -I/system/software/linux-x86_64/lib/mpfr/3.1.2/include -I/system/software/linux-x86_64/lib/gmp/5.1.3/include -I/system/software/linux-x86_64 /lib/sparsehash/gcc-4.8.2/2.0.2/include -I/system/software/linux-x86_64/python/2.7.8__gcc- 4.8.2/include/python2.7 -I/system/software/linux-x86_64/lib/boost/python2.7/1_55_0/include
-I/system/software/linux-x86_64/lib/python2.7/site-packages/numpy/core/include
-DSPARSEHASH_PREFIX=/system/software/linux-x86_64/lib/sparsehash/gcc-4.8.2/2.0.2/include /sparsehash -Wall -Wextra -ftemplate-backtrace-limit=0 -O3 -mavx -std=gnu++14 -DNDEBUG -ftemplate-depth-250 -Wno-deprecated -Wno-unknown-pragmas -O3 -fvisibility=default -fvisibility- inlines-hidden -fopenmp -DSPARSEHASH_PREFIX=/system/software/linux-x86_64/lib/sparsehash /gcc-4.8.2/2.0.2/include/sparsehash -L/system/software/linux-x86_64/lib/boost/python2.7 /1_55_0/lib -lboost_python -lboost_iostreams -lboost_regex -lboost_graph -L/system/software/linux- x86_64/python/2.7.8/lib -lpython2.7 -L/system/software/linux-x86_64/lib/cgal/4.3/lib -L/system /software/linux-x86_64/python/2.7.8__gcc-4.8.2/lib -lpython2.7 install prefix: /system/software/linux-x86_64/graph-tool/2.12 python dir: /system/software/linux-x86_64/python/2.7.8__gcc-4.8.2/lib/python2.7/site-packages graph filtering: True openmp: True uname: Linux login11 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 try shortest distance Segmentation fault (core dumped)
I cannot reproduce this. Could you run this under GDB and provide a backtrace of the segfault?
Also, do you also observe it with the newest version, 2.13?
Best, Tiago
This is the gdb backtrace:
#0 0x00007fffe29c9bc3 in std::vector<int, std::allocator<int>
::_M_fill_insert(__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, unsigned long, int const&) () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so #1 0x00007fffdeaec57d in std::vector<int, std::allocator<int> >::resize () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/topology/libgraph_tool_topology.so #2 0x00007fffdeaeebcb in do_all_pairs_search::operator()<boost::adj_list<unsigned long>, boost::typed_identity_property_map<unsigned long>, boost::unchecked_vector_property_map<std::vector<int, std::allocator<int>
, boost::typed_identity_property_map<unsigned long> >,
graph_tool::ConstantPropertyMap<unsigned long, boost::adj_list<unsigned long>::edge_descriptor> > () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/topology/libgraph_tool_topology.so #3 0x00007fffe17e0d16 in gomp_thread_start () at ../../../libgomp/team.c:117 #4 0x0000003d9e6079d1 in start_thread () from /lib64/libpthread.so.0 #5 0x0000003d9e2e89dd in clone () from /lib64/libc.so.6
I will ask the admin team at my university if they can install the newest version of graph-tool on the system.
Thanks and best wishes, Alice
This is the gdb backtrace:
#0 0x00007fffe29c9bc3 in std::vector<int, std::allocator<int>
::_M_fill_insert(__gnu_cxx::__normal_iterator<int*, std::vector<int,
std::allocator<int> > >, unsigned long, int const&) () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/libgraph_tool_core.so #1 0x00007fffdeaec57d in std::vector<int, std::allocator<int> >::resize () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/topology/libgraph_tool_topology.so #2 0x00007fffdeaeebcb in do_all_pairs_search::operator()<boost::adj_list<unsigned long>, boost::typed_identity_property_map<unsigned long>, boost::unchecked_vector_property_mapstd::vector<int, std::allocator<int >, boost::typed_identity_property_map<unsigned long>
, graph_tool::ConstantPropertyMap<unsigned long, boost::adj_list<unsigned
long>::edge_descriptor> > () from /system/software/linux-x86_64/lib/python2.7/site-packages/graph_tool/topology/libgraph_tool_topology.so #3 0x00007fffe17e0d16 in gomp_thread_start () at ../../../libgomp/team.c:117 #4 0x0000003d9e6079d1 in start_thread () from /lib64/libpthread.so.0 #5 0x0000003d9e2e89dd in clone () from /lib64/libc.so.6
I will ask the admin team at my university if they can install the newest version of graph-tool on the system and try 2.13 out then.
Thanks and best wishes, Alice
-- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.