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:

I can't reproduce this. The script above works just fine for me.

What version of graph-tool are you using?

Best,
Tiago

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(a)skewed.de, mmoll(a)macports.org

Could you try with the latest git version?

Best,
Tiago

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&gt; with the Portfile you provide for the latest git <http://downloads.skewed.de/graph-tool/macosx/graph-tool-devel.Portfile&gt;, along with the Macports guide for modifying Portfiles <https://trac.macports.org/wiki/howto/Upgrade&gt;\.

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?

attachment.html (3.32 KB)

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&gt; with the Portfile you provide
for the latest git
<http://downloads.skewed.de/graph-tool/macosx/graph-tool-devel.Portfile&gt;,
along with the Macports guide for modifying Portfiles
<https://trac.macports.org/wiki/howto/Upgrade&gt;\.

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