better performance for cycle detection algo
adj list fix
fix fix