Graph Theory37 sections · 1633 units
Open in Course

DFS Order Matters

(Consistent traversal)

The specific DFS order (which child you visit first) does not change correctness. Subtrees still map to ranges.

But if you want reproducible tintin values for debugging, use consistent child ordering (sorted by node number). In production, any DFS order works. Be consistent within a single run. This traversal order captures the tree structure in a way that makes range queries possible. If you change the DFS order, the timestamps change, but the technique still works. This property holds regardless of which child you visit first.