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

rev_edge_dir

Reverse the direction of all edges in a graph


Description

Using a directed graph as input, reverse the direction of all edges in that graph.

Usage

rev_edge_dir(graph)

Arguments

graph

A graph object of class dgr_graph.

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

# Reverse the edge directions
# such that edges are directed
# toward the root of the tree
graph <-
  graph %>%
  rev_edge_dir()

# 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.