title: Enumerating all paths in a tree
body: <p>I was wondering how to best implement a tree data structure to be able to enumerate paths of all levels. Let me explain it with the following example:</p>
  
  <pre><code>     A
     /   \
     B    C
     |    /\
     D   E  F
  </code></pre>
  
  <p>I want to be able to generate the following:</p>
  
  <pre><code>A
  B
  C
  D
  E
  F
  A-B
  A-C
  B-D
  C-E
  C-F
  A-B-D
  A-C-E
  A-C-F
  </code></pre>
  
  <p>As of now, I am executing a depth-first-search for different depths on a data structure built using a dictionary and recording unique nodes that are seen but I was wondering if there is a better way to do this kind of a traversal. Any suggestions?</p>