View source: R/localize_sgwt.R
localize_sgwt | R Documentation |
This function localizes a kernel at a specific vertex using the Spectral Graph Wavelet Transform (SGWT).
localize_sgwt(i, evalues, evectors, b = 2)
i |
Integer index of the node where to localize the kernel. |
evalues |
Numeric vector of the eigenvalues of the Laplacian matrix. |
evectors |
Numeric matrix of the eigenvectors of the Laplacian matrix. |
b |
Numeric scalar that controls the number of scales in the SGWT. It must be greater than 1. |
The SGWT offers a comprehensive understanding of graph signals by providing insights into both vertex (spatial) and spectral (frequency) domains.
The kernel is localized by transforming an impulse signal centered at vertex i
using the SGWT.
The SGWT leverages a wavelet function \psi(\lambda)
to provide a multi-resolution analysis of the graph signal.
The impulse signal at vertex i
is a vector f
with a one at the i-th position and zeros elsewhere.
The SGWT is given by:
W_f(\lambda) = f \ast \psi(\lambda) = U \psi(\Lambda) U^T f
where U
is the matrix of eigenvectors of the Laplacian and \Lambda
is the diagonal matrix of eigenvalues.
The localized spatial view of the kernel's behavior around vertex i
is achieved by transforming this impulse signal using the above expression.
To gain insights into the spectral localization of this localized kernel, one can analyze its GFT to understand how the energy of the kernel is distributed across various graph frequencies. As SGWT scales move from coarse to fine, energy concentration of the localized kernel shifts from lower to higher graph frequencies, indicating tighter spectral localization.
f
Kernel localized at vertex i
using SGWT.
forward_sgwt
, forward_gft
, forward_gft
## Not run:
# Compute the Laplacian matrix and its eigen-decomposition
L <- laplacian_mat(grid1$sA)
decomp <- eigensort(L)
# Randomly select a vertex
vertex_i <- sample(1:nrow(L), 1)
f_sgwt <- localize_sgwt(vertex_i, evalues=decomp$evalues, evectors=decomp$evectors, b=2)
# Select one scale j from f_sgwt.
N <- nrow(grid1$sA)
j <- 5 # change scale j to view other scales
f <- f_sgwt[ ((j-1)*N+1):(j*N)]
# Plot the localized kernel (for the chosen scale) as a signal on the graph
plot_signal(grid1, f)
# Plot the magnitude of the GFT coefficients
barplot(abs(f_gft), main="GFT of Localized Signal",
xlab="Eigenvalue Index", ylab="Magnitude")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.