depo2ind
Node depth-position to node index
Syntax
N = depo2ind(ORD,[D P])
Description
depo2ind
is a tree-management utility.
For a tree of order ORD
, N = depo2ind(ORD,[D P])
computes the indices N
of the nodes whose depths and positions are
encoded within [D,P]
.
The nodes are numbered from left to right and from top to bottom. The root index is 0.
D and P are column vectors. The values of depths D and positions P must be such that D ≥0 and 0≤ P ≤ ORDD-1.
Output indices N are such that 0 ≤ N < (ORDmax(D)-1)/ORD–1.
Note that for a column vector X
, we have depo2ind(O,X)
= X
.
Examples
Version History
Introduced before R2006a