Re: [Boost-users] Getting vertices names.

Hi there! Here is my piece of code, where the error raises: void MyGraph::Load( string filename ) { using namespace boost; graph_traits<GraphvizDigraph>::vertex_iterator i; GraphvizDigraph g; read_graphviz(filename, g); graph_property<GraphvizDigraph, graph_name_t>::type& name = get_property( g, graph_name ); Name( name ); boost::property_map<boost::GraphvizDigraph, boost::vertex_attribute_t>::type& va = boost::get(boost::vertex_attribute, g); boost::property_map< GraphvizDigraph, vertex_name_t>::type& vn = get(vertex_name, g); /* First, lets load all needed properties for vertices */ for(i = vertices(g).first; i != vertices(g).second; ++i ) { map<string, string>& m = va[(*i)]; for( std::map<string, string>::const_iterator p_key = m.begin(); p_key != m.end(); ++p_key ) { std::cout<<vn[(*i)]<<endl; /* ^^^^ this is the line where the problem arises. he thing is to make the following line work (first argument is std::string ), but there was an error here and i decided to test like this. */ SetObjAttribute( vn[(*i)], const_cast<std::string&>(p_key->first), const_cast<std::string&>(p_key-
second) ); } } }
Jeremy Siek <jsiek@osl.iu.edu>:
Hi Maxx,
From what you've posted, I can't tell what the problem is. If you post a short but complete program exhibiting the problem I'll take a look.
Cheers, Jeremy
On Feb 24, 2004, at 8:42 AM, Maxx Sloyko wrote:
Hi there!
May be I'm asking something unbeleivably stupid, but anyway here is
my
problem. I need to get the names of all vertices in the graph (It is GraphvizDigraph), so ---------------------------------------------------- using namespace boost; property_map< GraphvizDigraph, vertex_name_t>::type& vn = get(vertex_name, g); graph_traits<GraphvizDigraph>::vertex_iterator i;
for(i = vertices(g).first; i != vertices(g).second; ++i ) { std::cout<< vn[*i]<<endl; } ----------------------------------------------------
And here is the error I got: ---------------------------------------------------- c:\Documents and Settings\MAKC\My Documents\Visual Studio Projects\Graph\MyGraph.cpp(61) : error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'boost::vec_adj_list_any_vertex_pa::bind_<Tag,Graph,Property>::value _type' (or there is no acceptable conversion) with [ Tag=boost::vertex_name_t, Graph=boost::detail::subgraph_any_pmap::bind_<boost:: vertex_name_t,boost: :GraphvizDigraph,boost::detail::vertex_property_map<boost:: GraphvizDigrap h,boost::vertex_name_t>::Property>::Graph,
Property=boost::detail::vertex_property_map<boost::detail:: subgraph_any_p
map::bind_<boost::vertex_name_t,boost::GraphvizDigraph,boost::detail::
ver tex_property_map<boost::GraphvizDigraph,boost::vertex_name_t>:: Property>: :Graph,boost::vertex_name_t>::Property ] -----------------------------------------------------
Since this code is almost "CopyPasted" from the library example, my beleif is that it should work. At what point I have to change my worldview? :)
Thanks in advance.
------------------------------------- |your sincerely, Maxx, | | mailto:maxxua@pisem.net | ------------------------------------- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Jeremy Siek <jsiek@osl.iu.edu> http://www.osl.iu.edu/~jsiek Ph.D. Student, Indiana University Bloomington C++ Booster (http://www.boost.org) Office phone: (812) 856-1820 _______________________________________________
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------------- |your sincerely, Maxx, | | mailto:maxxua@pisem.net | -------------------------------------

Hi Maxx, On Feb 24, 2004, at 11:40 AM, Maxx Sloyko wrote:
From what you've posted, I can't tell what the problem is. If you post a short but complete program exhibiting the problem ^^^^^^^^^ I'll take a look.
I'm sorry for being pedantic about this. Best regards, Jeremy _______________________________________________ Jeremy Siek <jsiek@osl.iu.edu> http://www.osl.iu.edu/~jsiek Ph.D. Student, Indiana University Bloomington C++ Booster (http://www.boost.org) Office phone: (812) 856-1820 _______________________________________________
participants (2)
-
Jeremy Siek
-
Maxx Sloyko