Sparse Tools for the Spectral Graph Wavelet Transformation and Graph Convolution
Project description
Sparse Graph Signal Processing (GSP)
A high-performance Python library for sparse Graph Signal Processing (GSP) and Spectral Graph Wavelet Transforms (SGWT). This package leverages the CHOLMOD library for efficient sparse direct solvers, providing significant speedups over traditional dense or iterative methods for large-scale graph convolution.
Key Features
- High-Performance Sparse Solvers: Direct integration with the
CHOLMODlibrary for optimized sparse Cholesky factorizations and linear system solves. - Generalized Graph Convolution: Support for arbitrary spectral kernels via rational approximation (Kernel Fitting) and standard analytical filters (low-pass, band-pass, high-pass).
- Dynamic Topology Support: Specialized routines for graphs with evolving structures, utilizing efficient rank-1 updates for real-time topology changes.
- Resource-Aware Execution: Context-managed memory allocation and workspace reuse to minimize overhead in high-throughput applications.
- Integrated Graph Repository: Built-in access to standardized graph Laplacians and signals from power systems and infrastructure networks.
Installation
The package can be installed via pip:
python -m pip install sgwt
The package uses a compiled version of CHOLMOD.
Basic Usage
Quick Start
For the quick-start example, we will find the response of a low-pass filter $\phi$ scaled by s to impulse $\delta$ at node $n$ over the graph L. This is mathematically denoted by $\phi_{n,s}=\delta_n*\phi_s$.
import sgwt
# CSC Graph Laplacian
L = sgwt.DELAY_TX
# Impulse at Vertex n
X = sgwt.impulse(L, n=...)
# Discrete Scales
s = np.logspace(...)
# L -> Context of Convolution
with sgwt.Convolve(L) as conv:
# Apply Low-Pass Filters
Y = conv.lowpass(X, s)
The numpy arrays Y[i] correspond to a filtered signal X at the i-th scale.
The purpose of the context manager is to provide safe re-use of CHOLMOD workspace. While inside the context, the convolution procedure optimizes memory usage.
Underlying Graph
The module has a small repository of built in graph laplacians that are useful for quick start examples.
L = sgwt.LENGTH_TX
L = sgwt.IMPEDANCE_HAWAII
L = sgwt.DELAY_USA
The user can also load any graph Laplacian so long it is in the csc_matrix format.
Input Signals
A real-valued time-vertex function $X\in\mathbb{R}^{|N|\times|T|}$ stored as a 2D numpy array in column-major ordering (i.e., fortran style) can be used. For example, an empty array meeting these specifications:
X = np.empty(
shape=(nVert, nTime),
order = 'F'
)
Although, a (N,1) array can also be used.
Kernel Functions
There are three convenience analytical filters available.
with Convolve(L) as conv:
Y = conv.lowpass(X, s)
Y = conv.bandpass(X, s)
Y = conv.highpass(X, s)
For more advanced functionality, the convolution is generalized using kernel fitting. Single Function kernels include MEXICAN_HAT, MODIFIED_MORLET, SHANNON, and more.
The convolutional kernel F can be a vector function, meaning multiple filters can be applied concurrently (i.e., an orthoginal kernel to generate the wavaelet coefficients SGWT) This kernel will be available soon.
with Convolve(L) as conv:
Y = conv(X, F)
Same as before, the convolution is simply performed on our signal X by first defining L as the convolution context.
Dynamic Graphs
In many real-world applications, such as power systems or sensor networks, the underlying graph topology is dynamic. Re-initializing the entire convolution context for every edge update is computationally prohibitive. This example demonstrates the use of DyConvolve to perform efficient, real-time signal filtering on an evolving graph by leveraging rank-1 updates to adapt existing factorizations on-the-fly.
from sgwt.dynamic import DyConvolve
from sgwt import DELAY_USA as L
poles = [10.0, 1.0, 0.1]
with DyConvolve(L, poles) as conv:
for f_t, event in stream:
if event:
conv.addbranch(*event) # Update topology
W = conv.bandpass(f_t) # Filter signal
At each iteration, the matrix W contains the column vectors which are the filtered versionf of f at the 'spatial' scale associated with each pole. So in this example W be a 3-column matrix representing the signal at three different scales.
Other
A brief review of the theoretical work used in this module is available in this repository in markdown format THEORY.md. Additional examples with descriptions are also available in the sgwt/examples directory. Details regarding the built-in graph library (Laplacians, Signals, Kernels) can be found in sgwt/library.
This module is also implemented in Julia which takes advantage of the native SuiteSparse support.
References
The CHOLMOD library of SuiteSparse was developed by Dr. Tim Davis at Texas A&M University.
The graph laplacians used in the examples are derived from the synthetic grid repository, available thanks to the research of Dr. Adam Birchfield at Texas A&M University.
- Birchfield, Adam B. et al. “Grid Structural Characteristics as Validation Criteria for Synthetic Networks”. In: IEEE Trans. on Power Sys. 32.4 (2017)
The theoretical work of this module is derived in part from this paper nominated for best paper at HICSS-59.
- Lowery, Luke, Jongoh Baek, and Adam Birchfield. "Using Spectral Graph Wavelets to Analyze Large Power System Oscillation Modes." (2026)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sgwt-0.3.0.tar.gz.
File metadata
- Download URL: sgwt-0.3.0.tar.gz
- Upload date:
- Size: 13.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b597ffc029e09f1114c8b40a479998ace690c0eafecc4635c61846130f499455
|
|
| MD5 |
b221b9c14970560a472d5ad850d79623
|
|
| BLAKE2b-256 |
e35f59af827e32943d617641e3232e543d82943611f74fbc3572e540eaac61a7
|
Provenance
The following attestation bundles were made for sgwt-0.3.0.tar.gz:
Publisher:
python-publish.yml on lukelowry/sgwt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgwt-0.3.0.tar.gz -
Subject digest:
b597ffc029e09f1114c8b40a479998ace690c0eafecc4635c61846130f499455 - Sigstore transparency entry: 787100602
- Sigstore integration time:
-
Permalink:
lukelowry/sgwt@68f467524539d97e586f11aebaef367d4d6db4c1 -
Branch / Tag:
refs/tags/latest - Owner: https://github.com/lukelowry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@68f467524539d97e586f11aebaef367d4d6db4c1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sgwt-0.3.0-py3-none-any.whl.
File metadata
- Download URL: sgwt-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43df291e3d1fc84d56c96a7de55df4e8487e3b44a5f6e9348dd355e7ca9cb278
|
|
| MD5 |
ad9adf44ab1fb0006c4387a147b63a29
|
|
| BLAKE2b-256 |
0a62d4692e38240d276b3f77612e7e7fce59017e278a1538d7db88b825b7aeb1
|
Provenance
The following attestation bundles were made for sgwt-0.3.0-py3-none-any.whl:
Publisher:
python-publish.yml on lukelowry/sgwt
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sgwt-0.3.0-py3-none-any.whl -
Subject digest:
43df291e3d1fc84d56c96a7de55df4e8487e3b44a5f6e9348dd355e7ca9cb278 - Sigstore transparency entry: 787100603
- Sigstore integration time:
-
Permalink:
lukelowry/sgwt@68f467524539d97e586f11aebaef367d4d6db4c1 -
Branch / Tag:
refs/tags/latest - Owner: https://github.com/lukelowry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@68f467524539d97e586f11aebaef367d4d6db4c1 -
Trigger Event:
release
-
Statement type: