Longest Cycle in a Graph
Each node has at most one outgoing edge, so walk from every unvisited node and measure a cycle when a walk meets itself.
Each node has at most one outgoing edge, so walk from every unvisited node and measure a cycle when a walk meets itself.