AddEdgeVisitor Concept
The AddEdgeVisitor concept exists to allow for some indirection in
algorithms that modify graphs by adding edges. In such algorithms, it
may be convenient to perform additional operations (such as updating an
edge index map) at points in the algorithm where an edge addition
occurs. Replacing calls to to add_edge with calls to
AddEdgeVisitor::visit_vertex_pair allows for such operations
to be defined independently from the algorithm.
Notation
Visitor |
is a type that models the AddEdgeVisitor concept |
|---|---|
|
is an object of type Visitor |
|
is the type of a graph |
|
are objects of type
|
|
is an object of type
|
|
is an object of type
|
Valid Expressions
| Name | Expression | Return Type | Description |
|---|---|---|---|
Add an Edge |
|
|
Invoked
every time an edge between vertices |
Models
Two models of this concept are defined in the file
add_edge_visitors.hpp:
-
default_add_edge_visitor: The constructor of this class takes no arguments.visit_vertex_pair(u, v, g)is just a dispatch toadd_edge(u, v, g). -
edge_index_update_visitor: The constructor of this class takes two arguments: the first, an EdgeIndexMap, is a ReadWritePropertyMap that maps each edge in the associated graphgto a distinct integer in the range[0, num_edges(g)). The second argument is the number of edges in the underlying graph, which serves as the "next available index" counter within the visitor. For example, in the case the graph used has an initialized interior edge index, theedge_index_update_visitorconstructor should be called withget(edge_index, g)as the edge index andnum_edges(g)as the next available index. Whenvisit_vertex_pair(u, v, g)is called, theedge_index_update_visitorwill add the edge (u,v) to the graph and update the edge index for the newly created edge.