Algorithm::DependencySolver::Traversal - A module for traversing a dependency graph
version 1.01
my $traversal = Algorithm::DependencySolver::Traversal->new( Solver => $solver, visit => sub { my $operation = shift; print "Visited operation: ", $operation->id, "\n"; }, ); $traversal->run;
Given an Algorithm::DependencySolver::Solver.pm object, traverses it in such a way that upon entering a node, all of its prerequisites will have already been entered.
Currently this module is not thread-safe. However, it has been design in such a way that it should be easy to allow concurrency at a later stage, without needing to break backwards compatibility.
Note that if we allow concurrency, the visitable list may be empty, without indicating that the traversal is complete.
visitable
choose
During the traversal, we maintain a list of nodes, visitable, which can be immediately visited. If this list is empty, the traversal is complete.
The choose function is called to decide which node is visitable to visit next. Note that choose is guaranteed to be called, even if visitable is a singleton (but not if it's empty).
Create a linear path and return it as an array of the arguments that would have been passed into the visit function.
visit
Use run_path to run a path created by dryrun.
run_path
dryrun
To install Algorithm::DependencySolver::Solver, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Algorithm::DependencySolver::Solver
CPAN shell
perl -MCPAN -e shell install Algorithm::DependencySolver::Solver
For more information on module installation, please visit the detailed CPAN module installation guide.