|
Boost Users : |
Subject: Re: [Boost-users] [BGL] Color Maps
From: pablo barrio lópez-cortijo (p.barrio.lopez_at_[hidden])
Date: 2010-01-30 13:24:26
Hi Andrew, thanks for your help.
> I would recommend using the named parameter version of the call since it lets you omit optional parameters.
It seems like the right approach. So now my code is as follows:
typedef graph_traits<graph_t>::vertex_descriptor Vertex;
Vertex source;
... some code that finds the appropriate vertex
// DFSActions is the DFS visitor, with actions on vertex discover and finish
DFSActions actions(this);
// Calling DFS with named parameters
depth_first_search(*g, visitor(actions), root_vertex(source));
Problem: the code doesn't compile, and I'm sure the fault is in "root_vertex(source)". This is the (very synthesized) error thrown by the compiler:
property_map.hpp: In instantiation of boost::property_traits<boost::bgl_named_params<long unsigned int, boost::root_vertex_t, boost::no_property> >:
depth_first_search.hpp:192: instantiated from void boost::depth_first_search( long line ) [ with REALLY long line ]
depth_first_search.hpp:222: instantiated from void boost::depth_first_search( long line ) [ with REALLY long line ]
graphdef.cpp:134: instantiated from here
graphdef.cpp:134: instantiated from here
property_map.hpp:31: error: no type named key_type in struct boost::bgl_named_params<long unsigned int, boost::root_vertex_t, boost::no_property>
property_map.hpp:33: error: no type named reference in struct boost::bgl_named_params<long unsigned int, boost::root_vertex_t, boost::no_property>
property_map.hpp:34: error: no type named category in struct boost::bgl_named_params<long unsigned int, boost::root_vertex_t, boost::no_property>
And many other errors, but this is the first one. To check if the problem was in my "source" vertex, I changed the call to DFS with the default value for the root_vertex (looked up in the header file):
depth_first_search(*g, visitor(actions), root_vertex(*vertices(*g).first));
The error keeps showing. Having a look at the DFS source code, it seems that the named param function expects a root_vertex of type root_vertex_t, which appears several times in the error msg. The Boost docs specify a type of graph_traits<graph_t>::vertex_descriptor, which is what I'm using now. I suppose it's the same type, but I've not found the type definition. I'm sure it must be a very stupid mistake, but I can't see it.
Any clues?
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net