Main Content

ntnode

Number of terminal nodes

    Description

    ntnode is a tree-management utility.

    example

    nb = ntnode(t) returns the number of terminal nodes in the tree t.

    The nodes are numbered from left to right and from top to bottom. The root index is 0.

    Examples

    collapse all

    Create a tree of order 3 and depth 2.

    t = ntree(3,2);

    Plot the tree.

    plot(t)

    Use the ntnode function to count the terminal nodes.

    nb = ntnode(t)
    nb = 9
    

    Input Arguments

    collapse all

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

    Version History

    Introduced before R2006a

    See Also