title: Find all BFS/DFS traversals
body: <p>Given an undirected cyclic graph, I want to find all possible traversals with Breadth-First search or Depth-First search. That is given a graph as an adjacency-list:</p>
  
  <pre><code>A-BC
  B-A
  C-ADE
  D-C
  E-C
  </code></pre>
  
  <p>So all BFS paths from root A would be:</p>
  
  <pre><code>{ABCDE,ABCED,ACBDE,ACBED}
  </code></pre>
  
  <p>and for DFS: </p>
  
  <pre><code>{ABCDE,ABCED,ACDEB,ACEDB}
  </code></pre>
  
  <p>How would I generate those traversals algorithmically in a meaningful way? I suppose one could generate all permutations of letters and check their validity, but that seems like last-resort to me.</p>
  
  <p>Any help would be appreciated.</p>