Introduce state management system to visitors.

This feels way overengineered. Refactor it down later.
Introduce Tarjan's strongly connected components algorithm.

Feels very rough around the edges, but good enough for now.
Add DirectedGraph::isAcyclic() and ::getCycles().