title: Python freezes while path-finding
body: <p>I have a script that uses an adjacency graph and the BFS algorithm to find a path between two points.  The graph has about 10,000 vertexes and the script is set up like this:</p>
  
  <pre><code>graph = {...
           '9660': ['9661', '9662', '9659'],
           '9661': ['9654', '9660'],
           '9662': ['9660', '9663'],
           '9663': ['9664', '9662'],
           '9664': ['9665', '9663'],
                                ...}
  
  
  def bfs(graph, start, end):
  # maintain a queue of paths
  queue = []
  # push the first path into the queue
  queue.append([start])
  while queue:
      # get the first path from the queue
      path = queue.pop(0)
      # get the last node from the path
      node = path[-1]
      # path found
      if node == end:
          return path
      # enumerate all adjacent nodes, construct a new path and push it into the queue
      for adjacent in graph.get(node, []):
          new_path = list(path)
          new_path.append(adjacent)
          queue.append(new_path)
  
  print bfs(graph, '50', '8659')
  </code></pre>
  
  <p>Because this algorithm works on small adjacency graphs, I'm guessing python just takes a really long time to process a graph this size.   My goal is to find the shortest path but that's currently out of the question if I cant even find one path.  Is there a python solution to handling path-finding using large adjacency graphs?  If so, could I get an example?</p>