BFS Visitor Concept
This concept defines the visitor interface for
breadth_first_search().
Users can define a class with the BFS Visitor interface and pass and
object of the class to breadth_first_search(), thereby
augmenting the actions taken during the graph search.
Notation
V |
A type that is a model of BFS Visitor. |
|---|---|
|
An object of type |
|
A type that is a model of Graph. |
|
An object of type |
|
An object of type
|
|
An object of type
|
Valid Expressions
| Name | Expression | Return Type | Description |
|---|---|---|---|
Initialize Vertex |
|
|
This is invoked on every vertex of the graph before the start of the graph search. |
Discover Vertex |
|
|
This is invoked when a vertex is encountered for the first time. |
Examine Vertex |
|
|
This is invoked
on a vertex as it is popped from the queue. This happens immediately
before |
Examine Edge |
|
|
This is invoked on every out-edge of each vertex after it is discovered. |
Tree Edge |
|
|
This is invoked on each edge as it becomes a member of the edges that form the search tree. |
Non-Tree Edge |
|
|
This is invoked on back or cross edges for directed graphs and cross edges for undirected graphs. |
Gray Target |
|
|
This is invoked on the subset of non-tree edges whose target vertex is colored gray at the time of examination. The color gray indicates that the vertex is currently in the queue. |
Black Target |
|
|
This is invoked on the subset of non-tree edges whose target vertex is colored black at the time of examination. The color black indicates that the vertex has been removed from the queue. |
Finish Vertex |
|
|
This invoked on a vertex after all of its out edges have been added to the search tree and all of the adjacent vertices have been discovered (but before the out-edges of the adjacent vertices have been examined). |