code: def scc(graph):
      ''' Computes the strongly connected components of a graph '''
      order = []
      vis = {vertex: False for vertex in graph}
  
      graph_transposed = {vertex: [] for vertex in graph}
  
      for (v, neighbours) in graph.iteritems():
          for u in neighbours:
              add_edge(graph_transposed, u, v)
  
      for v in graph:
          if not vis[v]:
              dfs_transposed(v, graph_transposed, order, vis)
  
      vis = {vertex: False for vertex in graph}
      vertex_scc = {}
  
      current_comp = 0
      for v in reversed(order):
          if not vis[v]:
              # Each dfs will visit exactly one component
              dfs(v, current_comp, vertex_scc, graph, vis)
              current_comp += 1
  
      return vertex_scf scc(graph):
      ''' Computes the strongly connected components of a graph '''
      order = []
      vis = {vertex: False for vertex in graph}
  
      graph_transposed = {vertex: [] for vertex in graph}
  
      for (v, neighbours) in graph.iteritems():
          for u in neighbours:
              add_edge(graph_transposed, u, v)
  
      for v in graph:
          if not vis[v]:
              dfs_transposed(v, graph_transposed, order, vis)
  
      vis = {vertex: False for vertex in graph}
      vertex_scc = {}
  
      current_comp = 0
      for v in reversed(order):
          if not vis[v]:
              # Each dfs will visit exactly one component
              dfs(v, current_comp, vertex_scc, graph, vis)
              current_comp += 1
  
      return vertex_scc
docs: Computes the strongly connected components of a graph