| from_adj_matrix {DiagrammeR} | R Documentation |
Using an adjacency matrix object,
generate a graph of class dgr_graph.
from_adj_matrix(x, mode = "undirected", weighted = FALSE, use_diag = TRUE, graph_name = NULL, write_backups = FALSE)
x |
a square |
mode |
the method in which to interpret the
input adjacency matrix. Options include:
|
weighted |
whether to create a weighted graph from the adjacency matrix. |
use_diag |
whether to use the diagonal of the
adjacency matrix in calculations. If |
graph_name |
an optional string for labeling the graph object. |
write_backups |
an option to write incremental
backups of changing graph states to disk. If
|
a graph object of class dgr_graph.
# Create an adjacency matrix
adj_matrix <-
sample(0:1, 100,
replace = TRUE,
prob = c(0.9,0.1)) %>%
matrix(nc = 10)
# Create a graph from the adjacency matrix
graph <-
from_adj_matrix(adj_matrix)