Skip to main content

Python implementation of Weisfeiler-Lehman Graph Kernels

Project description

PyWLGK

Python implementation of the Weisfeiler-Lehman Graph Kernels (WLKs) method. This package is an alternative to FastWLK, GraKel, and other implementations of the WLKs method.

Installation

By design, PyWLGK is installable from PyPI and Anaconda. To install the package with pip, run the following command:

pip install pywlgk

or with conda (alternatively with mamba by replacing conda with mamba

conda install pywlgk

Usage

PyWLGK is designed to be easy to use. The following example shows how to use PyWLGK to compute the WLKs kernel between two graphs.

from pywlgk import wlk
import numpy as np

adjs = np.random.randint(0, 1, size=(2, 10, 10))
adjs = np.array(adjs + adjs.transpose(0, 2, 1), dtype=np.int32)
labels = np.ones((2, 10), dtype=np.int32)
wlk(adjs, labels, k=4)

PyWLGK takes as input a stack of adjacency matrices (adjs) and a stack of node labels (labels). The adjacency matrices must be symmetric, whereas the labels can have any type. Additionally, one can specify a k to control how many iterations of the kernel will be computed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywlgk-1.0.0.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

pywlgk-1.0.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page