Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

BFSVisitor#

class BFSVisitor[source]#

Bases: object

A visitor object that is invoked at the event-points inside the bfs_search() algorithm. By default, it performs no action, and should be used as a base class in order to be useful.

Methods

black_target_edge

This is invoked on the subset of non-tree edges whose target vertex is colored black at the time of examination.

discover_vertex

This is invoked when a vertex is encountered for the first time.

finish_vertex

This is invoked on vertex v after all of its out edges have been examined.

gray_target_edge

This is invoked on the subset of non-tree edges whose target vertex is colored gray at the time of examination.

non_tree_edge

This is invoked on back or cross edges for directed graphs and cross edges for undirected graphs.

tree_edge

This is invoked on each edge as it becomes a member of the edges that form the search tree.