Graph::RandomPath - Find a random path between two graph vertices
my $generator = Graph::RandomPath->create_generator($g, $from, $to);
say "Vertices on random path 1: ", join ' ', $generator->();
say "Vertices on random path 2: ", join ' ', $generator->();
Generates random paths between two vertices in a Graph.
Returns a reference to a sub routine that returns a list of vertices that describe a path from (inclusive) $start_vertex to $final_vertex (inclusive) in the Graph-compatible object $graph. The function stores a snapshot of the graph, modifications to the orignal graph are ignored. An exception is raised if no paths can be generated, e.g. when there is no path from $start_vertex to $final_vertex at all. The number of vertices in the path determines the length, edge weights are currently ignored.
The options hash %opt can set the following values:
The maximum length for generated paths. The default is 64.
The create_generator function internally calls SPT_Dijkstra on a reduced graph containing only reachable vertices. Depending on how the supplied Graph object implements this method it might not work on large graphs due to the algorithmic complexity of the function.
Copyright (c) 2014 Bjoern Hoehrmann <email@example.com>.
This module is licensed under the same terms as Perl itself.
To install Graph::RandomPath, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.