df_to_graph {crandep} | R Documentation |
Construct the giant component of the network from two data frames
Description
Construct the giant component of the network from two data frames
Usage
df_to_graph(edgelist, nodelist = NULL, gc = TRUE)
Arguments
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 |
Value
An igraph object & a connected graph if gc is 'TRUE'
Examples
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)
[Package crandep version 0.3.9 Index]