Main Content

ntnode

Number of terminal nodes

    Description

    ntnode is a tree-management utility.

    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.

    example

    Examples

    collapse all

    Create a tree of order 3 and depth 2.

    t = ntree(3,2);

    Plot the tree.

    plot(t)

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

    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