title: Graph.pm - how to get all paths with particular length?
body: <p>I have following example graph with 9 edges:</p>
  
  <p><a href="https://i.stack.imgur.com/FSQ1fm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FSQ1fm.png" alt="graph"></a></p>
  
  <p>Assuming that graph is undirected and weight of each edge is 1.</p>
  
  <p>We can describe it programmatically using <a href="https://metacpan.org/pod/Graph" rel="nofollow noreferrer">Graph.pm</a> as</p>
  
  <pre><code>use Graph::Undirected;
  my $g = Graph::Undirected-&gt;new; # An undirected graph.
  $g-&gt;add_edge(1, 3);
  $g-&gt;add_edge(3, 4);
  $g-&gt;add_edge(4, 2);
  $g-&gt;add_edge(1, 2);
  $g-&gt;add_edge(1, 5);
  $g-&gt;add_edge(1, 2);
  $g-&gt;add_edge(1, 6);
  $g-&gt;add_edge(6, 2);
  $g-&gt;add_edge(2, 7);
  </code></pre>
  
  <p>How to get all paths from vertex <code>1</code> to vertex <code>2</code> which have length = 2 ? </p>
  
  <p>I haven't found any method for it in <a href="https://metacpan.org/pod/Graph" rel="nofollow noreferrer">Graph.pm</a> :(</p>
  
  <p>In my example it must return 2 paths, <code>[ 1, 5, 2 ]</code> and <code>[ 1, 6, 2 ]</code></p>