*** t_CosimoGraph0.cpp 2009-07-21 16:50:48.000000000 +0200 --- t_CosimoGraph.cpp 2009-07-21 16:56:26.000000000 +0200 *************** *** 15,22 **** --- 15,24 ---- } //----------------------------------------------------------------------------- + template struct my_visitor : boost::default_bfs_visitor { + my_visitor(ColorMap cm, VisitedOut vo) : m_cm(cm), m_vo(vo) {} template void examine_edge(Edge e, const G &g) { *************** *** 26,32 **** --- 28,46 ---- Vertex t = boost::target(e, g_); boost::put(&vp_t::pred, g_, t, e); boost::put(&vp_t::pv, g_, t, s); + if (m_vo[t] && m_vo[t] < boost::out_degree(t, g_)) + { + m_cm[t] = 0; + } + + if (m_vo[t] < boost::out_degree(t, g_)) + { + m_vo[t] += boost::get(&ep_t::outel, g_, e).size(); + } } + private: + ColorMap m_cm; + VisitedOut m_vo; //The number of out_edges that have already been visited }; //----------------------------------------------------------------------------- *************** *** 69,75 **** } graph_wrapper gw( g ); ! print_graph( gw, get( vertex_index, g ) ); // set the constrains; all the edges can follow all the outer edges, // except the 2-9 edge that can't follow the 9-10 edge, like the --- 83,89 ---- } graph_wrapper gw( g ); ! //print_graph( gw, get( vertex_index, g ) ); // set the constrains; all the edges can follow all the outer edges, // except the 2-9 edge that can't follow the 9-10 edge, like the *************** *** 93,102 **** } boost::queue Q; ! boost::vector_property_map col(get(vertex_index, g)); ! boost::breadth_first_visit( gw, *boost::vertices(gw).first, Q, ! my_visitor(), col ); ! // boost::breadth_first_visit(g, *boost::vertices(g).first, Q, ! // my_visitor(), col); return 0; } --- 107,122 ---- } boost::queue Q; ! typedef boost::vector_property_map col_map_t; ! col_map_t col(get(vertex_index, g)); ! //boost::vector_property_map vo(get(vertex_index, g), 0); ! std::vector vo(boost::num_vertices(g), 0); ! typedef boost::iterator_property_map::iterator, vim_t> vo_t; ! boost::breadth_first_search( gw, *boost::vertices(gw).first, Q, ! my_visitor(col, boost::make_iterator_property_map(vo.begin(), get(vertex_index, g))), ! col ); ! //boost::breadth_first_visit(g, *boost::vertices(g).first, Q, ! //my_visitor(), col); return 0; } +