nPCA {CASCORE} | R Documentation |
Normalized Principle Component Analysis.
Description
Normalized Principle Component Analysis (nPCA), also known as spectral clustering on the
graph Laplacian, is a classical spectral clustering method that applies k-means
on the first K
leading (unit-norm) eigenvectors of the degree-corrected normalized graph laplacian.
Usage
nPCA(Adj, K, tau = NULL, itermax = 100, startn = 10)
Arguments
Adj |
A 0/1 adjacency matrix. |
K |
A positive integer, indicating the number of underlying communities in
graph |
tau |
An optional regularization parameter for suitable degree normalization. The default value is the
average degree of graph |
itermax |
|
startn |
|
Value
estall |
A lavel vector. |
References
Chung, F. R., & Graham, F. C. (1997). Spectral graph theory (Vol. 92). American Mathematical Soc..
Examples
# Simulate the Network
n = 10; K = 2;
theta = 0.4 + (0.45-0.05)*(seq(1:n)/n)^2; Theta = diag(theta);
P = matrix(c(0.8, 0.2, 0.2, 0.8), byrow = TRUE, nrow = K)
set.seed(2022)
l = sample(1:K, n, replace=TRUE); # node labels
Pi = matrix(0, n, K) # label matrix
for (k in 1:K){
Pi[l == k, k] = 1
}
Omega = Theta %*% Pi %*% P %*% t(Pi) %*% Theta;
Adj = matrix(runif(n*n, 0, 1), nrow = n);
Adj = Omega - Adj;
Adj = 1*(Adj >= 0)
diag(Adj) = 0
Adj[lower.tri(Adj)] = t(Adj)[lower.tri(Adj)]
nPCA(Adj, 2)