True for existing node.
Syntax
R = isnode(T,N)
Description
isnode is a tree management utility.
R = isnode(T,N) returns 1's for nodes N, which exist in the tree structure T, and 0's for others. N can be a column vector containing the indices of nodes or a matrix, that contains the depths and positions of nodes.
In the last case, N(i,1) is the depth of i-th node and N(i,2) is the position of i-th node.
The nodes are numbered from left to right and from top to bottom. The root index is 0.
Examples
% Create initial tree.
ord = 2;
t = maketree(ord,3); % binary tree of depth 3.
tt = nodejoin(t,5);
tt = nodejoin(tt,4);
plottree(tt)

% Check node index.
isnode(tt,[1;3;25])
ans =
1
1
0
% Check node depth-position.
isnode(tt,[1 0;3 1;4 5])
ans =
1
1
0
See Also
istnode, maketree, wtreemgr
[ Previous | Help Desk | Next ]