title: How can you use a breadth-first search to find the shortest path in a map?
body: <p>For simplicity sake, suppose I have the graph:</p>
  
  <pre><code>O O P O |
  O O O O O
  O | O | O
  O O O O O
  A O O O O
  </code></pre>
  
  <p>In which I want to use a breadth-first search to travel from A to P by the shortest path, where positions designated by | are restricted areas.  How can I achieve this result?  I've always seen the breadth-first search used to find some location (P in this case), but I haven't seen any implementation used to store path distances and compute the shortest one (nor efficient methods to store previously visited locations and exclude them from further scrutiny).  Also, what queue is typically suggested for graphs that are necessarily large and require extensive pushes and pops?</p>