hi,
i'm not sure if anyone can help, as I am having a problem with a specific module - called Graph-0.74 (
basically i am trying to use the Graph::AdjacencyMatrix module, for creating and querying an adjacency matrix and also a distance matrix. I can get the adjacency matrix to work fine, but not the distance matrix. If anyone has time to install the module and give me some tips i'd be really grateful!
the code i am using to test the module out is as follows:
I get the expected response for the first two if loops (first Success and then Failed) but the data dumper prints undef for $dist, when I am expecting a value of 1 for distance.
if anyone has any experience of using this module or can work out where i'm going wrong, basically i can get the is_adjacent($u,$v) object method to work but not the distance($u,$v) method.
thanks
i'm not sure if anyone can help, as I am having a problem with a specific module - called Graph-0.74 (
basically i am trying to use the Graph::AdjacencyMatrix module, for creating and querying an adjacency matrix and also a distance matrix. I can get the adjacency matrix to work fine, but not the distance matrix. If anyone has time to install the module and give me some tips i'd be really grateful!
the code i am using to test the module out is as follows:
Code:
use Graph::Directed;
use Graph::AdjacencyMatrix;
use Data::Dumper;
my $g = Graph::Directed->new;
$g->add_edge("A","B");
$g->add_edge("A","C");
$g->add_edge("B","C");
$g->add_edge("C","D");
my $am = Graph::AdjacencyMatrix->new($g, distance_matrix => 1);
if ($am->is_adjacent("A","B")) {
print "Success\n";
}
else { print "Failed\n"; }
if ($am->is_adjacent("A","D")) {
print "Success\n";
}
else { print "Failed\n"; }
my $dist = $am->distance("A","B");
print Dumper($dist);
I get the expected response for the first two if loops (first Success and then Failed) but the data dumper prints undef for $dist, when I am expecting a value of 1 for distance.
if anyone has any experience of using this module or can work out where i'm going wrong, basically i can get the is_adjacent($u,$v) object method to work but not the distance($u,$v) method.
thanks