Can a node have two parents?

Hmm… That makes sense, I think. It wouldn’t call for clearing, either; indeed, even having the number eventually overflow would be fine, as we would only be checking for equality.

So, does the following rough code look good to you?

In Node

static int globalPassCounter;

int passCounter;

Node()
 {
  passCounter = globalPassCounter;
 }

In the traversal code:

// Before traversal
Node::globalPassCounter++;

// ...
// During traversal, presumably when considering whether to add the node to the bins
if (currentNode.passCounter != Node::globalPassCounter)
 {
  // Add node as per usual
  currentNode.passCounter = Node::globalPassCounter;
 }