[Boost.Graph] Property map of a bundled property
Nobody knows the answer?:) Am I the only one confronted with this question? I mean I could define a structure to include my distance and pass it as a bundled property but isn't that a rather unclean way to manage the problem? Cheers Ewgenij
Ewgenij Sokolovski
Nobody knows the answer?:) Am I the only one confronted with this question? I mean I could define a structure to include my distance and pass it as a bundled property but isn't that a rather unclean way to manage the problem?
Cheers Ewgenij
Sorry, I used the false button:) The original question was: Hello, I want to apply dijkstra_shortest_paths to my Graph. I have added the lengths of the edges with while adding the edges with the function add_edge(vi, vj, distance, *nodesGraph) where vi, vj are the vertex descriptors, distance is the length of the edge and nodesGraph is a pointer to my graph. Now I need to provide an appropriate property map for the bundled property "distance". In the manual I read that I have to provide a member pointer to the property value: file:///usr/share/doc/packages/boost-doc/libs/graph/doc/bundles.html But in my case I do not have a class with members like 'Highway' in the manual. In my case the bundled property is represented by a single float value. And so I need access to it, not to some members of it. I tried to write weight_map(get(&float, myGraph)) instead of weight_map(get(&Highway::miles, map)) in the example, but then I get a compiler message "expected primary expression before "," token". So how can I access the distance? Or comes the compiler message due to some other bug in my code? Ewgenij
On Jul 12, 2007, at 3:27 AM, Ewgenij Sokolovski wrote:
Ewgenij Sokolovski
writes: Nobody knows the answer?:) Am I the only one confronted with this question? I mean I could define a structure to include my distance and pass it as a bundled property but isn't that a rather unclean way to manage the problem?
What you're looking for is get(edge_bundle, map). Use weight_map(get(edge_bundle, map)) for your call to dijkstra_shortest_paths. Enjoy. -krish
Sorry, I used the false button:) The original question was:
Hello, I want to apply dijkstra_shortest_paths to my Graph. I have added the lengths of the edges with while adding the edges with the function
add_edge(vi, vj, distance, *nodesGraph)
where vi, vj are the vertex descriptors, distance is the length of the edge and nodesGraph is a pointer to my graph. Now I need to provide an appropriate property map for the bundled property "distance". In the manual I read that I have to provide a member pointer to the property value:
file:///usr/share/doc/packages/boost-doc/libs/graph/doc/bundles.html
But in my case I do not have a class with members like 'Highway' in the manual. In my case the bundled property is represented by a single float value. And so I need access to it, not to some members of it. I tried to write weight_map(get(&float, myGraph)) instead of weight_map(get (&Highway::miles, map)) in the example, but then I get a compiler message "expected primary expression before "," token". So how can I access the distance? Or comes the compiler message due to some other bug in my code?
Ewgenij
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Krishna Roskin Center for Biomolecular Science and Engineering, UC Santa Cruz mailto:krish@soe.ucsc.edu http://www.soe.ucsc.edu/~krish/ "It is our blasphemy which has made us great, and will sustain us, and which the gods secretly admire in us." --Roger Zelazny, A Rose for Eccclesiastes
participants (2)
-
Ewgenij Sokolovski
-
Krishna Roskin