# NOT RUN {
# Create a graph with a cycle with 6 nodes
graph_cycle <-
create_graph() %>%
add_cycle(n = 6)
# Create a random graph with 8 nodes, 15 edges
graph_random <-
create_random_graph(
n = 8, m = 15,
set_seed = 23)
# Combine the two graphs in a union operation
combined_graph <-
combine_graphs(
graph_cycle,
graph_random)
# Get the number of nodes in the combined graph
node_count(combined_graph)
#> [1] 14
# The `combine_graphs()` function will renumber
# node ID values in graph `y` during the union;
# this ensures that node ID values are unique
get_node_ids(combined_graph)
#> [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14
# }
Run the code above in your browser using DataLab