Skip to main content

PyGSP2: Graph Signal Processing in Python

The PyGSP2 is a Python package to ease Signal Processing on Graphs. The documentation is available on Read the Docs and development takes place on GitHub. A (mostly unmaintained) Matlab version exists.

doc pypi release test

zenodo license pyversions

The PyGSP2 facilitates a wide variety of operations on graphs, like computing their Fourier basis, filtering or interpolating signals, plotting graphs, signals, and filters. Its core is spectral graph theory, and many of the provided operations scale to very large graphs. The package includes a wide range of graphs, from point clouds like the Stanford bunny and the Swiss roll; to networks like the Minnesota road network; to models for generating random graphs like stochastic block models, sensor networks, Erdős–Rényi model, Barabási-Albert model; to simple graphs like the path, the ring, and the grid. Many filter banks are also provided, e.g. various wavelets like the Mexican hat, Meyer, Half Cosine; some low-pass filters like the heat kernel and the exponential window; and Gabor filters. Despite all the pre-defined models, you can easily use a custom graph by defining its adjacency matrix, and a custom filter bank by defining a set of functions in the spectral domain.

While NetworkX and graph-tool are tools to analyze the topology of graphs, the aim of the PyGSP2 is to analyze graph signals, also known as features or properties (i.e., not the graph itself). Those three tools are complementary and work well together with the provided import / export facility.

The following demonstrates how to instantiate a graph and a filter, the two main objects of the package.

>>> from pygsp2 import graphs, filters
>>> G = graphs.Logo()
>>> G.compute_fourier_basis()  # Fourier to plot the eigenvalues.
>>> # G.estimate_lmax() is otherwise sufficient.
>>> g = filters.Heat(G, scale=50)
>>> fig, ax = g.plot()

Let’s now create a graph signal: a set of three Kronecker deltas for that example. We can now look at one step of heat diffusion by filtering the deltas with the above defined filter. Note how the diffusion follows the local structure!

>>> import numpy as np
>>> DELTAS = [20, 30, 1090]
>>> s = np.zeros(G.N)
>>> s[DELTAS] = 1
>>> s = g.filter(s)
>>> fig, ax = G.plot(s, highlight=DELTAS)

You can try it online, look at the tutorials to learn how to use it, or look at the reference guide for an exhaustive documentation of the API. Enjoy!

Installation

The PyGSP2 is available on PyPI:

$ pip install pygsp2

The PyGSP2 is available on Conda Forge:

$ conda install conda-forge::pygsp2

Contributing

See the guidelines for contributing in CONTRIBUTING.rst.

Acknowledgments

The PyGSP was started in 2014 as an academic open-source project for research purpose at the EPFL LTS2 laboratory. This project has been partly funded by the Swiss National Science Foundation under grant 200021_154350 “Towards Signal Processing on Graphs”.

It is released under the terms of the BSD 3-Clause license.

If you are using the library for your research, for the sake of reproducibility, please cite the version you used as indexed by Zenodo. Or cite the generic concept as:

@misc{pygsp,
  title = {PyGSP: Graph Signal Processing in Python},
  author = {Defferrard, Micha\"el and Martin, Lionel and Pena, Rodrigo and Perraudin, Nathana\"el},
  doi = {10.5281/zenodo.1003157},
  url = {https://github.com/epfl-lts2/pygsp/},
}

Metadata

Release files for PyGSP2 2.0.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyGSP2 2.0.15
File Size Uploaded Provenance Actions
pygsp2-2.0.15.tar.gz 2.1 MB Without provenance Details for pygsp2-2.0.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyGSP2 2.0.15
File Interpreter ABI Platform Actions
pygsp2-2.0.15-py3-none-any.whl Python 3 none any Details for pygsp2-2.0.15-py3-none-any.whl

Total release size: 4.2 MB

Release files / pygsp2-2.0.15.tar.gz

Download URL pygsp2-2.0.15.tar.gz
Size 2.1 MB
Tags Source
SHA-256 checksum
How to use checksums
0ab4818bb8000bdb65c9d2bd2fbf703ac8695e546824a7a8871867bb36204370
BLAKE2b-256 checksum
How to use checksums
07e048c50c4632ae2874ce8581ba3211ce2912318387db61a3b4c023b93570a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release files / pygsp2-2.0.15-py3-none-any.whl

Download URL pygsp2-2.0.15-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
aeb3c041ecd7af1e972a1a78917bec14a14d466aa5a33ae81d2c1aeb60c0c6b4
BLAKE2b-256 checksum
How to use checksums
ded0911b4e1d7fcc819d9431e590e7cecec0b07cca2dff03e026365a5470cb48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Security for PyGSP2 2.0.15

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page