This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.


Lay out tree or forest


[x,y] = treelayout(parent,post)
[x,y,h,s] = treelayout(parent,post)


[x,y] = treelayout(parent,post) lays out a tree or a forest. parent is the vector of parent pointers, with 0 for a root. post is an optional postorder permutation on the tree nodes. If you omit post, treelayout computes it. x and y are vectors of coordinates in the unit square at which to lay out the nodes of the tree to make a nice picture.

[x,y,h,s] = treelayout(parent,post) also returns the height of the tree h and the number of vertices s in the top-level separator.

Introduced before R2006a

Was this topic helpful?