View source: R/cluster-metrics.R
| layer_similarity | R Documentation |
Computes similarity between two network layers.
layer_similarity(
A1,
A2,
method = c("jaccard", "overlap", "hamming", "cosine", "pearson")
)
lsim(A1, A2, method = c("jaccard", "overlap", "hamming", "cosine", "pearson"))
A1 |
First adjacency matrix |
A2 |
Second adjacency matrix |
method |
Similarity method: "jaccard", "overlap", "hamming", "cosine", "pearson" |
Numeric similarity value
A1 <- matrix(c(0,1,1,0, 1,0,0,1, 1,0,0,1, 0,1,1,0), 4, 4)
A2 <- matrix(c(0,1,0,0, 1,0,1,0, 0,1,0,1, 0,0,1,0), 4, 4)
layer_similarity(A1, A2, "jaccard") # Edge overlap
layer_similarity(A1, A2, "cosine") # Weight similarity
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.