Returns for tree intree a matrix ipar of indices to the parent of individual nodes following the path against the direction of the adjacency matrix towards the root of the tree. This function is crucial to many other functions based on graph theory in the TREES package.

TREES

Example:

>> ipar_tree (sample2_tree)

_1 _0 _0 _0 0 0 0 0 0   → path of root
_2 _1 _0 _0 0 0 0 0 0   → path of node #2, etc...
_3 _2 _1 _0 0 0 0 0 0
_4 _3 _2 _1 0 0 0 0 0
_5 _4 _3 _2 1 0 0 0 0
_6 _5 _4 _3 2 1 0 0 0
_7 _6 _5 _4 3 2 1 0 0
_8 _7 _6 _5 4 3 2 1 0
_9 _6 _5 _4 3 2 1 0 0
10 _3 _2 _1 0 0 0 0 0
11 10 _3 _2 1 0 0 0 0
12 11 10 _3 2 1 0 0 0
13 12 11 10 3 2 1 0 0
14 12 11 10 3 2 1 0 0
15 10 _3 _2 1 0 0 0 0

>> ipar_tree (sample_tree, '-s')

TREES TREES

Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License