# NOT RUN {
# Create an empty graph and add 2 nodes by using
# the `add_node()` function twice
graph <-
create_graph() %>%
add_node() %>%
add_node()
# Get a count of all nodes
# in the graph
node_count(graph)
#> [1] 2
# The nodes added were given
# ID values `1` and `2`
get_node_ids(graph)
#> [1] 1 2
# Add a node with a `type` value defined
graph <-
add_node(
graph = graph,
type = "person")
# View the graph's internal
# node data frame (ndf)
get_node_df(graph)
#> id type label
#> 1 1 <NA> <NA>
#> 2 2 <NA> <NA>
#> 3 3 person <NA>
# }
Run the code above in your browser using DataLab