home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / BFS.pm < prev    next >
Encoding:
Perl POD Document  |  1999-08-19  |  850 b   |  62 lines

  1. package Graph::BFS;
  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::BFS - graph breadth-first search
  14.  
  15. =head1 SYNOPSIS
  16.  
  17.     use Graph::BFS;
  18.  
  19. =head1 DESCRIPTION
  20.  
  21. =over 4
  22.  
  23. =cut
  24.  
  25. =pod
  26. =item new
  27.  
  28.     $bfs = Graph::BFS->new($G, %param)
  29.  
  30. Returns a new breadth-first search object for the graph $G
  31. and the (optional) parameters %param.
  32.  
  33. =cut
  34. sub new {
  35.     my $class = shift;
  36.     my $graph = shift;
  37.  
  38.     Graph::Traversal::new( $class,
  39.                $graph,
  40.                current =>
  41.                    sub { $_[0]->{ active_list }->[ 0 ] },
  42.                finish  =>
  43.                    sub { shift @{ $_[0]->{ active_list } } },
  44.                @_);
  45. }
  46.  
  47. =pod
  48.  
  49. =back
  50.  
  51. See also C<Graph::Traversal>.
  52.  
  53. =head1 COPYRIGHT
  54.  
  55. Copyright 1999, O'Reilly & Associates.
  56.  
  57. This code is distributed under the same copyright terms as Perl itself.
  58.  
  59. =cut
  60.  
  61. 1;
  62.