Description Usage Arguments Value Examples
View source: R/cluster_eigen.R
This function implements a vector partition algorithm with global initialization that maximizes the modilarity measure and provide membership for community assignment. The idea is that the uncontrained solution of community assignment is the eigenvectors of the modualrity matrix. We project graph distance matrix to the eigenvectos in order to get a constrained solution and furture tune current assignment with one-iteration of k-means clustering or set it as an initialization of a full iteration of k-means clustering.
1 | cluster_eigen(g, kopt = 2, tune = c("fast", "fine"), verbose = FALSE)
|
g |
The input unweigheted and undirected graph. |
kopt |
The specified number of clusters. |
tune |
Methods selected to tune community assignment by one-iteration of k-means clustering with "fast" tune or full iteration of k-means clustering with "fine" tune. Defaut is "fine" tune. |
verbose |
output message |
Returns a list with entries:
The number of communities detected in current community assignment.
The calculated modularity for current community assignment showed by "label" in cluster list.
A list of membership, normalized membership and label for current and updated community assignment after tunning.
The number of communities detected in updated community assignment.
The calculated modularity for updated community assignment showed by "label_up" in cluster list.
1 2 3 4 5 | library(igraph)
g <- make_full_graph(5) %du% make_full_graph(5) %du% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
res <- cluster_eigen(g)
plot(g, vertex.color = res$cluster[[1]]$label_up)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.