adj_to_matrix | R Documentation |
Transform an adjacency list into a matrix
adj_to_matrix(A, type = c("adjacency", "incidence", "weighted"), loops = FALSE)
A |
An adjacent list |
type |
Transform the adjacent list into an |
loops |
Whether to include loops into the matrix |
This function transforms an adjacency list into a matrix
Alejandro Espinosa-Rada
adj_groups <- rbind(
c("a", "b", "c"), c("a", "c", NA),
c("b", "c", NA), c("c", NA, NA),
c("c", "a", NA)
)
M <- adj_to_matrix(adj_groups, type = "adjacency", loops = TRUE)
M
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.