title: Reversing a Depth First Search or Pre-order traversal
body: <p>Let's say I have a complete binary graph of height 2, something like this:</p>
  
  <pre><code>         0
       1        2 
    3     4  5     6
  </code></pre>
  
  <p>where there's an edge from 0 to 1 and 0 to 2, 1 to 3 and 1 to 4, 2 to 5, and 2 to 6.</p>
  
  <p>I can get the nodes in depth first search order (0, 1, 3, 4, 2, 5, 6) by doing a pre-order traversal.</p>
  
  <p>Is there some reasonably simple way to algorithmically get the reverse from the pre-order traversal, post order traversal, or in-order traversal, by which I mean at each level you go right first, then left so you end up with (0, 2, 6, 5, 1, 4, 3)?</p>
  
  <p>I've looked around a fair amount and haven't found anything applicable.</p>
  
  <p>N.B. in case you are wondering why I want it I have a search algorithm that is based off of DFS and so find nodes that are more to the left of the graph more quickly than nodes on right.  I'm thinking about running parallel processes one on the normal left to right dfs and the other on a right to left reversal.  </p>