reroute

0th

Percentile

Change terminal nodes of edges

The reroute verb lets you change the beginning and end node of edges by specifying the new indexes of the start and/or end node(s). Optionally only a subset of the edges can be rerouted using the subset argument, which should be an expression that are to be evaluated in the context of the edge data and should return an index compliant vector (either logical or integer).

Usage
reroute(.data, from = NULL, to = NULL, subset = NULL)
Arguments
.data

A tbl_graph or morphed_tbl_graph object. grouped_tbl_graph will be ungrouped prior to rerouting

from, to

The new indexes of the terminal nodes. If NULL nothing will be changed

subset

An expression evaluating to an indexing vector in the context of the edge data.

Value

An object of the same class as .data

Aliases
  • reroute
Examples
# NOT RUN {
# Switch direction of edges
create_notable('meredith') %>%
  activate(edges) %>%
  reroute(from = to, to = from)

# Using subset
create_notable('meredith') %>%
  activate(edges) %>%
  reroute(from = 1, subset = to > 10)
# }
Documentation reproduced from package tidygraph, version 1.1.2, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.