Description Usage Arguments Value Author(s) See Also Examples
View source: R/l1_spectralclustering.R
This function runs the l1-spectral algorithm, an l1-penalized version of the spectral clustering that aims at robustly clustering perturbed graphs.
1 2 3 4 5 6 7 8 | l1_spectralclustering(
A,
k = NULL,
k_max = NULL,
elements = NULL,
pen,
stab = TRUE
)
|
A |
The adjacency matrix of the graph to cluster. |
k |
True number of clusters (not necessarily needed). If not provided, k is chosen by spectral eigengap. |
k_max |
Maximal number of clusters to form (not necessarily needed). If not provided, k_max is set to the number of nodes. |
elements |
The representative elements of the clusters (not necessary needed). If not provided, index are chosen using the betweeness centrality score. |
pen |
The penalty (to be chosen among "lasso" or "thresholdedLS"). |
stab |
TRUE/FALSE indicated whether the indices should be stabilized (TRUE by default) |
A list with the following elements:
comm The community matrix,
structure The structure of the graph to cluster,
clusters The number of clusters,
elements The chosen representative elements of the clusters.
Camille Champion, Magali Champion
ComputePerformances, l1spectral.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #####################################################
# Performing the l1-spectral clustering on the graph
#####################################################
data(ToyData)
# if desired, the number of clusters and representative elements can be provided, otherwise, remove
results2 <- l1_spectralclustering(A = ToyData$A_hat, pen = "lasso")
results2$comm
# when desired, the number of clusters and representative elements can also be provided
results2 <- l1_spectralclustering(A = ToyData$A_hat, pen = "lasso",
k=2, elements = c(1,4))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.