NASM 0.99.05
[nasm/avx512.git] / perllib / Graph / Traversal / DFS.pm
blob4b109bd8ac0a3906c656a007fb68debeadf68312
1 package Graph::Traversal::DFS;
3 use strict;
5 use Graph::Traversal;
6 use base 'Graph::Traversal';
8 sub current {
9 my $self = shift;
10 $self->{ order }->[ -1 ];
13 sub see {
14 my $self = shift;
15 pop @{ $self->{ order } };
18 *dfs = \&Graph::Traversal::postorder;
21 __END__
22 =pod
24 =head1 NAME
26 Graph::Traversal::DFS - depth-first traversal of graphs
28 =head1 SYNOPSIS
30 use Graph;
31 my $g = Graph->new;
32 $g->add_edge(...);
33 use Graph::Traversal::DFS;
34 my $d = Graph::Traversal::DFS->new(%opt);
35 $d->dfs; # Do the traversal.
37 =head1 DESCRIPTION
39 With this class one can traverse a Graph in depth-first order.
41 The callback parameters %opt are explained in L<Graph::Traversal>.
43 =head2 Methods
45 The following methods are available:
47 =over 4
49 =item dfs
51 Traverse the graph in depth-first order.
53 =back
55 =head1 SEE ALSO
57 L<Graph::Traversal>, L<Graph::Traversal::BFS>, L<Graph>.
59 =cut