Dynamic Convolution

class DyConvolve(L, poles)[source]

Bases: object

Dynamic graph convolution context with efficient topology updates.

Optimized for graphs with evolving topologies where poles/scales remain constant. Pre-factors all shifted systems (L + qI) at initialization, then uses CHOLMOD’s updown routines for efficient rank-1 updates when edges are added or removed.

Parameters:
  • L (csc_matrix) – Sparse Graph Laplacian of shape (n_vertices, n_vertices).

  • poles (list[float] | VFKernel) – Predetermined set of poles (equivalent to 1/scale for analytical filters).

addbranch(i, j, w)[source]

Adds a branch to the graph topology and updates all factorizations.

Uses CHOLMOD’s updown routines for efficient rank-1 updates.

Parameters:
  • i (int) – Index of Vertex A.

  • j (int) – Index of Vertex B.

  • w (float) – Edge weight.

bandpass(B, order=1)[source]

Computes band-pass filtered wavelet coefficients.

Applies the spectral wavelet kernel:

\[\Psi_q(\mathbf{L}) = \left( \frac{4q\mathbf{L}}{(\mathbf{L} + q\mathbf{I})^2} \right)^n\]

where \(q\) is the pre-defined pole and \(n\) is the filter order.

Parameters:
  • B (ndarray) – Input signal array. Can be 1D (n_vertices,) or 2D (n_vertices, n_timesteps).

  • order (int, default: 1) – Filter order \(n\).

Returns:

Filtered signals for each pre-defined pole.

Return type:

list[np.ndarray]

convolve(B)[source]

Performs graph convolution using the pre-defined kernel.

Parameters:

B (ndarray) – Input signal array. Can be 1D (n_vertices,) or 2D (n_vertices, n_timesteps).

Returns:

Convolved signal. Shape depends on input: (n_vertices, nDim) for 1D input, (n_vertices, n_timesteps, nDim) for 2D input.

Return type:

ndarray

highpass(B)[source]

Computes high-pass filtered coefficients.

Applies the spectral filter:

\[\mu_q(\mathbf{L}) = \frac{\mathbf{L}}{\mathbf{L} + q\mathbf{I}}\]

where \(q\) is the pre-defined pole.

Parameters:

B (ndarray) – Input signal array. Can be 1D (n_vertices,) or 2D (n_vertices, n_timesteps).

Returns:

Filtered signals for each pre-defined pole.

Return type:

list[np.ndarray]

lowpass(B, Bset=None, order=1)[source]

Computes low-pass filtered scaling coefficients.

Applies the spectral filter:

\[\phi_q(\mathbf{L}) = \left( \frac{q\mathbf{I}}{\mathbf{L} + q\mathbf{I}} \right)^n\]

where \(q\) is the pre-defined pole and \(n\) is the filter order.

Parameters:
  • B (ndarray) – Input signal array. Can be 1D (n_vertices,) or 2D (n_vertices, n_timesteps).

  • Bset (csc_matrix, optional) – Sparse indicator vector for localized coefficient computation.

  • order (int, default: 1) – Filter order \(n\).

Returns:

Filtered signals for each pre-defined pole.

Return type:

list[np.ndarray]