Title: | Graph Kernels |
---|---|
Description: | A fast C++ implementation for computing various graph kernels including (1) simple kernels between vertex and/or edge label histograms, (2) graphlet kernels, (3) random walk kernels (popular baselines), and (4) the Weisfeiler-Lehman graph kernel (state-of-the-art). |
Authors: | Mahito Sugiyama [aut, cre], The development of the graphkernels open access software package was financially supported by the Horizon 2020/CDS-QUAMRI/634541 project. This support is gratefully acknowledged. [fnd] |
Maintainer: | Mahito Sugiyama <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.6.1 |
Built: | 2025-02-12 05:26:17 UTC |
Source: | https://github.com/cran/graphkernels |
A fast C++ implementation for computing various graph kernels including (1) simple kernels between vertex and/or edge label histograms, (2) graphlet kernels, (3) random walk kernels (popular baselines), and (4) the Weisfeiler-Lehman graph kernel (state-of-the-art).
This library provides the following graph kernels:
the linear kernel between vertex label histograms
the linear kernel between edge label histograms
the linear kernel between vertex-edge label histograms
the linear kernel combination vertex label histograms and vertex-edge label histograms
the Gaussian RBF kernel between vertex label histograms
the Gaussian RBF kernel between edge label histograms
the Gaussian RBF kernel between vertex-edge label histograms
the graphlet kernel
the -step random walk kernel
the geometric random walk kernel
the exponential random walk kernel
the shortest-path kernel
the Weisfeiler-Lehman subtree kernel
Given a list of igraph graphs, each function calculates the corresponding kernel (Gram) matrix.
Mahito Sugiyama
Maintainer: Mahito Sugiyama <[email protected]>
Borgwardt, K. M., Kriegel, H.-P.: Shortest-Path Kernels on Graphs, Proceedings of the 5th IEEE International Conference on Data Mining (ICDM'05), 74-81 (2005) https://ieeexplore.ieee.org/document/1565664/.
Debnath, A. K., Lopez de Compadre, R. L., Debnath, G., Shusterman, A. J., Hansch, C.: Structure-activity relationship of mutagenic aromatic and heteroaromatic nitro compounds. correlation with molecular orbital energies and hydrophobicity, Journal of Medicinal Chemistry, 34(2), 786-797 (1991) https://pubs.acs.org/doi/abs/10.1021/jm00106a046.
Gartner, T., Flach, P., Wrobel, S.: On graph kernels: Hardness results and efficient alternatives, Learning Theory and Kernel Machines (LNCS 2777), 129-143 (2003) https://link.springer.com/chapter/10.1007/978-3-540-45167-9_11.
Shervashidze, N., Schweitzer, P., van Leeuwen, E. J., Mehlhorn, K., Borgwardt, K. M.: Weisfeiler-Lehman Graph Kernels, Journal of Machine Learning Research, 12, 2359-2561 (2011) https://www.jmlr.org/papers/volume12/shervashidze11a/shervashidze11a.pdf.
Shervashidze, N., Vishwanathan, S. V. N., Petri, T., Mehlhorn, K., Borgwardt, K. M.: Efficient Graphlet Kernels for Large Graph Comparison, Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS), 5, 488-495 (2009) https://proceedings.mlr.press/v5/shervashidze09a.html.
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) KEH <- CalculateEdgeHistKernel(mutag) ## compute linear kernel between edge histograms KWL <- CalculateWLKernel(mutag, 5) ## compute Weisfeiler-Lehman subtree kernel
data(mutag) KEH <- CalculateEdgeHistKernel(mutag) ## compute linear kernel between edge histograms KWL <- CalculateWLKernel(mutag, 5) ## compute Weisfeiler-Lehman subtree kernel
This function calculates a kernel matrix of the graphlet kernel with
connected graphlets between unlabeled graphs.
CalculateConnectedGraphletKernel(G, par)
CalculateConnectedGraphletKernel(G, par)
G |
a list of |
par |
the number |
a kernel matrix of the connected graphlet kernel
Mahito Sugiyama
Shervashidze, N., Vishwanathan, S. V. N., Petri, T., Mehlhorn, K., Borgwardt, K. M.: Efficient Graphlet Kernels for Large Graph Comparison, Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS), 5, 488-495 (2009) https://proceedings.mlr.press/v5/shervashidze09a.html.
data(mutag) K <- CalculateConnectedGraphletKernel(mutag, 4)
data(mutag) K <- CalculateConnectedGraphletKernel(mutag, 4)
This function calculates a kernel matrix of the Gaussian RBF kernel
between edge label histograms.
CalculateEdgeHistGaussKernel(G, par)
CalculateEdgeHistGaussKernel(G, par)
G |
a list of |
par |
|
a kernel matrix of the Gaussian RBF kernel
between edge label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateEdgeHistGaussKernel(mutag, .1)
data(mutag) K <- CalculateEdgeHistGaussKernel(mutag, .1)
This function calculates a kernel matrix of the linear kernel
between edge label histograms.
CalculateEdgeHistKernel(G)
CalculateEdgeHistKernel(G)
G |
a list of |
a kernel matrix of the linear kernel between edge
label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateEdgeHistKernel(mutag)
data(mutag) K <- CalculateEdgeHistKernel(mutag)
This function calculates a kernel matrix of the exponential random walk
kernel .
CalculateExponentialRandomWalkKernel(G, par)
CalculateExponentialRandomWalkKernel(G, par)
G |
a list of |
par |
a coefficient |
a kernel matrix of the exponential random walk kernel
Mahito Sugiyama
Gartner, T., Flach, P., Wrobel, S.: On graph kernels: Hardness results and efficient alternatives, Learning Theory and Kernel Machines (LNCS 2777), 129-143 (2003) https://link.springer.com/chapter/10.1007/978-3-540-45167-9_11.
data(mutag) K <- CalculateExponentialRandomWalkKernel(mutag[1:5], .1)
data(mutag) K <- CalculateExponentialRandomWalkKernel(mutag[1:5], .1)
This function calculates a kernel matrix of the geometric random walk
kernel .
CalculateGeometricRandomWalkKernel(G, par)
CalculateGeometricRandomWalkKernel(G, par)
G |
a list of |
par |
a coefficient |
a kernel matrix of the geometric random walk kernel
Mahito Sugiyama
Gartner, T., Flach, P., Wrobel, S.: On graph kernels: Hardness results and efficient alternatives, Learning Theory and Kernel Machines (LNCS 2777), 129-143 (2003) https://link.springer.com/chapter/10.1007/978-3-540-45167-9_11.
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateGeometricRandomWalkKernel(mutag, .1)
data(mutag) K <- CalculateGeometricRandomWalkKernel(mutag, .1)
This function calculates a kernel matrix of the graphlet kernel
between unlabeled graphs.
CalculateGraphletKernel(G, par)
CalculateGraphletKernel(G, par)
G |
a list of |
par |
the number |
a kernel matrix of the graphlet kernel
Mahito Sugiyama
Shervashidze, N., Vishwanathan, S. V. N., Petri, T., Mehlhorn, K., Borgwardt, K. M.: Efficient Graphlet Kernels for Large Graph Comparison, Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS), 5, 488-495 (2009) https://proceedings.mlr.press/v5/shervashidze09a.html.
data(mutag) K <- CalculateGraphletKernel(mutag, 4)
data(mutag) K <- CalculateGraphletKernel(mutag, 4)
This function calculates a graphlet kernel matrix.
CalculateGraphletKernelCpp(graph_adj_all, graph_adjlist_all, k, connected)
CalculateGraphletKernelCpp(graph_adj_all, graph_adjlist_all, k, connected)
graph_adj_all |
a list of adjacency matrices |
graph_adjlist_all |
a list of adjacency lists |
k |
the number |
connected |
whether or not graphlets are conneceted |
a kernel matrix of the respective graphlet kernel
Mahito Sugiyama
Shervashidze, N., Vishwanathan, S. V. N., Petri, T., Mehlhorn, K., Borgwardt, K. M.: Efficient Graphlet Kernels for Large Graph Comparison, Proceedings of the 12th International Conference on Artificial Intelligence and Statistics (AISTATS), 5, 488-495 (2009) https://proceedings.mlr.press/v5/shervashidze09a.html.
data(mutag) al.list <- as.list(rep(NA, length(mutag))) for (i in 1:length(mutag)) { al.list[[i]] <- as_adj_list(mutag[[i]]) } K <- CalculateGraphletKernelCpp(list(), al.list, 4, 0)
data(mutag) al.list <- as.list(rep(NA, length(mutag))) for (i in 1:length(mutag)) { al.list[[i]] <- as_adj_list(mutag[[i]]) } K <- CalculateGraphletKernelCpp(list(), al.list, 4, 0)
This function calculates a kernel matrix.
CalculateKernelCpp(graph_info_list, par_r, kernel_type)
CalculateKernelCpp(graph_info_list, par_r, kernel_type)
graph_info_list |
a list of |
par_r |
parameters of kernels |
kernel_type |
type of kernel |
a kernel matrix of the respective kernel
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) graph.info.list <- vector("list", length(mutag)) for (i in 1:length(mutag)) { graph.info.list[[i]] <- GetGraphInfo(mutag[[i]]) } K <- CalculateKernelCpp(graph.info.list, 5, 11)
data(mutag) graph.info.list <- vector("list", length(mutag)) for (i in 1:length(mutag)) { graph.info.list[[i]] <- GetGraphInfo(mutag[[i]]) } K <- CalculateKernelCpp(graph.info.list, 5, 11)
This function calculates a kernel matrix of the -step random
walk kernel
.
CalculateKStepRandomWalkKernel(G, par)
CalculateKStepRandomWalkKernel(G, par)
G |
a list of |
par |
a vector of coefficients |
a kernel matrix of the k-step random walk kernel
Mahito Sugiyama
Gartner, T., Flach, P., Wrobel, S.: On graph kernels: Hardness results and efficient alternatives, Learning Theory and Kernel Machines (LNCS 2777), 129-143 (2003) https://link.springer.com/chapter/10.1007/978-3-540-45167-9_11.
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateKStepRandomWalkKernel(mutag, rep(1, 2))
data(mutag) K <- CalculateKStepRandomWalkKernel(mutag, rep(1, 2))
This function calculates a kernel matrix of the shortest-path kernel
.
CalculateShortestPathKernel(G)
CalculateShortestPathKernel(G)
G |
a list of |
a kernel matrix of the shortest-path kernel
Mahito Sugiyama
Borgwardt, K. M., Kriegel, H.-P.: Shortest-Path Kernels on Graphs, Proceedings of the 5th IEEE International Conference on Data Mining (ICDM'05), 74-81 (2005) https://ieeexplore.ieee.org/document/1565664/.
data(mutag) K <- CalculateShortestPathKernel(mutag)
data(mutag) K <- CalculateShortestPathKernel(mutag)
This function calculates a kernel matrix of the Gaussian RBF kernel
between vertex-edge label histograms.
CalculateVertexEdgeHistGaussKernel(G, par)
CalculateVertexEdgeHistGaussKernel(G, par)
G |
a list of |
par |
|
a kernel matrix of the Gaussian RBF kernel
between vertex-edge label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateVertexEdgeHistGaussKernel(mutag, .1)
data(mutag) K <- CalculateVertexEdgeHistGaussKernel(mutag, .1)
This function calculates a kernel matrix of the linear kernel
between vertex-edge label histograms.
CalculateVertexEdgeHistKernel(G)
CalculateVertexEdgeHistKernel(G)
G |
a list of |
a kernel matrix of the linear kernel between
vertex-edge label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateVertexEdgeHistKernel(mutag)
data(mutag) K <- CalculateVertexEdgeHistKernel(mutag)
This function calculates a kernel matrix of the Gaussian RBF kernel
between vertex label histograms.
CalculateVertexHistGaussKernel(G, par)
CalculateVertexHistGaussKernel(G, par)
G |
a list of |
par |
|
a kernel matrix of the Gaussian RBF kernel between vertex label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateVertexHistGaussKernel(mutag, .1)
data(mutag) K <- CalculateVertexHistGaussKernel(mutag, .1)
This function calculates a kernel matrix of the linear kernel
between vertex label histograms.
CalculateVertexHistKernel(G)
CalculateVertexHistKernel(G)
G |
a list of |
a kernel matrix of the linear kernel between vertex
label histograms
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateVertexHistKernel(mutag)
data(mutag) K <- CalculateVertexHistKernel(mutag)
This function calculates a kernel matrix of the linear kernel
combination of vertex label histograms
and vertex-edge label histograms
.
CalculateVertexVertexEdgeHistKernel(G, par)
CalculateVertexVertexEdgeHistKernel(G, par)
G |
a list of |
par |
a coefficient |
a kernel matrix that is equivalent to
Mahito Sugiyama
Sugiyama, M., Borgwardt, K. M.: Halting in Random Walk Kernels, Advances in Neural Information Processing Systems (NIPS 2015), 28, 1630-1638 (2015) https://papers.nips.cc/paper/5688-halting-in-random-walk-kernels.pdf.
data(mutag) K <- CalculateVertexVertexEdgeHistKernel(mutag, .1)
data(mutag) K <- CalculateVertexVertexEdgeHistKernel(mutag, .1)
This function calculates a kernel matrix of the Weisfeiler-Lehman
subtree kernel .
CalculateWLKernel(G, par)
CalculateWLKernel(G, par)
G |
a list of |
par |
the number |
a kernel matrix of the Weisfeiler-Lehman subtree kernel
Mahito Sugiyama
Shervashidze, N., Schweitzer, P., van Leeuwen, E. J., Mehlhorn, K., Borgwardt, K. M.: Weisfeiler-Lehman Graph Kernels, Journal of Machine Learning Research, 12, 2359-2561 (2011) https://www.jmlr.org/papers/volume12/shervashidze11a/shervashidze11a.pdf.
data(mutag) K <- CalculateWLKernel(mutag, 5)
data(mutag) K <- CalculateWLKernel(mutag, 5)
This function extracts necessary information of graphs for kernel computation.
GetGraphInfo(g)
GetGraphInfo(g)
g |
an |
a list of graph information with the following elements:
edge |
a matrix of edges with their labels |
vlabel |
a vector of vertex labels |
vsize |
the number of vertices |
esize |
the number of edges |
maxdegree |
the maximum degree |
Mahito Sugiyama
data(mutag) ginfo <- GetGraphInfo(mutag[[1]])
data(mutag) ginfo <- GetGraphInfo(mutag[[1]])
This is a supplement for symbol registration.
Mahito Sugiyama
This is a supplement for symbol registration.
Mahito Sugiyama
This is the mutag dataset, a well known benchmark dataset for graph processing algorithms.
data(mutag)
data(mutag)
Mahito Sugiyama
Debnath, A. K., Lopez de Compadre, R. L., Debnath, G., Shusterman, A. J., Hansch, C.: Structure-activity relationship of mutagenic aromatic and heteroaromatic nitro compounds. correlation with molecular orbital energies and hydrophobicity, Journal of Medicinal Chemistry, 34(2), 786-797 (1991) https://pubs.acs.org/doi/abs/10.1021/jm00106a046.
data(mutag) K <- CalculateWLKernel(mutag, 5)
data(mutag) K <- CalculateWLKernel(mutag, 5)