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

get_last_nodes_created

Get the last set of nodes created in a graph


Description

Get the last nodes that were created in a graph object of class dgr_graph. Provides a vector of node ID values. This function should ideally be used just after creating the nodes.

Usage

get_last_nodes_created(graph)

Arguments

graph

A graph object of class dgr_graph.

Value

A vector of node ID values.

Examples

# Create a graph and add 4 nodes
# in 2 separate function calls
graph <-
  create_graph() %>%
  add_n_nodes(
    n = 2,
    type = "a",
    label = c("a_1", "a_2")) %>%
  add_n_nodes(
    n = 2,
    type = "b",
    label = c("b_1", "b_2"))

# Get the last nodes created (2 nodes
# from the last function call)
graph %>% get_last_nodes_created()

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.