shobhitagrawal1 / fast_wl

A fast MATLAB implementation of the Weisfeiler--Lehman graph transformation and associated kernel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fast Weisfeiler--Lehman Transformation

A fast MATLAB implementation of the one-dimensional Weisfeiler--Lehman graph transformation and associated kernel.

For more details about the fast hashing-based algorithm used, see the following paper:

Kersting, K., Mladenov, M., Garnett, R., and Grohe, M. Power Iterated Color Refinement. (2014). AAAI Conference on Artificial Intelligence (AAAI 2014).

For more details about the Weisfeiler--Lehman graph kernel, see the following paper:

Shervashidze, N., Schweitzer, P. van Leeuwen, E.J., Mehlhorn, K., and Borgward, K.M. Weisfeiler--Lehman graph kernels. (2010). Journal of Machine Learning Research 12(Sep):2539--2561.

This implementation uses a fast perfect hash for performing the transformation. Consider a node x in G, and let l(x) and N(x) represent the label of x and neighborhood of x, respectively. Let p(i) represent the ith prime. The hash for x is given by

h(x) = l(x) + \sum_{y \in N(x)} log(p(l(y)))

It can be easily shown that, given two nodes (x, y) in V(G), h(x) = h(y) if and only if:

  • l(x) = l(y)
  • N(x) and N(y) contain the same labels with the same cardinality,

that is, h(x) gives unique values to unique WL signatures. The use of h(x) is much faster than the typical string hashes used for completing the WL transformation.

Usage

See the help for wl_transformation.m for usage information.

About

A fast MATLAB implementation of the Weisfeiler--Lehman graph transformation and associated kernel.

License:MIT License


Languages

Language:MATLAB 100.0%