BGL actually has an example of using dijkstra_shortest_paths
with listS/listS, but it’s not linked to from the HTML documentation: http://www.boost.org/doc/libs/release/libs/graph/example/dijkstra-example-listS.cpp
What the error message is trying to tell you (error: no match for ‘operator=’ in ‘index.boost::adj_list_vertex_property_map...ValueType = boost::detail::error_property_not_found...
) is that there is no per-vertex storage for the vertex_index_t
property, which is what adj_list_vertex_property_map
needs. To fix the problem you can either change your Graph
typedef
to include per-vertex storage for the vertex_index_t
property or use an “external” property map such as associative_property_map
.
The dijkstra-example-listS.cpp
example uses the approach of changing the graph typedef
. To use this approach in your code, you could define:
typedef boost::adjacency_list <boost::listS, boost::listS, boost::directedS,
boost::property<boost::vertex_name_t, std::string, boost::property<boost::vertex_index_t, int> >,
boost::property<boost::edge_weight_t, Weight> > Graph;