astar_search на графе с listS в качестве контейнера вершин?

Кажется, что boost::astar_search не любит графики с boost::listS как контейнер вершин.

typedef boost::adjacency_list<
boost::listS,
boost::listS,
boost::undirectedS,
WaypointNode,
boost::property<boost::edge_weight_t, float> >
Waypoint;

Приведенное выше определение графика компилируется нормально, когда я изменил второй параметр шаблона на boost::vecS в то время как он отказывается компилировать, когда я использую boost::listS,

Я не совсем уверен (так как сообщения об ошибках шаблона не могут быть поняты обычными людьми), но, похоже, проблема в том, что алгоритму нужен доступ к operator[] по какой-то причине. Который не существует, если вы используете listS, Я не совсем уверен, зачем нужен произвольный доступ, так как концептуально вы все равно можете видеть, какой сосед существует для конкретной вершины из списка ребер.

Есть ли что-нибудь, что я могу сделать, чтобы сделать astar_search принимает listS?

РЕДАКТИРОВАТЬ:
вот сообщение об ошибке при попытке компиляции (используя g++) приведенный выше код. Имейте в виду, что это хорошо компилируется, когда я изменил второй boost::listS в boost::vecS

эта строка интересна, в частности, то есть она, кажется, жалуется (или ее отсутствие) operator[]

/usr/local/Cellar/boost/1.49.0/include/boost/property_map/shared_array_property_map.hpp: In member function 'T& boost::shared_array_property_map<T, IndexMap>::operator[](typename boost::property_traits<IndexMap>::key_type) const [with T = boost::default_color_type, IndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>]'

это полные (и громоздкие) сообщения об ошибках:

/usr/local/Cellar/boost/1.49.0/include/boost/property_map/shared_array_property_map.hpp: In member function 'T& boost::shared_array_property_map<T, IndexMap>::operator[](typename boost::property_traits<IndexMap>::key_type) const [with T = boost::default_color_type, IndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>]':
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/property_map.hpp:361:   instantiated from 'void boost::put(const boost::put_get_helper<Reference, PropertyMap>&, K, const V&) [with PropertyMap = boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, Reference = boost::default_color_type&, K = void*, V = boost::default_color_type]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/astar_search.hpp:288:   instantiated from 'void boost::astar_search(const VertexListGraph&, typename boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, AStarVisitor, PredecessorMap, CostMap, DistanceMap, WeightMap, VertexIndexMap, ColorMap, CompareFunction, CombineFunction, CostInf, CostZero) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, AStarHeuristic = DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, AStarVisitor = WaypointNodeVisitor<void*>, PredecessorMap = boost::dummy_property_map, CostMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, DistanceMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, float, const float&, void*, const boost::property<boost::edge_weight_t, float, boost::no_property>, boost::edge_weight_t>, VertexIndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, ColorMap = boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, CompareFunction = std::less<float>, CombineFunction = boost::closed_plus<float>, CostInf = float, CostZero = float]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/astar_search.hpp:330:   instantiated from 'void boost::astar_search(const VertexListGraph&, typename boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, const boost::bgl_named_params<P, T, R>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, AStarHeuristic = DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, P = WaypointNodeVisitor<void*>, T = boost::graph_visitor_t, R = boost::no_property]'
Pathfinding.h:28:   instantiated from here
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/shared_array_property_map.hpp:36: error: no match for 'operator[]' in '((const boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)this)->boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >::data[boost::get [with PropertyMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, Reference = const boost::detail::error_property_not_found&, K = void*](((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >&)((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)(&((const boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)this)->boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >::index))), ((void* const&)((void* const*)(& v))))]'
/usr/local/Cellar/boost/1.49.0/include/boost/smart_ptr/shared_array.hpp:103: note: candidates are: T& boost::shared_array<T>::operator[](ptrdiff_t) const [with T = boost::default_color_type]
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/shared_array_property_map.hpp: In member function 'T& boost::shared_array_property_map<T, IndexMap>::operator[](typename boost::property_traits<IndexMap>::key_type) const [with T = float, IndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>]':
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/property_map.hpp:361:   instantiated from 'void boost::put(const boost::put_get_helper<Reference, PropertyMap>&, K, const V&) [with PropertyMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, Reference = float&, K = void*, V = float]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/astar_search.hpp:289:   instantiated from 'void boost::astar_search(const VertexListGraph&, typename boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, AStarVisitor, PredecessorMap, CostMap, DistanceMap, WeightMap, VertexIndexMap, ColorMap, CompareFunction, CombineFunction, CostInf, CostZero) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, AStarHeuristic = DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, AStarVisitor = WaypointNodeVisitor<void*>, PredecessorMap = boost::dummy_property_map, CostMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, DistanceMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, float, const float&, void*, const boost::property<boost::edge_weight_t, float, boost::no_property>, boost::edge_weight_t>, VertexIndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, ColorMap = boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, CompareFunction = std::less<float>, CombineFunction = boost::closed_plus<float>, CostInf = float, CostZero = float]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/astar_search.hpp:330:   instantiated from 'void boost::astar_search(const VertexListGraph&, typename boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, const boost::bgl_named_params<P, T, R>&) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, AStarHeuristic = DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, P = WaypointNodeVisitor<void*>, T = boost::graph_visitor_t, R = boost::no_property]'
Pathfinding.h:28:   instantiated from here
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/shared_array_property_map.hpp:36: error: no match for 'operator[]' in '((const boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)this)->boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >::data[boost::get [with PropertyMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, Reference = const boost::detail::error_property_not_found&, K = void*](((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >&)((const boost::put_get_helper<const boost::detail::error_property_not_found&, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)(&((const boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >*)this)->boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >::index))), ((void* const&)((void* const*)(& v))))]'
/usr/local/Cellar/boost/1.49.0/include/boost/smart_ptr/shared_array.hpp:103: note: candidates are: T& boost::shared_array<T>::operator[](ptrdiff_t) const [with T = float]
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/vector_property_map.hpp: In member function 'typename std::iterator_traits<typename std::vector<T, std::allocator<_CharT> >::iterator>::reference boost::vector_property_map<T, IndexMap>::operator[](const typename boost::property_traits<IndexMap>::key_type&) const [with T = long unsigned int, IndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>]':
/usr/local/Cellar/boost/1.49.0/include/boost/property_map/property_map.hpp:361:   instantiated from 'void boost::put(const boost::put_get_helper<Reference, PropertyMap>&, K, const V&) [with PropertyMap = boost::vector_property_map<long unsigned int, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, Reference = long unsigned int&, K = void*, V = size_t]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/detail/d_ary_heap.hpp:118:   instantiated from 'void boost::d_ary_heap_indirect<Value, Arity, IndexInHeapPropertyMap, DistanceMap, Compare, Container>::push(const Value&) [with Value = void*, long unsigned int Arity = 4ul, IndexInHeapPropertyMap = boost::vector_property_map<long unsigned int, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, DistanceMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, Compare = std::less<float>, Container = std::vector<void*, std::allocator<void*> >]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/breadth_first_search.hpp:74:   instantiated from 'void boost::breadth_first_visit(const IncidenceGraph&, typename boost::graph_traits<G>::vertex_descriptor, Buffer&, BFSVisitor, ColorMap) [with IncidenceGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, Buffer = boost::d_ary_heap_indirect<void*, 4ul, boost::vector_property_map<long unsigned int, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, std::less<float>, std::vector<void*, std::allocator<void*> > >, BFSVisitor = boost::detail::astar_bfs_visitor<DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, WaypointNodeVisitor<void*>, boost::d_ary_heap_indirect<void*, 4ul, boost::vector_property_map<long unsigned int, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, std::less<float>, std::vector<void*, std::allocator<void*> > >, boost::dummy_property_map, boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, boost::adj_list_edge_property_map<boost::undirected_tag, float, const float&, void*, const boost::property<boost::edge_weight_t, float, boost::no_property>, boost::edge_weight_t>, boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, boost::closed_plus<float>, std::less<float> >, ColorMap = boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >]'
/usr/local/Cellar/boost/1.49.0/include/boost/graph/astar_search.hpp:260:   instantiated from 'void boost::astar_search_no_init(const VertexListGraph&, typename boost::graph_traits<G>::vertex_descriptor, AStarHeuristic, AStarVisitor, PredecessorMap, CostMap, DistanceMap, WeightMap, ColorMap, VertexIndexMap, CompareFunction, CombineFunction, CostInf, CostZero) [with VertexListGraph = boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, AStarHeuristic = DistanceHeuristic<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS> >, AStarVisitor = WaypointNodeVisitor<void*>, PredecessorMap = boost::dummy_property_map, CostMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, DistanceMap = boost::shared_array_property_map<float, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, WeightMap = boost::adj_list_edge_property_map<boost::undirected_tag, float, const float&, void*, const boost::property<boost::edge_weight_t, float, boost::no_property>, boost::edge_weight_t>, ColorMap = boost::shared_array_property_map<boost::default_color_type, boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t> >, VertexIndexMap = boost::adj_list_vertex_property_map<boost::adjacency_list<boost::listS, boost::listS, boost::undirectedS, WaypointNode, boost::property<boost::edge_weight_t, float, boost::no_property>, boost::no_property, boost::listS>, boost::detail::error_property_not_found, const boost::detail::error_property_not_found&, boost::vertex_index_t>, CompareFunction = std::less<float>, CombineFunction = boost::closed_plus<float>, CostInf = float, CostZero = float]'

make[2]: *** [build/Debug/GNU-MacOSX/BotManager.o] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

3

Решение

boost::detail::error_property_not_found&, boost::vertex_index_t это важная часть ошибки. Только списки смежности с vecS, так как их VertexList имеют внутреннюю карту свойств vertex_index по умолчанию. Если вы действительно хотите использовать listS (я считаю, что единственное преимущество, которое он имеет, заключается в том, что удаление вершин проще), вам нужно либо создать карту свойств внутреннего индекса вершины, используя boost::property<boost::vertex_index_t, int, WaypointNode> в объявлении вашего графа, а затем инициализировать его как этот или же этот:

typedef boost::adjacency_list<
boost::listS,
boost::listS,
boost::undirectedS,
boost::property<boost::vertex_index_t, int, WaypointNode>,
boost::property<boost::edge_weight_t, float> >
Waypoint;
Waypoint waypoint_graph;
...
add_vertex(boost::property<boost::vertex_index_t, int,WaypointNode>(0, waypoint_node_0), graph);
add_vertex(boost::property<boost::vertex_index_t, int,WaypointNode>(1, waypoint_node_1), graph);
...
astar_search(waypoint_graph, start, my_heuristic, boost::visitor(my_visitor));

или вы можете создать карту свойств внешнего индекса вершины, инициализировать ее как этот а затем вызвать astar_search с указанным параметром vertex_index_map:

typedef boost::adjacency_list<
boost::listS,
boost::listS,
boost::undirectedS,
WaypointNode,
boost::property<boost::edge_weight_t, float> >
Waypoint;
Waypoint waypoint_graph;
...
add_vertex(waypoint_node_0, graph);
add_vertex(waypoint_node_1, graph);
...
typedef map<typename boost::graph_traits<Waypoint>::vertex_descriptor, size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);
size_t i=0;
BGL_FORALL_VERTICES(v, waypoint_graph, Waypoing)
{
put(propmapIndex, v, i++);
}
...
astar_search(waypoint_graph, start, my_heuristic, boost::visitor(my_visitor).vertex_index_map(propmapIndex));

Эта проблема не является исключительной для astar_search и оба эти решения могут использоваться с большинством алгоритмов в библиотеке Boost.Graph.

3

Другие решения

Я не уверен на 100%, но я думаю, что однажды тестировал astar_search с listS. Я заменил vecS следующего типа графа:

boost::adjacency_list < boost::vecS, boost::vecS,
boost::directedS, boost::no_property,
boost::property<boost::edge_weight_t, Cost> >

Я нашел пример делать кратчайший путь Дейкстры на adjecency_list, который использует listS. Посмотрите на это. Мой пример скомпилирован после комментирования множества вещей, которые зависят от векторов, однако у него все еще есть проблемы с beforecessor_map и distance_map. Пример заменяет те, которые используют property_map.

1