Compute the topological order of a tree

topological_order(MTG, ascend = FALSE)

Arguments

MTG

An MTG tree as from read_mtg()

ascend

Is the order computed from the base (TRUE), or the tip (FALSE) ?

Value

Nothing, update the values of the MTG in-place. The MTG is enriched with the topological order of each node

Examples

filepath= system.file("extdata", "simple_plant.mtg", package = "XploRer") MTG= read_mtg(filepath)
#> Warning: the condition has length > 1 and only the first element will be used
#> Warning: the condition has length > 1 and only the first element will be used
#> Warning: the condition has length > 1 and only the first element will be used
#> Warning: the condition has length > 1 and only the first element will be used
topological_order(MTG) print(MTG, "topological_order")
#> levelName topological_order #> 1 node_1 2 #> 2 °--node_2 2 #> 3 °--node_3 2 #> 4 °--node_4 2 #> 5 ¦--node_5 1 #> 6 °--node_6 2 #> 7 °--node_7 1