Algorithm-Functional-BFS

 view release on metacpan or  search on metacpan

lib/Algorithm/Functional/BFS.pm  view on Meta::CPAN

    confess 'Missing "victory_func" parameter' unless $opts{victory_func};

    my %self =
    (
        adjacent_nodes_func => $opts{adjacent_nodes_func},
        victory_func        => $opts{victory_func},
        include_start_node  => $opts{include_start_node},
        one_result          => $opts{one_result},
    );

    bless(\%self, $class);
}

=head2 search($start_node)

    Perform a breadth-first-search from the specified node until the depth at
    which at least one node satisfies the victory condition.

    Returns an array ref of routes.  Each route is an array ref of the nodes
    that are along the route from the start node to the node at which the
    victory condition was satisfied.  Because this implementation works on

t/tests/Test/ObjectsAsNodes.pm  view on Meta::CPAN

sub new
{
    my ($class, %args) = @_;

    my %self =
    (
        name           => $args{name},
        adjacent_nodes => $args{adjacent_nodes},
    );

    return bless(\%self, $class);
}

sub get_name
{
    my ($self) = @_;
    return $self->{name};
}

sub set_adjacent_nodes
{



( run in 0.372 second using v1.01-cache-2.11-cpan-de7293f3b23 )