summaryrefslogtreecommitdiff
path: root/boost/graph/depth_first_search.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/graph/depth_first_search.hpp')
-rw-r--r--boost/graph/depth_first_search.hpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/boost/graph/depth_first_search.hpp b/boost/graph/depth_first_search.hpp
index d38ad603d0..34d73a2fdd 100644
--- a/boost/graph/depth_first_search.hpp
+++ b/boost/graph/depth_first_search.hpp
@@ -21,6 +21,7 @@
#include <boost/graph/named_function_params.hpp>
#include <boost/ref.hpp>
#include <boost/implicit_cast.hpp>
+#include <boost/parameter.hpp>
#include <boost/concept/assert.hpp>
#include <vector>
@@ -198,7 +199,7 @@ namespace boost {
put(color, u, Color::white()); vis.initialize_vertex(u, g);
}
- if (start_vertex != implicit_cast<Vertex>(*vertices(g).first)){ vis.start_vertex(start_vertex, g);
+ if (start_vertex != detail::get_default_starting_vertex(g)){ vis.start_vertex(start_vertex, g);
detail::depth_first_visit_impl(g, start_vertex, vis, color,
detail::nontruth2());
}
@@ -221,7 +222,7 @@ namespace boost {
if (verts.first == verts.second)
return;
- depth_first_search(g, vis, color, *verts.first);
+ depth_first_search(g, vis, color, detail::get_default_starting_vertex(g));
}
template <class Visitors = null_visitor>
@@ -282,27 +283,27 @@ namespace boost {
}
typedef dfs_visitor<> default_dfs_visitor;
- // Named Parameter Variant
- template <class VertexListGraph, class P, class T, class R>
- void
- depth_first_search(const VertexListGraph& g,
- const bgl_named_params<P, T, R>& params)
- {
- typedef typename boost::graph_traits<VertexListGraph>::vertex_iterator vi;
- std::pair<vi, vi> verts = vertices(g);
- if (verts.first == verts.second)
- return;
- using namespace boost::graph::keywords;
- typedef bgl_named_params<P, T, R> params_type;
- BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(params_type, params)
- depth_first_search
- (g,
- arg_pack[_visitor | make_dfs_visitor(null_visitor())],
- boost::detail::make_color_map_from_arg_pack(g, arg_pack),
- arg_pack[_root_vertex | *vertices(g).first]
- );
+ // Boost.Parameter named parameter variant
+ namespace graph {
+ namespace detail {
+ template <typename Graph>
+ struct depth_first_search_impl {
+ typedef void result_type;
+ template <typename ArgPack>
+ void operator()(const Graph& g, const ArgPack& arg_pack) const {
+ using namespace boost::graph::keywords;
+ boost::depth_first_search(g,
+ arg_pack[_visitor | make_dfs_visitor(null_visitor())],
+ boost::detail::make_color_map_from_arg_pack(g, arg_pack),
+ arg_pack[_root_vertex || boost::detail::get_default_starting_vertex_t<Graph>(g)]);
+ }
+ };
+ }
+ BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(depth_first_search, 1, 4)
}
+ BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(depth_first_search, 1)
+
template <class IncidenceGraph, class DFSVisitor, class ColorMap>
void depth_first_visit
(const IncidenceGraph& g,