主要内容

treedpth

R2026b

    Description

    treedpth is a tree-management utility.

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

    example

    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)

    Figure contains an axes object and an object of type uimenu. The axes object with title Tree Decomposition contains 29 objects of type line, text.

    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.

    Extended Capabilities

    expand all

    Version History

    Introduced before R2006a

    expand all

    See Also