Adding cycle tests for undirected graphs.

Cycle tests using dfs only wored for directed graphs in the past. This commit
adds this functionality. The main change is that the DFSCyclicTestVisitor must
now keep track of which sets of edges have been visited.