title: How can I modify the breadth-first search algorithm to also include the solution path?
body: <p>I have the following pseudo-code in my book for a breadth-first search:</p>
  
  <pre><code>function breadth_first_search:
      begin
          open := [Start]
          closed := [];
          while open != [] do
              begin
                  remove leftmost state from open, call it X;
                      if X is a goal then return SUCCESS
                          else begin
                              generate children of X;
                              put X on closed;
                              discard children of X if already on open or closed;
                              put remaining children on right end of open;
                          end
              end
         return FAIL;
      end
  </code></pre>
  
  <p>I've implemented a similar algorithm myself following these pseudo-code instructions.  My question is, what is the simplest way to modify it so it maintains the solution path?</p>
  
  <p>Simply knowing I can reach a solution isn't nearly as useful as having a list of transitions to get to the solution.  </p>