Reverse the direction of selected edges in a graph using an edge selection
Using a directed graph with a selection of edges as input, reverse the direction of those selected edges in input graph.
rev_edge_dir_ws(graph)
graph |
A graph object of class |
This function makes use of an active selection of edges (and the function
ending with _ws hints at this).
Selections of edges can be performed using the following selection
(select_*()) functions: select_edges(), select_last_edges_created(),
select_edges_by_edge_id(), or select_edges_by_node_id().
Selections of edges can also be performed using the following traversal
(trav_*()) functions: trav_out_edge(), trav_in_edge(),
trav_both_edge(), or trav_reverse_edge().
A graph object of class dgr_graph.
Other Edge creation and removal:
add_edge_clone(),
add_edge_df(),
add_edges_from_table(),
add_edges_w_string(),
add_edge(),
add_forward_edges_ws(),
add_reverse_edges_ws(),
copy_edge_attrs(),
create_edge_df(),
delete_edges_ws(),
delete_edge(),
delete_loop_edges_ws(),
drop_edge_attrs(),
edge_data(),
join_edge_attrs(),
mutate_edge_attrs_ws(),
mutate_edge_attrs(),
recode_edge_attrs(),
rename_edge_attrs(),
rescale_edge_attrs(),
rev_edge_dir(),
set_edge_attr_to_display(),
set_edge_attrs_ws(),
set_edge_attrs()
# Create a graph with a
# directed tree
graph <-
create_graph() %>%
add_balanced_tree(
k = 2, h = 2)
# Inspect the graph's edges
graph %>% get_edges()
# Select all edges associated
# with nodes `1` and `2`
graph <-
graph %>%
select_edges_by_node_id(
nodes = 1:2)
# Reverse the edge directions
# of the edges associated with
# nodes `1` and `2`
graph <-
graph %>%
rev_edge_dir_ws()
# Inspect the graph's edges
# after their reversal
graph %>% get_edges()Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.