KaryTree
The k-ary tree on n vertices, in breadth-first (heap) layout — sized by vertex count, not depth.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram Language
KaryTree✓KaryTree(n)the binary (k = 2) tree on n verticesKaryTree(n, k)the k-ary tree on n verticesTyped signatures
| Type | Package | Applies |
|---|---|---|
(integer, integer?) -> value | combinatorics | always |
Details
- Vertex i's parent is ⌊(i - 2) / k⌋ + 1 — the same heap layout CompleteKaryTree uses, but sized by VERTEX COUNT rather than level count, so the last level need not be full.
- NOT the same thing as our FullKAryTrees DOMAIN (the combinatorial family of every n-node full k-ary tree shape, for ranking/enumeration) or CompleteKaryTree (a LEVEL count, always perfectly filled) — three different heads that happen to share a name fragment.
Examples
Scope #
Properties #
Eight vertices with four children per node: the root and its four children, then three more below
live ↗InOut
About
| Examples | 11 |
|---|---|
| Checked against | Wolfram Language 11 agree |
| Crosswalk | Wolfram Language |
See also: CompleteKaryTree