CompleteKaryTree

CompleteKaryTree[n]

gives the complete binary tree with n levels.

CompleteKaryTree[n,k]

gives the complete k-ary tree with n levels.

Details and Options

  • The complete k-ary tree with n levels is a rooted tree with k branches at each node and n levels deep.
  • The complete k-ary tree with n levels has vertices.
  • CompleteKaryTree[,DirectedEdges->True] gives a directed complete k-ary tree.
  • CompleteKaryTree takes the same options as Graph.

Examples

open allclose all

Basic Examples  (3)

A complete binary tree with 5 levels:

In[1]:=
Click for copyable input
Out[1]=

A complete ternary tree with 3 levels:

In[1]:=
Click for copyable input
Out[1]=

Use directed edges:

In[1]:=
Click for copyable input
Out[1]=

Options  (79)

Applications  (7)

Properties & Relations  (8)

See Also

KaryTree  TreeGraph  StarGraph  Groupings

Introduced in 2010
(8.0)