View source: R/node_edge_list.R
add_node_ids | R Documentation |
Edge lists can contain identification numbers (integers) for each node.
Because each row in the edge list data frame contains a "From
" node
and a "To
" node, two columns of node IDs are added, one for "From
"
and one for "To
".
add_node_ids(
edge_list,
from = "From",
to = "To",
node_id = "node_id",
first_node = 0
)
edge_list |
the edge list to which node ID numbers are to be added |
from |
the name of the column containing source nodes. (Default is " |
to |
the name of the column containing destination nodes. (Default is " |
node_id |
the root of the column name for node IDs. (Default is " |
first_node |
the ID number of the first node. (Default is |
The column names for the "From
" and "To
" nodes are created by paste
-ing
the value of the from
and to
arguments with the value of the node_id
argument.
edge_list
with two additional columns containing From
and To
node ID numbers.
library(matsbyname)
library(tidyr)
sutmats <- UKEnergy2000mats %>% spread(key = matrix.name, value = matrix)
# Suppress adding node IDs
elDF <- edge_list(sutmats, node_id = NULL)$`Edge list`[[1]]
add_node_ids(elDF)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.