Skip to content

LinearExtensionCount ​

BinaryTree: The number of linear extensions of the tree as a poset: n! over the tree factorial. OrderedTree: The number of linear extensions of the tree as a poset: n! over the tree factorial.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000045via BinaryTree✓St000085via OrderedTree✓
LinearExtensionCount(tree)BinaryTree: The number of linear extensions of the tree as a poset: n! over the tree factorial. OrderedTree: The number of linear extensions of the tree as a poset: n! over the tree factorial.
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

(1 if Length(Flatten([_x])) - 1 < 2 else Product(Range(
                                                        1,
                                                        Length(Flatten([_x])) -
                                                        1,
                                                      ))) / Apply(
                                                                  Function(
                                                                            1 if f in Integers else (Length(Flatten([f])) - 1) *
                                                                                                    self(self, f[1]) *
                                                                                                    self(self, f[2]),
                                                                            self,
                                                                            f,
                                                                          ),
                                                                  Function(
                                                                            1 if f in Integers else (Length(Flatten([f])) - 1) *
                                                                                                    self(self, f[1]) *
                                                                                                    self(self, f[2]),
                                                                            self,
                                                                            f,
                                                                          ),
                                                                  _x,
                                                                )

on OrderedTree, over _x

Apply(
       (r: collection) => (1 if r[1] < 2 else Product(Range(1, r[1]))) / r[2],
       Apply(
              Function([1, 1] if Length(t) == 0 else Apply(
                                                            (r: collection) => [
                                                                                 1 + r[1],
                                                                                 (1 + r[1]) *
                                                                                 r[2],
                                                                               ],
                                                            Fold(
                                                                  Function(
                                                                            [a[1] +
                                                                             b[1], a[2] *
                                                                               b[2]],
                                                                            a,
                                                                            b,
                                                                          ),
                                                                  [0, 1],
                                                                  Map(Function(
                                                                                self(self, c),
                                                                                c,
                                                                              ), t),
                                                                ),
                                                          ), self, t),
              Function([1, 1] if Length(t) == 0 else Apply(
                                                            (r: collection) => [
                                                                                 1 + r[1],
                                                                                 (1 + r[1]) *
                                                                                 r[2],
                                                                               ],
                                                            Fold(
                                                                  Function(
                                                                            [a[1] +
                                                                             b[1], a[2] *
                                                                               b[2]],
                                                                            a,
                                                                            b,
                                                                          ),
                                                                  [0, 1],
                                                                  Map(Function(
                                                                                self(self, c),
                                                                                c,
                                                                              ), t),
                                                                ),
                                                          ), self, t),
              _x,
            ),
     )

Examples

Basic #

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

live ↗
InLinearExtensionCount(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{LinearExtensionCount}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out33

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

live ↗
InLinearExtensionCount(OrderedTree⁡([[],[[]],[]]))\mathrm{LinearExtensionCount}({\operatorname{OrderedTree}}(\bigl\lbrack\bigl\lbrack\bigr\rbrack, \bigl\lbrack\bigl\lbrack\bigr\rbrack\bigr\rbrack, \bigl\lbrack\bigr\rbrack\bigr\rbrack))Out1212
Properties #

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

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

Known value · FindStat St000045

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

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

Known value · FindStat St000045

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

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

Known value · FindStat St000045

FindStat's value for [[]]

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

Known value · FindStat St000085

FindStat's value for [[[]]]

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

Known value · FindStat St000085

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

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

Known value · FindStat St000085

About
Examples8
CrosswalkFindStat ×2