BinaryTree
The singular-inhabitant constructor for a binary tree, nested: a leaf is 0, a node [left, right].
Wikipedia
Binary treeMathWorldBinaryTreeWikidataQ380172Encyclopedia of MathematicsBinary_treeOEISA000108via BinaryTreesFindStatMp00034via DyckPathMp00049via OrderedTreeSageMathBinaryTrees(n)via BinaryTreesBinaryTree(tree)The singular-inhabitant constructor for a binary tree, nested: a leaf is 0, a node [left, right].Typed signatures
| Type | Package | Applies |
|---|---|---|
((integer | list<any>) -> binary_tree) & ((binary_tree_parent_array) -> binary_tree) & ((ordered_tree) -> binary_tree) & ((dyck_path) -> binary_tree) | combinatorics | always |
Details
BinaryTree([[0, 0], 0])is a root whose left child is a single node. The empty tree isBinaryTree(0).- The same structure as a Dyck path, U φ(L) D φ(R) (
DyckPath(tree), FindStat's Mp00012), and as its in-order parent array (BinaryTreeParentArray(tree));BinaryTreeof either converts back. Both are bijections, so every Dyck path statistic answers on a tree. The parent arrays also keep BinaryTrees' order. BinaryTreeof an ordered tree is FindStat's Mp00049 (a vertex's left brother becomes its left child, its last child the right one, and the root goes).RightBranchBinaryTreeis the same with left and right exchanged (Mp00050).
Statistics
On BinaryTree, called as CombinatorialStat(x, "Name").
- BinaryNodesSt000196The number of nodes with two children.
- BoundaryNodesSt000203The number of nodes on the left spine or the right spine, the root counted once.
- CollessIndexSt001376The sum, over the nodes, of how much the node counts of the two subtrees differ.
- DistinctSubtreesSt001554The number of different nonempty subtrees.
- ExternalPathLengthSt000399The sum of the lengths of the paths from the root to the empty subtrees.
- ForkRightRightLeftPatternCountSt000132The number of nodes with two children whose right child's right child has a left child.
- HeightSt000050The height: the most nodes on a path from the root, 0 for the empty tree.
- HookNumberSt000568The number of hooks in the decomposition of the tree into hooks: a node with the chains of left children and of right children below it, the subtrees hanging off those chains decomposed in turn.
- LeavesSt000201The number of nodes with no children.
- LeftSpineSt000061The number of nodes on the left spine: the root and its chain of left children.
- LeftSubtreeSizeSt000051The number of nodes in the left subtree of the root.
- LinearExtensionCountSt000045The number of linear extensions of the tree as a poset: n! over the tree factorial.
- MaximalLeftBranchesSt000919The number of maximal paths of left edges.
- NonBoundaryNodesSt000204The number of nodes on neither the left spine nor the right spine.
- NonRootBinaryNodesSt000252The number of nodes other than the root with two children.
- ParenthesisCodeValueSt000198The value, read in binary, of the tree's parenthesis word: each node is ( left ) right, with ( as 1 and ) as 0.
- PathLengthSt000398The sum of the depths of the nodes, the root's being 0: the internal path length.
- PitchforksSt000409The number of nodes whose subtree has exactly two nodes.
- ProtectionNumberSt000701The edges from the root to the nearest leaf, a binary tree's empty subtree counting as a leaf.
- RightChildCountSt000083The number of nodes with a right child.
- RightForkRightLeftPatternCountSt000130The number of nodes whose right child has two children, the right one of which has a left child.
- RightLeftLeftLeftPathCountSt000131The number of nodes from which taking the right, then the left, then the left, then the left child stays inside the tree.
- RightLeftLeftPathCountSt000125The number of nodes from which taking the right, then the left, then the left child stays inside the tree.
- RightRightLeftLeftPathCountSt000129The number of nodes from which taking the right, then the right, then the left, then the left child stays inside the tree.
- RightRightLeftPathCountSt000122The number of nodes from which taking the right, then the right, then the left child stays inside the tree.
- RightRightLeftRightPathCountSt000128The number of nodes from which taking the right, then the right, then the left, then the right child stays inside the tree.
- RightRightPathCountSt000118The number of nodes from which taking the right, then the right child stays inside the tree.
- RightRightRightLeftPathCountSt000127The number of nodes from which taking the right, then the right, then the right, then the left child stays inside the tree.
- RightRightRightPathCountSt000121The number of nodes from which taking the right, then the right, then the right child stays inside the tree.
- RightRightRightRightPathCountSt000126The number of nodes from which taking the right, then the right, then the right, then the right child stays inside the tree.
- RightSubtreeSizeSumSt000161The sum, over the nodes, of the number of nodes in the right subtree.
- StrahlerNumberSt000396The Horton-Strahler number (register function): 0 for the empty tree, else the larger child's, plus one if the children tie.
- SwapEquivalentTreeCountSt000412The 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.
- SwapEquivalentTreeCountLogSt000414The binary logarithm of the number of binary trees with the same underlying rooted tree: the nodes whose two subtrees differ up to swaps.
- TreeFactorialSt000411The product, over the nodes, of the number of nodes at or below each.
- UnaryNodesSt000385The number of nodes with exactly one child.
- VertexHeightSumSt000569The sum, over the nodes, of the node's height (the most nodes on a path down).
Maps
Into and out of BinaryTree, called as CombinatorialMap(x, "Name"). Properties are the laws we state and what FindStat records.
From BinaryTree
- BinaryTreeParentArrayBinaryTree → BinaryTreeParentArrayinverseA binary tree as its parent array: its nodes numbered in order, entry k the number of the k-th node's parent, 0 at the root.
- DyckPathBinaryTree → DyckPathinverseBijectionGraded mapMp00012A binary tree [L, R] as the Dyck path U φ(L) D φ(R).
- LeftBorderSymmetryBinaryTree → BinaryTreeinvolutionBijectionGraded mapInvolutionMp00018Reverse the order of the right subtrees hanging off the left border, applying the same symmetry inside each.
- LeftRotationBinaryTree → BinaryTreebijectioninverseBijectionGraded mapMp00009Rotate the root to the left: the right child becomes the root, the root its left child.
- MirrorBinaryTree → BinaryTreeinvolutionBijectionGraded mapInvolutionMp00016The left-right symmetry of a binary tree: every node's two subtrees swapped.
- OrderedTreeBinaryTree → OrderedTreeinverseBijectionGraded mapMp00010A binary tree as an ordered tree with one more vertex: a left child becomes its parent's left brother, a right child its parent's last child.
- RightBranchOrderedTreeBinaryTree → OrderedTreeinverseBijectionGraded mapMp00015A binary tree as an ordered tree with one more vertex: a right child becomes its parent's right brother, a left child its parent's first child.
- RightRotationBinaryTree → BinaryTreebijectioninverseBijectionGraded mapMp00019Rotate the root to the right: the left child becomes the root, the root its right child.
- TamariDyckPathBinaryTree → DyckPathbijectioninverseBijectionGraded mapMp00020The Dyck path T(L) U T(R) D of a tree with subtrees L and R: the bijection compatible with the Tamari order.
To BinaryTree
- BinarySearchTreePermutation → BinaryTreesurjectionSurjectionGraded mapMp00072The tree built by inserting σ(1), σ(2), ... into an empty binary search tree.
- BinaryTreeBinaryTreeParentArray → BinaryTreeinverseThe binary tree an in-order parent array describes: a node below its parent goes left, above it right.
- BinaryTreeOrderedTree → BinaryTreeinverseBijectionGraded mapMp00049An ordered tree as a binary tree with one fewer node: a vertex's left brother becomes its left child, its last child its right child, and the root goes.
- BinaryTreeDyckPath → BinaryTreeinverseBijectionGraded mapMp00034A Dyck path U A D B, cut at its first return, as the binary tree [φ⁻¹(A), φ⁻¹(B)].
- RightBranchBinaryTreeOrderedTree → BinaryTreeinverseBijectionGraded mapMp00050An ordered tree as a binary tree with one fewer node: a vertex's right brother becomes its right child, its first child its left child, and the root goes.
- TamariBinaryTreeDyckPath → BinaryTreebijectionBijectionGraded mapMp00029A path D = L U R D as the binary tree whose left and right subtrees are those of L and R: the bijection compatible with the Tamari order.
9 more in FindStat, not implemented here
- Mp00008BinaryTree → OrderedTreeInjectionGraded mapto complete tree
- Mp00011BinaryTree → LabeledGraphGraded mapto graph
- Mp00013BinaryTree → PosetsGraded mapto poset
- Mp00014BinaryTree → PermutationInjectionGraded mapto 132-avoiding permutation
- Mp00017BinaryTree → PermutationInjectionGraded mapto 312-avoiding permutation
- Mp00061Permutation → BinaryTreeSurjectionGraded mapto increasing tree
- Mp00139OrderedTree → BinaryTreeBijectionGraded mapZeilberger's Strahler bijection
- Mp00140DyckPath → BinaryTreeBijectionGraded maplogarithmic height to pruning number
- Mp00141BinaryTree → DyckPathBijectionGraded mappruning number to logarithmic height
Examples
About
| Examples | 2 |
|---|---|
| Crosswalk | WikipediaMathWorldWikidataEncyclopedia of MathematicsOEISFindStat ×2SageMath |
See also: BinaryTrees, BinaryTreeParentArray, DyckPath