________________________________ From: Oodini
To: boost-users@lists.boost.org Sent: Monday, June 29, 2015 10:21 AM Subject: [Boost-users] Problems to use Boost Graph Hello,
I am trying to understand the boost::dijkstra_shortest_paths() function. I don't understand the second and third arguments. The documentation says they're supposed to be properties map :
OUT: predecessor_map(PredecessorMap p_map) The predecessor map records the edges in the shortest path tree, the tree computed by the traversal of the graph. Upon completion of the algorithm, the edges (p[u],u) for all u in V are in the tree. The shortest path from vertex s to each vertex v in the graph consists of the vertices v, p[v], p[p[v]], and so on until s is reached, in reverse order. The tree is not guaranteed to be a minimum spanning tree. If p[u] = u then u is either the source vertex or a vertex that is not reachable from the source. The PredecessorMap type must be a Read/Write Property Map whose key and value types are the same as the vertex descriptor type of the graph.
but that doesn't work. I have to use an iterator on the properties map, by using :
boost::make_iterator_property_map(pred_map.begin(),vertex_index)
Does the documentation need reviewers ?
The function requires a property map object, like the one make_iterator_property_map returns. It does not work directly with a container. Is there somewhere the documentation says something different from that? -- Jeremiah Willcock