I miss Golden Tate <| sep |> Ok that ' s new to me , cool . <| sep |> What the hell ? Sweet potatoes are perfect for a veggie Thanksgiving ! They ' re a traditional dish , but filling . <| sep |> no you don ' t check if it leads anywhere , you would have to use extra memory to keep track of such things for example a boolean grid where you mark the vertices that have already been found , and when you explore a new edge check if it leads to such a vertex if yes you have a cycle . Most work is probably to determine the inner part of the cycle fast just storing the predecessor for every vertex found doesn ' t work to findthe path around the cycle . I guess you need at least twice the maze area as extra memory . <| sep |> Your first and second paragraph is contradicting .