code: def tarjan_recursive(g):
          
          S = []
          S_set = set()
          index = {}
          lowlink = {}
          ret = []
  
          def visit(v):
                  index[v] = len(index)
                  lowlink[v] = index[v]
                  S.append(v)
                  S_set.add(v)
                  for w in g.get(v,()):
                          if w not in index:
                                  visit(w)
                                  lowlink[v] = min(lowlink[w], lowlink[v])
                          elif w in S_set:
                                  lowlink[v] = min(lowlink[v], index[w])
                  if lowlink[v] == index[v]:
                          scc = []
                          w = None
                          while v != w:
                                  w = S.pop()
                                  scc.append(w)
                                  S_set.remove(w)
                          ret.append(scc)
  
          for v in g:
                  if not v in index:
                          visit(v)
          return ret
docs: Returns the strongly connected components of the graph @g
              in a topological order.
  
                  @g is the graph represented as a dictionary
                          { <vertex> : <successors of vertex> }.
                          
              This function recurses --- large graphs may cause a stack
              overflow.