mirror of
https://github.com/boostorg/graph.git
synced 2026-02-01 08:32:11 +00:00
170 lines
3.9 KiB
HTML
170 lines
3.9 KiB
HTML
<HTML>
|
|
<!--
|
|
-- Copyright (c) Jeremy Siek, Lie-Quan Lee, and Andrew Lumsdaine 2000
|
|
--
|
|
-- Permission to use, copy, modify, distribute and sell this software
|
|
-- and its documentation for any purpose is hereby granted without fee,
|
|
-- provided that the above copyright notice appears in all copies and
|
|
-- that both that copyright notice and this permission notice appear
|
|
-- in supporting documentation. We make no
|
|
-- representations about the suitability of this software for any
|
|
-- purpose. It is provided "as is" without express or implied warranty.
|
|
-->
|
|
<Head>
|
|
<Title>Boost Graph Library: BellmanFordVisitor</Title>
|
|
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
|
ALINK="#ff0000">
|
|
<IMG SRC="../../../c++boost.gif"
|
|
ALT="C++ Boost">
|
|
|
|
<BR Clear>
|
|
|
|
<H1>BellmanFordVisitor Concept</H1>
|
|
|
|
This concept defines the visitor interface for <a
|
|
href="./bellman_ford_shortest_paths.html"><tt>bellman_ford_shortest_paths()</tt></a>.
|
|
Users can define a class with the BellmanFordVisitor interface and
|
|
pass and object of the class to <tt>bellman_ford_shortest_paths()</tt>,
|
|
thereby augmenting the actions taken during the graph search.
|
|
|
|
<h3>Refinement of</h3>
|
|
|
|
none
|
|
<p>
|
|
|
|
<h3>Notation</h3>
|
|
|
|
<Table>
|
|
<TR>
|
|
<TD><tt>V</tt></TD>
|
|
<TD>A type that is a model of BellmanFordVisitor.</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><tt>vis</tt></TD>
|
|
<TD>An object of type <tt>V</tt>.</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><tt>G</tt></TD>
|
|
<TD>A type that is a model of Graph.</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><tt>g</tt></TD>
|
|
<TD>An object of type <tt>G</tt>.</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><tt>e</tt></TD>
|
|
<TD>An object of type <tt>boost::graph_traits<G>::edge_descriptor</tt>.</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD><tt>s,u</tt></TD>
|
|
<TD>An object of type <tt>boost::graph_traits<G>::vertex_descriptor</tt>.</TD>
|
|
</TR>
|
|
|
|
</table>
|
|
|
|
<h3>Associated Types</h3>
|
|
|
|
none
|
|
<p>
|
|
|
|
<h3>Valid Expressions</h3>
|
|
|
|
<table border>
|
|
<tr>
|
|
<th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Initialize Vertex</td>
|
|
<td><tt>vis.initialize_vertex(s, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
This is invoked on every vertex of the graph before the start of the
|
|
graph search.
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Examine Edge</td>
|
|
<td><tt>vis.examine_edge(e, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
This is invoked on every edge in the graph <tt>num_vertices(g)</tt> times.
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td>Edge Relaxed</td>
|
|
<td><tt>vis.edge_relaxed(e, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
Upon examination, if the following condition holds then the edge
|
|
is relaxed (its distance is reduced), and this method is invoked.<br>
|
|
<tt>
|
|
tie(u,v) = incident(e, g);<br>
|
|
D d_u = get(d, u), d_v = get(d, v);<br>
|
|
W w_e = get(w, e);<br>
|
|
assert(compare(combine(d_u, w_e), d_v));<br>
|
|
</tt>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Edge Not Relaxed</td>
|
|
<td><tt>edge_not_relaxed(e, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
Upon examination, if the edge is not relaxed (see above) then
|
|
this method is invoked.
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Edge Minimized</td>
|
|
<td><tt>vis.edge_minimized(e, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
After the <tt>num_vertices(g)</tt> iterations through the edge set
|
|
of the graph is complete, one last iteration is made to test whether
|
|
each edge was minimized. If the edge is minimized then this function
|
|
is invoked.
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>Edge Not Minimized</td>
|
|
<td><tt>edge_not_minimized(e, g)</tt></td>
|
|
<td><tt>void</tt></td>
|
|
<td>
|
|
If the edge is not minimized, this function is invoked. This happens
|
|
when there is a negative cycle in the graph.
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
</table>
|
|
|
|
|
|
<br>
|
|
<HR>
|
|
<TABLE>
|
|
<TR valign=top>
|
|
<TD nowrap>Copyright © 2000</TD><TD>
|
|
<A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>,
|
|
Univ.of Notre Dame (<A
|
|
HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)<br>
|
|
<A HREF=http://www.lsc.nd.edu/~llee1>Lie-Quan Lee</A>, Univ.of Notre Dame (<A HREF="mailto:llee1@lsc.nd.edu">llee1@lsc.nd.edu</A>)<br>
|
|
<A HREF=http://www.lsc.nd.edu/~lums>Andrew Lumsdaine</A>,
|
|
Univ.of Notre Dame (<A
|
|
HREF="mailto:lums@lsc.nd.edu">lums@lsc.nd.edu</A>)
|
|
</TD></TR></TABLE>
|
|
|
|
</BODY>
|
|
</HTML>
|