BGL using the VertexIndexMap with VertexList=listS
Hello I'm using the BGL and wandering to use dijkstra_short_path I this code struct vertex1 { int step; int node; int MPI; int OMP; int acc; }; struct edge1 { double cost; }; typedef boost::adjacency_list< boost::listS, boost::listS, boost::directedS, vertex1, edge1> Graph; Graph g; std::vector<double> distances(num_vertices(g)); dijkstra_shortest_paths(g, from, weight_map(get(&edge1::cost, g)) .distance_map(make_iterator_property_map(distances.begin(), get(vertex_index, g)))); I have a problem with the VertexIndexMap (I guess is this the problem :) ) as I'm using a adjacenty_list with VertexList=listS does not have an internal vertex_index property. So, Please can you help me to fix this ? what is the VertexIndexMap to be used with the listS VertexList ?? Thanks -- K.H
On Fri, 5 Mar 2010, khaled wrote:
Hello
I'm using the BGL and wandering to use dijkstra_short_path
I this code (snip) std::vector<double> distances(num_vertices(g));
dijkstra_shortest_paths(g, from, weight_map(get(&edge1::cost, g)) .distance_map(make_iterator_property_map(distances.begin(), get(vertex_index, g))));
I have a problem with the VertexIndexMap (I guess is this the problem :) ) as I'm using a adjacenty_list with VertexList=listS does not have an internal vertex_index property. So, Please can you help me to fix this ? what is the VertexIndexMap to be used with the listS VertexList ??
You will need to create one. Look at libs/graph/example/dijkstra-example-listS.cpp in your Boost source tree to see how to create a vertex index map and fill it in. Please write back if that does not solve your issue. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
khaled