
Thanks Jeremiah,
But I'm talking about edge weights - why would you put in "get(vertex_index,g)" and not "get(edge_index,g)" or similar (I've tried this simple substitution and it doesn't work; so it's obviously more complex than that)?
OK. I misread that -- you do want edge_index. You will need to provide them yourself, though. You must have some mapping from edges to numbers already to index the vector; that needs to be turned into a property map.
In any case I've tried more or less exactly what you suggested as follows but the compiler spits out a long error, reported below (libboost1.40):
-------- #include
class road; typedef adjacency_list Graph; typedef boost::vertex_descriptor vdest; vdest shortest_path(Graph& g, vdest src, vdest dst) { vector<vdest> parent(num_vertices(g)); vector<double> agent_weightmap(num_edges(g)); dijkstra_shortest_paths(g,src, //weight_map(get(&road::transit_time,g)) // ---> this weight_map works weight_map(make_iterator_property_map(agent_weightmap.begin(), get(vertex_index, g))) .predecessor_map(make_iterator_property_map(parent.begin(), get(vertex_index, g))));
vdest vd; for (vd=dst ; parent[vd]!=src ; vd=parent[vd]); return(vd); } --------
Compiler error: ------- /usr/include/boost/property_map/property_map.hpp: In function ‘Reference boost::get(... [lots of instantiated froms] ... instantiated from [dijkstra_shortest_paths(...)] /usr/include/boost/property_map/property_map.hpp:317: error: no match for ‘operator[]’ in ‘(const boost::iterator_property_map<__gnu_cxx::__normal_iterator
I'm getting a backward warning on hash_set included from boost/graph/adjacency_list.hpp - could this be an issue?
The warning is not interesting -- it's just saying that BGL is using old-style hash tables; 1.41 (I believe) has this fixed. I do not know the exact cause of the operator[] error; you removed too much of the error message to tell. -- Jeremiah Willcock