Main Content

treedpth

    Description

    treedpth is a tree-management utility.

    example

    d = treedpth(t) returns the depth d of the tree t.

    Examples

    collapse all

    A tree of order 2 is a binary tree. Create a binary tree of depth 3. Plot the tree.

    order = 2;
    depth = 3;
    t = ntree(order,depth);
    plot(t)

    Use the treedpth function to confirm the tree depth is 3.

    treedpth(t)
    ans = 3
    

    Input Arguments

    collapse all

    Tree, specified as an ntree, dtree, or wptree object.

    Version History

    Introduced before R2006a

    See Also