// Sequence, stepping back along the path until we find the Vertex
// that closed the cycle.
//
// If no cycle is found, the Sequence will be empty and the cycle
// Iterator will be empty
Sequence theCycle = new NodeSequence();
ObjectIterator pathVerts = prospectiveCycle_.elements();
while (pathVerts.hasNext()) {
Vertex v = (Vertex)pathVerts.nextObject();
theCycle.insertFirst(v);
if (v == cycleStart_) {
break;
}
}
// remove all decorations added during the DFS
cleanup();
// get ready to return the cycle.
cycleIterator_ = theCycle.elements();
}