Python implementation of Tarjan's cycle enumeration algorithm.