Detect Cycle in Directed Graph