graph_zoom | R Documentation |
Perform GraphZoom pipeline as described in the paper.
If 'A_feat' is provided, it will be used directly for graph fusion instead of computing a feature graph from X. If both 'A_feat' and 'X' are provided, 'A_feat' takes precedence.
graph_zoom(
A,
X = NULL,
A_feat = NULL,
levels = 2,
t = 10,
kNN = 10,
beta = 1,
embed_dim = 16,
filter_power = 2,
sigma = 0.001,
verbose = FALSE
)
A |
Sparse adjacency matrix (N x N) of the original graph topology. |
X |
Node feature matrix (N x K). If NULL, no fusion from features is done unless A_feat is provided. |
A_feat |
Optional precomputed feature graph (N x N). If provided, used directly for fusion. |
levels |
Number of coarsening levels. |
t |
Dimension for local spectral embedding during coarsening. |
kNN |
Number of nearest neighbors for feature-based kNN (ignored if A_feat is given). |
beta |
Weight to balance topology and feature graph in fusion. |
embed_dim |
Dimension of embeddings at coarsest level. |
filter_power |
The power k in Eq.(7) for refinement. |
sigma |
Self-loop factor in refinement filter. |
verbose |
If TRUE, print progress messages. |
A list:
E_original |
Refined embeddings for the original graph (N x embed_dim). |
graphs |
List of graphs from level 0 to level L (fused and coarsened). |
H_list |
List of mapping operators. |
E_coarse |
Embeddings at the coarsest level. |
GraphZoom Paper (Sections 3.1-3.4)
library(Matrix)
library(RcppHNSW)
set.seed(42)
N <- 100
A <- rsparsematrix(N, N, 0.01)
A <- (A + t(A))/2
diag(A) <- 0
X <- matrix(rnorm(N*20), nrow=N, ncol=20)
# Run with computed feature graph:
result <- graph_zoom(A, X, levels=2, embed_dim=8, kNN=5)
# If you have your own A_feat:
# Suppose A_feat is a NxN matrix you constructed from features externally:
# result <- graph_zoom(A, A_feat=my_feature_graph, levels=2, embed_dim=8)
E <- result$E_original
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.