Cycle Detection in Directed Graph