incremental-cycle-detect

Keeps a directed acyclic graph topologically sorted each time you add an edge or vertex to check for cycles.

cyclist

Cyclist is an efficient cyclic list implemention.