[boost::graph] creating an external map for depth_first_search

I cannot figure out how to create a color map for depth first search, i`m using bundled properties and the following type as graph.
adjacency_list

On 10/1/07, v r
I cannot figure out how to create a color map for depth first search, i`m using bundled properties and the following type as graph. adjacency_list
world_graph_t; right now i`m trying to make it like this, but i get 50 errors and cannot deduce what my error is.
template<class VisitorT> THOR_INLINE void DepthFirstSearch(const VisitorT& vis, const vertex_descriptor& start) { using namespace boost; std::vector
color_vec( num_vertices(graph) ); depth_first_search(graph, visitor(vis), color_map(make_iterator_property_map(color_vec.begin(),get(vertex_color,graph))), start); }
Hi,
From the depth_first_search documentation: The type ColorMap must be a model of Read/Write Property Map and its key type must be the graph's vertex descriptor type and the value type of the color map must model ColorValue. Based on the definition of color_vec and the code you've written above, this would mean that vertex_color would have to be an interior property mapping each vertex desciptor to a distinct integer in the range [0..num_vertices(graph)). But your graph declaration doesn't include any interior property declarations. I'm assuming that WorldNode is a struct that contains a vertex_color member? Then you really want to say "get(&WorldNode::vertex_color, graph)" instead of "get(vertex_color,graph)". You also need to initialize WorldNode::vertex_color with the appropriate integer range for all vertices in the graph.
That's my best guess without seeing any of the error messages or the definition of WorldNode. Regards, Aaron

Soth wrote:
I cannot figure out how to create a color map for depth first search, i`m using bundled properties and the following type as graph. adjacency_list
world_graph_t; right now i`m trying to make it like this, but i get 50 errors and cannot deduce what my error is.
template<class VisitorT> THOR_INLINE void DepthFirstSearch(const VisitorT& vis, const vertex_descriptor& start) { using namespace boost; std::vector
color_vec( num_vertices(graph) ); depth_first_search(graph, visitor(vis), color_map(make_iterator_property_map(color_vec.begin(),get(vertex_color,graph))), start); } ---------------------------------
Вы уже с Yahoo!? Испытайте обновленную и улучшенную. Yahoo! Почту! _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
I figured out that i can create property maps this way
template<class VisitorT>
THOR_INLINE void DepthFirstSearchImpl(const VisitorT& vis, const
vertex_descriptor& start, const boost::vecS& tag)
{
using namespace boost;
//this approach works when vecS is used when vertexlist=vecS
vector_property_map
participants (3)
-
Aaron Windsor
-
Soth
-
v r