Overview#

GraKeL is a Python package which provides implementations of several graph kernels, a family of powerful methods which allow kernel-based learning approaches such as SVMs to work directly on graphs.

What’s New#

  • Version 0.1.11

    Note

    From this release onwards GraKeL is Python 3 only. The last release that carried any Python 2 support was 0.1.10; if you are still on Python 2, pin grakel<=0.1.10. Supported versions are 3.9 to 3.12.

    • The Python 2 compatibility layer is gone: six and future are no longer dependencies, the __future__ imports and the six.moves shims have been replaced by their standard library equivalents, and the Python 2 C-API wrapper for BLISS has been removed along with it. No behaviour changes beyond the fix below.

    • Fixed a latent error in priority_dict.smallest, which used the Python 2 raise(IndexError, ...) form. On Python 3 that raises TypeError: exceptions must derive from BaseException instead of the intended IndexError. The path is reached through the Dijkstra and shortest-path kernels on an empty queue.

    • setup.py no longer imports distutils, which was dropped from the standard library in 3.12.

    • Python support is now 3.9 to 3.12; wheels are built for all of them on Linux, macOS and Windows. Python 2 is gone from CI, the docs and the conda recipe.

    • Dependency minimums raised to the first versions supporting 3.9: numpy 1.19, scikit-learn 0.24, Cython 0.29.21 and scipy 1.12. scipy is now a declared dependency rather than one picked up transitively.

    • Fixes for modern numpy and scipy, which the kernels had stopped working against: big-endian sparse dtypes in VertexHistogram, the removed eigvals keyword in SvmTheta and LovaszTheta, and scalar extraction under numpy 2 in SubgraphMatching.

    • WeisfeilerLehman no longer fails on a node with no outgoing edges (#119). Note that it relabels from outgoing edges, so on directed graphs incoming edges do not take part.

    • NeighborhoodSubgraphPairwiseDistance can be used as a base kernel of a framework again (#120): its diagonal() returned a scalar where one value per graph was expected.

    • Printing a Graph works again (#102).

    • The geometric RandomWalk kernel keeps its series convergent: the decay factor is checked against the spectral radius of the graphs it is given and lowered, with a warning, when it would diverge. Previously this produced negative self similarities and NaNs once normalized.

    • GraphHopper says when it has been handed discrete labels instead of continuous node attributes (#106), rather than failing with a shape mismatch.

    • Tooling: the project builds with uv, CI runs on github actions with the docs built and published from there, and the release is a single manual workflow. CircleCI is gone.

  • Version 0.1.10

    • Fixes for a batch of reported bugs: EdgeHistogram errors (#97), one against many comparison with WeisfeilerLehman.transform (#95), RandomWalkLabeled returning an all ones matrix (#96), NeighborhoodSubgraphPairwiseDistance diagonals below one (#94), missing arguments on fit_transform (#75) and the initialisation of self.mu_ in the random walk kernel (#71).

    • Graph.copy() and a __repr__ for graphs (#90).

    • Newer python and cvxopt versions; cp312 wheels were not yet buildable at the time of this release.

  • Version 0.1.9

    • Wheels are built and published from CI for every supported python, with win32 dropped following scipy, and musllinux skipped.

    • LovaszTheta warns on windows, where the underlying solver is unreliable.

  • Version 0.1a8

    • Added a new kernel: Weisfeiler-Lehman-Optimal-Assignment.

    • Removed MultiScaleLaplacian as being really slow, and renamed MultiScaleLaplacianFast to MultiScaleLaplacian.

    • Fixed minor issues carried over from 0.1a7 (joblib deprecation, skbunch and the like).

  • Version 0.1a7

    • Detailed installation instructions for the c++ extensions on windows.

    • Renamed the base_kernel argument of the frameworks to base_graph_kernel, to disambiguate it from the vectorial kernels.

    • Faster floyd-warshall calculation in graph.py.

    • Large update throughout the documentation.

  • Version 0.1a6

    • More scikit-learn compatibility: kernels can be initialised by name and alias on GraphKernel, fitting and instantiation work from the default parameters, the random number generator is standardised on check_random_state so random_seed arguments are now random_state, and the docstrings carry doctests.

    • More detailed output when a kernel is unsupported.

    • More detailed licensing information covering cvxopt and BLISS.

    • Bugfix in the (count sensitive) neighborhood hash kernel.

    • Sparse input support for VertexHistogram and EdgeHistogram.

  • Version 0.1a5

    • Various bugfixes in the kernel implementations.

    • Added utils functions for external operations: converting existing graph formats (csv, pandas, networkx) to the grakel native one, k-fold cross validation with an SVM, and a kernel matrix transformer for manipulating precomputed kernel matrices in a Transformer fashion.

    • Conda compatibility: visit anaconda.org/ysig/grakel-dev.

Benchmarks#

To demonstrate the efficiency of the algorithms implemented in GraKeL, we present a comparison of the running times of the implementations of some graph kernels from GraKeL and from other packages. We also compare the running times of the different kernels to each other.

Package Reference#

A collection of all classes and functions important for the use and understanding of the GraKeL package.

Acknowledgements#

We would like to thank @SneachChea for a round of tooling, CI, and docs modernization.

We would like to thank @eddiebergman for modernizing our CI and extending our python support.

Indices and tables#