Create Detect Cycle of graph