# NOT RUN {
# Create a simple graph
graph <-
create_graph() %>%
add_path(6)
# Select specific edges from the graph and
# apply the edge attribute `color = blue` to
# those selected edges
graph <-
graph %>%
select_nodes_by_id(2:4) %>%
trav_out_edge() %>%
set_edge_attrs_ws("color", "blue")
# Show the internal edge data frame to verify
# that the edge attribute has been set for
# specific edges
get_edge_df(graph)
#> 1 1 1 2 <NA> <NA>
#> 2 2 2 3 <NA> blue
#> 3 3 3 4 <NA> blue
#> 4 4 4 5 <NA> blue
#> 5 5 5 6 <NA> <NA>
# }
Run the code above in your browser using DataLab