Learn R Programming

GMPro (version 0.1.0)

SCORE: 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.

K

A positive integer, indictaing the number of underlying communities in graph G.

itermax

k-means parameter, indicating the maximum number of iterations allowed. The default value is 100.

startn

k-means parameter. If centers is a number, how many random sets should be chosen? The default value is 10.

Value

A label vector.

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.

References

Jin, J. (2015) Fast community detection by score, The Annals of Statistics 43 (1), 57<U+2013>89https://projecteuclid.org/euclid.aos/1416322036

Examples

Run this code
# NOT RUN {
set.seed(2020)
n = 10; K = 2
P  = matrix(c(1/2, 1/4, 1/4, 1/2), byrow = TRUE, nrow = K)
distribution = c(1, 2)
l = sample(distribution, n, replace=TRUE, prob = c(1/2, 1/2))
Pi = matrix(0, n, 2)
for (i in 1:n){
  Pi[i, l[i]] = 1
  }
### define the expectation of the parent graph's adjacency matrix
Omega = Pi %*% P %*% t(Pi)
### construct the parent graph G
G = matrix(runif(n*n, 0, 1), nrow = n)
G = G - Omega
temp = G
G[which(temp >0)] = 0
G[which(temp <=0)] = 1
diag(G) = 0
G[lower.tri(G)] = t(G)[lower.tri(G)]
SCORE(G, 2)

# }

Run the code above in your browser using DataLab