Description Usage Arguments Value Examples
This function returns the height of a tree, defined as the number of nodes of the longest subchain. For an empty tree, the height is conventionally equal to 0.
1 2 3 4 5 6 |
.tree, x |
A tree. |
value |
integer. Height to assign to the tree |
An integer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Rooted tree
(tr0 = c_("Bob", "Carl", "Daniel"))
tr1 = r_("Dimitri", s = list(c_("Enoc"), c_("Ferdinand")))
tr1 = r_("Caroline", s = list(tr1))
(tr1 = r_("Bill", s = list(tr1)))
(tr2 = r_("Alice", s = list(tr0, tr1)))
height(empty_tree())
height(tr0)
height(tr1)
height(tr2)
## Unrooted tree
(tr3 = r_(s = list(tr2, c_("Grand-Mother", "Father", "Son"))))
height(tr3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.