[BGL] Error using breadth_first_search with labeled_graph
Hi, I'm having the above (end of email) error message when compiling my source using breadth_first_search in a labeled_graph, here are some of my definitions: I'm using boost 1.51.0. struct VertexProperty { string x; }; typedef boost::property<boost::edge_weight_t, double> IndexProperty; typedef boost::labeled_graph< boost::adjacency_list<boost::vecS, boost::setS, boost::bidirectionalS, VertexProperty, IndexProperty>, std::string> GraphT; I also created the following visitor: class recurrence_bfs_visitor : public boost::default_bfs_visitor { public: GraphT::vertex_descriptor check_node; recurrence_bfs_visitor(GraphT::vertex_descriptor node) : boost::default_bfs_visitor(), check_node(node) {} template < typename Vertex, typename Graph > void discover_vertex(Vertex u, const Graph & g) const { if( u == check_node ) throw std::runtime_error(""); } }; Then I call my functions in this way: auto v1 = g.vertex(e1); auto v2 = g.vertex(e2); recurrence_bfs_visitor vis(v2); boost::breadth_first_search(g.graph(), v1, boost::visitor(vis)); Where g is my GraphT and e1,e2 are strings that I receive as parameters. Here are the error message: 1>d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2499): error C2039: 'type' : is not a member of 'boost::property_value<PropertyList,Tag>' 1> with 1> [ 1> PropertyList=VertexProperty, 1> Tag=boost::vertex_index_t 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2576) : see reference to class template instantiation 'boost::adj_list_any_vertex_pa::bind_<Tag,Graph,Property>' being compiled 1> with 1> [ 1> Tag=boost::vertex_index_t, 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> Property=VertexProperty 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2709) : see reference to class template instantiation 'boost::detail::adj_list_choose_vertex_pa<Tag,Graph,Property>' being compiled 1> with 1> [ 1> Tag=boost::vertex_index_t, 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> Property=VertexProperty 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\properties.hpp(224) : see reference to class template instantiation 'boost::adj_list_vertex_property_selector::bind_<Graph,Property,Tag>' being compiled 1> with 1> [ 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> Property=VertexProperty, 1> Tag=boost::vertex_index_t 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\properties.hpp(233) : see reference to class template instantiation 'boost::detail::vertex_property_map<Graph,PropertyTag>' being compiled 1> with 1> [ 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> PropertyTag=boost::vertex_index_t 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\named_function_params.hpp(259) : see reference to class template instantiation 'boost::property_map<Graph,Property>' being compiled 1> with 1> [ 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> Property=boost::vertex_index_t 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::detail::const_type_as_type<T>' being compiled 1> with 1> [ 1> T=boost::property_map<boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>,boost::vertex_index_t> 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\mpl\eval_if.hpp(41) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled 1> with 1> [ 1> C=boost::mpl::true_, 1> F1=boost::detail::const_type_as_type<boost::property_map<boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>,boost::vertex_index_t>>, 1> F2=boost::property_map<boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>,boost::vertex_index_t> 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\named_function_params.hpp(274) : see reference to class template instantiation 'boost::mpl::eval_if<C,F1,F2>' being compiled 1> with 1> [ 1> C=boost::is_same<boost::param_not_found,boost::param_not_found>, 1> F1=boost::mpl::eval_if<boost::mpl::true_,boost::detail::const_type_as_type<boost::property_map<boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>,boost::vertex_index_t>>,boost::property_map<boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>,boost::vertex_index_t>>, 1> F2=boost::mpl::identity<boost::param_not_found> 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\breadth_first_search.hpp(316) : see reference to class template instantiation 'boost::detail::choose_impl_result<GraphIsConst,Graph,Param,Tag>' being compiled 1> with 1> [ 1> GraphIsConst=boost::mpl::true_, 1> Graph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> Param=boost::param_not_found, 1> Tag=boost::vertex_index_t 1> ] 1> d:\projects\cprojects\boost_1_51_0\boost\graph\breadth_first_search.hpp(340) : see reference to function template instantiation 'void boost::detail::bfs_dispatch<boost::param_not_found>::apply<VertexListGraph,recurrence_bfs_visitor,boost::graph_visitor_t,boost::no_property>(VertexListGraph &,void *,const boost::bgl_named_params<T,Tag,Base> &,boost::param_not_found)' being compiled 1> with 1> [ 1> VertexListGraph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> T=recurrence_bfs_visitor, 1> Tag=boost::graph_visitor_t, 1> Base=boost::no_property 1> ] 1> d:\novosprojetos\experiments\orcgraph\graphlib\graph.cpp(124) : see reference to function template instantiation 'void boost::breadth_first_search<boost::adjacency_list<OutEdgeListS,VertexListS,DirectedS,VertexProperty,EdgeProperty>,recurrence_bfs_visitor,boost::graph_visitor_t,boost::no_property>(const VertexListGraph &,void *,const boost::bgl_named_params<T,Tag,Base> &)' being compiled 1> with 1> [ 1> OutEdgeListS=boost::vecS, 1> VertexListS=boost::setS, 1> DirectedS=boost::bidirectionalS, 1> VertexProperty=VertexProperty, 1> EdgeProperty=IndexProperty, 1> VertexListGraph=boost::adjacency_list<boost::vecS,boost::setS,boost::bidirectionalS,VertexProperty,IndexProperty>, 1> T=recurrence_bfs_visitor, 1> Tag=boost::graph_visitor_t, 1> Base=boost::no_property 1> ] 1>d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2504): error C3203: 'type' : unspecialized class template can't be used as a template argument for template parameter 'ValueType', expected a real type 1>d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2504): error C2955: 'boost::type' : use of class template requires template argument list 1> d:\projects\cprojects\boost_1_51_0\boost\type.hpp(14) : see declaration of 'boost::type' 1> d:\projects\cprojects\boost_1_51_0\boost\type.hpp(14) : see declaration of 'boost::type' 1>d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2506): error C3203: 'type' : unspecialized class template can't be used as a template argument for template parameter 'ValueType', expected a real type 1>d:\projects\cprojects\boost_1_51_0\boost\graph\detail\adjacency_list.hpp(2506): error C2955: 'boost::type' : use of class template requires template argument list 1> d:\projects\cprojects\boost_1_51_0\boost\type.hpp(14) : see declaration of 'boost::type' 1> d:\projects\cprojects\boost_1_51_0\boost\type.hpp(14) : see declaration of 'boost::type' 1>d:\projects\cprojects\boost_1_51_0\boost\graph\breadth_first_search.hpp(316): error C2893: Failed to specialize function template 'boost::two_bit_color_map<IndexMap> boost::make_two_bit_color_map(size_t,const IndexMap &)' 1> With the following template arguments: 1> 'boost::adj_list_vertex_property_map' -- Julio Cezar Novais Raffaine Sistemas de Engenharia, Odebrecht SA São Paulo, SP http://elloxas.blogspot.com/
On Tue, 9 Apr 2013, Julio Cezar Novais Raffaine wrote:
Hi, I'm having the above (end of email) error message when compiling my source using breadth_first_search in a labeled_graph, here are some of my definitions:
I'm using boost 1.51.0.
struct VertexProperty { string x; };
typedef boost::property<boost::edge_weight_t, double> IndexProperty; typedef boost::labeled_graph< boost::adjacency_list<boost::vecS, boost::setS, boost::bidirectionalS, VertexProperty, IndexProperty>, std::string> GraphT;
I think the issue is that your vertex container is setS. Many Boost.Graph algorithms, including BFS, require a vertex_index property in your graph by default, and the error message is saying that your graph does not have one. If you hare not modifying your graph frequently, you might want to change the setS to vecS in the definition of GraphT and see if that changes anything. -- Jeremiah Willcock
Thanks Jeremiah, that work for me, know my vistor is working as expected. On Wed, Apr 10, 2013 at 12:28 PM, Jeremiah Willcock <jewillco@osl.iu.edu>wrote:
On Tue, 9 Apr 2013, Julio Cezar Novais Raffaine wrote:
Hi,
I'm having the above (end of email) error message when compiling my source using breadth_first_search in a labeled_graph, here are some of my definitions:
I'm using boost 1.51.0.
struct VertexProperty { string x; };
typedef boost::property<boost::edge_**weight_t, double> IndexProperty; typedef boost::labeled_graph< boost::adjacency_list<boost::**vecS, boost::setS, boost::bidirectionalS, VertexProperty, IndexProperty>, std::string> GraphT;
I think the issue is that your vertex container is setS. Many Boost.Graph algorithms, including BFS, require a vertex_index property in your graph by default, and the error message is saying that your graph does not have one. If you hare not modifying your graph frequently, you might want to change the setS to vecS in the definition of GraphT and see if that changes anything.
-- Jeremiah Willcock _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Julio Cezar Novais Raffaine Sistemas de Engenharia, Odebrecht SA São Paulo, SP http://elloxas.blogspot.com/
participants (2)
-
Jeremiah Willcock
-
Julio Cezar Novais Raffaine