Path-based depth-first search for strong and biconnected components
Introduction to Algorithms