Considering the setup mentioned in the beginning, this PR determines the roots to be rendered correctly.
XoR for node_ids and parent_ids is used to determine all Node#id which are either a root or a leaf.
Then, opts[:boost] is used to check which of the nodes (which are either root or leaf) are root nodes for the tree (or sub tree)
This leverages the previously built opts[:boost] ID-Hash, where each Node is mapped to his corresponding parent_id.
A leaf will not be present in this hash, because it will never act as a parent.
Considering the setup mentioned in the beginning, this PR determines the roots to be rendered correctly.
XoR
fornode_ids
andparent_ids
is used to determine allNode#id
which are either a root or a leaf. Then,opts[:boost]
is used to check which of the nodes (which are either root or leaf) are root nodes for the tree (or sub tree)This leverages the previously built
opts[:boost]
ID-Hash, where each Node is mapped to his correspondingparent_id
.A leaf will not be present in this hash, because it will never act as a parent.