def is_acyclic(self, restore=True):
        # A graph with no vertices is automatically acyclic.
        if len(self.vertices) == 0:
            return True
        # A graph with NO leaf vertices is cyclic.
        leaves = len([self.is_leaf(vertex) for vertex in self.vertices])
        if leaves == 0:
            return False
        # Keep a backup of the original graph.
        if restore:
            graph_copy = deepcopy(self.vertices)
        self._prune_all()
        # If a cycle wasn't found while pruning, it's guaranteed to be acyclic.
        is_acyclic = self._is_acyclic()
        # Restore backup
        if restore:
            self.vertices = graph_copy
        return is_acyclic
Set the filtering method
dataset/ETHPy150Open christabor/MoAL/MOAL/data_structures/graphs/graphs.py/DirectedGraph.is_acyclic--crossover with--dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/statespace/mlemodel.py/MLEModel.set_filter_method