#line 935 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst" #include #include #include BOOST_PARAMETER_NAME((_graph, graphs) graph) BOOST_PARAMETER_NAME((_visitor, graphs) visitor) BOOST_PARAMETER_NAME((_root_vertex, graphs) root_vertex) BOOST_PARAMETER_NAME((_index_map, graphs) index_map) BOOST_PARAMETER_NAME((_color_map, graphs) color_map) using boost::mpl::_; #line 859 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst" // We first need to define a few metafunction that we use in the // predicates below. template struct traversal_category { typedef typename boost::graph_traits::traversal_category type; }; template struct vertex_descriptor { typedef typename boost::graph_traits::vertex_descriptor type; }; template struct value_type { typedef typename boost::property_traits::value_type type; }; template struct key_type { typedef typename boost::property_traits::key_type type; }; template boost::iterator_property_map< boost::default_color_type*, IndexMap , boost::default_color_type, boost::default_color_type& > default_color_map(Size num_vertices, IndexMap const& index_map) { std::vector colors(num_vertices); return &colors[0]; } BOOST_PARAMETER_FUNCTION( (void), depth_first_search, graphs , (required (graph , *(boost::mpl::and_< boost::is_convertible< traversal_category<_>, boost::incidence_graph_tag > , boost::is_convertible< traversal_category<_>, boost::vertex_list_graph_tag > >) )) (optional (visitor, *, boost::dfs_visitor<>()) // not checkable (root_vertex , (vertex_descriptor) , *vertices(graph).first) (index_map , *(boost::mpl::and_< boost::is_integral > , boost::is_same< vertex_descriptor, key_type<_> > >) , get(boost::vertex_index,graph)) (in_out(color_map) , *(boost::is_same< vertex_descriptor, key_type<_> >) , default_color_map(num_vertices(graph), index_map) ) ) ) #line 949 "/home/daniel/dev/boost/trunk/libs/parameter/doc/index.rst" {} int main() { typedef boost::adjacency_list G; enum {u, v, w, x, y, z, N}; typedef std::pair E; E edges[] = {E(u, v), E(u, x), E(x, v), E(y, x), E(v, y), E(w, y), E(w,z), E(z, z)}; G g(edges, edges + sizeof(edges) / sizeof(E), N); depth_first_search(g); depth_first_search(g, _root_vertex = (int)x); }