<div dir="ltr"><div><div><div><br clear="all"></div>Lets say I have a graph g (of type graph_t)<br></div><div><br></div><div>and a color map (boy I wish I had a colormap):<br></div><div><br></div><div>typedef boost::property_map<graph_t, boost::vertex_color_t>::type color_map_t;</div><div><br></div><div>or is it?</div><div><br></div><div>auto indexmap = boost::get(boost::vertex_index, g);<br></div><div>auto colors = boost::make_vector_property_map<boost::default_color_type>(indexmap);<br></div><div><br></div><div>or maybe?</div><div><br></div><div><div>auto indexmap = boost::get(boost::vertex_index, g);<br></div><div>auto colors = boost::make_vector_property_map<boost::vertex_color_t>(indexmap);<br></div><div><br></div><div>or possibly some goop found on the internet?</div></div><div><br></div><div>boost::make_iterator_property_map(color_map.begin(), boost::get(boost::vertex_index, data_->g), color_map[0])<br></div><br><div>or other internet goop?<br></div></div><div><br></div><div>typedef boost::property_map<GraphType, boost::vertex_color_t>::type color_map_t;<br>color_map_t colorMap;<br>boost::color_map(colorMap))</div><div><br></div><div>or other internet goop??<br></div><br>std::vector<int> colorMap(num_vertices(g), boost::white_color);<br><br>so confused... (certainly not surprised why bgl is not a part of stl) Can someone help explain the various types and ways of specifying colormaps and the logic for each way and means?<br><div><div><br>and a function (if I could get that far without VS syntax highlighter going bonkers and gobs of compiler errors.. you know the type):<br></div><div><br></div><div>make_pretty(g, colormap ) <br></div><div><br></div><div>which colors the graph colormap<br><br></div><div><br></div><div>and a filter struct for boost::filtered_graph<Graph, EdgePredicate, VertexPredicate> (where I wonder why if I only want to filter vertices I have to set boost::keep_all for EdgePredicate... sigh... I know the answer... and also know how long it found me to find/figure out boost::keep_all - and if you are looking for boost::keep_all and found it here... your welcome ;-) )<br></div><div><br></div><div>and modifying (probably incorrectly) boost::filtered_graph example to:<br></div><div><br></div><div><br>template <typename ColorMap><br>struct vertex_color_filter_eq {<br> vertex_color_filter_eq() { }<br> vertex_color_filter_eq(ColorMap colormap/*, boost::default_color_type c*/) : m_colormap(colormap)/*, m_c(c)*/ { }<br> <br> template <typename Vertex><br> bool operator()(const Vertex& v) const {<br> return 0 < get(m_colormap, v);<br> //return c < get(m_colormap, v);<br> }<br> ColorMap m_colormap;<br> //boost::default_color_type m_c;<br>};<br><br> </div><div>auto indexmap = boost::get(boost::vertex_index, g);<br>auto colors = boost::make_vector_property_map<boost::default_color_type>(indexmap);<br><br>// some where here I would call make_pretty(g, colors)<br><br><br>typedef property_map<graph_t, boost::vertex_color_t>::type ColorMap_t;<br>vertex_color_filter<ColorMap_t> filter(colors);<br><br>// boost::filtered_graph<graph_t, boost::keep_all, VertexPredicate><br>boost::filtered_graph<graph_t, boost::keep_all, vertex_color_filter> fg(g, filter);<br><br><br>// Later say if I could get it compile and better if it compiled and worked I could move on and<br><br>auto color = boost::red_color;<br><br>typedef property_map<graph_t, boost::vertex_color_t>::type ColorMap_t;<br>vertex_color_filter<ColorMap_t> filter(colors, color);<br>boost::filtered_graph<graph_t, boost::keep_all, vertex_color_filter> fg(g, filter);<br><br><br></div><div>Maybe if I color them yellow, I can then reach the wizard pull back the curtain and ask how to create a color map... If I only had a color map. </div><div><br></div><div><br></div><div><br></div><br><div><div><div class="gmail_signature"><br></div> </div></div></div></div>