GraphTheory[SpecialGraphs]
CompleteBinaryTree
construct complete binary tree
CompleteKaryTree
construct complete k-ary tree
Calling Sequence
Parameters
Description
Examples
CompleteBinaryTree(n)
CompleteKaryTree(k,n)
k
-
positive integer indicating the degree of the root
n
positive integer indicating the depth of the tree
The CompleteBinaryTree(n) command constructs the complete binary tree with depth n.
The CompleteKaryTree(k,n) command constructs the complete k-ary tree with depth n for a given k.
with⁡GraphTheory:
with⁡SpecialGraphs:
G≔CompleteBinaryTree⁡2
G≔Graph 1: an undirected unweighted graph with 7 vertices and 6 edge(s)
Edges⁡G
1,2,1,5,2,3,2,4,5,6,5,7
DrawGraph⁡G
H≔CompleteKaryTree⁡3,2
H≔Graph 2: an undirected unweighted graph with 13 vertices and 12 edge(s)
Edges⁡H
1,2,1,6,1,10,2,3,2,4,2,5,6,7,6,8,6,9,10,11,10,12,10,13
DrawGraph⁡H
See Also
SpecialGraphs
Download Help Document
What kind of issue would you like to report? (Optional)