View source: R/network_analysis.R
| as_igraph | R Documentation |
Convert tidy network data to an igraph object
as_igraph(x, directed = NULL)
x |
A simulab network, tidy edge list, matrix, or native TNA model. |
directed |
Whether the resulting graph is directed. |
A native igraph object carrying a weight edge attribute. When x
is a simulab_sim with a nodes component, that node set supplies the
vertices, so isolates are preserved; otherwise the vertices are the nodes
appearing in the edge list.
network <- simulate_network(nodes = 30, model = "bernoulli", probability = 0.1, seed = 1)
if (requireNamespace("igraph", quietly = TRUE)) {
graph <- as_igraph(network)
igraph::vcount(graph)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.