Main Content

nodesplt

Split (decompose) node

    Description

    X = nodesplt(T,N) decomposes node N of the tree T and returns the result as a tree of the same type.

    example

    Examples

    collapse all

    Create a binary tree of depth 3.

    ord = 2;
    t = ntree(ord,3);

    Plot the tree.

    fig = 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.

    Programmatically, in Node Label, change the selected item from Depth_Position to Index.

    plot(t,"setNodeLabel",fig,"Index")

    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.

    Split the tree node at index 10. Plot the result.

    t = nodesplt(t,10);
    fig = plot(t);
    plot(t,"setNodeLabel",fig,"Index")

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

    Input Arguments

    collapse all

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

    Tree nodes, specified as a column vector that contains indices of the nodes or a matrix that contains the depths and positions of the nodes. If specified as a matrix, N(i,1) and N(i,2) are the depth and position, respectively, of the ith node.

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

    Data Types: double

    Version History

    Introduced before R2006a

    See Also