Path::Graph is a Perl module created to generate paths from hash graph.
SYNOPSIS
Code 1
#!usr/bin/perl
my %graph = ( A => {B=>1,C=>4}, B => {A=>1,C=>2}, C => {A=>4,B=>2}
);
use Paths::Graph;
my $g = Paths::Graph->new(-origin=>"A",-destiny=>"C",-graph=>%graph);
my @paths = $g->shortest_path();
for my $path (@paths) {
print "Shortest Path:" . join ("->" , @$path) . " Cost:". $g->get_path_cost(@$path) ."n";
}
This package provides an object class which can be used to get diferents graph paths , with only pure perl code and I don't use other packet or module cpan.
This class calculates the shortest path between two nodes in a graph and return in other method , vals in the execution time (free_path_event).
Technically , the graph is composed of vertices (nodes) and edges (with optional weights) linked between them.
The shortest path is found using the Dijkstra's algorithm. This algorithm is the fastest and requires all weights to be positive.
The object builds a help about this concept of the graph's , exist a method named debug().
Product's homepage
Requirements:
· Perl