graphkernels
is a Python package for computing various graph kernels. The
backend is coded in C++ and
exposed to Python through SWIG.
The Python and R packages are described at:
- M. Sugiyama, M.E. Ghisu, F. Llinares-López and K. Borgwardt. graphkernels: R and Python packages for graph comparison. Bioinformatics, 2017.
The paper can be found here.
graphkernels
requires the following dependencies to be pre-installed in your
local environment:
During setup, you will also need the following dependencies:
- a C++ compiler (e.g. gcc, XCode)
- pkg-config and the respective Python bindings
- SWIG
We recommend the following steps for installing the dependencies (except for the C++ compiler):
- On Ubuntu 18.04 LTS:
$ sudo apt-get install libeigen3-dev python3-igraph python3-numpy python3-pkgconfig swig
Some of the packages might not be available in older distributions.
- On MacOSX:
$ brew install eigen pkg-config
To install the package through PyPI, type:
$ pip3 install graphkernels --user
It is recommended that version 10
or later of pip
is used; newer versions
of pip
can handle missing dependencies better, by automatically downloading
and installing them together with graphkernels
(this won't work for the Eigen
library). To see which version of pip
is installed, type:
$ pip3 --version
If you are using an older version, you can locally upgrade pip
by typing:
$ python3 -m pip install --user --upgrade-pip
before attempting the graphkernels
installation.
In case you already have an older version of graphkernels
installed, you can
use the --no-cache-dir
option so that your local package cache is ignored and
the lastest package is downloaded:
$ pip3 --no-cache-dir install graphkernels --user
Alternatively, the package can be built from source as follows:
- Download the latest source code from GitHub (please only use the
master
branch when doing so, other branches are not guaranteed to contain a correct build):
$ git clone https://github.com/Renelvon/GraphKernels.git
- Build the package; this will also compile the C++ backend and generate the SWIG wrapper:
$ cd GraphKernels
$ python3 setup.py build
- Install the package for this user only (showed by
--user
; installing the package system-wide might requiresudo -H
):
$ python3 setup.py install --user
The Tutorial
folder should help with getting started using the package.
There, you can also find an example script for computing graph kernels through
our package on a benchmark dataset.
This version of graphkernels
aims to be fast, user-friendly and
backwards-compatible (in that order). Accordingly, support for Python 2 in
graphkernels
has been dropped because it is reaching
End-Of-Life very soon. If you care about speed
enough to use a C++ backend for your project, you should care as much about
future portability and give serious thought before continuing development on
Python 2. Most of the ML projects will drop
support for Python 2 soon.
If you use the graphkernels
package in your projects please cite our work as
follows:
@article{Sugiyama-2017-Bioinformatics,
author = {Sugiyama, Mahito and Ghisu, M. Elisabetta and Llinares-López, Felipe and Borgwardt, Karsten},
title = {graphkernels: R and Python packages for graph comparison},
journal = {Bioinformatics},
volume = {34},
number = {3},
pages = {530--532},
year = {2017},
doi = {10.1093/bioinformatics/btx602},
URL = {http://dx.doi.org/10.1093/bioinformatics/btx602},
}
If our project has made your life easier, we will be happy to receive your feedback, through e-mail or an issue on GitHub.