Proof
The proof is
similar to the proof of the orbit algorithm.
Termination
Correctness
Since X is a finite set, and the vertex set of T is a subset which
increases strictly at each pass of Step 3
with nonempty N, termination is guaranteed.
Each vertex is added with exactly one edge connecting it to prior vertices,
that is, vertices closer to the root. Thus,
T is a tree with the right labels.
By construction, the vertex set of T is the G-orbit of x.
See the orbit algorithm.