Modified ClusterNode.pre_order() for non-root

Fixes #2177 by replacing the boolean vectors with sets.