Deselect edges in a graph object of
class dgr_graph
.
deselect_edges(graph, edges)
graph | a graph object of class
|
---|---|
edges | a vector of edge IDs that should be deselected. |
a graph object of class dgr_graph
.
# Create a node data frame (ndf) ndf <- create_node_df( n = 4, type = c("a", "a", "z", "z"), label = TRUE, value = c(3.5, 2.6, 9.4, 2.7)) # Create an edge data frame (edf) edf <- create_edge_df( from = c(1, 2, 3), to = c(4, 3, 1), rel = c("a", "z", "a")) # Create a graph with the ndf and edf graph <- create_graph( nodes_df = ndf, edges_df = edf) # Explicitly select nodes `1` and `3` graph <- graph %>% select_edges_by_edge_id( edges = c(1, 3)) %>% deselect_edges(edges = 1) # Verify that the edge selection # has been made for edges `1` and # `3` and that edge `1` has been # deselected (leaving only `3`) graph %>% get_selection()#> [1] 3