Produces a graph of tree or forest. The first argument is vector of predecessors, optional parameters LineStyle and EdgeStyle define the output style. The complexity of the algorithm is O(n) in terms of is time and memory requirements.
The following code
% Plot a simple tree plot treeplot([2 4 2 0 6 4 6])
Produces the following figure
![]() |
The following code
% Plot a simple tree plot defining the edge and node styles treeplot([2 4 2 0 6 4 6], "b+", "g")
Produces the following figure
![]() |