2
0
mirror of https://github.com/boostorg/graph.git synced 2026-02-26 04:42:16 +00:00

Merged Boost.Graph, Boost.Graph.Parallel, and Boost.PropertyMap changes from trunk

[SVN r84299]
This commit is contained in:
Jeremiah Willcock
2013-05-16 15:38:05 +00:00
parent 22b521ecf4
commit 67f7bcfa96
31 changed files with 1376 additions and 404 deletions

View File

@@ -16,6 +16,7 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths_no_color_map.hpp>
#include <boost/property_map/property_map.hpp>
using namespace boost;
@@ -36,33 +37,15 @@ main(int, char *[])
};
int weights[] = { 1, 2, 1, 2, 7, 3, 1, 1, 1 };
int num_arcs = sizeof(edge_array) / sizeof(Edge);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
graph_t g(num_nodes);
property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);
for (std::size_t j = 0; j < num_arcs; ++j) {
edge_descriptor e; bool inserted;
boost::tie(e, inserted) = add_edge(edge_array[j].first, edge_array[j].second, g);
weightmap[e] = weights[j];
}
#else
graph_t g(edge_array, edge_array + num_arcs, weights, num_nodes);
property_map<graph_t, edge_weight_t>::type weightmap = get(edge_weight, g);
#endif
std::vector<vertex_descriptor> p(num_vertices(g));
std::vector<int> d(num_vertices(g));
vertex_descriptor s = vertex(A, g);
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
// VC++ has trouble with the named parameters mechanism
property_map<graph_t, vertex_index_t>::type indexmap = get(vertex_index, g);
dijkstra_shortest_paths_no_color_map(g, s, &p[0], &d[0], weightmap,
indexmap, std::less<int>(),
closed_plus<int>(),
(std::numeric_limits<int>::max)(), 0,
default_dijkstra_visitor());
#else
dijkstra_shortest_paths_no_color_map(g, s, predecessor_map(&p[0]).distance_map(&d[0]));
#endif
dijkstra_shortest_paths_no_color_map(g, s,
predecessor_map(boost::make_iterator_property_map(p.begin(), get(boost::vertex_index, g))).
distance_map(boost::make_iterator_property_map(d.begin(), get(boost::vertex_index, g))));
std::cout << "distances and parents:" << std::endl;
graph_traits < graph_t >::vertex_iterator vi, vend;