Now my problem is:
Is there any faster way to gather the distance map from the dijkstra_shortest_paths?
The obvious solution is to manually exchange messages between the processors. But certainly there is a more transparent way to do that.
I was looking at the distributed property map but I wasn't able to find any example to check if that is what I need.
The distributed property map basically acts as a DSM so you can get() or request() the results of remote values (get() returns the default value_type of your distributed property map in the case where the remote value is not cached locally). Requested values are guaranteed to be received following the next synchronize() call (but may appear earlier if allowed by your property map).
So if what you want to do is gather the distance values for all vertices in the graph on one process something like:
DistanceMap distance;
Graph g;
// total vertices on all processors, easy to get with an all_reduce() on num_vertices(g)
graph_traits<Graph>::vertices_size_type N;
for (graph_traits<Graph>::vertices_size_type i = 0; i < N; ++i) {
graph_traits<Graph>::vertices_size_type v = vertex(i, g);
if (get(get(vertex_owner, g), v) != process_id(process_group(g)))
request(distance, v);
}
synchronize(distance);
The if() statement basically just avoids requesting local values, you could also do something like:
for (graph_traits<Graph>::vertices_size_type i = 0; i < N; ++i) {
get(distance, vertex(i, g)); // return value unused
}
synchronize(distance);
After the call to synchronize() returns you can use the remote values in 'distance' you just retrieved.
Hope that helps.
-Nick