Detect if a directed graph has a cycle using DFS and coloring (white=0, gray=1, black=2).
Examples
cycle → True
no cycle → False