Returns for tree intree, an Nx1 vector sub,
where the elements corresponding to a sub-tree defined by its starting node
inode are “1”, and all other elements are “0”.
An optional output subtree is a structure containing
the tree structure corresponding to the sub-tree.
Example:
>> [sub subtree] = sub_tree (sample2_tree, 5)
[0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0]'
>> sum (sub) → number of child nodes of node #5
5
>> find (sub) → indices of nodes in the sub-tree
[5, 6, 7, 8, 9]
>> subtree → tree structure corresponding to sub-tree
dA: [5x5 double]
X: [5x1 double]
Y: [5x1 double]
etc..
>> resttree = delete_tree (sample2_tree, find(sub))
dA: [10x10 double] → original tree structure without the sub-tree
X: [10x1 double]
Y: [10x1 double]
etc..
This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License