Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rev_edge_dir_ws

Reverse the direction of selected edges in a graph using an edge selection


Description

Using a directed graph with a selection of edges as input, reverse the direction of those selected edges in input graph.

Usage

rev_edge_dir_ws(graph)

Arguments

graph

A graph object of class dgr_graph.

Details

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().

Value

A graph object of class dgr_graph.

See Also

Examples

# 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()

DiagrammeR

Graph/Network Visualization

v1.0.6.1
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.