Skip to content

SwapEquivalentTreeCount ​

The number of binary trees that become this one when the children at any nodes are swapped: each node with different subtrees (an only child counts as different from the empty one) doubles the count.

✓ checked against that system · ! checked, with disagreements (hover a chip)FindStatSt000412via BinaryTree✓
SwapEquivalentTreeCount(tree)The number of binary trees that become this one when the children at any nodes are swapped: each node with different subtrees (an only child counts as different from the empty one) doubles the count.
Typed signatures
TypePackageApplies
(binary_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.
  • FindStat's St000412: the binary trees with the same underlying unordered (rooted) tree.

Definition

Epsil, as the implementation runs it.

on BinaryTree, over _x

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

Examples

Basic #

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

live ↗
InSwapEquivalentTreeCount(BinaryTree⁡([[0,0],[[0,0],0]]))\mathrm{SwapEquivalentTreeCount}({\operatorname{BinaryTree}}(\bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, \bigl\lbrack\bigl\lbrack0, 0\bigr\rbrack, 0\bigr\rbrack\bigr\rbrack))Out44
Properties #

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

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

Known value · FindStat St000412

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

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

Known value · FindStat St000412

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

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

Known value · FindStat St000412

About
Examples4
CrosswalkFindStat