fix cycle bug

networkx used to return a list for simple_cycles, but now it returns an iterator.
Thus we can't test it for cycles without reifying it into a list.