Kahn's algorithm: count the arcs into each vertex, take the vertices with none left, and find a cycle when nothing is ready.
This interactive visualization needs JavaScript.