mat2Edge | R Documentation |
Adjacency matrix to a data.frame of edges.
mat2Edge(
mat,
mode = c("directed", "undirected", "upper", "lower"),
diag = FALSE
)
mat |
adjacency matrix. |
mode |
Character, to specify the class of graph and which part of the matrix will be used. Possible values are: "directed" (default), "undirected", "upper", "lower". |
diag |
logic, whether to include the diagonal of the matrix. |
a data.frame of edge information. The first column is from node, the second column is to node, and the third is weight.
edge2Mat
{
## Not run:
mat = matrix(rnorm(4*4), nrow = 4,
dimnames = list(letters[1:4], LETTERS[1:4]))
mat2Edge(mat, mode = "undirected", diag = TRUE)
mat2Edge(mat, mode = "undirected", diag = FALSE)
mat2Edge(mat, mode = "directed", diag = TRUE)
mat2Edge(mat, mode = "upper", diag = TRUE)
mat2Edge(mat, mode = "upper", diag = FALSE)
## End(Not run)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.