If so, I would keep the pointers in a set to mark nodes as processed but is there a more elegant solution?