View source: R/network-utils.R
| to_igraph | R Documentation |
Converts various network representations to an igraph object. Supports matrices, igraph objects, network objects, cograph_network, and tna objects.
to_igraph(x, directed = NULL)
x |
Network input. Can be:
|
directed |
Logical or NULL. If NULL (default), auto-detect from matrix symmetry. Set TRUE to force directed, FALSE to force undirected. |
An igraph object.
to_data_frame, as_cograph
# From matrix
adj <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), 3, 3)
rownames(adj) <- colnames(adj) <- c("A", "B", "C")
g <- to_igraph(adj)
# Force directed
g_dir <- to_igraph(adj, directed = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.