Color map in boost graph breadth_first_visit

Viewed 3837

I want to use boosts breadth_first_visit method and i'd like to provide it with my own "external" color map. I defined the graph as follows

typedef boost::adjacency_list<boost::setS, boost::listS, boost::undirectedS, 
  boost::property<boost::vertex_index_t, int, 
  boost::property<boost::vertex_color_t, boost::default_color_type, 
  Node_t>>>  GraphType;

where Node_t is a struct, defining the properties for the vertices. However, i can't find out how i can provide the BFS with my own color map. I'd like to store the vertex colors in a vector, so my definition looks like

std::vector<boost::default_color_type> colors;

but i can't figure it out, how to use this for the bfs.

Neither

boost::breadth_first_search(g, *boost::vertices(g).first, 
  boost::color_map(colors));

nor

boost::breadth_first_search(g, *boost::vertices(g).first, 
  boost::color_map(&colors[0]));

is working. While the first gives me a bunch of different compiler errors (e.g. default-int is not supported, "boost::color_traits" use of class type requires type argument list) the second compile aborts with only C2664 : 'boost::put' cannot convert parameter 2 from 'void*' to 'ptrdiff_t'.

So the question is: How can i use my own color-mapping-structure. An additional question would be: How can i get the color-value for a specific vertex_descriptor?

1 Answers
Related