|
Boost-Commit : |
From: asutton_at_[hidden]
Date: 2008-08-26 13:21:55
Author: asutton
Date: 2008-08-26 13:21:54 EDT (Tue, 26 Aug 2008)
New Revision: 48396
URL: http://svn.boost.org/trac/boost/changeset/48396
Log:
Fixed a typo.
Extracted the start_vertex function from a couple search functions.
Text files modified:
sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/algorithm.hpp | 31 +++++++++++++++++++++++--------
sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/visitor.hpp | 2 +-
2 files changed, 24 insertions(+), 9 deletions(-)
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/algorithm.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/algorithm.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/algorithm.hpp 2008-08-26 13:21:54 EDT (Tue, 26 Aug 2008)
@@ -15,6 +15,27 @@
// - search_for (x2)
/**
+ * Prepare a vertex for a search algorithm by coloring it, enqueuing it, and
+ * visiting it.
+ */
+template <
+ typename Graph,
+ typename Vertex,
+ typename ColorMap,
+ typename Buffer,
+ typename Visitor>
+void
+start_vertex(Graph const& g, Vertex v, ColorMap color, Buffer& buf, Visitor vis)
+{
+ typedef color_traits<typename ColorMap::value_type> ColorTraits;
+
+ buf.push(v);
+ color(v, ColorTraits::white());
+ vis.start_vertex(g, v);
+ vis.discover_vertex(v);
+}
+
+/**
* Examine the edge e rooted at vertex u to determine the search action to be
* taken (or not) for the opposite vertex.
*
@@ -171,10 +192,7 @@
typedef color_traits<typename ColorMap::value_type> ColorTraits;
// Initialize the start vertex and put it in the buf.
- color(start, ColorTraits::gray());
- buf.push(start);
- vis.start_vertex(g, start);
- vis.discover_vertex(g, start);
+ start_vertex(g, start, color, buf, vis);
search_vertices(g, color, buf, vis, strat);
}
@@ -203,10 +221,7 @@
for( ; first != last; ++first) {
Vertex v = *first;
- color(v, ColorTraits::gray());
- buf.push(v);
- vis.start_vertex(g, v);
- vis.discover_vertex(g, v);
+ start_vertex(g, v, color, buf, vis);
}
search_vertices(g, color, buf, vis, strat);
}
Modified: sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/visitor.hpp
==============================================================================
--- sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/visitor.hpp (original)
+++ sandbox/SOC/2008/graphs/trunk/boost/graphs/algorithms/search/visitor.hpp 2008-08-26 13:21:54 EDT (Tue, 26 Aug 2008)
@@ -62,7 +62,7 @@
{ }
/**
- * Called for eacch edge that is not a tree edge (i.e., whose target has
+ * Called for each edge that is not a tree edge (i.e., whose target has
* already been discovered). Specific types of non-tree edges can be
* classified as back or cross edges depending on the color of the target.
*/
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk