Python<->C++ interface tutorial?

Hey,

I'm a researcher without much experience in creating good graph algorithm
implementations.

I'm blown away with how much faster some algorithms are in C++ (for instance
Dijkstra's shortest path) when compared to the implementation in python or
matlab.

Is there any chance you could create a tutorial of how you made the python
interface to C++ code?

Also as far as I can tell this is the best graph library out there, but it's
relatively hard to install. As a result people like me are using inferior
libraries for algorithms and visualization. Do you think you could work on
making your library easier to install, or at least providing more
instructions? I work with both Windows and Mac OS X, and I wasn't able to
install your library on either.

Is there any chance you could create a tutorial of how you made the python
interface to C++ code?

Yes, this is planned. I just need to find the time to write it down.

Also as far as I can tell this is the best graph library out there,
but it's relatively hard to install. As a result people like me are
using inferior libraries for algorithms and visualization. Do you
think you could work on making your library easier to install, or at
least providing more instructions? I work with both Windows and Mac OS
X, and I wasn't able to install your library on either.

graph-tool is harder to install than other libraries such as networkx
mainly because it is implemented in C++ and has C++ dependencies, such
as Boost.

Pure python code is easy to install everywhere. C++ libraries are easy
to install on systems which have built-in package management, such as
most GNU/Linux distros, but are complicated on windows and Mac OS. Mac
OS has third-party package management like macports and homebrew, which
makes things easier; however installing either system already requires
some effort. As is stated in the website, macports is the recommended
way to install the library on Mac OS, since it is the easiest.

On Mac OS and windows I simply see no way of making the installation
just as easy as typing "pip install graph-tool" because there is no way
to avoid installing Boost, CGAL, etc. The only alternative I see is to
provide pre-compiled binaries, but this is difficult since I don't even
have Mac OS or Windows installed anywhere.

Best,
Tiago

Hi,

I know Christof Gohlke <cjgohlke at gmail.com> provides very kindly
precompiled windows binaries for lots of scientific python packages.
Maybe you (Tiago) could ask him to add graph-tool to the bundle?

Also I think your library is popular enough that you might discuss with
people from Anaconda? (I think they provide precompiled wheels or such)

Best,

Guillaume

attachment.html (3.13 KB)

Hi,

I agree with Maksim the compilation step of "graph-tool » quite tedious (especially for Windows and OSX users). Maybe Binstar (https://binstar.org/) could provide an alternative solution to the shipping problem, sending both python code with its binaries dependencies (pre-compiled binaries such as Boost, CGAL, etc). I have tried to build « graph-tool » for Mac OS, that seems to work fine except for « cairo » library, which I didn’t succeed to build with the conda tool. However, Binstar offert a convenient way to install code python with complex dependencies such as graph-tool.

Best,
Vincent

attachment.html (3.87 KB)

Hi,

I know Christof Gohlke <cjgohlke at gmail.com> provides very kindly
precompiled windows binaries for lots of scientific python
packages. Maybe you (Tiago) could ask him to add graph-tool to the
bundle?

Thank you for the tip. I'll try contacting him.

Also I think your library is popular enough that you might discuss
with people from Anaconda? (I think they provide precompiled wheels or
such)

I'm not sure they want to include things like Boost in their package,
and besides they already include NetworkX. But I'll try probing them
anyway.

Best,
Tiago

Hi all,

I'm using graph-tool to model mesh-like elements (cells in a biological
tissue). As the model evolves towards more complicated geometries, I'd
very much like to access some of the underlying GCAL objects not ported
to graph-tool (such as faces). For now I rely on a somehow cumbersome
dual propertymaps/pandas data manipulation.

I was wondering how this could go, but don't know from which end I shell
read the code in graph-tool. Also would some kind of plugin architecture
be possible (i.e. compiling the relevant Cpp bindings as a shared object
compatible with graph-tool)?

Thanks,

Guillaume

It is entirely possible to write such C++ plugins for graph-tool; I do
it all the time for my own stuff. However, this is still entirely
undocumented.

I plan to write this documentation, with a least a simple example, soon.
(I will give a small graph-tool tutorial talk in the next NetSci in
June, and I want to have this done by then.)

In the mean time, you can peak at how the PageRank code is implemented,
which is fact a rather complete yet not too long example of how to
extend graph-tool:

The C++ part:

https://git.skewed.de/count0/graph-tool/blob/master/src/graph/centrality/graph_pagerank.hh
https://git.skewed.de/count0/graph-tool/blob/master/src/graph/centrality/graph_pagerank.cc

The python part:

https://git.skewed.de/count0/graph-tool/blob/master/src/graph_tool/centrality/__init__.py#L62

You need to know how to use the BGL and Boost python.

Best,
Tiago

Thanks!

I'll dive into it,

Hope your talk is filmed! Any plan to come to EuroScipPy?

Guillaume

attachment.html (3.04 KB)

I don't think I will be able to...

Best,
Tiago