# NOT RUN {
# Create a graph with a path of
# nodes; supply `label`, `type`,
# and `value` node attributes
graph <-
create_graph() %>%
add_path(
n = 3,
label = c("d", "g", "r"),
type = c("a", "b", "c"),
value = c(10, 20, 30))
# Display the graph's internal
# node data frame
graph %>%
get_node_df()
#> id type label value
#> 1 1 a d 10
#> 2 2 b g 20
#> 3 3 c r 30
# Create 3 clones of node `1`
# but assign new node label
# values (leaving `label` as
# NULL yields NA values)
graph <-
graph %>%
add_n_node_clones(
n = 3,
node = 1,
label = c("x", "y", "z"))
# Display the graph's internal
# node data frame: nodes `4`,
# `5`, and `6` are clones of `1`
graph %>%
get_node_df()
#> id type label value
#> 1 1 a d 10
#> 2 2 b g 20
#> 3 3 c r 30
#> 4 4 a x 10
#> 5 5 a y 10
#> 6 6 a z 10
# }
Run the code above in your browser using DataLab