'Find cycles using Tarjan\'s strongly connected components algorithm.'

def find_cycles(self):

    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((' DCTB Function    %s\n' % member.name))
