Hi Mikuláš, Posting the compilation errors without showing the source code is not very useful... It's possible to adapt property maps, but I think the simplest approach for you would be to use an auxiliary scalar property map, and then copy its values into the vector property map. However, I'm only speculating, since you described your task only very vaguely. Best, Tiago Am 08.08.19 um 10:06 schrieb Mikuláš Poul:
Hi!
For the project I'm working on I need to calculate distances on a graph from a couple of vertices to all other vertices. The topology.shortest_distance can only do either from all vertices or from a single one, and to save time I'd like this to run in parallel, so I set out to implement this in C++. I took inspiration from graph-tool's implementation of shortest_distance for pair-wise distances in unweighted graphs (running BFS from all vertices in parallel), and managed to modify that to only run from some vertices. However I ran into a problem trying to do the same for weighted graphs. I think the problem I have is that when passing the vector for distances to all vertices it is supposed to be a property map and not a vector, but I cannot figure out how to get a 1d property map from a 2d property map on a C++ level, basically I pass a vector<double> property map to my function but I need to pass a simple double property map to the dijskstra function from boost. Could anyone please help me point to how would I do that? Or is my approach wrong completely? What most confuses me that the same approach works fine for breadth_first_search.
The errors I'm getting in compilation:
/usr/include/boost/graph/dijkstra_shortest_paths_no_color_map.hpp:43:63: error: no type named ‘value_type’ in ‘struct boost::property_traits<std::vector<double> >’ 43 | typedef typename property_traits<DistanceMap>::value_type Distance;
/usr/include/boost/pending/indirect_cmp.hpp:32:78: error: no type named ‘value_type’ in ‘struct boost::property_traits<std::vector<double> >’ 32 | typedef typename boost::property_traits<ReadablePropertyMap>::value_type T; | ^ /usr/include/boost/pending/indirect_cmp.hpp:33:76: error: no type named ‘key_type’ in ‘struct boost::property_traits<std::vector<double> >’ 33 | typedef typename boost::property_traits<ReadablePropertyMap>::key_type K;
Thank you,
Mikuláš
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool
-- Tiago de Paula Peixoto <tiago@skewed.de>