edgelist_to_matrix | R Documentation |
Transform an edgelist to a matrix
edgelist_to_matrix(
E,
digraph = TRUE,
label = NULL,
label2 = NULL,
bipartite = FALSE
)
E |
An edge list |
digraph |
Whether the matrix is directed or not |
label |
A vector with the names of the nodes |
label2 |
A vector with the names of a different set of nodes |
bipartite |
Whether the matrix is bipartite |
This function transform the edgelist into a matrix
Alejandro Espinosa-Rada
A <- matrix(c(
0, 1, 1, 0, 0, 0, 0, 1, 0,
1, 0, 1, 0, 0, 0, 0, 0, 0,
1, 1, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 1, 1, 0, 0, 0,
0, 0, 0, 1, 0, 0, 0, 0, 0,
0, 0, 0, 1, 0, 0, 1, 1, 0,
0, 0, 0, 0, 0, 1, 0, 1, 0,
1, 0, 0, 0, 0, 1, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0
), byrow = TRUE, ncol = 9)
rownames(A) <- letters[1:nrow(A)]
colnames(A) <- rownames(A)
E <- matrix_to_edgelist(A)
edgelist_to_matrix(E, label = c("i"), digraph = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.