API Reference

This is the class and function reference of GraKeL. In order for the user to understand how to use the package, we suggest he reads Documentation section.

grakel.graph: Graph class with its utility functions

Base Class

Graph([initialization_object, node_labels, …])

The general graph class.

Utility Functions

graph.is_adjacency(g[, transform])

Define if input is in a valid adjacency matrix format.

graph.is_edge_dictionary(g[, transform])

Define if input is in a valid edge dictionary format.

graph.laplacian(csgraph[, normed, …])

Return the Laplacian matrix of a directed graph.

graph.floyd_warshall(adjacency_matrix)

Calculate the Floyd Warshall, shortest path matrix.

User guide: See the Graph (class) section for further details.

grakel.graph_kernels: A kernel decorator

Graph Kernel (decorator)

grakel.GraphKernel([kernel, normalize, …])

A generic wrapper for graph kernels.

User guide: See the GraphKernel (class) section for further details.

grakel.kernels: A collection of graph kernels

Kernels

Kernel([n_jobs, normalize, verbose])

A general class for graph kernels.

RandomWalk([n_jobs, normalize, verbose, …])

The random walk kernel class.

RandomWalkLabeled([n_jobs, normalize, …])

The labeled random walk kernel class.

PyramidMatch([n_jobs, normalize, verbose, …])

Pyramid match kernel class.

NeighborhoodHash([n_jobs, normalize, …])

Neighborhood hashing kernel as proposed in [HK09].

ShortestPath([n_jobs, normalize, verbose, …])

The shortest path kernel class.

ShortestPathAttr([n_jobs, normalize, …])

The shortest path kernel for attributes.

GraphletSampling([n_jobs, normalize, …])

The graphlet sampling kernel.

SubgraphMatching([n_jobs, verbose, …])

Calculate the subgraph matching kernel.

WeisfeilerLehman([n_jobs, verbose, …])

Compute the Weisfeiler Lehman Kernel.

HadamardCode([n_jobs, verbose, normalize, …])

The simple Hadamard code kernel, as proposed in [KI16].

NeighborhoodSubgraphPairwiseDistance([…])

The Neighborhood subgraph pairwise distance kernel.

LovaszTheta([n_jobs, normalize, verbose, …])

Lovasz theta kernel as proposed in [JJDB14].

SvmTheta([n_jobs, normalize, verbose, …])

Calculate the SVM theta kernel.

Propagation([n_jobs, verbose, normalize, …])

The Propagation kernel for fully labeled graphs.

PropagationAttr([n_jobs, verbose, …])

The Propagation kernel for fully attributed graphs.

OddSth([n_jobs, normalize, verbose, h])

ODD-Sth kernel as proposed in [DSMNS12].

MultiscaleLaplacian([n_jobs, normalize, …])

Laplacian Graph Kernel as proposed in [KP16].

MultiscaleLaplacianFast([n_jobs, normalize, …])

Laplacian Graph Kernel as proposed in [KP16].

HadamardCode([n_jobs, verbose, normalize, …])

The simple Hadamard code kernel, as proposed in [KI16].

VertexHistogram([n_jobs, normalize, …])

Vertex Histogram kernel as found in [SB15].

EdgeHistogram([n_jobs, normalize, verbose, …])

Edge Histogram kernel as found in [SB15].

GraphHopper([n_jobs, normalize, verbose, …])

Graph Hopper Histogram kernel as found in [FKP+13].

CoreFramework([n_jobs, verbose, normalize, …])

The core kernel framework, as proposed in [NMLV18].

User guide: See the Kernels (between graphs) section for further details.

grakel.datasets: Datasets

Fetch

fetch_dataset(name[, verbose, data_home, …])

Load a dataset from a huge collection of benchmark datasets [KKM+16].

get_dataset_info(dataset_name[, default])

Return the info concerning the existence of a certain dataset.

User guide: See the Dataset loading utilities section for further details.

grakel: Utils

Use a kernel matrix as a transformer

KMTransformer([K])

A Kernel Matrix Transformer.

Cross Validation

cross_validate_Kfold_SVM(K, y[, n_iter, …])

Cross Validate a list of precomputed kernels with an SVM.

Load from other file formats

graph_from_networkx(X[, node_labels_tag, …])

Transform an iterable of networkx objects to an iterable of Graphs.

graph_from_pandas(edge_df[, node_df, …])

Produces a collection of Graph Objects from pandas dataframes.

graph_from_csv(edge_files[, node_files, …])

Produces a collection of Graph Objects from a collection of csv files.

User guide: Usefull functions for applying to existing datasets, of other formats.