Skip to contents

Get all descendants from a single node in a tree

Usage

get_all_descendants(x, ...)

Arguments

x

The tree to extract the node from.

node_index

The node index to extract children from.

Value

The children of node node_index, as an integer vector.

Examples

tree() |>
  add_node() |>
  add_node(parent = 1L) |>
  add_node(parent = 2L) |>
  get_all_descendants(1L)
#> [1] 1 2 3