Collects all node ids within a tree given by a respective root node
The root id nodes to start collecting from
A function that determines whether to stop collecting at a given node, does not stop by default
Collects all node ids within a tree given by a respective root node