(self)
Find cycles using Tarjan's strongly connected components algorithm.
Find cycles using Tarjan's strongly connected components algorithm.
Find cycles using Tarjan s strongly connected components algorithm .
def find_cycles(self):
        """Find cycles using Tarjan's strongly connected components algorithm."""

        # Apply the Tarjan's algorithm successively until all functions are visited
        visited = set()
        for function in self.functions.itervalues():
            if function not in visited:
                self._tarjan(function, 0, [], {}, {}, visited)
        cycles = []
        for function in self.functions.itervalues():
            if function.cycle is not None and function.cycle not in cycles:
                cycles.append(function.cycle)
        self.cycles = cycles
        if 0:
            for cycle in cycles:
                sys.stderr.write("Cycle:\n")
                for member in cycle.functions:
                    sys.stderr.write("\tFunction %s\n" % member.name)
def find_cycles ( self ) : # Apply the Tarjan's algorithm successively until all functions are visited visited = set ( ) for function in self . functions . itervalues ( ) : if function not in visited : self . _tarjan ( function , 0 , [ ] , { } , { } , visited ) cycles = [ ] for function in self . functions . itervalues ( ) : if function . cycle is not None and function . cycle not in cycles : cycles . append ( function . cycle ) self . cycles = cycles if 0 : for cycle in cycles : sys . stderr . write ( "Cycle:\n" ) for member in cycle . functions : sys . stderr . write ( "\tFunction %s\n" % member . name )