def _checkJobGraphAcylicDFS(self, stack, visited, extraEdges):
        if self not in visited:
            visited.add(self)
            stack.append(self)
            for successor in self._children + self._followOns + extraEdges[self]:
                successor._checkJobGraphAcylicDFS(stack, visited, extraEdges)
            assert stack.pop() == self
        if self in stack:
            stack.append(self)
            raise JobGraphDeadlockException("A cycle of job dependencies has been detected '%s'" % stack)
DFS traversal to detect cycles in augmented job graph.
dataset/ETHPy150Open BD2KGenomics/toil/src/toil/job.py/Job._checkJobGraphAcylicDFS