code: def connected_components(graph):
      
      recursionlimit = getrecursionlimit()
      setrecursionlimit(max(len(graph.nodes())*2,recursionlimit))
      
      visited = {}
      count = 1
  
      # For 'each' node not found to belong to a connected component, find its connected
      # component.
      for each in graph:
          if (each not in visited):
              _dfs(graph, visited, count, each)
              count = count + 1
      
      setrecursionlimit(recursionlimit)
      return visited
docs: Connected components.
  
      @type  graph: graph, hypergraph
      @param graph: Graph.
  
      @rtype:  dictionary
      @return: Pairing that associates each node to its connected component.