Solving $UCYCLE$ in logspace - two possible approaches ? Why can't we one of them use to solve connectivity?
Your algorithm is from the paper Problems complete for deterministic logspace by Cook and McKenzie, where it is used to perform DFS on trees, as well as for related problems such as cycle detection. Presumably it doesn't work on graphs with cycles.