title: Find ALL possible paths between two nodes in a directed labeled graph
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/713508/find-the-paths-between-two-given-nodes">Find the paths between two given nodes?</a>  </p>
  </blockquote>
  
  
  
  <p>Given a directed graph, how to find ALL the possible paths between two nodes and return those paths.</p>
  
  <p>If not in Java, please recommend me with the algorithm for it. I searched and what I found is using BFS or DFS, but I'm not able to see which is better in my case. And how to keep track of all paths not only the shortest one.</p>
  
  <p>For example, given the following graph:</p>
  
  <p>1 -> 2</p>
  
  <p>1 -> 3</p>
  
  <p>2 -> 3</p>
  
  <p>3 -> 4</p>
  
  <p>For paths between nodes 1 and 4, the output should be:</p>
  
  <p>First Path: 1 -> 2 -> 3 -> 4</p>
  
  <p>Second Path: 1 -> 3 -> 4</p>