Esempio n. 1
0
    def get_parentmap_toposort(self, reverse=False):
        """
        Returns an iterator in topological order over element, parent pairs.
        """
        parent_map = self.get_parentmap()

        digraph = graph.digraph(parent_map.items())
        if reverse:
            digraph = graph.reverse(digraph)

        for element in toposort_flatten(digraph, sort=False):
            yield element, parent_map.get(element, None)