Uniform sampling of vertices by DFS rank #
A time in the unit interval selects DFS rank min (floor (size * time)) (size - 1).
The final time therefore selects the last vertex. All earlier rank cells are
half-open intervals of length 1 / size; the final cell is closed at one and
has the same volume. The pushforward of the actual interval volume is exactly
the uniform measure on all vertices, including roots and leaves.
Select a DFS vertex by an interval time, with the final time clamped to the last rank.
Equations
Instances For
The sampler is measurable into the existing Borel space of vertices.
Interval volume pushes forward to exactly the uniform probability on all vertices.
The first sampling time selects the root.
Every vertex is selected, at the time given by its DFS rank divided by tree size.
The sampled vertex's first-visit time stays uniformly close to its sampling time.