(self)
Perform a quasi-topological sort on an already constructed CFG graph (a networkx DiGraph)

        :return: None
Perform a quasi-topological sort on an already constructed CFG graph (a networkx DiGraph)
Perform a quasi - topological sort on an already constructed CFG graph ( a networkx DiGraph )
def _quasi_topological_sort(self):
        """
        Perform a quasi-topological sort on an already constructed CFG graph (a networkx DiGraph)

        :return: None
        """

        # Clear the existing sorting result
        self._quasi_topological_order = {}

        ctr = self._graph.number_of_nodes()

        for ep in self._entry_points:
            # FIXME: This is not always correct. We'd better store CFGNodes in self._entry_points
            ep_node = self.get_any_node(ep)

            if not ep_node:
                continue

            for n in networkx.dfs_postorder_nodes(self._graph, source=ep_node):
                if n not in self._quasi_topological_order:
                    self._quasi_topological_order[n] = ctr
                    ctr -= 1
def _quasi_topological_sort ( self ) : # Clear the existing sorting result self . _quasi_topological_order = { } ctr = self . _graph . number_of_nodes ( ) for ep in self . _entry_points : # FIXME: This is not always correct. We'd better store CFGNodes in self._entry_points ep_node = self . get_any_node ( ep ) if not ep_node : continue for n in networkx . dfs_postorder_nodes ( self . _graph , source = ep_node ) : if n not in self . _quasi_topological_order : self . _quasi_topological_order [ n ] = ctr ctr -= 1