df_to_graph | R Documentation |
Construct the giant component of the network from two data frames
df_to_graph(edgelist, nodelist = NULL, gc = TRUE)
edgelist |
A data frame with (at least) two columns: from and to |
nodelist |
NULL, or a data frame with (at least) one column: name, that contains the nodes to include |
gc |
Boolean, if 'TRUE' (default) then the giant component is extracted, if 'FALSE' then the whole graph is returned |
An igraph object & a connected graph if gc is 'TRUE'
from <- c("1", "2", "4")
to <- c("2", "3", "5")
edges <- data.frame(from = from, to = to, stringsAsFactors = FALSE)
nodes <- data.frame(name = c("1", "2", "3", "4", "5"), stringsAsFactors = FALSE)
df_to_graph(edges, nodes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.