View source: R/from_adj_matrix.R
from_adj_matrix | 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,
display_msgs = 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 |
display_msgs |
An option to display messages primarily concerned with
changes in graph selections. By default, this is |
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(ncol = 10)
# Create a graph from the adjacency matrix
graph <- from_adj_matrix(adj_matrix)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.