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 ?
On Mon, 29 Jun 2015 18:21:51 +0200, Oodini
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 : [...]
There are some examples with boost::dijkstra_shortest_paths() at http://theboostcpplibraries.com/boost.graph-algorithms. Maybe they help you getting started? Boris
Yes, this site was very helpful. But as it doesn't cover all the Boost features, I need to know if I can trust the doc for my other needs, or if I have to consider it as obsolete, and instead refer to the BGL code... ----- Mail original -----
De: "Boris Schäling"
À: boost-users@lists.boost.org Envoyé: Mercredi 1 Juillet 2015 10:41:47 Objet: Re: [Boost-users] Problems to use Boost Graph There are some examples with boost::dijkstra_shortest_paths() at http://theboostcpplibraries.com/boost.graph-algorithms. Maybe they help you getting started?
Boris
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
----- Original Message -----
From: Oodini
To: boost-users@lists.boost.org Cc: Sent: Wednesday, July 1, 2015 2:46 AM Subject: Re: [Boost-users] Problems to use Boost Graph Yes, this site was very helpful.
But as it doesn't cover all the Boost features, I need to know if I can trust the doc for my other needs, or if I have to consider it as obsolete, and instead refer to the BGL code...
The documentation should still be fully accurate with respect to the current version of the code. -- Jeremiah Willcock
________________________________ 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
participants (3)
-
Boris Schäling
-
Jeremiah Willcock
-
Oodini