DFSVisitor#

class graph_tool.search.DFSVisitor[source]#

Bases: object

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

Methods

back_edge(e)

This is invoked on the back edges in the graph.

discover_vertex(u)

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

examine_edge(e)

This is invoked on every out-edge of each vertex after it is discovered.

finish_vertex(e)

This is invoked on vertex u after finish_vertex has been called for all the vertices in the DFS-tree rooted at vertex u.

forward_or_cross_edge(e)

This is invoked on forward or cross edges in the graph.

initialize_vertex(u)

This is invoked on every vertex of the graph before the start of the graph search.

start_vertex(u)

This is invoked on the source vertex once before the start of the search.

tree_edge(e)

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

back_edge(e)[source]#

This is invoked on the back edges in the graph. For an undirected graph there is some ambiguity between tree edges and back edges since the edge (u,v) and (v,u) are the same edge, but both the tree_edge() and back_edge() functions will be invoked. One way to resolve this ambiguity is to record the tree edges, and then disregard the back-edges that are already marked as tree edges. An easy way to record tree edges is to record predecessors at the tree_edge event point.

discover_vertex(u)[source]#

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

examine_edge(e)[source]#

This is invoked on every out-edge of each vertex after it is discovered.

finish_vertex(e)[source]#

This is invoked on vertex u after finish_vertex has been called for all the vertices in the DFS-tree rooted at vertex u. If vertex u is a leaf in the DFS-tree, then the finish_vertex() function is called on u after all the out-edges of u have been examined.

forward_or_cross_edge(e)[source]#

This is invoked on forward or cross edges in the graph. In an undirected graph this method is never called.

initialize_vertex(u)[source]#

This is invoked on every vertex of the graph before the start of the graph search.

start_vertex(u)[source]#

This is invoked on the source vertex once before the start of the search.

tree_edge(e)[source]#

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