Skip to content

StrahlerNumber ​

BinaryTree: The Horton-Strahler number (register function): 0 for the empty tree, else the larger child's, plus one if the children tie. OrderedTree: The Strahler number: a leaf is 1, a vertex takes its largest child's, plus one if that value occurs twice.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000396via BinaryTree✓St000397via OrderedTree✓
StrahlerNumber(tree)BinaryTree: The Horton-Strahler number (register function): 0 for the empty tree, else the larger child's, plus one if the children tie. OrderedTree: The Strahler number: a leaf is 1, a vertex takes its largest child's, plus one if that value occurs twice.
Typed signatures
TypePackageApplies
(binary_tree | ordered_tree) -> numbercombinatoricsalways

Domain: Tree statistics

Details
  • Defined over BinaryTree as an expression in _x, evaluated by compute-engine — the definition IS the implementation.
  • Takes a BinaryTree and nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.
  • Defined over OrderedTree as an expression in _x, evaluated by compute-engine — the definition IS the implementation.
  • Takes a OrderedTree and nothing else — it reads values against their positions, or walks the orbits, so it needs the bijection. Applying it to a bare list is a type error, not a wrong answer.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

Apply(
       Function(0 if t in Integers else Apply(
                                               Function(
                                                         a + 1 if a == b else Max(a, b),
                                                         a,
                                                         b,
                                                       ),
                                               self(self, t[1]),
                                               self(self, t[2]),
                                             ), self, t),
       Function(0 if t in Integers else Apply(
                                               Function(
                                                         a + 1 if a == b else Max(a, b),
                                                         a,
                                                         b,
                                                       ),
                                               self(self, t[1]),
                                               self(self, t[2]),
                                             ), self, t),
       _x,
     )

on OrderedTree, over _x

Apply(
       Function(1 if Length(t) == 0 else Apply(
                                                (r: collection) => Max(
                                                                        r[1],
                                                                        r[2] + 1,
                                                                      ),
                                                Fold(
                                                      Function([
                                                                 Max(p[1], e),
                                                                 Max(
                                                                      p[2],
                                                                      Min(
                                                                           p[1],
                                                                           e,
                                                                         ),
                                                                    ),
                                                               ], p, e),
                                                      [0, 0],
                                                      Map(
                                                           Function(self(
                                                                          self,
                                                                          c,
                                                                        ), c),
                                                           t,
                                                         ),
                                                    ),
                                              ), self, t),
       Function(1 if Length(t) == 0 else Apply(
                                                (r: collection) => Max(
                                                                        r[1],
                                                                        r[2] + 1,
                                                                      ),
                                                Fold(
                                                      Function([
                                                                 Max(p[1], e),
                                                                 Max(
                                                                      p[2],
                                                                      Min(
                                                                           p[1],
                                                                           e,
                                                                         ),
                                                                    ),
                                                               ], p, e),
                                                      [0, 0],
                                                      Map(
                                                           Function(self(
                                                                          self,
                                                                          c,
                                                                        ), c),
                                                           t,
                                                         ),
                                                    ),
                                              ), self, t),
       _x,
     )

Examples

Basic #

the binary tree [[.,.],[[.,.],.]][[.,.],[[.,.],.]]

live ↗
InStrahlerNumber(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{StrahlerNumber}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out22

the ordered tree [[],[[]],[]][[],[[]],[]]

live ↗
InStrahlerNumber(OrderedTree⁡([[],[[]],[]]))\mathrm{StrahlerNumber}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack))Out22
Properties #

FindStat's value for [.,.]

live ↗
InCombinatorialStat(BinaryTree⁡([0,0]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, 0\bigr\rbrack), \text{StrahlerNumber})Out11

Known value · FindStat St000396

FindStat's value for [.,[.,.]]

live ↗
InCombinatorialStat(BinaryTree⁡([0,[0,0]]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack0, \bigl\lbrack0, 0\bigr\rbrack\bigr\rbrack), \text{StrahlerNumber})Out11

Known value · FindStat St000396

FindStat's value for [[.,.],.]

live ↗
InCombinatorialStat(BinaryTree⁡([[0,0],0]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack), \text{StrahlerNumber})Out11

Known value · FindStat St000396

FindStat's value for [[]]

live ↗
InCombinatorialStat(OrderedTree⁡([[]]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack), \text{StrahlerNumber})Out11

Known value · FindStat St000397

FindStat's value for [[[]]]

live ↗
InCombinatorialStat(OrderedTree⁡([[[]]]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack\bigr\rbrack), \text{StrahlerNumber})Out11

Known value · FindStat St000397

FindStat's value for [[],[]]

live ↗
InCombinatorialStat(OrderedTree⁡([[],[]]),StrahlerNumber)\mathrm{CombinatorialStat}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack), \text{StrahlerNumber})Out22

Known value · FindStat St000397

About
Examples8
CrosswalkFindStat ×2