Graph Theory37 sections · 1633 units
Open in Course

Entry-Exit Variant

(tin and tout pairs)

Store both tin[v] and tout[v]. This is what you have been using. It identifies subtree ranges.

Advantage: subtree of vv is exactly range [tin[v], tout[v]]. Any range query structure works. This is the most flexible variant for subtree queries, updates, and path decompositions.

This is the standard variant. Most problems use this because both timestamps give you complete information about subtree ranges and ancestor relationships.