Graph::Traversal - graph traversal


NAME

Graph::Traversal - graph traversal


SYNOPSIS

    use Graph::Traversal;


DESCRIPTION

        $s = Graph::Traversal->new($G, %param)

Returns a new graph search object for the graph $G and the parameters %param.

Usually not used directly but instead via frontends like Graph::DFS for depth-first searching and Graph::BFS for breadth-first searching:

        $dfs = Graph::DFS->new($G, %param)
        $bfs = Graph::BFS->new($G, %param)

%param documentation to be written

        $S->reset

Resets a graph search object $S to its initial state.

        $v = $s->next_preorder

Returns the next vertex in preorder of the graph encapsulated within the search object $s.

        ($u, $v) = $s->next_edge

Returns the vertices of the next edge of the graph encapsulated within the search object $s.

        @V = $S->preorder

Returns all the vertices in preorder of the graph encapsulated within the search object $S.

        @V = $S->postorder

Returns all the vertices in postorder of the graph encapsulated within the search object $S.

        @V = $S->edges

Returns all the edges of the graph encapsulated within the search object $S.

        @R = $S->roots

Returns all the root vertices of the trees of the graph encapsulated within the search object $S. ``The root vertices'' is ambiguous: what really happens is that either the roots from the previous search made on the $s are returned; or a preorder search is done and the roots of this search are returned.

        %R = $S->vertex_roots

Returns as a hash of ($vertex, $root) pairs all the vertices and the root vertices of their search trees of the graph encapsulated within the search object $S. ``The root vertices'' is ambiguous; see the documentation of the roots() method for more details.


COPYRIGHT

Copyright 1999, O'Reilly & Associates.

This code is distributed under the same copyright terms as Perl itself.

 Graph::Traversal - graph traversal