& params) { typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor Vertex; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_search (g, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, vis, color); } //------------------------------------------------------------------------- // Choose between default color and color parameters. Using // function dispatching so that we don't require vertex index if // the color default is not being used. template struct bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, ColorMap color) { bfs_helper (g, s, color, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), params); } }; template <> struct bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, detail::error_property_not_found) { std::vector color_vec(num_vertices(g)); default_color_type c = white_color; null_visitor null_vis; bfs_helper (g, s, make_iterator_property_map (color_vec.begin(), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), c), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_vis)), params); } }; } // namespace detail // Named Parameter Variant template void breadth_first_search (const VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); typedef typename property_value< bgl_named_params, vertex_color_t>::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } // This version does not initialize colors, user has to. template void breadth_first_visit (const IncidenceGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
& params, ColorMap color) { bfs_helper (g, s, color, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), params); } }; template <> struct bfs_dispatch { template static void apply (VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params, detail::error_property_not_found) { std::vector color_vec(num_vertices(g)); default_color_type c = white_color; null_visitor null_vis; bfs_helper (g, s, make_iterator_property_map (color_vec.begin(), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), c), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_vis)), params); } }; } // namespace detail // Named Parameter Variant template void breadth_first_search (const VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); typedef typename property_value< bgl_named_params, vertex_color_t>::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } // This version does not initialize colors, user has to. template void breadth_first_visit (const IncidenceGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
& params, detail::error_property_not_found) { std::vector color_vec(num_vertices(g)); default_color_type c = white_color; null_visitor null_vis; bfs_helper (g, s, make_iterator_property_map (color_vec.begin(), choose_const_pmap(get_param(params, vertex_index), g, vertex_index), c), choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_vis)), params); } }; } // namespace detail // Named Parameter Variant template void breadth_first_search (const VertexListGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); typedef typename property_value< bgl_named_params, vertex_color_t>::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } // This version does not initialize colors, user has to. template void breadth_first_visit (const IncidenceGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. VertexListGraph& ng = const_cast(g); typedef typename property_value< bgl_named_params, vertex_color_t>::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } // This version does not initialize colors, user has to. template void breadth_first_visit (const IncidenceGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
, vertex_color_t>::type C; detail::bfs_dispatch::apply(ng, s, params, get_param(params, vertex_color)); } // This version does not initialize colors, user has to. template void breadth_first_visit (const IncidenceGraph& g, typename graph_traits::vertex_descriptor s, const bgl_named_params& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP
& params) { // The graph is passed by *const* reference so that graph adaptors // (temporaries) can be passed into this function. However, the // graph is not really const since we may write to property maps // of the graph. IncidenceGraph& ng = const_cast(g); typedef graph_traits Traits; // Buffer default typedef typename Traits::vertex_descriptor vertex_descriptor; typedef boost::queue queue_t; queue_t Q; detail::wrap_ref Qref(Q); breadth_first_visit (ng, s, choose_param(get_param(params, buffer_param_t()), Qref).ref, choose_param(get_param(params, graph_visitor), make_bfs_visitor(null_visitor())), choose_pmap(get_param(params, vertex_color), ng, vertex_color) ); } } // namespace boost #endif // BOOST_GRAPH_BREADTH_FIRST_SEARCH_HPP