'Returns a list of cycles in the graph, where each cycle is its own list.'

def FindCycles(self):

    results = []
    visited = set()
    def Visit(node, path):
        for child in node.dependents:
            if (child in path):
                results.append(([child] + path[:(path.index(child) + 1)]))
            elif (not (child in visited)):
                visited.add(child)
                Visit(child, ([child] + path))
    visited.add(self)
    Visit(self, [self])
    return results
