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:
sixandfutureare no longer dependencies, the__future__imports and thesix.movesshims 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 2raise(IndexError, ...)form. On Python 3 that raisesTypeError: exceptions must derive from BaseExceptioninstead of the intendedIndexError. The path is reached through the Dijkstra and shortest-path kernels on an empty queue.setup.pyno longer importsdistutils, 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 removedeigvalskeyword inSvmThetaandLovaszTheta, and scalar extraction under numpy 2 inSubgraphMatching.WeisfeilerLehmanno 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.NeighborhoodSubgraphPairwiseDistancecan be used as a base kernel of a framework again (#120): itsdiagonal()returned a scalar where one value per graph was expected.Printing a
Graphworks again (#102).The geometric
RandomWalkkernel 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.GraphHoppersays 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:
EdgeHistogramerrors (#97), one against many comparison withWeisfeilerLehman.transform(#95),RandomWalkLabeledreturning an all ones matrix (#96),NeighborhoodSubgraphPairwiseDistancediagonals below one (#94), missing arguments onfit_transform(#75) and the initialisation ofself.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.
LovaszThetawarns on windows, where the underlying solver is unreliable.
Version 0.1a8
Added a new kernel: Weisfeiler-Lehman-Optimal-Assignment.
Removed
MultiScaleLaplacianas being really slow, and renamedMultiScaleLaplacianFasttoMultiScaleLaplacian.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_kernelargument of the frameworks tobase_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 oncheck_random_statesorandom_seedarguments are nowrandom_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
VertexHistogramandEdgeHistogram.
Version 0.1a5
Various bugfixes in the kernel implementations.
Added
utilsfunctions 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 aTransformerfashion.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.