Solving $UCYCLE$ in logspace - two possible approaches ? Why can't we one of them use to solve connectivity? $$UCYLE = \mathcal \{ &lt;G&gt; ~:~ G \text{ is an undirected graph that contains a simple cycle}\}.$$
There are two possible approaches to this exercise:
Solving cycle in undirected graph in log space?  

https://stackoverflow.com/questions/29640543/solving-cycle-in-undirected-graph-in-log-space   

These two solutions are different. The instresting solution is second one (on stackoverflow). In this case we generally implement DFS in logspace.  I can see that it does work (using DFS). However the question is:
Why we can't use this DFS algorithm to solve USTCON problem ?  

However, I can see that we can't easily use this DFS to solve bipartity problem. It is not easy to count number of nodes in cycle.  

Edit
Modified algorithm from stackoverflow (mentioned link) which should solve ustcon problem:  

    for v_j in neighbours(s)
        current, prev = v_j, s
        repeat
            idx = neighbours(current).index(v_j)
            idx = (idx + 1) % len(neighbours(current))
            current, prev = neighbours(current)[idx], current
            if current = t then return connection between s and t
        until current adjacent to s
return no_connection between s and t
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.