API Reference

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

grakelx.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 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.

grakelx.graph_kernels: A kernel decorator

Graph Kernel (decorator)

grakelx.GraphKernel([kernel, normalize, ...])

A generic wrapper for graph kernels.

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

grakelx.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 [].

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 [].

NeighborhoodSubgraphPairwiseDistance([...])

The Neighborhood subgraph pairwise distance kernel.

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

Lovasz theta kernel as proposed in [].

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 [].

MultiscaleLaplacian([n_jobs, normalize, ...])

Laplacian Graph Kernel as proposed in [].

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 [].

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

The core kernel framework, as proposed in [].

WeisfeilerLehmanOptimalAssignment([n_jobs, ...])

Compute the Weisfeiler Lehman Optimal Assignment Kernel.

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

grakelx.datasets: Datasets

Fetch

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

Access a large collection of benchmark datasets from TU Dortmund [].

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.

grakelx: 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 / export to other file formats

graph_from_networkx(X[, node_labels_tag, ...])

Transform networkx objects to grakel.Graph objects.

networkx_from_graph(X[, node_labels_tag, ...])

Transform grakel.Graph objects to networkx graph objects.

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.

graph_from_torch_geometric(data[, ...])

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

User guide: See the Converting Between Formats section for detailed examples.