Vertex.in_neighbours() throws an error for undirected graphs
The Vertex methods in_neighbours() and all_neighbours() throw an error for undirected graphs. Is this behavior intended? Code:
import numpy as np import numpy.random as rand import graph_tool.all as gt
n = 1000; p = 2.0*np.log(n)/n g = gt.random_graph(n, lambda: rand.poisson((n - 1) * p), directed=False, model="erdos") v = [v for v in g.vertices() if g.vertex_index[v] == 0][0] [u.__int__() for u in v.out_neighbours()]
# Fail: [u.__int__() for u in v.in_neighbours()] # Fail: [u.__int__() for u in v.all_neighbours()]
# Correct by setting direction g.is_directed() g.set_directed(True) g.is_directed() [u.__int__() for u in v.in_neighbours()] [u.__int__() for u in v.out_neighbours()]
Error:
File "gt_test.py", line 11, in <module> [u.__int__() for u in v.in_neighbours()] File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 2327, in _in_neighbours yield e.source() ValueError: invalid edge descriptor
On 20.10.2014 18:01, Smith, Steven - 1004 - MITLL wrote:
The Vertex methods in_neighbours() and all_neighbours() throw an error for undirected graphs. Is this behavior intended? Code:
import numpy as np import numpy.random as rand import graph_tool.all as gt
n = 1000; p = 2.0*np.log(n)/n g = gt.random_graph(n, lambda: rand.poisson((n - 1) * p), directed=False, model="erdos") v = [v for v in g.vertices() if g.vertex_index[v] == 0][0] [u.__int__() for u in v.out_neighbours()]
# Fail: [u.__int__() for u in v.in_neighbours()] # Fail: [u.__int__() for u in v.all_neighbours()]
# Correct by setting direction g.is_directed() g.set_directed(True) g.is_directed() [u.__int__() for u in v.in_neighbours()] [u.__int__() for u in v.out_neighbours()]
Error:
File "gt_test.py", line 11, in <module> [u.__int__() for u in v.in_neighbours()] File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/graph_tool/__init__.py", line 2327, in _in_neighbours yield e.source() ValueError: invalid edge descriptor
I can't reproduce this. The script above works just fine for me. What version of graph-tool are you using? Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
I can't reproduce this. The script above works just fine for me.
What version of graph-tool are you using?
Latest 2.2.35. Boost issue? Here’s what Macports says: $ sudo port info py-graph-tool boost py-graph-tool @2.2.35 (python, science) Sub-ports: py27-graph-tool, py34-graph-tool Description: graph-tool is an efficient python module for manipulation and statistical analysis of graphs. The internal data structures and most algorithms are implemented in C++ with the Boost Graph Library. Homepage: http://graph-tool.skewed.de Library Dependencies: py27-graph-tool Platforms: darwin License: GPL-3 Maintainers: tiago@skewed.de, mmoll@macports.org -- boost @1.56.0_1 (devel) Variants: debug, [+]no_single, [+]no_static, python25, python26, [+]python27, python31, python32, python33, python34, regex_match_extra, universal Description: Boost provides free portable peer-reviewed C++ libraries. The emphasis is on portable libraries which work well with the C++ Standard Library. Homepage: http://www.boost.org Library Dependencies: zlib, expat, bzip2, libiconv, icu, python27 Platforms: darwin License: Boost-1 Maintainers: nomaintainer@macports.org
On 27.10.2014 18:54, Smith, Steven - 1004 - MITLL wrote:
I can't reproduce this. The script above works just fine for me.
What version of graph-tool are you using?
Latest 2.2.35. Boost issue? Here’s what Macports says:
Could you try with the latest git version? Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
Tiago, Looking into this issue, I see from graph_tool.show_config() that openmp is not enabled on the default Macports install. So now I’m really motivated to reinstall from the latest git with openmp compilation enabled. I’m using your macports instructions <http://graph-tool.skewed.de/download> with the Portfile you provide for the latest git <http://downloads.skewed.de/graph-tool/macosx/graph-tool-devel.Portfile>, along with the Macports guide for modifying Portfiles <https://trac.macports.org/wiki/howto/Upgrade>. I’ve run into this error with the latest git build with the Portfile linked above: cd $(port dir py-graph-tool) sudo cp Portfile Portfile.orig sudo cp ~/Downloads/graph-tool-devel.Portfile.txt Portfile sudo port edit py-graph-tool sudo port -d checksum py-graph-tool sudo port -d install py-graph-tool :info:configure Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-graph-tool/py-graph-tool/work/graph-tool-devel" && ./configure --prefix=/opt/local --prefix=`python2.7-config --prefix` :info:configure Exit code: 127 :error:configure org.macports.configure for port py-graph-tool returned: configure failure: command execution failed Looking in the directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-graph-tool/py-graph-tool/work/graph-tool-devel, I see that there’s a file ./configure.ac, but no ./configure, so there’s some autoconf glitch. Would you please advise on building graph-tool with the Portfile graph-tool-devel.Portfile? It ow;d be great to have openmp enabled. Thanks again, Steve Could you try with the latest git version? I can't reproduce this. The script above works just fine for me. What version of graph-tool are you using?
On 07.11.2014 20:50, Smith, Steven - 1004 - MITLL wrote:
Tiago,
Looking into this issue, I see from graph_tool.show_config() that openmp is not enabled on the default Macports install. So now I’m really motivated to reinstall from the latest git with openmp compilation enabled. I’m using your macports instructions <http://graph-tool.skewed.de/download> with the Portfile you provide for the latest git <http://downloads.skewed.de/graph-tool/macosx/graph-tool-devel.Portfile>, along with the Macports guide for modifying Portfiles <https://trac.macports.org/wiki/howto/Upgrade>.
I'm afraid it is not this simple. Clang does not yet have support for openmp (that is why it is not enabled in the Portfile), and GCC does not really work in MacOS (but you can try, and see how far you go).
I’ve run into this error with the latest git build with the Portfile linked above:
cd $(port dir py-graph-tool) sudo cp Portfile Portfile.orig sudo cp ~/Downloads/graph-tool-devel.Portfile.txt Portfile sudo port edit py-graph-tool sudo port -d checksum py-graph-tool sudo port -d install py-graph-tool
:info:configure Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-graph-tool/py-graph-tool/work/graph-tool-devel" && ./configure --prefix=/opt/local --prefix=`python2.7-config --prefix` :info:configure Exit code: 127 :error:configure org.macports.configure for port py-graph-tool returned: configure failure: command execution failed
Looking in the directory /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-graph-tool/py-graph-tool/work/graph-tool-devel, I see that there’s a file ./configure.ac, but no ./configure, so there’s some autoconf glitch.
Would you please advise on building graph-tool with the Portfile graph-tool-devel.Portfile? It ow;d be great to have openmp enabled.
I guess this Portfile is very outdated, I have to update it. In the mean time take at look at the official Portfile: https://trac.macports.org/browser/trunk/dports/python/py-graph-tool/Portfile Just modify it to fetch from git: fetch.type git git.url https://git.skewed.de/count0/graph-tool.git git.branch origin/master Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
Smith, Steven - 1004 - MITLL -
Tiago de Paula Peixoto