def predecessors ( self , node , graph = None ) : if graph is None : graph = self . graph return [ key for key in graph if node in graph [ key ] ]
getall predecessors of a node python
Returns a list of all predecessors of the given node
def predecessors(self, node, graph=None):
        """ Returns a list of all predecessors of the given node """
        if graph is None:
            graph = self.graph
        return [key for key in graph if node in graph[key]]