| 1 | package Graph::DFS; |
| 2 | |
| 3 | use strict; |
| 4 | local $^W = 1; |
| 5 | |
| 6 | use Graph::Traversal; |
| 7 | |
| 8 | use vars qw(@ISA); |
| 9 | @ISA = qw(Graph::Traversal); |
| 10 | |
| 11 | =head1 NAME |
| 12 | |
| 13 | Graph::DFS - graph depth-first search |
| 14 | |
| 15 | =head1 SYNOPSIS |
| 16 | |
| 17 | B<see description> |
| 18 | |
| 19 | =head1 DESCRIPTION |
| 20 | |
| 21 | =over 4 |
| 22 | |
| 23 | =cut |
| 24 | |
| 25 | =pod |
| 26 | |
| 27 | =item new |
| 28 | |
| 29 | $dfs = Graph::DFS->new($G, %param) |
| 30 | |
| 31 | Returns a new depth-first search object for the graph $G |
| 32 | and the (optional) parameters %param. |
| 33 | |
| 34 | =cut |
| 35 | |
| 36 | sub new { |
| 37 | my $class = shift; |
| 38 | my $graph = shift; |
| 39 | |
| 40 | Graph::Traversal::new( $class, |
| 41 | $graph, |
| 42 | current => |
| 43 | sub { $_[0]->{ active_list }->[ -1 ] }, |
| 44 | finish => |
| 45 | sub { pop @{ $_[0]->{ active_list } } }, |
| 46 | @_); |
| 47 | } |
| 48 | |
| 49 | =pod |
| 50 | |
| 51 | =back |
| 52 | |
| 53 | See also C<Graph::Traversal>. |
| 54 | |
| 55 | =head1 COPYRIGHT |
| 56 | |
| 57 | Copyright 1999, O'Reilly & Associates. |
| 58 | |
| 59 | This code is distributed under the same copyright terms as Perl itself. |
| 60 | |
| 61 | =cut |
| 62 | |
| 63 | 1; |