|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r71704 - trunk/libs/graph_parallel/example
From: ngedmond_at_[hidden]
Date: 2011-05-03 19:04:40
Author: ngedmond
Date: 2011-05-03 19:04:39 EDT (Tue, 03 May 2011)
New Revision: 71704
URL: http://svn.boost.org/trac/boost/changeset/71704
Log:
Added distance map initialization and 'min' reduction operation for distance maps
Text files modified:
trunk/libs/graph_parallel/example/breadth_first_search.cpp | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
Modified: trunk/libs/graph_parallel/example/breadth_first_search.cpp
==============================================================================
--- trunk/libs/graph_parallel/example/breadth_first_search.cpp (original)
+++ trunk/libs/graph_parallel/example/breadth_first_search.cpp 2011-05-03 19:04:39 EDT (Tue, 03 May 2011)
@@ -27,6 +27,9 @@
// Graphviz Output
#include <boost/graph/distributed/graphviz.hpp>
+// For choose_min_reducer
+#include <boost/graph/distributed/distributed_graph_utility.hpp>
+
// Standard Library includes
#include <fstream>
#include <string>
@@ -71,6 +74,12 @@
property_map<Graph, vertex_distance_t>::type distance =
get(vertex_distance, g);
+ // Initialize distances to infinity and set reduction operation to 'min'
+ BGL_FORALL_VERTICES(v, g, Graph) {
+ put(distance, v, std::numeric_limits<std::size_t>::max());
+ }
+ distance.set_reduce(boost::graph::distributed::choose_min_reducer<std::size_t>());
+
put(distance, start, 0);
breadth_first_search
(g, start,
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