1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
<html>
<head>
<!-- Copyright 2007 Aaron Windsor
--
-- Distributed under the Boost Software License, Version 1.0.
-- (See accompanying file LICENSE_1_0.txt or copy at
-- http://www.boost.org/LICENSE_1_0.txt)
--
-->
<title>AddEdgeVisitor Concept</title>
</head>
<body alink="#ff0000"
bgcolor="#ffffff"
link="#0000ee"
text="#000000"
vlink="#551a8b">
<img src="../../../boost.png" alt="C++ Boost" height="86" width="277">
<br clear="">
<h1>AddEdgeVisitor Concept</h1>
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 <tt>add_edge</tt> with calls to <tt>AddEdgeVisitor::visit_vertex_pair</tt>
allows for such operations to be defined independently from the algorithm.
<h3>Notation</h3>
<table>
<tbody>
<tr>
<td> <tt>Visitor</tt> </td>
<td> is a type that models the AddEdgeVisitor concept </td>
</tr>
<tr>
<td> <tt>vis</tt> </td>
<td> is an object of type Visitor </td>
</tr>
<tr>
<td> <tt>Graph</tt> </td>
<td> is the type of a graph </td>
</tr>
<tr>
<td> <tt>u,v</tt> </td>
<td> are objects of type <tt>graph_traits<Graph>::vertex_descriptor</tt>
</td>
</tr>
<tr>
<td> <tt>e</tt> </td>
<td> is an object of type <tt>graph_traits<Graph>::edge_descriptor</tt>
</td>
</tr>
<tr>
<td> <tt>v</tt> </td>
<td> is an object of type <tt>graph_traits<Graph>::vertex_descriptor</tt>
</td>
</tr><tr>
<td>
</td></tr></tbody></table>
<h3>Associated Types</h3>
None
<h3>Valid Expressions</h3>
<p>
<table border="1">
<tbody><tr><th>Name</th><th>Expression</th><th>Return Type</th>
<th>Description</th>
</tr><tr>
<td> Add an Edge </td>
<td> <tt>vis.visit_vertex_pair(u, v, g)</tt> </td>
<td> <tt>void</tt></td>
<td> Invoked every time an edge between vertices <tt>u</tt> and <tt>v</tt>
should be added to the graph <tt>g</tt>.
</td></tr>
</tbody></table>
</p><h3>Models</h3>
Two models of this concept are defined in the file
<a href="../../../boost/graph/planar_detail/add_edge_visitors.hpp">
<tt>add_edge_visitors.hpp</tt></a>:
<ul>
<li><tt>default_add_edge_visitor</tt>: The constructor of this class takes
no arguments.<tt>visit_vertex_pair(u, v, g)</tt> is just a dispatch to
<tt>add_edge(u, v, g)</tt>.
<li><tt>edge_index_update_visitor</tt>: The constructor of this class takes
two arguments: the first, an EdgeIndexMap,
is a <a href="../../property_map/ReadWritePropertyMap.html">
ReadWritePropertyMap</a> that maps each edge in the associated graph
<tt>g</tt> to a distinct integer in the range <tt>[0, num_edges(g))</tt>.
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, the <tt>edge_index_update_visitor</tt> constructor should be
called with <tt>get(edge_index, g)</tt> as the edge index and
<tt>num_edges(g)</tt> as the next available index. When
<tt>visit_vertex_pair(u, v, g)</tt> is called, the
<tt>edge_index_update_visitor</tt> will add the edge <i>(u,v)</i> to the graph
and update the edge index for the newly created edge.
</ul>
<p>
<br>
</p><hr>
Copyright 2007 Aaron Windsor (<a href="mailto:aaron.windsor@gmail.com">
aaron.windsor@gmail.com</a>)
</body></html>
|