implementation and tests for tree-node-collection-functions