Hello zing
I was looking at the same Graph module for several days...
I want to ask the same question for directed graph. I wonder if this module lacks for 'list all path', or whether I miss something.
You can list all shortest path in your graph, if you do like this.
use strict;
use warnings;
use Graph;
my @a=qw(a b d);
my @b=qw(c c e);
my $g = Graph>new( undirected => 1 );
for (my $r = 0; $r <= 2; $r++) {
$g>add_edge($a[$r], $b[$r]);
}
#get path from apsp
my $apsp=$g>APSP_Floyd_Warshall();
#...with all pattern using glob
my @v=$g>vertices;
my $ptn=join(",", @v);
for (glob "{$ptn},{$ptn}"){
my($u,$v)=split(/,/, $_);
next if( $u eq $v ); #skip same combination, or ignore self cyc
+le
my @p=$apsp>path_vertices($u,$v);
if (@p){
print join(',', @p), "\n";
}
}
So, for just listing all path, it may be faster if I do recursive call by myself. I am feeling missing something.
I would like to ask for a good way, if you find one.
regards.
