Jarkko Hietaniemi > Graph-0.20105 > Graph::Traversal

Download:
Graph-0.20105.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  4
Open  1
View Bugs
Report a bug
Source   Latest Release: Graph-0.91

NAME ^

Graph::Traversal - graph traversal

SYNOPSIS ^

    use Graph::Traversal;

DESCRIPTION ^

new

        $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

reset

        $S->reset

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

next_preorder

        $v = $s->next_preorder

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

next_postorder

        $v = $S->next_postorder

Returns the next vertex in postorder of the graph encapsulated within the search object $S.

next_edge

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

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

preorder

        @V = $S->preorder

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

postorder

        @V = $S->postorder

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

edges

        @V = $S->edges

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

roots

        @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.

_vertex_roots

        %R = $S->_vertex_roots

Returns as a hash of ($vertex, index) pairs where index is an index into the vertex_root list of the traversal.

"The root vertices" is ambiguous; see the documentation of the roots() method for more details.

(This is the old vertex_roots().)

vertex_roots

        %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.

(See also _vertex_roots()).

COPYRIGHT ^

Copyright 1999, O'Reilly & Associates.

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