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

select_last_edges_created

Select the last set of edges created in a graph


Description

Select the last edges that were created in a graph object of class dgr_graph. This function should ideally be used just after creating the edges to be selected.

Usage

select_last_edges_created(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

A graph object of class dgr_graph.

Examples

# Create a graph and add a cycle and then
# a tree in 2 separate function calls
graph <-
  create_graph() %>%
  add_cycle(
    n = 3,
    rel = "a") %>%
  add_balanced_tree(
    k = 2, h = 2,
    rel = "b")

# Select the last edges created (all edges
# from the tree) and then set their edge
# color to be `red`
graph <-
  graph %>%
  select_last_edges_created() %>%
  set_edge_attrs_ws(
    edge_attr = color,
    value = "red") %>%
  clear_selection()

# Display the graph's internal edge
# data frame to verify the change
graph %>% get_edge_df()

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.