SCORE {CASCORE} | R Documentation |
Spectral Clustering On Ratios-of-Eigenvectors.
Description
Using ratios-of-eigenvectors to detect underlying communities.
Usage
SCORE(G, K, itermax = NULL, startn = NULL)
Arguments
G |
A 0/1 adjacency matrix of a connected graph. |
K |
A positive integer, indicating the number of underlying communities in graph |
itermax |
|
startn |
|
Details
SCORE is fully established in Fast community detection by
SCORE of Jin (2015). SCORE uses the entry-wise ratios between the
first leading eigenvector and each of the other leading eigenvectors for
clustering. It is noteworthy that SCORE only works on connected graphs,
in other words, it does not allow for isolated vertices.
Value
estall |
A lavel vector. |
References
Jin, J. (2015). Fast community detection by score.
The Annals of Statistics 43 (1), 57–89.
doi:10.1214/14-AOS1265
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)]
library(igraph)
is.igraph(Adj) # [1] FALSE
ix = components(graph.adjacency(Adj))
componentLabel = ix$membership
giantLabel = which(componentLabel == which.max(ix$csize))
Giant = Adj[giantLabel, giantLabel]
SCORE(Giant, 2)