Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74334 - in sandbox/graph-loop_erased_random_tree: . boost boost/detail boost/detail/metafunction boost/graph boost/graph/detail boost/graph/keywords libs libs/graph libs/graph/doc libs/graph/doc/images libs/graph/example
From: sponage_at_[hidden]
Date: 2011-09-10 11:16:41


Author: expaler
Date: 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
New Revision: 74334
URL: http://svn.boost.org/trac/boost/changeset/74334

Log:
Added Boost.Graph.LoopErasedRandomTree candidate sublibrary.
Added:
   sandbox/graph-loop_erased_random_tree/
   sandbox/graph-loop_erased_random_tree/boost/
   sandbox/graph-loop_erased_random_tree/boost.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/detail/
   sandbox/graph-loop_erased_random_tree/boost/detail/metafunction/
   sandbox/graph-loop_erased_random_tree/boost/detail/metafunction/data_type.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/
   sandbox/graph-loop_erased_random_tree/boost/graph/call_visitors.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_combine_function.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_compare_predicate.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_terminate_predicate.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree_params.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/detail/null_vertex.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/fuse_property_writer.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/keywords/
   sandbox/graph-loop_erased_random_tree/boost/graph/keywords/input_graph.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/keywords/rng_engine.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/keywords/source_vertex.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/keywords/terminate_predicate.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_tree.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_weighted_tree.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/simple_edge_writer.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/boost/graph/vertex_property_map_gen.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/
   sandbox/graph-loop_erased_random_tree/libs/graph/
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/Jamroot (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/boostbook.css (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.html (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.html (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/alert.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/blank.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/caution.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/draft.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/home.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/important.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/next.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/next_disabled.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/note.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/prev.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/prev_disabled.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/smiley.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/tip.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-blank.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-minus.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-plus.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/up.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/up_disabled.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/warning.png (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/lert.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.html (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.html (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.html (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.qbk (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/example/
   sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.cpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.hpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.cpp (contents, props changed)
   sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.hpp (contents, props changed)

Added: sandbox/graph-loop_erased_random_tree/boost.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/boost/detail/metafunction/data_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/detail/metafunction/data_type.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,52 @@
+// Copyright (C) 2007-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_DETAIL_METAFUNCTION_DATA_TYPE_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_DATA_TYPE_HPP_INCLUDED
+
+#include <boost/ref.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/type_traits/remove_const.hpp>
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/type_traits/remove_pointer.hpp>
+#include <boost/type_traits/remove_volatile.hpp>
+#include <boost/type_traits/remove_all_extents.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T>
+ struct data_type
+ {
+ private:
+ typedef typename ::boost::remove_const<
+ typename ::boost::remove_reference<
+ typename ::boost::remove_pointer<
+ typename ::boost::remove_volatile<
+ typename ::boost::remove_all_extents<
+ typename ::boost::unwrap_reference<T>::type
+ >::type
+ >::type
+ >::type
+ >::type
+ >::type
+ lower_type;
+
+ public:
+ typedef typename ::boost::mpl::eval_if<
+ ::boost::is_same<T,lower_type>
+ , ::boost::mpl::identity<T>
+ , data_type<lower_type>
+ >::type
+ type;
+
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,data_type,(T))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_DETAIL_METAFUNCTION_DATA_TYPE_HPP_INCLUDED
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/call_visitors.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/call_visitors.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,264 @@
+// Copyright (C) 2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_CALL_VISITORS_HPP
+#define BOOST_GRAPH_CALL_VISITORS_HPP
+
+#include <utility>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/equal_to.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/fusion/view/filter_view.hpp>
+#include <boost/fusion/iterator.hpp>
+#include <boost/graph/visitors.hpp>
+
+namespace boost {
+ namespace detail {
+
+ template <typename Filter, typename Pair>
+ struct matches_event_filter
+ {
+ typedef ::std::tr1::is_same<Filter,typename Pair::first_type> type;
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,matches_event_filter,(Filter,Pair))
+ };
+
+ // Invoked when itr is past-the-end.
+ template <
+ typename Iterator
+ , typename EndIterator
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_impl(
+ Iterator itr
+ , EndIterator itr_end
+ , T t
+ , InputGraph& input_graph
+ , ::boost::mpl::true_
+ )
+ {
+ }
+
+ // Invoked when itr is not past-the-end.
+ template <
+ typename Iterator
+ , typename EndIterator
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_impl(
+ Iterator itr
+ , EndIterator itr_end
+ , T t
+ , InputGraph& input_graph
+ , ::boost::mpl::false_
+ )
+ {
+ ::boost::fusion::deref(itr).second(t, input_graph);
+ call_visitors_impl(
+ ::boost::fusion::next(itr)
+ , itr_end
+ , t
+ , input_graph
+ , ::boost::mpl::equal_to<
+ ::boost::mpl::int_<0>
+ , typename ::boost::fusion::result_of::distance<
+ typename ::boost::fusion::result_of::next<Iterator>::type
+ , EndIterator
+ >::type
+ >()
+ );
+ }
+
+ // Invoked if std::pair is used as a Boost.Fusion Sequence.
+ template <
+ typename Filter
+ , typename FirstFilter
+ , typename FirstVisitor
+ , typename SecondFilter
+ , typename SecondVisitor
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_dispatch2(
+ ::std::pair<
+ ::boost::fusion::pair<FirstFilter,FirstVisitor>
+ , ::boost::fusion::pair<SecondFilter,SecondVisitor>
+ >& visitors
+ , T t
+ , InputGraph& input_graph
+ )
+ {
+ typedef ::boost::fusion::filter_view<
+ ::std::pair<
+ ::boost::fusion::pair<FirstFilter,FirstVisitor>
+ , ::boost::fusion::pair<SecondFilter,SecondVisitor>
+ >
+ , matches_event_filter<Filter,::boost::mpl::_>
+ >
+ Listeners;
+
+ Listeners listeners(visitors);
+
+ call_visitors_impl(
+ ::boost::fusion::begin(listeners)
+ , ::boost::fusion::end(listeners)
+ , t
+ , input_graph
+ , ::boost::mpl::equal_to<
+ ::boost::mpl::int_<0>
+ , typename ::boost::fusion::result_of::distance<
+ typename ::boost::fusion::result_of::begin<Listeners>::type
+ , typename ::boost::fusion::result_of::end<Listeners>::type
+ >::type
+ >()
+ );
+ }
+
+ // Invoked for Event Visitor Lists.
+ template <
+ typename Filter
+ , typename First
+ , typename Second
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_dispatch2(
+ ::std::pair<First,Second>& visitors
+ , T t
+ , InputGraph& input_graph
+ )
+ {
+ invoke_visitors(visitors, t, input_graph, Filter());
+ }
+
+ // Invoked for other Boost.Fusion sequences.
+ template <
+ typename Filter
+ , typename VisitorList
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_dispatch2(
+ VisitorList& visitors
+ , T t
+ , InputGraph& input_graph
+ )
+ {
+ typedef ::boost::fusion::filter_view<
+ VisitorList
+ , matches_event_filter<Filter,::boost::mpl::_>
+ >
+ Listeners;
+
+ Listeners listeners(visitors);
+
+ call_visitors_impl(
+ ::boost::fusion::begin(listeners)
+ , ::boost::fusion::end(listeners)
+ , t
+ , input_graph
+ , ::boost::mpl::equal_to<
+ ::boost::mpl::int_<0>
+ , typename ::boost::fusion::result_of::distance<
+ typename ::boost::fusion::result_of::begin<Listeners>::type
+ , typename ::boost::fusion::result_of::end<Listeners>::type
+ >::type
+ >()
+ );
+ }
+
+ // So we know that VisitorList is a Boost.Fusion Sequence, but we still
+ // need to know whether or not it's a std::pair and, if so, whether it's
+ // being used as a Boost.Fusion Sequence or as an Event Visitor List.
+ template <
+ typename Filter
+ , typename VisitorList
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_dispatch(
+ VisitorList& visitors
+ , T t
+ , InputGraph& input_graph
+ , ::boost::mpl::true_
+ )
+ {
+ call_visitors_dispatch2<Filter>(
+ visitors
+ , t
+ , input_graph
+ );
+ }
+
+ // Invoked if std::pair is not recognized as a Boost.Fusion Sequence.
+ template <
+ typename Filter
+ , typename VisitorList
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors_dispatch(
+ VisitorList& visitors
+ , T t
+ , InputGraph& input_graph
+ , ::boost::mpl::false_
+ )
+ {
+ invoke_visitors(visitors, t, input_graph, Filter());
+ }
+ } // namespace detail
+
+ //[reference__call_visitors
+ template <
+ typename Filter
+ , typename VisitorList
+ , typename T
+ , typename InputGraph
+ >
+ void
+ call_visitors(
+ VisitorList& visitors
+ , T t
+ , InputGraph& input_graph
+ );
+ //]
+
+ template <
+ typename Filter
+ , typename VisitorList
+ , typename T
+ , typename InputGraph
+ >
+ inline void
+ call_visitors(
+ VisitorList& visitors
+ , T t
+ , InputGraph& input_graph
+ )
+ {
+ detail::call_visitors_dispatch<Filter>(
+ visitors
+ , t
+ , input_graph
+ , typename ::boost::fusion::traits::is_sequence<VisitorList>::type()
+ );
+ }
+} // namespace boost
+
+#endif // BOOST_GRAPH_CALL_VISITORS_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_combine_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_combine_function.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,25 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_DEFAULT_COMBINE_FUNCTION_HPP
+#define BOOST_GRAPH_DETAIL_DEFAULT_COMBINE_FUNCTION_HPP
+
+#include <functional>
+#include <boost/property_map/property_map.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename EdgeWeightMap>
+ inline ::std::plus<typename property_traits<EdgeWeightMap>::value_type>
+ make_default_combine_function(EdgeWeightMap const& map)
+ {
+ return ::std::plus<
+ typename property_traits<EdgeWeightMap>::value_type
+ >();
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_DEFAULT_COMBINE_FUNCTION_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_compare_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_compare_predicate.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,25 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_DEFAULT_COMPARE_PREDICATE_HPP
+#define BOOST_GRAPH_DETAIL_DEFAULT_COMPARE_PREDICATE_HPP
+
+#include <functional>
+#include <boost/property_map/property_map.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename EdgeWeightMap>
+ inline ::std::less<typename property_traits<EdgeWeightMap>::value_type>
+ make_default_compare_predicate(EdgeWeightMap const& map)
+ {
+ return ::std::less<
+ typename property_traits<EdgeWeightMap>::value_type
+ >();
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_DEFAULT_COMPARE_PREDICATE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_terminate_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/default_terminate_predicate.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,39 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_DEFAULT_TERMINATE_PREDICATE_HPP
+#define BOOST_GRAPH_DETAIL_DEFAULT_TERMINATE_PREDICATE_HPP
+
+#include <boost/graph/graph_traits.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ struct default_terminate_predicate
+ {
+ typedef typename graph_traits<InputGraph>::vertex_descriptor
+ first_argument_type;
+ typedef InputGraph const&
+ second_argument_type;
+ typedef bool
+ result_type;
+
+ inline result_type
+ operator()(first_argument_type v, second_argument_type g) const
+ {
+ return false;
+ }
+ };
+
+ template <typename InputGraph>
+ inline default_terminate_predicate<InputGraph>
+ make_default_terminate_predicate(InputGraph const& g)
+ {
+ return default_terminate_predicate<InputGraph>();
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_DEFAULT_TERMINATE_PREDICATE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,794 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_HPP
+#define BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_HPP
+
+#include <vector>
+#include <utility>
+#include <iterator>
+#include <algorithm>
+#include <boost/tr1/tuple.hpp>
+#include <boost/tr1/random.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/concept_check.hpp>
+#include <boost/parameter.hpp>
+#include <boost/ref.hpp>
+#include <boost/function.hpp>
+#include <boost/utility/value_init.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_concepts.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/call_visitors.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/keywords/rng_engine.hpp>
+//#include <boost/graph/adjacency_list.hpp> must be included before this file.
+#include <boost/detail/metafunction/data_type.hpp>
+
+namespace boost {
+
+ struct on_loop_erased_vertex
+ {
+ };
+
+ namespace detail {
+
+ template <
+ typename EdgeIterator
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ >
+ ::std::size_t
+ loop_erased_random_tree_edge_idx(
+ EdgeIterator edge_itr
+ , EdgeIterator edge_end
+ , ArgumentPack const& args
+ , HasEdgeWeights
+ )
+ {
+ typedef typename ::boost::detail::data_type<
+ typename ::boost::parameter::binding<
+ ArgumentPack
+ , ::boost::graph::keywords::tag::weight_map
+ >::type
+ >::type
+ EdgeWeightMap;
+ typedef typename property_traits<EdgeWeightMap>::value_type
+ EdgeWeight;
+
+ ::std::vector<EdgeWeight> weights;
+ EdgeWeightMap const weight_map = args[
+ ::boost::graph::keywords::_weight_map
+ ];
+ function2<EdgeWeight,EdgeWeight,EdgeWeight> combine = args[
+ ::boost::graph::keywords::_distance_combine
+ ];
+
+ for (
+ EdgeWeight weight = initialized_value;
+ edge_itr != edge_end;
+ ++edge_itr
+ )
+ {
+ weights.push_back(
+ weight = combine(weight, get(weight_map, *edge_itr))
+ );
+ }
+
+ typedef typename ::boost::detail::data_type<
+ typename ::boost::parameter::binding<
+ ArgumentPack
+ , ::boost::graph::keywords::tag::rng_engine
+ >::type
+ >::type
+ RNGEngine;
+ typedef ::std::tr1::uniform_real<EdgeWeight>
+ Distribution;
+
+ ::std::tr1::variate_generator<RNGEngine&,Distribution> rng(
+ ::boost::unwrap_ref(args[::boost::graph::keywords::_rng_engine])
+ , Distribution(value_initialized<EdgeWeight>(), weights.back())
+ );
+ function2<bool,EdgeWeight,EdgeWeight> compare = args[
+ ::boost::graph::keywords::_distance_compare
+ ];
+
+ return std::distance(
+ weights.begin()
+ , ::std::lower_bound(weights.begin(), weights.end(), rng(), compare)
+ );
+ }
+
+ template <
+ typename EdgeIterator
+ , typename ArgumentPack
+ >
+ ::std::size_t
+ loop_erased_random_tree_edge_idx(
+ EdgeIterator edge_begin
+ , EdgeIterator edge_end
+ , ArgumentPack const& args
+ , ::boost::mpl::false_
+ )
+ {
+ typedef typename ::boost::detail::data_type<
+ typename ::boost::parameter::binding<
+ ArgumentPack
+ , ::boost::graph::keywords::tag::rng_engine
+ >::type
+ >::type
+ RNGEngine;
+ typedef ::std::tr1::uniform_int< ::std::size_t>
+ Distribution;
+
+ return ::std::tr1::variate_generator<RNGEngine&,Distribution>(
+ ::boost::unwrap_ref(args[::boost::graph::keywords::_rng_engine])
+ , Distribution(0, ::std::distance(edge_begin, edge_end) - 1)
+ )();
+ }
+
+ // The general-purpose RandomSuccessor() implementation;
+ // also the undirected-graph RandomPredecessor() implementation.
+ template <
+ typename Graph
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ , typename DirectionalCategory
+ , typename IsLookingForSuccessor
+ >
+ ::std::pair<
+ typename graph_traits<Graph>::vertex_descriptor
+ , typename graph_traits<Graph>::edge_descriptor
+ >
+ loop_erased_random_tree_vertex_edge(
+ typename graph_traits<Graph>::vertex_descriptor const vertex
+ , Graph const& g
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , DirectionalCategory
+ , IsLookingForSuccessor
+ )
+ {
+ typedef graph_traits<Graph> GraphTraits;
+ typedef typename GraphTraits::vertex_descriptor Vertex;
+ typedef typename GraphTraits::edge_descriptor Edge;
+ typedef ::std::pair<Vertex,Edge> Result;
+
+ // In an undirected graph, there is no functional difference
+ // between the in-edges and the out-edges of a vertex.
+ typename GraphTraits::out_edge_iterator ei, ei_end;
+
+ ::std::tr1::tie(ei, ei_end) = out_edges(vertex, g);
+
+ if (ei == ei_end)
+ {
+ return Result(GraphTraits::null_vertex(), Edge());
+ }
+
+ ::std::advance(
+ ei
+ , loop_erased_random_tree_edge_idx(ei, ei_end, args, has_ew)
+ );
+
+ // However, if the graph is undirected and we are looking for
+ // predecessors, then the correct way to obtain the source vertex of
+ // an in-edge is to treat it as an out-edge and find its target.
+ return Result(target(*ei, g), *ei);
+ }
+
+ // The bidirectional-graph RandomPredecessor() implementation.
+ template <
+ typename Graph
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ >
+ ::std::pair<
+ typename graph_traits<Graph>::vertex_descriptor
+ , typename graph_traits<Graph>::edge_descriptor
+ >
+ loop_erased_random_tree_vertex_edge(
+ typename graph_traits<Graph>::vertex_descriptor const vertex
+ , Graph const& g
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , bidirectional_tag
+ , ::boost::mpl::false_
+ )
+ {
+ typedef graph_traits<Graph> GraphTraits;
+ typedef typename GraphTraits::vertex_descriptor Vertex;
+ typedef typename GraphTraits::edge_descriptor Edge;
+ typedef ::std::pair<Vertex,Edge> Result;
+
+ typename GraphTraits::in_edge_iterator ei, ei_end;
+
+ ::std::tr1::tie(ei, ei_end) = in_edges(vertex, g);
+
+ if (ei == ei_end)
+ {
+ return Result(GraphTraits::null_vertex(), Edge());
+ }
+
+ ::std::advance(
+ ei
+ , loop_erased_random_tree_edge_idx(ei, ei_end, args, has_ew)
+ );
+ return Result(source(*ei, g), *ei);
+ }
+
+ // The directed-graph RandomPredecessor() implementation.
+ template <
+ typename Graph
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ >
+ ::std::pair<
+ typename graph_traits<Graph>::vertex_descriptor
+ , typename graph_traits<Graph>::edge_descriptor
+ >
+ loop_erased_random_tree_vertex_edge(
+ typename graph_traits<Graph>::vertex_descriptor const vertex
+ , Graph const& g
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , directed_tag
+ , ::boost::mpl::false_
+ )
+ {
+ typedef graph_traits<Graph> GraphTraits;
+ typedef typename GraphTraits::vertex_descriptor Vertex;
+ typedef typename GraphTraits::edge_descriptor Edge;
+ typedef ::std::pair<Vertex,Edge> Result;
+
+ ::std::vector<Edge> edges;
+ typename GraphTraits::vertex_iterator vi, vi_end;
+ typename GraphTraits::out_edge_iterator ei, ei_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
+ {
+ if (*vi != vertex)
+ {
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, g);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ if (vertex == target(*ei, g))
+ {
+ edges.push_back(*ei);
+ }
+ }
+ }
+ }
+
+ if (edges.empty())
+ {
+ return Result(GraphTraits::null_vertex(), Edge());
+ }
+
+ typename ::std::vector<Edge>::iterator itr = edges.begin();
+ typename ::std::vector<Edge>::iterator itr_end = edges.end();
+
+ ::std::advance(
+ itr
+ , loop_erased_random_tree_edge_idx(itr, itr_end, args, has_ew)
+ );
+ return Result(source(*itr, g), *itr);
+ }
+
+ // Initializes the vertices and the specified property maps.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ >
+ void
+ loop_erased_random_tree_init(
+ Graph const& g
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ )
+ {
+ typename graph_traits<Graph>::vertex_iterator vi, vend;
+
+ for (::std::tr1::tie(vi, vend) = vertices(g); vi != vend; ++vi)
+ {
+ call_visitors<on_initialize_vertex>(visitors, *vi, g);
+ put(out_pred_map, *vi, *vi);
+ put(
+ vertex_color_map
+ , *vi
+ , color_traits<
+ typename property_traits<VertexColorMap>::value_type
+ >::white()
+ );
+ }
+ }
+
+ // The RandomTree() implementation.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ , typename TerminatorFunction
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ , typename IsLookingForSuccessor
+ >
+ bool
+ loop_erased_random_tree_impl(
+ Graph const& g
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ , TerminatorFunction function
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , IsLookingForSuccessor is_lfs
+ )
+ {
+ typedef graph_traits<Graph>
+ GraphTraits;
+ typedef typename GraphTraits::vertex_descriptor
+ Vertex;
+ BOOST_CONCEPT_ASSERT((
+ ReadWritePropertyMapConcept<OutputPredecessorMap,Vertex>
+ ));
+ typedef color_traits<
+ typename property_traits<VertexColorMap>::value_type
+ >
+ VertexColor;
+ typedef typename ::boost::detail::data_type<
+ typename ::boost::parameter::binding<
+ ArgumentPack
+ , ::boost::graph::keywords::tag::rng_engine
+ >::type
+ >::type
+ RNGEngine;
+ typedef ::std::tr1::uniform_real<>
+ Distribution;
+ typedef typename ::boost::unwrap_reference<TerminatorFunction>::type
+ TF;
+
+ ::std::tr1::variate_generator<RNGEngine&,Distribution> chance(
+ ::boost::unwrap_ref(args[::boost::graph::keywords::_rng_engine])
+ , Distribution(0.0, 1.0)
+ );
+
+ // This line is mainly for Borland compilers.
+ TF& should_terminate = static_cast<TF&>(function);
+
+ Vertex u, v, w;
+ typename GraphTraits::vertex_iterator vi, vend;
+ typename GraphTraits::edge_descriptor e;
+ ::std::size_t root_count, dead_end_count;
+
+ for (double epsilon = 0.5;;)
+ {
+ loop_erased_random_tree_init(
+ g
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ );
+ root_count = dead_end_count = 0;
+
+ for (::std::tr1::tie(vi, vend) = vertices(g); vi != vend; ++vi)
+ {
+ v = *vi;
+
+ while (get(vertex_color_map, v) != VertexColor::black())
+ {
+ if (get(vertex_color_map, v) == VertexColor::white())
+ {
+ call_visitors<on_discover_vertex>(visitors, v, g);
+ }
+
+ put(vertex_color_map, v, VertexColor::gray());
+ call_visitors<on_examine_vertex>(visitors, v, g);
+
+ if (!dead_end_count && (chance() < epsilon))
+ {
+ ++root_count;
+ break;
+ }
+
+ ::std::tr1::tie(
+ u
+ , e
+ ) = loop_erased_random_tree_vertex_edge(
+ v
+ , g
+ , args
+ , has_ew
+ , typename GraphTraits::directed_category()
+ , is_lfs
+ );
+
+ if (u == GraphTraits::null_vertex())
+ {
+ if (++dead_end_count < 2)
+ {
+ ++root_count;
+ }
+ else
+ {
+ return false;
+ }
+
+ break;
+ }
+ else if (should_terminate(u, g))
+ {
+ // MAINTAINER:
+ // Find out if terminal vertices should be treated
+ // the same way as the null vertex.
+ if (++dead_end_count < 2)
+ {
+ ++root_count;
+ }
+ else
+ {
+ return false;
+ }
+
+ break;
+ }
+
+ call_visitors<on_examine_edge>(visitors, e, g);
+
+ if (get(vertex_color_map, u) == VertexColor::gray())
+ {
+ call_visitors<on_back_edge>(visitors, e, g);
+ put(out_pred_map, v, u);
+
+ // Erase the previous loop from the output.
+ for (w = get(out_pred_map, u); w != u; w = v)
+ {
+ v = get(out_pred_map, w);
+ put(out_pred_map, w, w);
+ put(vertex_color_map, w, VertexColor::red());
+ call_visitors<
+ on_loop_erased_vertex
+ >(visitors, w, g);
+ }
+
+ put(out_pred_map, v, v);
+ put(vertex_color_map, v, VertexColor::red());
+ call_visitors<
+ on_loop_erased_vertex
+ >(visitors, v, g);
+ }
+ else
+ {
+ call_visitors<on_tree_edge>(visitors, e, g);
+ put(out_pred_map, v, u);
+ v = u;
+ }
+ }
+
+ for (
+ v = *vi;
+ get(vertex_color_map, v) != VertexColor::black();
+ v = get(out_pred_map, v)
+ )
+ {
+ put(vertex_color_map, v, VertexColor::black());
+ call_visitors<on_finish_vertex>(visitors, v, g);
+ }
+ }
+
+ if (1 < root_count)
+ {
+ epsilon *= 0.5;
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ return true;
+ }
+
+ // Initializes the vertices and the specified property maps.
+ // Visitors will start at and discover the root vertex.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ >
+ void
+ loop_erased_random_tree_init(
+ Graph const& g
+ , typename graph_traits<Graph>::vertex_descriptor const root
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ )
+ {
+ loop_erased_random_tree_init(
+ g
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ );
+ call_visitors<on_start_vertex>(visitors, root, g);
+ call_visitors<on_discover_vertex>(visitors, root, g);
+ put(
+ vertex_color_map
+ , root
+ , color_traits<
+ typename property_traits<VertexColorMap>::value_type
+ >::black()
+ );
+ }
+
+ // Searches for a random path from vertex to root.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ , typename TerminatorFunction
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ , typename IsLookingForSuccessor
+ >
+ bool
+ loop_erased_random_tree_path(
+ Graph const& g
+ , typename graph_traits<Graph>::vertex_descriptor const root
+ , typename graph_traits<Graph>::vertex_descriptor vertex
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ , TerminatorFunction function
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , IsLookingForSuccessor is_lfs
+ )
+ {
+ typedef graph_traits<Graph>
+ GraphTraits;
+ typedef color_traits<
+ typename property_traits<VertexColorMap>::value_type
+ >
+ VertexColor;
+ typedef typename ::boost::unwrap_reference<TerminatorFunction>::type
+ TF;
+
+ typename GraphTraits::vertex_descriptor u, v = vertex, w;
+ typename GraphTraits::edge_descriptor e;
+ bool result = true;
+
+ // This line is mainly for Borland compilers.
+ TF& should_terminate = static_cast<TF&>(function);
+
+ do
+ {
+ if (get(vertex_color_map, v) == VertexColor::white())
+ {
+ call_visitors<on_discover_vertex>(visitors, v, g);
+ }
+
+ put(vertex_color_map, v, VertexColor::gray());
+ call_visitors<on_examine_vertex>(visitors, v, g);
+
+ ::std::tr1::tie(u, e) = loop_erased_random_tree_vertex_edge(
+ v
+ , g
+ , args
+ , has_ew
+ , typename GraphTraits::directed_category()
+ , is_lfs
+ );
+
+ if (u == GraphTraits::null_vertex())
+ {
+ result = false;
+ break;
+ }
+ else if (should_terminate(u, g))
+ {
+ result = false;
+ break;
+ }
+
+ call_visitors<on_examine_edge>(visitors, e, g);
+
+ if (get(vertex_color_map, u) == VertexColor::gray())
+ {
+ call_visitors<on_back_edge>(visitors, e, g);
+ put(out_pred_map, v, u);
+
+ // Erase the previous loop from the output.
+ for (w = get(out_pred_map, u); w != u; w = v)
+ {
+ v = get(out_pred_map, w);
+ put(out_pred_map, w, w);
+ put(vertex_color_map, w, VertexColor::red());
+ call_visitors<on_loop_erased_vertex>(visitors, w, g);
+ }
+
+ put(out_pred_map, v, v);
+ put(vertex_color_map, v, VertexColor::red());
+ call_visitors<on_loop_erased_vertex>(visitors, v, g);
+ }
+ else
+ {
+ call_visitors<on_tree_edge>(visitors, e, g);
+ put(out_pred_map, v, u);
+ v = u;
+ }
+ }
+ while (get(vertex_color_map, v) != VertexColor::black());
+
+ for (
+ v = vertex;
+ get(vertex_color_map, v) != VertexColor::black();
+ v = get(out_pred_map, v)
+ )
+ {
+ put(vertex_color_map, v, VertexColor::black());
+ call_visitors<on_finish_vertex>(visitors, v, g);
+ }
+
+ return result;
+ }
+
+ // The RandomTreeWithRoot() implementation.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ , typename TerminatorFunction
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ , typename IsLookingForSuccessor
+ >
+ bool
+ loop_erased_random_tree_impl(
+ Graph const& g
+ , typename graph_traits<Graph>::vertex_descriptor const root
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ , TerminatorFunction function
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , IsLookingForSuccessor is_lfs
+ )
+ {
+ BOOST_CONCEPT_ASSERT((
+ ReadWritePropertyMapConcept<
+ OutputPredecessorMap
+ , typename graph_traits<Graph>::vertex_descriptor
+ >
+ ));
+ typedef typename ::boost::unwrap_reference<TerminatorFunction>::type
+ TF;
+
+ loop_erased_random_tree_init(
+ g
+ , root
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ );
+
+ bool is_tree = true, has_path;
+ typename graph_traits<Graph>::vertex_iterator vi, vend;
+
+ // This line is mainly for Borland compilers.
+ TF& should_terminate = static_cast<TF&>(function);
+
+ for (std::tr1::tie(vi, vend) = vertices(g); vi != vend; ++vi)
+ {
+ if (
+ !(root == *vi)
+ && !should_terminate(*vi, g)
+ && !(
+ get(vertex_color_map, *vi)
+ == color_traits<
+ typename property_traits<VertexColorMap>::value_type
+ >::black()
+ )
+ )
+ {
+ has_path = loop_erased_random_tree_path(
+ g
+ , root
+ , *vi
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ , function
+ , args
+ , has_ew
+ , is_lfs
+ );
+
+ if (is_tree)
+ {
+ is_tree = has_path;
+ }
+ }
+ }
+
+ call_visitors<on_finish_vertex>(visitors, root, g);
+ return is_tree;
+ }
+
+ // Random-walk implementation.
+ template <
+ typename Graph
+ , typename OutputPredecessorMap
+ , typename VertexColorMap
+ , typename Vis
+ , typename TerminatorFunction
+ , typename ArgumentPack
+ , typename HasEdgeWeights
+ , typename IsLookingForSuccessor
+ >
+ bool
+ loop_erased_random_tree_impl(
+ Graph const& g
+ , typename graph_traits<Graph>::vertex_descriptor const src
+ , typename graph_traits<Graph>::vertex_descriptor const tgt
+ , OutputPredecessorMap out_pred_map
+ , VertexColorMap vertex_color_map
+ , Vis visitors
+ , TerminatorFunction function
+ , ArgumentPack const& args
+ , HasEdgeWeights has_ew
+ , IsLookingForSuccessor is_lfs
+ )
+ {
+ BOOST_CONCEPT_ASSERT((
+ ReadWritePropertyMapConcept<
+ OutputPredecessorMap
+ , typename graph_traits<Graph>::vertex_descriptor
+ >
+ ));
+
+ loop_erased_random_tree_init(
+ g
+ , tgt
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ );
+
+ bool result = loop_erased_random_tree_path(
+ g
+ , tgt
+ , src
+ , out_pred_map
+ , vertex_color_map
+ , visitors
+ , function
+ , args
+ , has_ew
+ , is_lfs
+ );
+
+ call_visitors<on_finish_vertex>(visitors, tgt, g);
+ return result;
+ }
+ } // namespace detail
+} // namespace boost
+
+#endif // BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree_params.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/loop_erased_random_tree_params.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,208 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_PARAMS_HPP
+#define BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_PARAMS_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/keywords/rng_engine.hpp>
+#include <boost/graph/keywords/source_vertex.hpp>
+#include <boost/graph/keywords/terminate_predicate.hpp>
+
+#define BOOST_BGL_DECLARE_NAMED_PARAMS \
+ BOOST_BGL_ONE_PARAM_CREF(weight_map, edge_weight) \
+ BOOST_BGL_ONE_PARAM_CREF(predecessor_map, vertex_predecessor) \
+ BOOST_BGL_ONE_PARAM_CREF(root_vertex, root_vertex) \
+ BOOST_BGL_ONE_PARAM_CREF(color_map, vertex_color) \
+ BOOST_BGL_ONE_PARAM_CREF(visitor, graph_visitor) \
+ BOOST_BGL_ONE_PARAM_CREF(distance_compare, distance_compare) \
+ BOOST_BGL_ONE_PARAM_CREF(distance_combine, distance_combine) \
+//
+
+#define BOOST_BGL_LOOP_ERASED_RANDOM_TREE_DECLARE_PARAMS \
+ BOOST_BGL_ONE_PARAM_REF(rng_engine, rng_engine) \
+ BOOST_BGL_ONE_PARAM_CREF(source_vertex, source_vertex) \
+ BOOST_BGL_ONE_PARAM_CREF(terminate_predicate, terminate_predicate) \
+//
+
+namespace boost {
+ namespace detail {
+
+ template <typename T, typename Tag, typename Base = no_property>
+ struct loop_erased_random_tree_params : Base
+ {
+ typedef loop_erased_random_tree_params self;
+ typedef Base next_type;
+ typedef Tag tag_type;
+ typedef T value_type;
+
+ T m_value;
+
+ loop_erased_random_tree_params(T v = T()) : Base(), m_value(v)
+ {
+ }
+
+ loop_erased_random_tree_params(T v, Base const& b)
+ : Base(b), m_value(v)
+ {
+ }
+
+#define BOOST_BGL_ONE_PARAM_REF(name, key) \
+ template <typename PType> \
+ inline loop_erased_random_tree_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ name(PType& p) const \
+ { \
+ typedef loop_erased_random_tree_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ Params; \
+ return Params(::boost::ref(p), *this); \
+ } \
+//
+
+#define BOOST_BGL_ONE_PARAM_CREF(name, key) \
+ template <typename PType> \
+ inline loop_erased_random_tree_params< \
+ PType \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ name(PType const& p) const \
+ { \
+ typedef loop_erased_random_tree_params< \
+ PType \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ Params; \
+ return Params(p, *this); \
+ } \
+//
+
+ BOOST_BGL_LOOP_ERASED_RANDOM_TREE_DECLARE_PARAMS
+
+#undef BOOST_BGL_ONE_PARAM_CREF
+#undef BOOST_BGL_ONE_PARAM_REF
+
+#define BOOST_BGL_ONE_PARAM_REF(name, key) \
+ template <typename PType> \
+ inline bgl_named_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ name(PType& p) const \
+ { \
+ typedef bgl_named_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ , self \
+ > \
+ Params; \
+ return Params(::boost::ref(p), *this); \
+ } \
+//
+
+#define BOOST_BGL_ONE_PARAM_CREF(name, key) \
+ template <typename PType> \
+ inline bgl_named_params<PType,BOOST_PP_CAT(key, _t),self> \
+ name(PType const& p) const \
+ { \
+ typedef bgl_named_params<PType,BOOST_PP_CAT(key, _t),self> \
+ Params; \
+ return Params(p, *this); \
+ } \
+//
+
+ BOOST_BGL_DECLARE_NAMED_PARAMS
+
+#undef BOOST_BGL_ONE_PARAM_CREF
+#undef BOOST_BGL_ONE_PARAM_REF
+
+ template <typename PType>
+ inline bgl_named_params<PType,vertex_color_t,self>
+ vertex_color_map(PType const& p) const
+ {
+ return this->color_map(p);
+ }
+ };
+
+ typedef loop_erased_random_tree_params<char,unused_tag_type>
+ no_loop_erased_random_tree_params;
+
+ template <>
+ struct convert_bgl_params_to_boost_parameter<
+ no_loop_erased_random_tree_params
+ >
+ {
+ typedef ::boost::parameter::aux::empty_arg_list type;
+
+ static type conv(no_property const&)
+ {
+ return type();
+ }
+ };
+ } // namespace detail
+
+ inline detail::no_loop_erased_random_tree_params
+ make_loop_erased_random_tree_params()
+ {
+ return detail::no_loop_erased_random_tree_params();
+ }
+
+#if 0
+#define BOOST_BGL_ONE_PARAM_REF(name, key) \
+ template <typename PType> \
+ inline detail::loop_erased_random_tree_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ > \
+ name(PType& p) const \
+ { \
+ typedef detail::loop_erased_random_tree_params< \
+ ::boost::reference_wrapper<PType> \
+ , BOOST_PP_CAT(key, _t) \
+ > \
+ Params; \
+ return Params(::boost::ref(p)); \
+ } \
+//
+
+#define BOOST_BGL_ONE_PARAM_CREF(name, key) \
+ template <typename PType> \
+ inline detail::loop_erased_random_tree_params< \
+ PType \
+ , BOOST_PP_CAT(key, _t) \
+ > \
+ name(PType const& p) const \
+ { \
+ typedef detail::loop_erased_random_tree_params< \
+ PType \
+ , BOOST_PP_CAT(key, _t) \
+ > \
+ Params; \
+ return Params(p); \
+ } \
+//
+
+ BOOST_BGL_LOOP_ERASED_RANDOM_TREE_DECLARE_PARAMS
+
+#undef BOOST_BGL_ONE_PARAM_CREF
+#undef BOOST_BGL_ONE_PARAM_REF
+#endif
+} // namespace boost
+
+#undef BOOST_BGL_LOOP_ERASED_RANDOM_TREE_DECLARE_PARAMS
+#undef BOOST_BGL_DECLARE_NAMED_PARAMS
+
+#endif // BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_PARAMS_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/detail/null_vertex.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/detail/null_vertex.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,22 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_DETAIL_NULL_VERTEX_HPP
+#define BOOST_GRAPH_DETAIL_NULL_VERTEX_HPP
+
+#include <boost/graph/graph_traits.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ inline typename graph_traits<InputGraph>::vertex_descriptor
+ null_vertex(InputGraph const& g)
+ {
+ return graph_traits<InputGraph>::null_vertex();
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_NULL_VERTEX_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/fuse_property_writer.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/fuse_property_writer.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,45 @@
+// Copyright (C) 2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_FUSE_PROPERTY_WRITER_HPP
+#define BOOST_GRAPH_FUSE_PROPERTY_WRITER_HPP
+
+#include <boost/fusion/support/pair.hpp>
+#include <boost/graph/visitors.hpp>
+
+//[reference__fuse_property_writer
+namespace boost {
+
+ template <typename Filter, typename PropertyMap, typename OutputIterator>
+ ::boost::fusion::pair<
+ Filter
+ , property_writer<PropertyMap,OutputIterator,Filter>
+ >
+ fuse_property_writer(PropertyMap property_map, OutputIterator out_itr);
+
+ //<-
+ template <typename Filter, typename PropertyMap, typename OutputIterator>
+ inline ::boost::fusion::pair<
+ Filter
+ , property_writer<PropertyMap,OutputIterator,Filter>
+ >
+ fuse_property_writer(PropertyMap property_map, OutputIterator out_itr)
+ {
+ return ::boost::fusion::pair<
+ Filter
+ , property_writer<PropertyMap,OutputIterator,Filter>
+ >(
+ property_writer<PropertyMap,OutputIterator,Filter>(
+ property_map
+ , out_itr
+ )
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_FUSE_PROPERTY_WRITER_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/keywords/input_graph.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/keywords/input_graph.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,17 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_KEYWORDS_INPUT_GRAPH_HPP
+#define BOOST_GRAPH_KEYWORDS_INPUT_GRAPH_HPP
+
+#include <boost/parameter/name.hpp>
+
+namespace boost { namespace graph { namespace keywords {
+
+ BOOST_PARAMETER_NAME(input_graph);
+}}} // namespace boost::graph::keywords
+
+#endif // BOOST_GRAPH_KEYWORDS_INPUT_GRAPH_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/keywords/rng_engine.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/keywords/rng_engine.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_KEYWORDS_RNG_ENGINE_HPP
+#define BOOST_GRAPH_KEYWORDS_RNG_ENGINE_HPP
+
+#include <boost/graph/named_function_params.hpp>
+#include <boost/parameter/name.hpp>
+
+namespace boost {
+ namespace graph { namespace keywords {
+
+ BOOST_PARAMETER_NAME(rng_engine);
+ }} // namespace graph::keywords
+
+ struct rng_engine_t
+ {
+ };
+
+ namespace detail {
+
+ template <>
+ struct convert_one_keyword<rng_engine_t>
+ {
+ typedef boost::graph::keywords::tag::rng_engine type;
+ };
+ } // namespace detail
+} // namespace boost
+
+#endif // BOOST_GRAPH_KEYWORDS_RNG_ENGINE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/keywords/source_vertex.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/keywords/source_vertex.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_KEYWORDS_SOURCE_VERTEX_HPP
+#define BOOST_GRAPH_KEYWORDS_SOURCE_VERTEX_HPP
+
+#include <boost/graph/named_function_params.hpp>
+#include <boost/parameter/name.hpp>
+
+namespace boost {
+ namespace graph { namespace keywords {
+
+ BOOST_PARAMETER_NAME(source_vertex);
+ }} // namespace graph::keywords
+
+ struct source_vertex_t
+ {
+ };
+
+ namespace detail {
+
+ template <>
+ struct convert_one_keyword<source_vertex_t>
+ {
+ typedef boost::graph::keywords::tag::source_vertex type;
+ };
+ } // namespace detail
+} // namespace boost
+
+#endif // BOOST_GRAPH_KEYWORDS_SOURCE_VERTEX_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/keywords/terminate_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/keywords/terminate_predicate.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_KEYWORDS_TERMINATE_PREDICATE_HPP
+#define BOOST_GRAPH_KEYWORDS_TERMINATE_PREDICATE_HPP
+
+#include <boost/graph/named_function_params.hpp>
+#include <boost/parameter/name.hpp>
+
+namespace boost {
+ namespace graph { namespace keywords {
+
+ BOOST_PARAMETER_NAME(terminate_predicate);
+ }} // namespace graph::keywords
+
+ struct terminate_predicate_t
+ {
+ };
+
+ namespace detail {
+
+ template <>
+ struct convert_one_keyword<terminate_predicate_t>
+ {
+ typedef boost::graph::keywords::tag::terminate_predicate type;
+ };
+ } // namespace detail
+} // namespace boost
+
+#endif // BOOST_GRAPH_KEYWORDS_TERMINATE_PREDICATE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_tree.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,305 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_HPP
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_HPP
+
+#include <vector>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/parameter/preprocessor.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/detail/loop_erased_random_tree_params.hpp>
+#include <boost/graph/keywords/input_graph.hpp>
+#include <boost/graph/keywords/rng_engine.hpp>
+#include <boost/graph/keywords/source_vertex.hpp>
+#include <boost/graph/keywords/terminate_predicate.hpp>
+#include <boost/graph/detail/loop_erased_random_tree.hpp>
+#include <boost/graph/detail/null_vertex.hpp>
+#include <boost/graph/detail/default_terminate_predicate.hpp>
+
+#if BOOST_PP_LESS(7, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+#elif BOOST_PP_LESS(4, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_5_PARAMS
+#endif
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph, typename Params>
+ inline bool
+ loop_erased_random_tree_dispatch(
+ InputGraph const& input_graph
+ , Params const& params
+ )
+ {
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+ typename graph_traits<InputGraph>::vertex_descriptor root = arg_pack[
+ ::boost::graph::keywords::_root_vertex
+ ];
+ typename graph_traits<InputGraph>::vertex_descriptor src = arg_pack[
+ ::boost::graph::keywords::_source_vertex
+ ];
+
+ if (root == graph_traits<InputGraph>::null_vertex())
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , src
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::false_()
+ , ::boost::mpl::false_()
+ );
+ }
+ }
+ else
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , root
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , src
+ , root
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ }
+ }
+}} // namespace boost::detail
+
+//[reference__loop_erased_random_tree__prototype_old
+namespace boost {
+
+ template <typename InputGraph, typename Params>
+ bool
+ loop_erased_random_tree(
+ InputGraph const& input_graph
+ , Params const& params
+ );
+
+ //<-
+ template <typename InputGraph, typename Params>
+ inline bool
+ loop_erased_random_tree(
+ InputGraph const& input_graph
+ , Params const& params
+ )
+ {
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+
+ return detail::loop_erased_random_tree_dispatch(
+ input_graph
+ , make_loop_erased_random_tree_params().rng_engine(
+ arg_pack[::boost::graph::keywords::_rng_engine]
+ ).source_vertex(
+ arg_pack[
+ ::boost::graph::keywords::_source_vertex
+ | graph_traits<InputGraph>::null_vertex()
+ ]
+ ).terminate_predicate(
+ arg_pack[
+ ::boost::graph::keywords::_terminate_predicate
+ | detail::default_terminate_predicate<InputGraph>()
+ ]
+ ).predecessor_map(
+ arg_pack[::boost::graph::keywords::_predecessor_map]
+ ).root_vertex(
+ arg_pack[
+ ::boost::graph::keywords::_root_vertex
+ | graph_traits<InputGraph>::null_vertex()
+ ]
+ ).color_map(
+ arg_pack[
+ ::boost::graph::keywords::_color_map
+ | make_vertex_property_map(input_graph, white_color)
+ ]
+ ).visitor(
+ arg_pack[::boost::graph::keywords::_visitor | null_visitor()]
+ )
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+namespace boost {
+
+#if defined(BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS)
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph, *)
+ (in_out(rng_engine), *)
+ (out(predecessor_map), *)
+ )
+ (optional
+ (root_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (source_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (in_out(color_map)
+ , *
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *
+ , null_visitor()
+ )
+ (terminate_predicate
+ , *
+ , detail::make_default_terminate_predicate(input_graph)
+ )
+ )
+ )
+ {
+ if (root_vertex == detail::null_vertex(input_graph))
+ {
+ if (source_vertex == detail::null_vertex(input_graph))
+ {
+ return detail::loop_erased_random_tree_impl(
+ input_graph
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return detail::loop_erased_random_tree_impl(
+ input_graph
+ , source_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::false_()
+ , ::boost::mpl::false_()
+ );
+ }
+ }
+ else if (source_vertex == detail::null_vertex(input_graph))
+ {
+ return detail::loop_erased_random_tree_impl(
+ input_graph
+ , root_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return detail::loop_erased_random_tree_impl(
+ input_graph
+ , source_vertex
+ , root_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ }
+#elif defined(BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_5_PARAMS)
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph, *)
+ (in_out(rng_engine), *)
+ (out(predecessor_map), *)
+ )
+ (optional
+ (root_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (source_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ )
+ )
+ {
+ return loop_erased_random_tree(
+ input_graph
+ , make_loop_erased_random_tree_params().rng_engine(
+ rng_engine
+ ).source_vertex(
+ source_vertex
+ ).predecessor_map(
+ predecessor_map
+ ).root_vertex(
+ root_vertex
+ )
+ );
+ }
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_*_PARAMS
+} // namespace boost
+
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_weighted_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/loop_erased_random_weighted_tree.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,384 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+
+#include <vector>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/parameter/preprocessor.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/detail/loop_erased_random_tree_params.hpp>
+#include <boost/graph/keywords/input_graph.hpp>
+#include <boost/graph/keywords/rng_engine.hpp>
+#include <boost/graph/keywords/source_vertex.hpp>
+#include <boost/graph/keywords/terminate_predicate.hpp>
+#include <boost/graph/detail/loop_erased_random_tree.hpp>
+#include <boost/graph/detail/null_vertex.hpp>
+#include <boost/graph/detail/default_combine_function.hpp>
+#include <boost/graph/detail/default_compare_predicate.hpp>
+#include <boost/graph/detail/default_terminate_predicate.hpp>
+
+#if BOOST_PP_LESS(10, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+#elif BOOST_PP_LESS(4, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_5_PARAMS
+#endif
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph, typename Params>
+ inline bool
+ loop_erased_random_weighted_tree_dispatch(
+ InputGraph const& input_graph
+ , Params const& params
+ )
+ {
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+ typename graph_traits<InputGraph>::vertex_descriptor root = arg_pack[
+ ::boost::graph::keywords::_root_vertex
+ ];
+ typename graph_traits<InputGraph>::vertex_descriptor src = arg_pack[
+ ::boost::graph::keywords::_source_vertex
+ ];
+
+ if (root == graph_traits<InputGraph>::null_vertex())
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::true_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , src
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::true_()
+ , ::boost::mpl::false_()
+ );
+ }
+ }
+ else
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , root
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::false_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , src
+ , root
+ , arg_pack[::boost::graph::keywords::_predecessor_map]
+ , arg_pack[::boost::graph::keywords::_color_map]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , arg_pack[::boost::graph::keywords::_terminate_predicate]
+ , arg_pack
+ , ::boost::mpl::true_()
+ , ::boost::mpl::true_()
+ );
+ }
+ }
+ }
+}} // namespace boost::detail
+
+//[reference__loop_erased_random_weighted_tree__prototype_old
+namespace boost {
+
+ template <typename InputGraph, typename Params>
+ bool
+ loop_erased_random_weighted_tree(
+ InputGraph const& input_graph
+ , Params const& params
+ );
+
+ //<-
+ template <typename InputGraph, typename Params>
+ inline bool
+ loop_erased_random_weighted_tree(
+ InputGraph const& input_graph
+ , Params const& params
+ )
+ {
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+ typedef typename ::boost::detail::data_type<
+ typename ::boost::parameter::binding<
+ arg_pack_type
+ , ::boost::graph::keywords::tag::weight_map
+ , typename property_map<
+ InputGraph
+ , edge_weight_t
+ >::const_type
+ >::type
+ >::type
+ EdgeWeightMap;
+
+ EdgeWeightMap weight_map = arg_pack[
+ ::boost::graph::keywords::_weight_map
+ | get(edge_weight, input_graph)
+ ];
+
+ return detail::loop_erased_random_weighted_tree_dispatch(
+ input_graph
+ , make_loop_erased_random_tree_params().rng_engine(
+ arg_pack[::boost::graph::keywords::_rng_engine]
+ ).source_vertex(
+ arg_pack[
+ ::boost::graph::keywords::_source_vertex
+ | graph_traits<InputGraph>::null_vertex()
+ ]
+ ).terminate_predicate(
+ arg_pack[
+ ::boost::graph::keywords::_terminate_predicate
+ | detail::default_terminate_predicate<InputGraph>()
+ ]
+ ).predecessor_map(
+ arg_pack[::boost::graph::keywords::_predecessor_map]
+ ).root_vertex(
+ arg_pack[
+ ::boost::graph::keywords::_root_vertex
+ | graph_traits<InputGraph>::null_vertex()
+ ]
+ ).weight_map(
+ weight_map
+ ).color_map(
+ arg_pack[
+ ::boost::graph::keywords::_color_map
+ | make_vertex_property_map(input_graph, white_color)
+ ]
+ ).visitor(
+ arg_pack[::boost::graph::keywords::_visitor | null_visitor()]
+ ).distance_compare(
+ arg_pack[
+ ::boost::graph::keywords::_distance_compare
+ | detail::make_default_compare_predicate(weight_map)
+ ]
+ ).distance_combine(
+ arg_pack[
+ ::boost::graph::keywords::_distance_combine
+ | detail::make_default_combine_function(weight_map)
+ ]
+ )
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+namespace boost {
+
+#if defined(BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS)
+ namespace detail {
+
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree_dispatch
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph, *)
+ (in_out(rng_engine), *)
+ (out(predecessor_map), *)
+ (root_vertex, *)
+ (source_vertex, *)
+ (weight_map, *)
+ (in_out(color_map), *)
+ (visitor, *)
+ (distance_compare, *)
+ (distance_combine, *)
+ (terminate_predicate, *)
+ )
+ )
+ {
+ if (root_vertex == null_vertex(input_graph))
+ {
+ if (source_vertex == null_vertex(input_graph))
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::true_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , source_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::true_()
+ , ::boost::mpl::false_()
+ );
+ }
+ }
+ else if (source_vertex == null_vertex(input_graph))
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , root_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::true_()
+ , ::boost::mpl::true_()
+ );
+ }
+ else
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , source_vertex
+ , root_vertex
+ , predecessor_map
+ , color_map
+ , visitor
+ , terminate_predicate
+ , args
+ , ::boost::mpl::true_()
+ , ::boost::mpl::true_()
+ );
+ }
+ }
+ } // namespace detail
+
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , graph::keywords::tag
+ , (required
+ (input_graph, *)
+ (in_out(rng_engine), *)
+ (out(predecessor_map), *)
+ )
+ (optional
+ (root_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (source_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (weight_map
+ , *
+ , get(edge_weight_t(), input_graph)
+ )
+ (in_out(color_map)
+ , *
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *
+ , null_visitor()
+ )
+ (distance_compare
+ , *
+ , detail::make_default_compare_predicate(weight_map)
+ )
+ (distance_combine
+ , *
+ , detail::make_default_combine_function(weight_map)
+ )
+ (terminate_predicate
+ , *
+ , detail::make_default_terminate_predicate(input_graph)
+ )
+ )
+ )
+ {
+ return detail::loop_erased_random_weighted_tree_dispatch(
+ input_graph
+ , rng_engine
+ , predecessor_map
+ , root_vertex
+ , source_vertex
+ , weight_map
+ , color_map
+ , visitor
+ , distance_compare
+ , distance_combine
+ , terminate_predicate
+ );
+ }
+#elif defined(BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_5_PARAMS)
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph, *)
+ (in_out(rng_engine), *)
+ (out(predecessor_map), *)
+ )
+ (optional
+ (root_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ (source_vertex
+ , *
+ , detail::null_vertex(input_graph)
+ )
+ )
+ )
+ {
+ return loop_erased_random_weighted_tree(
+ input_graph
+ , make_loop_erased_random_tree_params().rng_engine(
+ rng_engine
+ ).source_vertex(
+ source_vertex
+ ).predecessor_map(
+ predecessor_map
+ ).root_vertex(
+ root_vertex
+ )
+ );
+ }
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_*_PARAMS
+} // namespace boost
+
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/simple_edge_writer.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/simple_edge_writer.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,207 @@
+// Copyright (C) 2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_SIMPLE_EDGE_WRITER_HPP
+#define BOOST_GRAPH_SIMPLE_EDGE_WRITER_HPP
+
+#include <boost/tuple/tuple_io.hpp>
+#include <boost/fusion/support/pair.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+
+//[reference__simple_edge_writer
+namespace boost {
+
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ class simple_edge_writer
+ {
+ //<-
+ VertexPropertyMap _property_map;
+ OutputStream& _os;
+ CharT const* _suffix;
+ //->
+
+ public:
+ typedef Filter event_filter;
+
+ simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ );
+
+ simple_edge_writer(simple_edge_writer const& copy);
+
+ template <typename Graph>
+ void
+ operator()(
+ typename graph_traits<Graph>::edge_descriptor e
+ , Graph const& g
+ );
+ };
+
+ //<-
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ simple_edge_writer<
+ VertexPropertyMap
+ , OutputStream
+ , CharT
+ , Filter
+ >::simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ ) : _property_map(property_map), _os(os), _suffix(suffix)
+ {
+ }
+
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ simple_edge_writer<
+ VertexPropertyMap
+ , OutputStream
+ , CharT
+ , Filter
+ >::simple_edge_writer(simple_edge_writer const& copy)
+ : _property_map(copy._property_map), _os(copy._os), _suffix(copy._suffix)
+ {
+ }
+
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ template <typename Graph>
+ inline void
+ simple_edge_writer<
+ VertexPropertyMap
+ , OutputStream
+ , CharT
+ , Filter
+ >::operator()(
+ typename graph_traits<Graph>::edge_descriptor e
+ , Graph const& g
+ )
+ {
+ _os << ::boost::make_tuple(
+ get(_property_map, source(e, g))
+ , get(_property_map, target(e, g))
+ ) << _suffix;
+ }
+ //->
+} // namespace boost
+//]
+
+//[reference__make_simple_edge_writer
+namespace boost {
+
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>
+ make_simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ , Filter
+ );
+
+ //<-
+ template <
+ typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ , typename Filter
+ >
+ inline simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>
+ make_simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ , Filter
+ )
+ {
+ return simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>(
+ property_map
+ , os
+ , suffix
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+//[reference__fuse_simple_edge_writer
+namespace boost {
+
+ template <
+ typename Filter
+ , typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ >
+ ::boost::fusion::pair<
+ Filter
+ , simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>
+ >
+ fuse_simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ );
+
+ //<-
+ template <
+ typename Filter
+ , typename VertexPropertyMap
+ , typename OutputStream
+ , typename CharT
+ >
+ inline ::boost::fusion::pair<
+ Filter
+ , simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>
+ >
+ fuse_simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ )
+ {
+ return ::boost::fusion::pair<
+ Filter
+ , simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>
+ >(
+ simple_edge_writer<VertexPropertyMap,OutputStream,CharT,Filter>(
+ property_map
+ , os
+ , suffix
+ )
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_SIMPLE_EDGE_WRITER_HPP
+

Added: sandbox/graph-loop_erased_random_tree/boost/graph/vertex_property_map_gen.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/boost/graph/vertex_property_map_gen.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,179 @@
+// Copyright (C) 2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GRAPH_VERTEX_PROPERTY_MAP_GEN_HPP
+#define BOOST_GRAPH_VERTEX_PROPERTY_MAP_GEN_HPP
+
+#include <deque>
+#include <map>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+
+//[reference__vertex_property_map_gen
+namespace boost {
+
+ template <typename Graph, typename Value>
+ class vertex_property_map_gen
+ {
+ //<-
+ typedef typename property_map<Graph,vertex_index_t>::const_type
+ index_map;
+ typedef typename property_traits<index_map>::value_type
+ index_value;
+
+ class yes_type : public put_get_helper<Value&,yes_type>
+ {
+ typedef ::std::deque<Value> values;
+
+ public:
+ typedef typename graph_traits<Graph>::vertex_descriptor key_type;
+ typedef Value value_type;
+ typedef Value& reference;
+ typedef lvalue_property_map_tag category;
+
+ private:
+ values _values;
+ index_map _i_map;
+ iterator_property_map<
+ typename values::iterator
+ , index_map
+ , value_type
+ , reference
+ > _map;
+
+ public:
+ inline yes_type(Graph const& g)
+ : _values(num_vertices(g))
+ , _i_map(get(vertex_index, g))
+ , _map(_values.begin(), _i_map)
+ {
+ }
+
+ inline yes_type(yes_type const& copy)
+ : _values(copy._values)
+ , _i_map(copy._i_map)
+ , _map(_values.begin(), _i_map)
+ {
+ }
+
+ inline reference operator[](key_type const& key) const
+ {
+ return _map[key];
+ }
+ };
+
+ class no_type : public put_get_helper<Value&,no_type>
+ {
+ public:
+ typedef typename graph_traits<Graph>::vertex_descriptor key_type;
+ typedef Value value_type;
+ typedef Value& reference;
+ typedef lvalue_property_map_tag category;
+
+ private:
+ typedef ::std::map<key_type,value_type> under_map;
+
+ under_map _under_map;
+ associative_property_map<under_map> _map;
+
+ public:
+ inline no_type(Graph const& g) : _under_map(), _map(_under_map)
+ {
+ }
+
+ inline no_type(no_type const& copy)
+ : _under_map(copy._under_map), _map(_under_map)
+ {
+ }
+
+ inline reference operator[](key_type const& key) const
+ {
+ return _map[key];
+ }
+ };
+ //->
+
+ public:
+ typedef // implementation_defined
+ //<-
+ typename ::boost::mpl::if_<
+ ::std::tr1::is_integral<index_value>
+ , yes_type
+ , no_type
+ >::type
+ //->
+ type;
+ };
+} // namespace boost
+//]
+
+//[reference__make_vertex_property_map
+namespace boost {
+
+ template <typename Value, typename Graph>
+ typename vertex_property_map_gen<Graph,Value>::type
+ make_vertex_property_map(Graph const& g);
+
+ //<-
+ template <typename Value, typename Graph>
+ inline typename vertex_property_map_gen<Graph,Value>::type
+ make_vertex_property_map(Graph const& g)
+ {
+ return typename vertex_property_map_gen<Graph,Value>::type(g);
+ }
+ //->
+} // namespace boost
+//]
+
+//[reference__make_vertex_property_map__with_value
+namespace boost {
+
+ template <typename Graph, typename Value>
+ typename vertex_property_map_gen<Graph,Value>::type
+ make_vertex_property_map(Graph const& g, Value);
+
+ //<-
+ template <typename Graph, typename Value>
+ inline typename vertex_property_map_gen<Graph,Value>::type
+ make_vertex_property_map(Graph const& g, Value)
+ {
+ return typename vertex_property_map_gen<Graph,Value>::type(g);
+ }
+ //->
+} // namespace boost
+//]
+
+//[reference__make_vertex_predecessor_map
+namespace boost {
+
+ template <typename Graph>
+ typename vertex_property_map_gen<
+ Graph
+ , typename graph_traits<Graph>::vertex_descriptor
+ >::type
+ make_vertex_predecessor_map(Graph const& g);
+
+ //<-
+ template <typename Graph>
+ inline typename vertex_property_map_gen<
+ Graph
+ , typename graph_traits<Graph>::vertex_descriptor
+ >::type
+ make_vertex_predecessor_map(Graph const& g)
+ {
+ return typename vertex_property_map_gen<
+ Graph
+ , typename graph_traits<Graph>::vertex_descriptor
+ >::type(g);
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_VERTEX_PROPERTY_MAP_GEN_HPP
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/Jamroot 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,29 @@
+project html ;
+import boostbook : boostbook ;
+using quickbook ;
+
+xml loop_erased_random_tree
+ :
+ lert.qbk
+ ;
+boostbook quickbook
+ :
+ loop_erased_random_tree
+ :
+ <xsl:param>admon.graphics.path=doc/images/
+ <xsl:param>navig.graphics.path=doc/images/
+ <xsl:param>boost.root=http://www.boost.org
+ <xsl:param>boost.libraries=http://www.boost.org/libs/libraries.htm
+ <xsl:param>boost.image.src=../../boost.png
+ <xsl:param>boost.image.alt="C++ Boost"
+ <xsl:param>boost.image.w=277
+ <xsl:param>boost.image.h=86
+ <xsl:param>html.stylesheet=doc/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=1
+ <xsl:param>chunk.first.sections=1
+ <xsl:param>generate.section.toc.level=0
+ <xsl:param>toc.section.depth=0
+ <xsl:param>toc.max.depth=0
+ ;
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/boostbook.css
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/boostbook.css 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,588 @@
+/*=============================================================================
+ Copyright (c) 2004 Joel de Guzman
+ http://spirit.sourceforge.net/
+
+ Distributed under the Boost Software License, Version 1.0. (See accompany-
+ ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+=============================================================================*/
+
+/*=============================================================================
+ Body defaults
+=============================================================================*/
+
+ body
+ {
+ margin: 1em;
+ font-family: sans-serif;
+ }
+
+/*=============================================================================
+ Paragraphs
+=============================================================================*/
+
+ p
+ {
+ text-align: left;
+ font-size: 10pt;
+ line-height: 1.15;
+ }
+
+/*=============================================================================
+ Program listings
+=============================================================================*/
+
+ /* Code on paragraphs */
+ p tt.computeroutput
+ {
+ font-size: 9pt;
+ }
+
+ pre.synopsis
+ {
+ font-size: 90%;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ .programlisting,
+ .screen
+ {
+ font-size: 9pt;
+ display: block;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ /* Program listings in tables don't get borders */
+ td .programlisting,
+ td .screen
+ {
+ margin: 0pc 0pc 0pc 0pc;
+ padding: 0pc 0pc 0pc 0pc;
+ }
+
+/*=============================================================================
+ Headings
+=============================================================================*/
+
+ h1, h2, h3, h4, h5, h6
+ {
+ text-align: left;
+ margin: 1em 0em 0.5em 0em;
+ font-weight: bold;
+ }
+
+ h1 { font: 140% }
+ h2 { font: bold 140% }
+ h3 { font: bold 130% }
+ h4 { font: bold 120% }
+ h5 { font: italic 110% }
+ h6 { font: italic 100% }
+
+ /* Top page titles */
+ title,
+ h1.title,
+ h2.title
+ h3.title,
+ h4.title,
+ h5.title,
+ h6.title,
+ .refentrytitle
+ {
+ font-weight: bold;
+ margin-bottom: 1pc;
+ }
+
+ h1.title { font-size: 140% }
+ h2.title { font-size: 140% }
+ h3.title { font-size: 130% }
+ h4.title { font-size: 120% }
+ h5.title { font-size: 110% }
+ h6.title { font-size: 100% }
+
+ .section h1
+ {
+ margin: 0em 0em 0.5em 0em;
+ font-size: 140%;
+ }
+
+ .section h2 { font-size: 140% }
+ .section h3 { font-size: 130% }
+ .section h4 { font-size: 120% }
+ .section h5 { font-size: 110% }
+ .section h6 { font-size: 100% }
+
+ /* Code on titles */
+ h1 tt.computeroutput { font-size: 140% }
+ h2 tt.computeroutput { font-size: 140% }
+ h3 tt.computeroutput { font-size: 130% }
+ h4 tt.computeroutput { font-size: 120% }
+ h5 tt.computeroutput { font-size: 110% }
+ h6 tt.computeroutput { font-size: 100% }
+
+/*=============================================================================
+ Author
+=============================================================================*/
+
+ h3.author
+ {
+ font-size: 100%
+ }
+
+/*=============================================================================
+ Lists
+=============================================================================*/
+
+ li
+ {
+ font-size: 10pt;
+ line-height: 1.3;
+ }
+
+ /* Unordered lists */
+ ul
+ {
+ text-align: left;
+ }
+
+ /* Ordered lists */
+ ol
+ {
+ text-align: left;
+ }
+
+/*=============================================================================
+ Links
+=============================================================================*/
+
+ a
+ {
+ text-decoration: none; /* no underline */
+ }
+
+ a:hover
+ {
+ text-decoration: underline;
+ }
+
+/*=============================================================================
+ Spirit style navigation
+=============================================================================*/
+
+ .spirit-nav
+ {
+ text-align: right;
+ }
+
+ .spirit-nav a
+ {
+ color: white;
+ padding-left: 0.5em;
+ }
+
+ .spirit-nav img
+ {
+ border-width: 0px;
+ }
+
+/*=============================================================================
+ Copyright footer
+=============================================================================*/
+ .copyright-footer
+ {
+ text-align: right;
+ font-size: 70%;
+ }
+
+ .copyright-footer p
+ {
+ text-align: right;
+ font-size: 80%;
+ }
+
+/*=============================================================================
+ Table of contents
+=============================================================================*/
+
+ .toc
+ {
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.1pc 1pc 0.1pc 1pc;
+ font-size: 80%;
+ line-height: 1.15;
+ }
+
+ .boost-toc
+ {
+ float: right;
+ padding: 0.5pc;
+ }
+
+/*=============================================================================
+ Tables
+=============================================================================*/
+
+ .table-title,
+ div.table p.title
+ {
+ margin-left: 4%;
+ padding-right: 0.5em;
+ padding-left: 0.5em;
+ }
+
+ .informaltable table,
+ .table table
+ {
+ width: 92%;
+ margin-left: 4%;
+ margin-right: 4%;
+ }
+
+ div.informaltable table,
+ div.table table
+ {
+ padding: 4px;
+ }
+
+ /* Table Cells */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ padding: 0.5em;
+ text-align: left;
+ font-size: 9pt;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ padding: 0.5em 0.5em 0.5em 0.5em;
+ border: 1pt solid white;
+ font-size: 80%;
+ }
+
+ table.simplelist
+ {
+ width: auto !important;
+ margin: 0em !important;
+ padding: 0em !important;
+ border: none !important;
+ }
+ table.simplelist td
+ {
+ margin: 0em !important;
+ padding: 0em !important;
+ text-align: left !important;
+ font-size: 9pt !important;
+ border: none !important;
+ }
+
+/*=============================================================================
+ Blurbs
+=============================================================================*/
+
+ div.note,
+ div.tip,
+ div.important,
+ div.caution,
+ div.warning,
+ p.blurb
+ {
+ font-size: 9pt; /* A little bit smaller than the main text */
+ line-height: 1.2;
+ display: block;
+ margin: 1pc 4% 0pc 4%;
+ padding: 0.5pc 0.5pc 0.5pc 0.5pc;
+ }
+
+ p.blurb img
+ {
+ padding: 1pt;
+ }
+
+/*=============================================================================
+ Variable Lists
+=============================================================================*/
+
+ /* Make the terms in definition lists bold */
+ div.variablelist dl dt,
+ span.term
+ {
+ font-weight: bold;
+ font-size: 10pt;
+ }
+
+ div.variablelist table tbody tr td
+ {
+ text-align: left;
+ vertical-align: top;
+ padding: 0em 2em 0em 0em;
+ font-size: 10pt;
+ margin: 0em 0em 0.5em 0em;
+ line-height: 1;
+ }
+
+ div.variablelist dl dt
+ {
+ margin-bottom: 0.2em;
+ }
+
+ div.variablelist dl dd
+ {
+ margin: 0em 0em 0.5em 2em;
+ font-size: 10pt;
+ }
+
+ div.variablelist table tbody tr td p,
+ div.variablelist dl dd p
+ {
+ margin: 0em 0em 0.5em 0em;
+ line-height: 1;
+ }
+
+/*=============================================================================
+ Misc
+=============================================================================*/
+
+ /* Title of books and articles in bibliographies */
+ span.title
+ {
+ font-style: italic;
+ }
+
+ span.underline
+ {
+ text-decoration: underline;
+ }
+
+ span.strikethrough
+ {
+ text-decoration: line-through;
+ }
+
+ /* Copyright, Legal Notice */
+ div div.legalnotice p
+ {
+ text-align: left
+ }
+
+/*=============================================================================
+ Colors
+=============================================================================*/
+
+ @media screen
+ {
+ body {
+ background-color: #FFFFFF;
+ }
+
+ /* Links */
+ a
+ {
+ color: #005a9c;
+ }
+
+ a:visited
+ {
+ color: #9c5a9c;
+ }
+
+ h1 a, h2 a, h3 a, h4 a, h5 a, h6 a,
+ h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover, h6 a:hover,
+ h1 a:visited, h2 a:visited, h3 a:visited, h4 a:visited, h5 a:visited, h6 a:visited
+ {
+ text-decoration: none; /* no underline */
+ color: #000000;
+ }
+
+ /* Syntax Highlighting */
+ .keyword { color: #0000AA; }
+ .identifier { color: #000000; }
+ .special { color: #707070; }
+ .preprocessor { color: #402080; }
+ .char { color: teal; }
+ .comment { color: #800000; }
+ .string { color: teal; }
+ .number { color: teal; }
+ .white_bkd { background-color: #FFFFFF; }
+ .dk_grey_bkd { background-color: #999999; }
+
+ /* Copyright, Legal Notice */
+ .copyright
+ {
+ color: #666666;
+ font-size: small;
+ }
+
+ div div.legalnotice p
+ {
+ color: #666666;
+ }
+
+ /* Program listing */
+ pre.synopsis
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ .programlisting,
+ .screen
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ td .programlisting,
+ td .screen
+ {
+ border: 0px solid #DCDCDC;
+ }
+
+ /* Blurbs */
+ div.note,
+ div.tip,
+ div.important,
+ div.caution,
+ div.warning,
+ p.blurb
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ /* Tables */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ border: 1px solid #DCDCDC;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ background-color: #F0F0F0;
+ border: 1px solid #DCDCDC;
+ }
+
+ .copyright-footer
+ {
+ color: #8F8F8F;
+ }
+
+ /* Misc */
+ span.highlight
+ {
+ color: #00A000;
+ }
+ }
+
+ @media print
+ {
+ /* Links */
+ a
+ {
+ color: black;
+ }
+
+ a:visited
+ {
+ color: black;
+ }
+
+ .spirit-nav
+ {
+ display: none;
+ }
+
+ /* Program listing */
+ pre.synopsis
+ {
+ border: 1px solid gray;
+ }
+
+ .programlisting,
+ .screen
+ {
+ border: 1px solid gray;
+ }
+
+ td .programlisting,
+ td .screen
+ {
+ border: 0px solid #DCDCDC;
+ }
+
+ /* Table of contents */
+ .toc
+ {
+ border: 1px solid gray;
+ }
+
+ .informaltable table,
+ .table table
+ {
+ border: 1px solid gray;
+ border-collapse: collapse;
+ }
+
+ /* Tables */
+ div.informaltable table tr td,
+ div.table table tr td
+ {
+ border: 1px solid gray;
+ }
+
+ div.informaltable table tr th,
+ div.table table tr th
+ {
+ border: 1px solid gray;
+ }
+
+ table.simplelist tr td
+ {
+ border: none !important;
+ }
+
+ /* Misc */
+ span.highlight
+ {
+ font-weight: bold;
+ }
+ }
+
+/*=============================================================================
+ Images
+=============================================================================*/
+
+ span.inlinemediaobject img
+ {
+ vertical-align: middle;
+ }
+
+/*==============================================================================
+ Super and Subscript: style so that line spacing isn't effected, see
+ http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=1&postId=5341
+==============================================================================*/
+
+sup,
+sub {
+ height: 0;
+ line-height: 1;
+ vertical-align: baseline;
+ _vertical-align: bottom;
+ position: relative;
+
+}
+
+sup {
+ bottom: 1ex;
+}
+
+sub {
+ top: .5ex;
+}
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.html
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.html 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,180 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>call_visitors</title>
+<link rel="stylesheet" href="../doc/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="index 0.1">
+<link rel="up" href="../index.html" title="index 0.1">
+<link rel="prev" href="simple_edge_writer.html" title="simple_edge_writer&lt;VertexPropertyMap, OutputStream, CharT, Filter&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="C++ Boost" width="277" height="86" src="../../../boost.png"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simple_edge_writer.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="index.call_visitors"></a><a class="link" href="call_visitors.html" title="call_visitors"><code class="computeroutput"><span class="identifier">call_visitors</span></code></a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.call_visitors.synopsis"></a><a class="link" href="call_visitors.html#index.call_visitors.synopsis" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">VisitorList</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">T</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+<span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">call_visitors</span><span class="special">(</span>
+ <span class="identifier">VisitorList</span><span class="special">&amp;</span> <span class="identifier">visitors</span>
+ <span class="special">,</span> <span class="identifier">T</span> <span class="identifier">t</span>
+ <span class="special">,</span> <span class="identifier">InputGraph</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">);</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.call_visitors.description"></a><a class="link" href="call_visitors.html#index.call_visitors.description" title="Description">Description</a>
+</h3></div></div></div>
+<p>
+ This function will invoke the function call operator of each element in the
+ specified visitor list whose event filter type matches the one specified.
+ </p>
+<p>
+ This function enables BGL
+ algorithms such as <a class="link" href="loop_erased_random_tree.html" title="loop_erased_random_tree and loop_erased_random_weighted_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span><span class="special">()</span></code></a>
+ to decouple visitor event points from algorithm-specific class definitions
+ while offering user code the ability to take advantage of a simpler programming
+ interface via Boost.Fusion
+ containers. It still supports the Event Visitor List interface as an alternative.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.call_visitors.definition"></a><a class="link" href="call_visitors.html#index.call_visitors.definition" title="Where defined">Where defined</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span>boost/graph/call_visitors.hpp<span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.call_visitors.type_requirements"></a><a class="link" href="call_visitors.html#index.call_visitors.type_requirements" title="Type Requirements">Type Requirements</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="special">*</span> <span class="error">`</span><span class="identifier">Filter</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">explicitly</span> <span class="identifier">passed</span> <span class="identifier">in</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="keyword">template</span> <span class="identifier">parameter</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">VisitorList</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">either</span> <span class="identifier">the</span> Fusion Forward Sequence <span class="identifier">concept</span> <span class="keyword">or</span>
+ <span class="identifier">the</span> Event Visitor List <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">If</span> <span class="error">`</span><span class="identifier">VisitorList</span><span class="error">`</span> <span class="identifier">models</span> <span class="identifier">the</span> Fusion Forward Sequence <span class="identifier">concept</span><span class="special">,</span> <span class="identifier">then</span> <span class="identifier">the</span>
+ <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="identifier">each</span> half-runtime pair <span class="identifier">in</span> <span class="error">`</span><span class="identifier">VisitorList</span><span class="error">`</span> <span class="identifier">whose</span> <span class="identifier">first</span> <span class="identifier">type</span>
+ <span class="identifier">matches</span> <span class="error">`</span><span class="identifier">Filter</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Binary Function <span class="identifier">concept</span><span class="special">.</span> <span class="identifier">Furthermore</span><span class="special">,</span>
+ <span class="identifier">the</span> <span class="identifier">function</span> <span class="identifier">call</span> <span class="keyword">operator</span> <span class="identifier">of</span> <span class="identifier">the</span> <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="error">`</span><span class="identifier">T</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span>
+ <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">reference</span> <span class="identifier">to</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">second</span>
+ <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.call_visitors.parameters"></a><a class="link" href="call_visitors.html#index.call_visitors.parameters" title="Parameters">Parameters</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Runtime requirements
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">visitors</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The visitor list to be filtered for event point invocation.
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">t</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The object to be passed in as the first argument to the function
+ call of each visitor whose event filter type matches <code class="computeroutput"><span class="identifier">Filter</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+ The input graph must also contain the specified object.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">input_graph</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The object to be passed in as the second argument to the function
+ call of each visitor whose event filter type matches <code class="computeroutput"><span class="identifier">Filter</span></code>.
+ </p>
+ </td>
+<td>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011 Cromwell D. Enage<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="simple_edge_writer.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a>
+</div>
+</body>
+</html>

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/call_visitors.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,74 @@
+[/=============================================================================
+ Copyright (C) 2011 Cromwell D. Enage
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+=============================================================================/]
+
+[section:call_visitors `call_visitors`]
+
+[section Synopsis]
+[reference__call_visitors]
+[endsect]
+
+[section Description]
+This function will invoke the function call operator of each element in the
+specified visitor list whose event filter type matches the one specified.
+
+This function enables __BGL__ algorithms such as __loop_erased_random_tree__ to
+decouple visitor event points from algorithm-specific class definitions while
+offering user code the ability to take advantage of a simpler programming
+interface via __Boost_Fusion__ containers. It still supports the
+__Event_Visitor_List__ interface as an alternative.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_call_visitors_hpp__>
+``
+[endsect]
+
+[section Type Requirements]
+
+ * `Filter` must be explicitly passed in as a template parameter.
+ * `VisitorList` must model either the __Fusion_Forward_Sequence__ concept or
+ the __Event_Visitor_List__ concept.
+ * If `VisitorList` models the __Fusion_Forward_Sequence__ concept, then the
+ second type of each __half_runtime_pair__ in `VisitorList` whose first type
+ matches `Filter` must model the __Binary_Function__ concept. Furthermore,
+ the function call operator of the second type must accept `T` as a valid
+ first argument type and a reference to `InputGraph` as a valid second
+ argument type.
+
+[endsect]
+
+[section Parameters]
+[table
+ [[Parameter][Description][Runtime requirements]]
+ [
+ [`visitors`]
+ [The visitor list to be filtered for event point invocation.]
+ []
+ ]
+ [
+ [`t`]
+ [
+ The object to be passed in as the first argument to the function
+ call of each visitor whose event filter type matches `Filter`.
+ ]
+ [The input graph must also contain the specified object.]
+ ]
+ [
+ [`input_graph`]
+ [
+ The object to be passed in as the second argument to the function
+ call of each visitor whose event filter type matches `Filter`.
+ ]
+ []
+ ]
+]
+[endsect]
+
+[endsect] [/ call_visitors]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.html
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.html 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,81 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>fuse_property_writer</title>
+<link rel="stylesheet" href="../doc/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="index 0.1">
+<link rel="up" href="../index.html" title="index 0.1">
+<link rel="prev" href="vertex_property_map_gen.html" title="vertex_property_map_gen&lt;Graph, Value&gt;">
+<link rel="next" href="simple_edge_writer.html" title="simple_edge_writer&lt;VertexPropertyMap, OutputStream, CharT, Filter&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="C++ Boost" width="277" height="86" src="../../../boost.png"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="vertex_property_map_gen.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="simple_edge_writer.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="index.fuse_property_writer"></a><a class="link" href="fuse_property_writer.html" title="fuse_property_writer"><code class="computeroutput"><span class="identifier">fuse_property_writer</span></code></a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.fuse_property_writer.synopsis"></a><a class="link" href="fuse_property_writer.html#index.fuse_property_writer.synopsis" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Filter</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">PropertyMap</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputIterator</span><span class="special">&gt;</span>
+ <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span>
+ <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="identifier">property_writer</span><span class="special">&lt;</span><span class="identifier">PropertyMap</span><span class="special">,</span><span class="identifier">OutputIterator</span><span class="special">,</span><span class="identifier">Filter</span><span class="special">&gt;</span>
+ <span class="special">&gt;</span>
+ <span class="identifier">fuse_property_writer</span><span class="special">(</span><span class="identifier">PropertyMap</span> <span class="identifier">property_map</span><span class="special">,</span> <span class="identifier">OutputIterator</span> <span class="identifier">out_itr</span><span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.fuse_property_writer.description"></a><a class="link" href="fuse_property_writer.html#index.fuse_property_writer.description" title="Description">Description</a>
+</h3></div></div></div>
+<p>
+ Requires the <code class="computeroutput"><span class="identifier">Filter</span></code> type
+ to be explicitly passed in as a template parameter. Creates and returns a
+ boost::fusion::pair that matches the filter type
+ with a property_writer object that will
+ be invoked when the algorithm reaches the appropriate event point.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.fuse_property_writer.definition"></a><a class="link" href="fuse_property_writer.html#index.fuse_property_writer.definition" title="Where defined">Where defined</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span>boost/graph/fuse_property_writer.hpp<span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011 Cromwell D. Enage<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="vertex_property_map_gen.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="simple_edge_writer.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/fuse_property_writer.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,29 @@
+[/=============================================================================
+ Copyright (C) 2011 Cromwell D. Enage
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+=============================================================================/]
+
+[section:fuse_property_writer `fuse_property_writer`]
+
+[section Synopsis]
+[reference__fuse_property_writer]
+[endsect]
+
+[section Description]
+Requires the `Filter` type to be explicitly passed in as a template
+parameter. Creates and returns a __fusion_pair__ that matches the
+filter type with a __property_writer__ object that will be
+invoked when the algorithm reaches the appropriate event point.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_fuse_property_writer_hpp__>
+``
+[endsect]
+
+[endsect] [/ fuse_property_writer]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/alert.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/blank.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/caution.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/draft.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/home.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/important.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/next.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/next_disabled.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/note.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/prev.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/prev_disabled.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/smiley.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/tip.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-blank.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-minus.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/toc-plus.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/up.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/up_disabled.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/images/warning.png
==============================================================================
Binary file. No diff available.

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/lert.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/lert.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,119 @@
+[reference index
+ [quickbook 1.5]
+ [version 0.1]
+ [authors [Enage, Cromwell D.]]
+ [copyright 2011 Cromwell D. Enage]
+ [purpose Tree-generating implementations of loop-erased random walk]
+ [license
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+ ]
+]
+
+[/ General links.]
+[def __James_Gary_Propp__ [@http://www.math.wisc.edu/~propp/ James Gary Propp]]
+[def __David_Bruce_Wilson__ [@http://dbwilson.com/ David Bruce Wilson]]
+[def __algorithm_link__ [@http://dbwilson.com/ja/ja.ps.gz.ps]]
+
+[/ General concept links.]
+[def __Binary_Function__ [@http://www.sgi.com/tech/stl/BinaryFunction.html [*Binary Function]]]
+[def __Binary_Predicate__ [@http://www.sgi.com/tech/stl/BinaryPredicate.html [*Binary Predicate]]]
+[def __Strict_Weak_Ordering__ [@http://www.sgi.com/tech/stl/StrictWeakOrdering.html [*Strict Weak Ordering]]]
+
+[/ STL reference links.]
+[def __std_deque__ [@http://www.sgi.com/tech/stl/Deque.html `std::deque`]]
+[def _std_deque_ [@http://www.sgi.com/tech/stl/Deque.html std::deque]]
+[def __std_map__ [@http://www.sgi.com/tech/stl/Map.html `std::map`]]
+[def _std_map_ [@http://www.sgi.com/tech/stl/Map.html std::map]]
+[def _std_less_ [@http://www.sgi.com/tech/stl/less.html std::less]]
+[def _std_plus_ [@http://www.sgi.com/tech/stl/plus.html std::plus]]
+
+[/ Boost library links.]
+[def __Boost_Fusion__ [@boost:libs/fusion/doc/html/ Boost.Fusion]]
+[def __Boost_Parameter__ [@boost:libs/parameter/doc/html/index.html Boost.Parameter]]
+[def __BGL__ [@boost:libs/graph/doc/index.html BGL]]
+
+[/ Boost concept links.]
+[def __Copy_Constructible__ [@boost:libs/utility/CopyConstructible.html [*Copy Constructible]]]
+[def __Assignable__ [@boost:libs/utility/Assignable.html [*Assignable]]]
+[def __Fusion_Forward_Sequence__ [@boost:libs/fusion/doc/html/fusion/sequence/concepts/forward_sequence.html [*Fusion Forward Sequence]]]
+[def __half_runtime_pair__ [@boost:libs/fusion/doc/html/fusion/support/pair.html half-runtime pair]]
+[def __Uniform_Random_Number_Generator__ [@boost:doc/html/boost_random/reference.html#boost_random.reference.concepts.uniform_random_number_generator [*Uniform Random Number Generator]]]
+[def __Readable_Property_Map__ [@boost:/libs/property_map/doc/ReadablePropertyMap.html [*Readable Property Map]]]
+[def __Read_Write_Property_Map__ [@boost:/libs/property_map/doc/ReadWritePropertyMap.html [*Read/Write Property Map]]]
+[def __Lvalue_Property_Map__ [@boost:/libs/property_map/doc/LvaluePropertyMap.html [*Lvalue Property Map]]]
+[def __Color_Value__ [@boost:/libs/graph/doc/ColorValue.html [*Color Value]]]
+[def __Event_Visitor__ [@boost:/libs/graph/doc/EventVisitor.html [*Event Visitor]]]
+[def __Event_Visitor_List__ [@boost:/libs/graph/doc/EventVisitorList.html [*Event Visitor List]]]
+[def __Incidence_Graph__ [@boost:libs/graph/doc/IndicenceGraph.html [*Incidence Graph]]]
+[def __Bidirectional_Graph__ [@boost:libs/graph/doc/BidirectionalGraph.html [*Bidirectional Graph]]]
+[def __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[def __Property_Graph__ [@boost:libs/graph/doc/PropertyGraph.html [*Property Graph]]]
+
+[/ Boost reference links in text.]
+[def __named_parameter__ [@boost:libs/parameter/doc/html/index.html named parameter]]
+[def __old_style_named_parameters__ [@boost:libs/graph/doc/bgl_named_params.html old-style named parameters]]
+[def __vertex_descriptor_type__ [@boost:libs/graph/doc/graph_traits.html vertex descriptor type]]
+[def __vertex_iterator__ [@boost:libs/graph/doc/graph_traits.html vertex iterator]]
+[def __edge_descriptor_type__ [@boost:libs/graph/doc/graph_traits.html edge descriptor type]]
+
+[/ Boost reference links in code.]
+[def __fusion_make_list__ [@boost:libs/fusion/doc/html/fusion/container/generation/functions/make_list.html `boost::fusion::make_list`]]
+[def __fusion_make_pair__ [@boost:libs/fusion/doc/html/fusion/support/pair.html `boost::fusion::make_pair`]]
+[def __fusion_pair__ [@boost:libs/fusion/doc/html/fusion/support/pair.html `boost::fusion::pair`]]
+[def _property_traits_ [@boost:libs/property_map/doc/property_map.html#sec:property-map-traits property_traits]]
+[def __iterator_property_map__ [@boost:/libs/property_map/doc/iterator_property_map.html `iterator_property_map`]]
+[def __associative_property_map__ [@boost:/libs/property_map/doc/associative_property_map.html `associative_property_map`]]
+[def _get_map_ [@boost:libs/graph/doc/using_property_maps.html#sec:interior-properties get]]
+[def __weight_map__ [@boost:libs/graph/doc/PropertyTag.html `weight_map`]]
+[def _weight_map_ [@boost:libs/graph/doc/PropertyTag.html weight_map]]
+[def __vertex_index__ [@boost:libs/graph/doc/PropertyTag.html `vertex_index`]]
+[def _graph_traits_ [@boost:libs/graph/doc/graph_traits.html graph_traits]]
+[def _vertices_ [@boost:libs/graph/doc/VertexListGraph.html vertices]]
+[def _num_vertices_ [@boost:libs/graph/doc/VertexListGraph.html num_vertices]]
+[def __property_writer__ [@boost:libs/graph/doc/property_writer.html `property_writer`]]
+[def __depth_first_search__ [@boost:libs/graph/doc/depth_first_search.html `depth_first_search`]]
+[def __adjacency_list__ [@boost:libs/graph/doc/adjacency_list.html `adjacency_list`]]
+
+[/ Header and source file links.]
+[def __boost_graph_loop_erased_random_tree_hpp__ [@../../boost/graph/loop_erased_random_tree.hpp `<boost/graph/loop_erased_random_tree.hpp>`]]
+[def __boost_graph_loop_erased_random_weighted_tree_hpp__ [@../../boost/graph/loop_erased_random_weighted_tree.hpp `<boost/graph/loop_erased_random_weighted_tree.hpp>`]]
+[def __boost_graph_vertex_property_map_gen_hpp__ [@../../boost/graph/vertex_property_map_gen.hpp boost/graph/vertex_property_map_gen.hpp]]
+[def __boost_graph_fuse_property_writer_hpp__ [@../../boost/graph/call_visitors.hpp boost/graph/fuse_property_writer.hpp]]
+[def __boost_graph_simple_edge_writer_hpp__ [@../../boost/graph/vertex_property_map_gen.hpp boost/graph/simple_edge_writer.hpp]]
+[def __boost_graph_call_visitors_hpp__ [@../../boost/graph/call_visitors.hpp boost/graph/call_visitors.hpp]]
+[def __example_loop_erased_random_tree_hpp__ [@example/loop_erased_random_tree.hpp]]
+[def __example_loop_erased_random_tree_cpp__ [@example/loop_erased_random_tree.cpp]]
+[def __example_loop_erased_random_weighted_tree_hpp__ [@example/loop_erased_random_weighted_tree.hpp]]
+[def __example_loop_erased_random_weighted_tree_cpp__ [@example/loop_erased_random_weighted_tree.cpp]]
+
+[/ Internal links.]
+[def __loop_erased_random_tree__ [link index.loop_erased_random_tree `loop_erased_random_tree()`]]
+[def __RandomTree__ [link index.loop_erased_random_tree.description.random_tree `RandomTree()`]]
+[def __RandomTreeWithRoot__ [link index.loop_erased_random_tree.description.random_tree_with_root `RandomTreeWithRoot()`]]
+[def __parameters__ [link index.loop_erased_random_tree.parameters parameters]]
+[def __vertex_property_map_gen__ [link index.vertex_property_map_gen `vertex_property_map_gen`]]
+[def __fuse_property_writer__ [link index.fuse_property_writer `fuse_property_writer()`]]
+[def __fuse_simple_edge_writer__ [link index.simple_edge_writer.non_members `fuse_simple_edge_writer()`]]
+[def _make_vertex_property_map_ [link index.vertex_property_map_gen.non_members make_vertex_property_map]]
+
+[/ Autogenerate reference documentation directly from code.]
+[/ Bypass Doxygen.]
+[import ../../../boost/graph/vertex_property_map_gen.hpp]
+[import ../../../boost/graph/fuse_property_writer.hpp]
+[import ../../../boost/graph/simple_edge_writer.hpp]
+[import ../../../boost/graph/call_visitors.hpp]
+[import ../../../boost/graph/loop_erased_random_tree.hpp]
+[import ../../../boost/graph/loop_erased_random_weighted_tree.hpp]
+[import ../example/loop_erased_random_tree.hpp]
+[import ../example/loop_erased_random_tree.cpp]
+[import ../example/loop_erased_random_weighted_tree.hpp]
+[import ../example/loop_erased_random_weighted_tree.cpp]
+
+[include loop_erased_random_tree.qbk]
+[include vertex_property_map_gen.qbk]
+[include fuse_property_writer.qbk]
+[include simple_edge_writer.qbk]
+[include call_visitors.qbk]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.html
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.html 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,2272 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>loop_erased_random_tree and loop_erased_random_weighted_tree</title>
+<link rel="stylesheet" href="../doc/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="index 0.1">
+<link rel="up" href="../index.html" title="index 0.1">
+<link rel="prev" href="../index.html" title="index 0.1">
+<link rel="next" href="vertex_property_map_gen.html" title="vertex_property_map_gen&lt;Graph, Value&gt;">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="C++ Boost" width="277" height="86" src="../../../boost.png"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="vertex_property_map_gen.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="index.loop_erased_random_tree"></a><a class="link" href="loop_erased_random_tree.html" title="loop_erased_random_tree and loop_erased_random_weighted_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code>
+ and <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code></a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.prototypes"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.prototypes" title="Prototypes">Prototypes</a>
+</h3></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="index.loop_erased_random_tree.prototypes.loop_erased_random_tree"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.prototypes.loop_erased_random_tree" title="loop_erased_random_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code></a>
+</h4></div></div></div>
+<p>
+ The function prototype that takes in <a href="http://www.boost.org/libs/graph/doc/bgl_named_params.html" target="_top">old-style
+ named parameters</a> is always defined.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Params</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">Params</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">params</span>
+ <span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ The function prototype that explicitly takes in all parameters is defined
+ if the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS</span></code>
+ preprocessor token is defined--that is, if you set <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ to 8 or higher.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">PredecessorMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">VertexColorMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Visitor</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TerminatePredicate</span>
+ <span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&amp;</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">source_vertex</span>
+ <span class="special">,</span> <span class="identifier">VertexColorMap</span> <span class="identifier">color_map</span>
+ <span class="special">,</span> <span class="identifier">Visitor</span> <span class="identifier">visitor</span>
+ <span class="special">,</span> <span class="identifier">TerminatePredicate</span> <span class="identifier">terminate_predicate</span>
+ <span class="special">);</span>
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ Otherwise, the following function prototype is defined if the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_5_PARAMS</span></code>
+ preprocessor token is defined--that is, if you <span class="emphasis"><em>don't</em></span>
+ set <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ lower than its default value of 5.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">PredecessorMap</span>
+ <span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&amp;</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">source_vertex</span>
+ <span class="special">);</span>
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ If you need to pass in any additional arguments, then either you must set
+ <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ to 8 or higher, or you must use the first prototype instead.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="index.loop_erased_random_tree.prototypes.loop_erased_random_weighted_tree"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.prototypes.loop_erased_random_weighted_tree" title="loop_erased_random_weighted_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code></a>
+</h4></div></div></div>
+<p>
+ The function prototype that takes in <a href="http://www.boost.org/libs/graph/doc/bgl_named_params.html" target="_top">old-style
+ named parameters</a> is always defined.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Params</span><span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">Params</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">params</span>
+ <span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ The function prototype that explicitly takes in all parameters is defined
+ if the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS</span></code>
+ preprocessor token is defined--that is, if you set <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ to 11 or higher.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">PredecessorMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">EdgeWeightMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">VertexColorMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Visitor</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">DistanceCompare</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">DistanceCombine</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">TerminatePredicate</span>
+ <span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&amp;</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">source_vertex</span>
+ <span class="special">,</span> <span class="identifier">EdgeWeightMap</span> <span class="identifier">weight_map</span>
+ <span class="special">,</span> <span class="identifier">VertexColorMap</span> <span class="identifier">color_map</span>
+ <span class="special">,</span> <span class="identifier">Visitor</span> <span class="identifier">visitor</span>
+ <span class="special">,</span> <span class="identifier">DistanceCompare</span> <span class="identifier">distance_compare</span>
+ <span class="special">,</span> <span class="identifier">DistanceCombine</span> <span class="identifier">distance_combine</span>
+ <span class="special">,</span> <span class="identifier">TerminatePredicate</span> <span class="identifier">terminate_predicate</span>
+ <span class="special">);</span>
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ Otherwise, the following function prototype is defined if the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_5_PARAMS</span></code>
+ preprocessor token is defined--that is, if you <span class="emphasis"><em>don't</em></span>
+ set <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ lower than its default value of 5.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">PredecessorMap</span>
+ <span class="special">&gt;</span>
+ <span class="keyword">bool</span>
+ <span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&amp;</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">source_vertex</span>
+ <span class="special">);</span>
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+<p>
+ If you need to pass in any additional arguments, then either you must set
+ <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ to 11 or higher, or you must use the first protype instead.
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.description"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description" title="Description">Description</a>
+</h3></div></div></div>
+<p>
+ These functions implement both the <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree" title="RandomTree() Outline"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code></a>
+ and <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ algorithms by James Gary Propp
+ and David Bruce Wilson, located
+ at http://dbwilson.com/ja/ja.ps.gz.ps.
+ The <code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code>
+ function assumes the input graph to be unweighted, while the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code> function
+ will use either the specified weight map or the input graph's internal weight_map
+ property to compute the probability of an edge being chosen as a successor.
+ The predecessor map will hold the output.
+ </p>
+<p>
+ If neither vertex is specified, then the function invoked will use the <code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code>
+ algorithm. The function will return <code class="computeroutput"><span class="keyword">true</span></code>
+ unless it detects more than one dead-end vertex (one with out-degree zero),
+ in which case it will return <code class="computeroutput"><span class="keyword">false</span></code>.
+ </p>
+<p>
+ If both vertices are specified, then the function invoked will search for
+ a random path from the source vertex to the root vertex. Essentially, it
+ will run only one iteration of the <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ algorithm. The function will return <code class="computeroutput"><span class="keyword">true</span></code>
+ immediately upon success, <code class="computeroutput"><span class="keyword">false</span></code>
+ as soon as it detects a dead-end vertex that is not the root vertex.
+ </p>
+<p>
+ If only the root vertex is specified, then the function invoked will use
+ the <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ algorithm. The function will return <code class="computeroutput"><span class="keyword">true</span></code>
+ unless it detects a dead-end vertex that is not the root vertex, in which
+ case it will return <code class="computeroutput"><span class="keyword">false</span></code> after
+ visiting every vertex (indicating that the output is actually a forest).
+ </p>
+<p>
+ In each of the previous cases, the predecessor map is actually a successor
+ map, i.e. for each edge <code class="computeroutput"><span class="identifier">e</span></code>
+ in the graph that is part of the output:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">predecessor_map</span><span class="special">[</span><span class="identifier">source</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">g</span><span class="special">)]</span> <span class="special">==</span> <span class="identifier">target</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">g</span><span class="special">)</span>
+</pre>
+<p>
+ </p>
+<p>
+ If only the source vertex is specified, then the function will use the <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ algorithm as before, except that the predecessor map will follow the usual
+ convention:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="identifier">predecessor_map</span><span class="special">[</span><span class="identifier">target</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">g</span><span class="special">)]</span> <span class="special">==</span> <span class="identifier">source</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">g</span><span class="special">)</span>
+</pre>
+<p>
+ </p>
+<p>
+ We recommend that the <code class="computeroutput"><span class="identifier">InputGraph</span></code>
+ type model the Bidirectional Graph concept so that this usage
+ runs efficiently.
+ </p>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="index.loop_erased_random_tree.description.random_tree_with_root"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code>
+ Outline</a>
+</h4></div></div></div>
+<p>
+ This algorithm attempts to build random paths from every other vertex to
+ the root vertex (or from the source vertex to every other vertex). The
+ visitor event points for this algorithm are indicated by the labels on
+ the right.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">v</span> <span class="identifier">in</span> <span class="identifier">V</span><span class="special">[</span><span class="identifier">G</span><span class="special">]</span> <span class="identifier">initialize_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">WHITE</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">v</span>
+<span class="identifier">end</span> <span class="keyword">for</span> <span class="identifier">start_vertex</span><span class="special">(</span><span class="identifier">root</span><span class="special">)</span>
+ <span class="identifier">discover_vertex</span><span class="special">(</span><span class="identifier">root</span><span class="special">)</span>
+<span class="identifier">color</span><span class="special">[</span><span class="identifier">root</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">BLACK</span>
+<span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">v</span> <span class="identifier">in</span> <span class="identifier">V</span><span class="special">[</span><span class="identifier">G</span><span class="special">]</span>
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">!=</span> <span class="identifier">BLACK</span><span class="special">)</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">WHITE</span><span class="special">)</span> <span class="identifier">discover_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="special">...</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">GRAY</span> <span class="identifier">examine_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="identifier">Let</span> <span class="identifier">edge</span> <span class="identifier">e</span> <span class="special">:=</span> <span class="identifier">RandomEdge</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="identifier">examine_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="identifier">Let</span> <span class="identifier">vertex</span> <span class="identifier">u</span> <span class="special">:=</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">opposite</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">u</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">GRAY</span><span class="special">)</span> <span class="identifier">back_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">w</span> <span class="identifier">in</span> <span class="identifier">loop</span> <span class="identifier">from</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">u</span><span class="special">]</span> <span class="identifier">to</span> <span class="identifier">u</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">w</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">RED</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">w</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">w</span> <span class="identifier">loop_erased_vertex</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
+ <span class="identifier">end</span> <span class="keyword">for</span>
+ <span class="keyword">else</span> <span class="identifier">tree_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">u</span>
+ <span class="identifier">v</span> <span class="special">:=</span> <span class="identifier">u</span>
+ <span class="identifier">end</span> <span class="keyword">while</span>
+ <span class="identifier">Reset</span> <span class="identifier">v</span>
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">!=</span> <span class="identifier">BLACK</span><span class="special">)</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">BLACK</span> <span class="identifier">finish_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="identifier">v</span> <span class="special">:=</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span>
+ <span class="identifier">end</span> <span class="keyword">while</span>
+<span class="identifier">end</span> <span class="keyword">for</span> <span class="identifier">finish_vertex</span><span class="special">(</span><span class="identifier">root</span><span class="special">)</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h4 class="title">
+<a name="index.loop_erased_random_tree.description.random_tree"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree" title="RandomTree() Outline"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code>
+ Outline</a>
+</h4></div></div></div>
+<p>
+ This algorithm repeatedly attempts to pick random vertices as roots until
+ it picks only one vertex to be the root. The visitor event points for this
+ algorithm are indicated by the labels on the right.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">v</span> <span class="identifier">in</span> <span class="identifier">V</span><span class="special">[</span><span class="identifier">G</span><span class="special">]</span> <span class="identifier">initialize_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">WHITE</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">v</span>
+<span class="identifier">end</span> <span class="keyword">for</span>
+<span class="identifier">success</span> <span class="special">:=</span> <span class="identifier">FALSE</span>
+<span class="identifier">epsilon</span> <span class="special">:=</span> <span class="number">0.5</span>
+<span class="keyword">while</span> <span class="identifier">success</span> <span class="special">!=</span> <span class="identifier">TRUE</span>
+ <span class="identifier">Let</span> <span class="identifier">root_count</span> <span class="special">:=</span> <span class="number">0</span><span class="special">;</span>
+ <span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">v</span> <span class="identifier">in</span> <span class="identifier">V</span><span class="special">[</span><span class="identifier">G</span><span class="special">]</span>
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">!=</span> <span class="identifier">BLACK</span><span class="special">)</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">WHITE</span><span class="special">)</span> <span class="identifier">discover_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="special">...</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">GRAY</span> <span class="identifier">examine_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">Chance</span><span class="special">()</span> <span class="special">&lt;</span> <span class="identifier">epsilon</span><span class="special">)</span>
+ <span class="identifier">root_count</span> <span class="special">:=</span> <span class="identifier">root_count</span> <span class="special">+</span> <span class="number">1</span>
+ <span class="keyword">break</span> <span class="keyword">while</span>
+ <span class="identifier">Let</span> <span class="identifier">edge</span> <span class="identifier">e</span> <span class="special">:=</span> <span class="identifier">RandomEdge</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span> <span class="identifier">examine_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="identifier">Let</span> <span class="identifier">vertex</span> <span class="identifier">u</span> <span class="special">:=</span> <span class="identifier">e</span><span class="special">.</span><span class="identifier">opposite</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">u</span><span class="special">]</span> <span class="special">=</span> <span class="identifier">GRAY</span><span class="special">)</span> <span class="identifier">back_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="keyword">for</span> <span class="identifier">each</span> <span class="identifier">vertex</span> <span class="identifier">w</span> <span class="identifier">in</span> <span class="identifier">loop</span> <span class="identifier">from</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">u</span><span class="special">]</span> <span class="identifier">to</span> <span class="identifier">u</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">w</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">RED</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">w</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">w</span> <span class="identifier">loop_erased_vertex</span><span class="special">(</span><span class="identifier">w</span><span class="special">)</span>
+ <span class="identifier">end</span> <span class="keyword">for</span>
+ <span class="keyword">else</span> <span class="identifier">tree_edge</span><span class="special">(</span><span class="identifier">e</span><span class="special">)</span>
+ <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">u</span>
+ <span class="identifier">v</span> <span class="special">:=</span> <span class="identifier">u</span>
+ <span class="identifier">end</span> <span class="keyword">while</span>
+ <span class="identifier">Reset</span> <span class="identifier">v</span>
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">!=</span> <span class="identifier">BLACK</span><span class="special">)</span>
+ <span class="identifier">color</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span> <span class="special">:=</span> <span class="identifier">BLACK</span> <span class="identifier">finish_vertex</span><span class="special">(</span><span class="identifier">v</span><span class="special">)</span>
+ <span class="identifier">v</span> <span class="special">:=</span> <span class="identifier">p</span><span class="special">[</span><span class="identifier">v</span><span class="special">]</span>
+ <span class="identifier">end</span> <span class="keyword">while</span>
+ <span class="identifier">end</span> <span class="keyword">for</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">root_count</span> <span class="special">&gt;</span> <span class="number">1</span><span class="special">)</span>
+ <span class="identifier">epsilon</span> <span class="special">:=</span> <span class="identifier">epsilon</span> <span class="special">/</span> <span class="number">2</span>
+ <span class="keyword">else</span>
+ <span class="identifier">success</span> <span class="special">:=</span> <span class="identifier">TRUE</span>
+<span class="identifier">end</span> <span class="keyword">while</span>
+</pre>
+<p>
+ </p>
+</div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.definition"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.definition" title="Where Defined">Where Defined</a>
+</h3></div></div></div>
+<p>
+ The <boost/graph/loop_erased_random_tree.hpp>
+ header file defines the <code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code>
+ function, while the <boost/graph/loop_erased_random_weighted_tree.hpp>
+ header file defines the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code>
+ function.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.type_requirements"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.type_requirements" title="Type Requirements">Type
+ Requirements</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="special">*</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Incidence Graph<span class="special">,</span> Vertex List Graph<span class="special">,</span> <span class="keyword">and</span>
+ <span class="special">(</span><span class="keyword">if</span> <span class="error">`</span><span class="identifier">weight_map</span><span class="error">`</span> <span class="identifier">is</span> <span class="identifier">used</span> <span class="identifier">but</span> <span class="identifier">unspecified</span><span class="special">)</span> Property Graph <span class="identifier">concepts</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">RNGEngine</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Uniform Random Number Generator <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">PredecessorMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Read/Write Property Map <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> vertex descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">usable</span> <span class="identifier">as</span> <span class="identifier">both</span> <span class="identifier">the</span>
+ <span class="identifier">key</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">the</span> <span class="identifier">value</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">PredecessorMap</span><span class="error">`</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">EdgeWeightMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Readable Property Map <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> edge descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">usable</span> <span class="identifier">as</span> <span class="identifier">the</span> <span class="identifier">key</span>
+ <span class="identifier">type</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">EdgeWeightMap</span><span class="error">`</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">VertexColorMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Read/Write Property Map <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> vertex descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">usable</span> <span class="identifier">as</span> <span class="identifier">the</span> <span class="identifier">key</span>
+ <span class="identifier">type</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">VertexColorMap</span><span class="error">`</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> <span class="identifier">value</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">VertexColorMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Color Value <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">either</span> <span class="identifier">the</span> Fusion Forward Sequence <span class="identifier">concept</span> <span class="keyword">or</span>
+ <span class="identifier">the</span> Event Visitor List <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">If</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">models</span> <span class="identifier">the</span> Fusion Forward Sequence <span class="identifier">concept</span><span class="special">,</span> <span class="identifier">then</span> <span class="identifier">the</span>
+ <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="identifier">each</span> half-runtime pair <span class="identifier">in</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">whose</span> <span class="identifier">first</span> <span class="identifier">type</span> <span class="identifier">is</span>
+ <span class="error">`</span><span class="identifier">on_initialize_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_start_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_discover_vertex</span><span class="error">`</span><span class="special">,</span>
+ <span class="error">`</span><span class="identifier">on_examine_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_loop_erased_vertex</span><span class="error">`</span><span class="special">,</span> <span class="keyword">or</span> <span class="error">`</span><span class="identifier">on_finish_vertex</span><span class="error">`</span> <span class="identifier">must</span>
+ <span class="identifier">model</span> <span class="identifier">the</span> Binary Function <span class="identifier">concept</span><span class="special">.</span> <span class="identifier">Furthermore</span><span class="special">,</span> <span class="identifier">the</span> <span class="identifier">function</span> <span class="identifier">call</span>
+ <span class="keyword">operator</span> <span class="identifier">of</span> <span class="identifier">the</span> <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span> vertex descriptor type <span class="identifier">of</span>
+ <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">reference</span> <span class="identifier">to</span>
+ <span class="error">`</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">second</span> <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">If</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">models</span> <span class="identifier">the</span> Fusion Forward Sequence <span class="identifier">concept</span><span class="special">,</span> <span class="identifier">then</span> <span class="identifier">the</span>
+ <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="identifier">each</span> half-runtime pair <span class="identifier">in</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">whose</span> <span class="identifier">first</span> <span class="identifier">type</span> <span class="identifier">is</span>
+ <span class="error">`</span><span class="identifier">on_examine_edge</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_tree_edge</span><span class="error">`</span><span class="special">,</span> <span class="keyword">or</span> <span class="error">`</span><span class="identifier">on_back_edge</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span>
+ Binary Function <span class="identifier">concept</span><span class="special">.</span> <span class="identifier">Furthermore</span><span class="special">,</span> <span class="identifier">the</span> <span class="identifier">function</span> <span class="identifier">call</span> <span class="keyword">operator</span> <span class="identifier">of</span>
+ <span class="identifier">the</span> <span class="identifier">second</span> <span class="identifier">type</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span> edge descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span>
+ <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">reference</span> <span class="identifier">to</span> <span class="error">`</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span>
+ <span class="identifier">valid</span> <span class="identifier">second</span> <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">If</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">models</span> <span class="identifier">the</span> Event Visitor List <span class="identifier">concept</span><span class="special">,</span> <span class="identifier">then</span> <span class="identifier">the</span>
+ Event Visitor <span class="identifier">element</span> <span class="identifier">type</span> <span class="identifier">whose</span> <span class="identifier">event</span> <span class="identifier">filter</span> <span class="identifier">type</span> <span class="identifier">is</span>
+ <span class="error">`</span><span class="identifier">on_initialize_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_start_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_discover_vertex</span><span class="error">`</span><span class="special">,</span>
+ <span class="error">`</span><span class="identifier">on_examine_vertex</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_loop_erased_vertex</span><span class="error">`</span><span class="special">,</span> <span class="keyword">or</span> <span class="error">`</span><span class="identifier">on_finish_vertex</span><span class="error">`</span><span class="special">--</span><span class="keyword">if</span> <span class="identifier">one</span>
+ <span class="identifier">exists</span><span class="special">--</span><span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span> vertex descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span>
+ <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="identifier">to</span> <span class="identifier">its</span> <span class="identifier">apply</span> <span class="identifier">member</span> <span class="identifier">function</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">If</span> <span class="error">`</span><span class="identifier">Visitor</span><span class="error">`</span> <span class="identifier">models</span> <span class="identifier">the</span> Event Visitor List <span class="identifier">concept</span><span class="special">,</span> <span class="identifier">then</span> <span class="identifier">the</span>
+ Event Visitor <span class="identifier">element</span> <span class="identifier">type</span> <span class="identifier">whose</span> <span class="identifier">event</span> <span class="identifier">filter</span> <span class="identifier">type</span> <span class="identifier">is</span>
+ <span class="error">`</span><span class="identifier">on_examine_edge</span><span class="error">`</span><span class="special">,</span> <span class="error">`</span><span class="identifier">on_tree_edge</span><span class="error">`</span><span class="special">,</span> <span class="keyword">or</span> <span class="error">`</span><span class="identifier">on_back</span><span class="error">`</span><span class="special">--</span><span class="keyword">if</span> <span class="identifier">one</span> <span class="identifier">exists</span><span class="special">--</span><span class="identifier">must</span> <span class="identifier">accept</span>
+ <span class="identifier">the</span> edge descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span>
+ <span class="identifier">to</span> <span class="identifier">its</span> <span class="identifier">apply</span> <span class="identifier">member</span> <span class="identifier">function</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">DistanceCompare</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Strict Weak Ordering <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> <span class="identifier">function</span> <span class="identifier">call</span> <span class="keyword">operator</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">DistanceCompare</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span> <span class="identifier">value</span> <span class="identifier">type</span>
+ <span class="identifier">of</span> <span class="error">`</span><span class="identifier">EdgeWeightMap</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">both</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">second</span>
+ <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">DistanceCombine</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Binary Function <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> <span class="identifier">function</span> <span class="identifier">call</span> <span class="keyword">operator</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">DistanceCombine</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span> <span class="identifier">value</span> <span class="identifier">type</span>
+ <span class="identifier">of</span> <span class="error">`</span><span class="identifier">EdgeWeightMap</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">both</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span> <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">second</span>
+ <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span> <span class="identifier">Its</span> <span class="identifier">result</span> <span class="identifier">type</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">convertible</span> <span class="identifier">to</span> <span class="identifier">the</span> <span class="identifier">value</span> <span class="identifier">type</span> <span class="identifier">of</span>
+ <span class="error">`</span><span class="identifier">EdgeWeightMap</span><span class="error">`</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">TerminatePredicate</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Binary Predicate <span class="identifier">concept</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> <span class="identifier">function</span> <span class="identifier">call</span> <span class="keyword">operator</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">TerminatePredicate</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">accept</span> <span class="identifier">the</span>
+ vertex descriptor type <span class="identifier">of</span> <span class="error">`</span><span class="identifier">InputGraph</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">first</span> <span class="identifier">argument</span> <span class="identifier">type</span>
+ <span class="keyword">and</span> <span class="identifier">a</span> <span class="identifier">reference</span> <span class="identifier">to</span> <span class="error">`</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="error">`</span> <span class="identifier">as</span> <span class="identifier">a</span> <span class="identifier">valid</span> <span class="identifier">second</span> <span class="identifier">argument</span> <span class="identifier">type</span><span class="special">.</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.parameters"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.parameters" title="Parameters">Parameters</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Runtime requirements
+ </p>
+ </th>
+<th>
+ <p>
+ Default
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">input_graph</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The input graph.
+ </p>
+ </td>
+<td>
+ <p>
+ If both <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ and <code class="computeroutput"><span class="identifier">source_vertex</span></code>
+ are specified, then <code class="computeroutput"><span class="identifier">is_connected</span><span class="special">(</span><span class="identifier">source_vertex</span><span class="special">,</span> <span class="identifier">root_vertex</span><span class="special">,</span> <span class="identifier">input_graph</span><span class="special">)</span></code> must return <code class="computeroutput"><span class="keyword">true</span></code>.
+ Otherwise, the entire input graph must be at least weakly connected.
+ (This funciton may run infinitely otherwise.)
+ </p>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">rng_engine</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The number generator that the function invoked to find a random
+ successor or predecessor. If neither <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ nor <code class="computeroutput"><span class="identifier">source_vertex</span></code>
+ are specified, then the function will also use the number generator
+ to execute its <code class="computeroutput"><span class="identifier">Chance</span><span class="special">()</span></code> implementation. See both the
+ <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree" title="RandomTree() Outline"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code></a>
+ and <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ outlines.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">predecessor_map</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The predecessor map. It records the edges in the tree that the
+ function invoked computes. If <code class="computeroutput"><span class="identifier">source_vertex</span></code>
+ is specified but <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ is not, then the edges <code class="computeroutput"><span class="special">(</span><span class="identifier">predecessor_map</span><span class="special">[</span><span class="identifier">u</span><span class="special">],</span>
+ <span class="identifier">u</span><span class="special">)</span></code>
+ for each vertex <code class="computeroutput"><span class="identifier">u</span></code>
+ in <code class="computeroutput"><span class="identifier">input_graph</span></code>
+ are in the tree; otherwise, the edges <code class="computeroutput"><span class="special">(</span><span class="identifier">u</span><span class="special">,</span>
+ <span class="identifier">predecessor_map</span><span class="special">[</span><span class="identifier">u</span><span class="special">])</span></code>
+ for each vertex <code class="computeroutput"><span class="identifier">u</span></code>
+ in <code class="computeroutput"><span class="identifier">input_graph</span></code>
+ are in the tree. If <code class="computeroutput"><span class="identifier">predecessor_map</span><span class="special">[</span><span class="identifier">u</span><span class="special">]</span> <span class="special">==</span> <span class="identifier">u</span></code>, then <code class="computeroutput"><span class="identifier">u</span></code>
+ is either a root vertex, a dead-end vertex, or an unvisited vertex.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The root vertex.
+ </p>
+ </td>
+<td>
+ <p>
+ If this parameter is specified, then the argument must be a valid
+ dereferenced value for some <a href="http://www.boost.org/libs/graph/doc/graph_traits.html" target="_top">vertex
+ iterator</a> in the range returned by <code class="literal">vertices(input_graph)</code>.
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">graph_traits&lt;InputGraph&gt;::null_vertex()</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">source_vertex</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The source vertex.
+ </p>
+ </td>
+<td>
+ <p>
+ If this parameter is specified, then the argument must be a valid
+ dereferenced value for some <a href="http://www.boost.org/libs/graph/doc/graph_traits.html" target="_top">vertex
+ iterator</a> in the range returned by <code class="literal">vertices(input_graph)</code>.
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">graph_traits&lt;InputGraph&gt;::null_vertex()</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">weight_map</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ The weight map. Recognized and used only by the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code>
+ function. Does not need to be stochastic by default: in other words,
+ the weights of the successor edges of a vertex need not add up
+ to one.
+ </p>
+ </td>
+<td>
+ <p>
+ All values must be non-negative.
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">get(weight_map,
+ input_graph)</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">color_map</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Used by the function invoked to keep track of its progress through
+ the input graph. <code class="computeroutput"><span class="identifier">WHITE</span></code>
+ vertices are undiscovered. <code class="computeroutput"><span class="identifier">RED</span></code>
+ vertices have been loop-erased. <code class="computeroutput"><span class="identifier">GRAY</span></code>
+ vertices are part of the current search for a <code class="computeroutput"><span class="identifier">BLACK</span></code>
+ vertex. As soon at the search succeeds, these vertices will also
+ become <code class="computeroutput"><span class="identifier">BLACK</span></code>.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="literal"><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.non_members" title="Non-members">make_vertex_property_map</a>(input_graph,
+ white_color)</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">visitor</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A heterogeneous container of event visitors. See the <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree" title="RandomTree() Outline"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code></a>
+ and <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code></a>
+ outlines for an explanation of the event points and when they are
+ triggered.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">null_visitor</span><span class="special">()</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">distance_compare</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A function object that compares probabilities based on edge weights.
+ Recognized and used only by the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code>
+ function, for efficient searching through successor edges.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="literal">std::less&lt;property_traits&lt;EdgeWeightMap&gt;::value_type&gt;()</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">distance_combine</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A function object that assists in the computation of probabilities
+ based on edge weights by combining them with each other or with
+ the results of other such computations. Recognized and used only
+ by the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code>
+ function.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="literal">std::plus&lt;property_traits&lt;EdgeWeightMap&gt;::value_type&gt;()</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">terminate_predicate</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A function object that stops the function invoked from discovering
+ a vertex if passing it to the predicate causes the predicate to
+ return <code class="computeroutput"><span class="keyword">true</span></code>.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ A Binary Predicate object that always
+ returns <code class="computeroutput"><span class="keyword">false</span></code>.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.tree_example"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.tree_example" title="loop_erased_random_tree Example"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code> Example</a>
+</h3></div></div></div>
+<p>
+ The following routine displays the output of several random spanning trees
+ without a specified root vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">loop_erased_random_tree_example</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">engine</span><span class="special">,</span> <span class="identifier">pred_map</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays the output of several random spanning trees
+ with the specified root vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_tree_with_target_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">root_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Target = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">engine</span><span class="special">,</span> <span class="identifier">pred_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays the output of several random spanning trees
+ with the source vertex passed in by <a href="http://www.boost.org/libs/parameter/doc/html/index.html" target="_top">named
+ parameter</a>. The <code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code>
+ function recognizes its <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.parameters" title="Parameters">parameters</a>
+ this way by prepending the name of each parameter with a single underscore.
+ The BGL defines all
+ such Boost.Parameter
+ objects in the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span></code> namespace.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_tree_with_source_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">root_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Source = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_source_vertex</span> <span class="special">=</span> <span class="identifier">root</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Predecessors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" &lt;-- "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays several random paths from the start vertex
+ to the end vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_path_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">start_index</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">end_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">start</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">start_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">end_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">v</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Start = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">start</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", End = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">end</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">engine</span><span class="special">,</span> <span class="identifier">pred_map</span><span class="special">,</span> <span class="identifier">end</span><span class="special">,</span> <span class="identifier">start</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Path: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">start</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">v</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" -&gt; "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Code that assembles an Event Visitor List object composed of many
+ event visitors can become tedious to write or maintain. (Aside: note the
+ use of the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS</span></code>
+ preprocessor token to separate Boost.Parameter-style
+ invocation from the use of <a href="http://www.boost.org/libs/graph/doc/bgl_named_params.html" target="_top">old-style
+ named parameters</a>.)
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">loop_erased_random_tree_example_with_visitor_list</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_traits</span><span class="special">&lt;</span><span class="identifier">VertexIndexMap</span><span class="special">&gt;::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(;;)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">if</span> <span class="special">(</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_visitor</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span><span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" is a tree edge.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#else</span> <span class="comment">// !def BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_loop_erased_random_tree_params</span><span class="special">().</span><span class="identifier">rng_engine</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">).</span><span class="identifier">predecessor_map</span><span class="special">(</span>
+ <span class="identifier">pred_map</span>
+ <span class="special">).</span><span class="identifier">visitor</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span><span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" is a tree edge.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" Done!"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Trying again..."</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The boost::fusion::make_list and boost::fusion::make_pair functions allow user
+ code to associate the appropriate event filter types with their visitor objects
+ in a manner that is much more straightforward. (For writing vertex property
+ values and edge connections to an output stream, the <a class="link" href="fuse_property_writer.html" title="fuse_property_writer"><code class="computeroutput"><span class="identifier">fuse_property_writer</span><span class="special">()</span></code></a>
+ and <a class="link" href="simple_edge_writer.html#index.simple_edge_writer.non_members" title="Non-members"><code class="computeroutput"><span class="identifier">fuse_simple_edge_writer</span><span class="special">()</span></code></a> functions provide added convenience.)
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_tree_example_with_fusion_visitor_list</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">root_index</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_traits</span><span class="special">&lt;</span><span class="identifier">VertexIndexMap</span><span class="special">&gt;::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Target = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(;;)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">if</span> <span class="special">(</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">root</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_visitor</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">make_list</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#else</span> <span class="comment">// !def BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_loop_erased_random_tree_params</span><span class="special">().</span><span class="identifier">rng_engine</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">).</span><span class="identifier">source_vertex</span><span class="special">(</span>
+ <span class="identifier">root</span>
+ <span class="special">).</span><span class="identifier">predecessor_map</span><span class="special">(</span>
+ <span class="identifier">pred_map</span>
+ <span class="special">).</span><span class="identifier">visitor</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">make_list</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span>
+ <span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span>
+ <span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" Done!"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">));</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Trying again..."</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The complete example program can be compiled from these files:
+ </p>
+<pre class="programlisting"><span class="special">*</span> example/loop_erased_random_tree.hpp
+<span class="special">*</span> example/loop_erased_random_tree.cpp
+</pre>
+<p>
+ Note that this program will not compile if <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ is set lower than its default value of 5.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.loop_erased_random_tree.weighted_tree_example"></a><a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.weighted_tree_example" title="loop_erased_random_weighted_tree Example"><code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code> Example</a>
+</h3></div></div></div>
+<p>
+ The following routine displays the output of several random spanning trees
+ without a specified root vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">loop_erased_random_weighted_tree_example</span><span class="special">(</span><span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">EdgeWeightMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+
+ <span class="identifier">EdgeWeightMap</span> <span class="identifier">e_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">u</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">e_map</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">engine</span><span class="special">,</span> <span class="identifier">pred_map</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">u</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" ("</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge</span><span class="special">(*</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">e_map</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">')'</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays the output of several random spanning trees
+ with the specified root vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_weighted_tree_with_target_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">root_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">EdgeWeightMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+
+ <span class="identifier">EdgeWeightMap</span> <span class="identifier">e_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">u</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Target = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">e_map</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">engine</span><span class="special">,</span> <span class="identifier">pred_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">u</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" ("</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge</span><span class="special">(*</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">e_map</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">')'</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays the output of several random spanning trees
+ with the source vertex passed in by <a href="http://www.boost.org/libs/parameter/doc/html/index.html" target="_top">named
+ parameter</a>. The <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span></code>
+ function recognizes its <a class="link" href="loop_erased_random_tree.html#index.loop_erased_random_tree.parameters" title="Parameters">parameters</a>
+ this way by prepending the name of each parameter with a single underscore.
+ The BGL defines all
+ such Boost.Parameter
+ objects in the <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span></code> namespace.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_weighted_tree_with_source_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">root_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">EdgeWeightMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+
+ <span class="identifier">EdgeWeightMap</span> <span class="identifier">e_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">u</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Source = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">e_map</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_source_vertex</span> <span class="special">=</span> <span class="identifier">root</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Predecessors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" &lt;-- "</span><span class="special">;</span>
+ <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">u</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" ("</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge</span><span class="special">(</span><span class="identifier">u</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">e_map</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">')'</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The following routine displays several random paths from the start vertex
+ to the end vertex.
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_weighted_path_example</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">start_index</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="keyword">const</span> <span class="identifier">end_index</span>
+ <span class="special">,</span> <span class="keyword">unsigned</span> <span class="keyword">int</span> <span class="identifier">num_runs</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">start</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">start_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">end</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">end_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">Vertex</span> <span class="identifier">v</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Start = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">start</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", End = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">end</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">));</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">num_runs</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="keyword">if</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">end</span>
+ <span class="special">,</span> <span class="identifier">start</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Path: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">start</span><span class="special">);</span>
+
+ <span class="keyword">while</span> <span class="special">(</span><span class="identifier">v</span> <span class="special">!=</span> <span class="identifier">end</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">v</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" -&gt; "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">v</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">--</span><span class="identifier">num_runs</span><span class="special">;</span>
+ <span class="special">}</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ Code that assembles an Event Visitor List object composed of many
+ event visitors can become tedious to write or maintain. (Aside: note the
+ use of the <code class="computeroutput"><span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS</span></code>
+ preprocessor token to separate Boost.Parameter-style
+ invocation from the use of <a href="http://www.boost.org/libs/graph/doc/bgl_named_params.html" target="_top">old-style
+ named parameters</a>.)
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">loop_erased_random_weighted_tree_example_with_visitor_list</span><span class="special">()</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_traits</span><span class="special">&lt;</span><span class="identifier">VertexIndexMap</span><span class="special">&gt;::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">EdgeWeightMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+
+ <span class="identifier">EdgeWeightMap</span> <span class="identifier">e_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">u</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">e_map</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(;;)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">if</span> <span class="special">(</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_visitor</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span><span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" is a tree edge.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#else</span> <span class="comment">// !def BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_loop_erased_random_tree_params</span><span class="special">().</span><span class="identifier">rng_engine</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">).</span><span class="identifier">predecessor_map</span><span class="special">(</span>
+ <span class="identifier">pred_map</span>
+ <span class="special">).</span><span class="identifier">visitor</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">write_property</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span><span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">make_pair</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" is a tree edge.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">()</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" Done!"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">u</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" ("</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge</span><span class="special">(*</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">e_map</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">')'</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Trying again...\t"</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The boost::fusion::make_list and boost::fusion::make_pair functions allow user
+ code to associate the appropriate event filter types with their visitor objects
+ in a manner that is much more straightforward. (For writing vertex property
+ values and edge connections to an output stream, the <a class="link" href="fuse_property_writer.html" title="fuse_property_writer"><code class="computeroutput"><span class="identifier">fuse_property_writer</span><span class="special">()</span></code></a>
+ and <a class="link" href="simple_edge_writer.html#index.simple_edge_writer.non_members" title="Non-members"><code class="computeroutput"><span class="identifier">fuse_simple_edge_writer</span><span class="special">()</span></code></a> functions provide added convenience.)
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">RNGEngine</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="identifier">loop_erased_random_weighted_tree_example_with_fusion_visitor_list</span><span class="special">(</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">root_index</span>
+ <span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_iterator</span>
+ <span class="identifier">VertexIterator</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="identifier">Vertex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">PredecessorMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">VertexIndexMap</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_traits</span><span class="special">&lt;</span><span class="identifier">VertexIndexMap</span><span class="special">&gt;::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_map</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight_t</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">EdgeWeightMap</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="number">24</span><span class="special">);</span>
+ <span class="identifier">VertexIterator</span> <span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="identifier">PredecessorMap</span> <span class="identifier">pred_map</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">index_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">RNGEngine</span> <span class="identifier">engine</span><span class="special">;</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">variate_generator</span><span class="special">&lt;</span><span class="identifier">RNGEngine</span><span class="special">&amp;,</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;</span> <span class="special">&gt;</span> <span class="identifier">rng</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">tr1</span><span class="special">::</span><span class="identifier">uniform_real</span><span class="special">&lt;&gt;(</span><span class="number">0.2</span><span class="special">,</span> <span class="number">0.8</span><span class="special">)</span>
+ <span class="special">);</span>
+ <span class="identifier">initialize_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">rng</span><span class="special">);</span>
+
+ <span class="identifier">EdgeWeightMap</span> <span class="identifier">e_map</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge_weight</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+ <span class="keyword">typename</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span><span class="special">;</span>
+ <span class="keyword">bool</span> <span class="identifier">b</span><span class="special">;</span>
+ <span class="identifier">Vertex</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">root</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertex</span><span class="special">(</span><span class="identifier">root_index</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Target = "</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">root</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">", Graph:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_graph</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">print_edges2</span><span class="special">(</span><span class="identifier">g</span><span class="special">,</span> <span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">e_map</span><span class="special">);</span>
+
+ <span class="keyword">for</span> <span class="special">(;;)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">if</span> <span class="special">(</span>
+<span class="preprocessor">#ifdef</span> <span class="identifier">BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">engine</span>
+ <span class="special">,</span> <span class="identifier">pred_map</span>
+ <span class="special">,</span> <span class="identifier">root</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">graph</span><span class="special">::</span><span class="identifier">keywords</span><span class="special">::</span><span class="identifier">_visitor</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">make_list</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#else</span> <span class="comment">// !def BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">(</span>
+ <span class="identifier">g</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">make_loop_erased_random_tree_params</span><span class="special">().</span><span class="identifier">rng_engine</span><span class="special">(</span>
+ <span class="identifier">engine</span>
+ <span class="special">).</span><span class="identifier">source_vertex</span><span class="special">(</span>
+ <span class="identifier">root</span>
+ <span class="special">).</span><span class="identifier">predecessor_map</span><span class="special">(</span>
+ <span class="identifier">pred_map</span>
+ <span class="special">).</span><span class="identifier">visitor</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">make_list</span><span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span>
+ <span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" initialized...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" started...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" discovered...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" examined...\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_loop_erased_vertex</span>
+ <span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" erased from loop.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special">&lt;</span>
+ <span class="identifier">VertexIndex</span>
+ <span class="special">&gt;(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">,</span> <span class="string">" finished.\t"</span><span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_tree_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" examined...\t"</span>
+ <span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</span><span class="special">&gt;(</span>
+ <span class="identifier">index_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span>
+ <span class="special">,</span> <span class="string">" leads to a loop.\t"</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+ <span class="special">)</span>
+<span class="preprocessor">#endif</span> <span class="comment">// BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+</span> <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">" Done!"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Successors:"</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+
+ <span class="keyword">for</span> <span class="special">(</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">vi_end</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">vertices</span><span class="special">(</span><span class="identifier">g</span><span class="special">);</span>
+ <span class="identifier">vi</span> <span class="special">!=</span> <span class="identifier">vi_end</span><span class="special">;</span>
+ <span class="special">++</span><span class="identifier">vi</span>
+ <span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">'\t'</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" --&gt; "</span><span class="special">;</span>
+ <span class="identifier">u</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">pred_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">index_map</span><span class="special">,</span> <span class="identifier">u</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="string">" ("</span><span class="special">;</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">tie</span><span class="special">(</span><span class="identifier">e</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">edge</span><span class="special">(*</span><span class="identifier">vi</span><span class="special">,</span> <span class="identifier">u</span><span class="special">,</span> <span class="identifier">g</span><span class="special">);</span>
+
+ <span class="keyword">if</span> <span class="special">(</span><span class="identifier">b</span><span class="special">)</span>
+ <span class="special">{</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">get</span><span class="special">(</span><span class="identifier">e_map</span><span class="special">,</span> <span class="identifier">e</span><span class="special">);</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="char">')'</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="keyword">break</span><span class="special">;</span>
+ <span class="special">}</span>
+
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special">&lt;&lt;</span> <span class="string">"Trying again...\t"</span><span class="special">;</span>
+ <span class="special">}</span>
+<span class="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The complete example program can be compiled from these files:
+ </p>
+<pre class="programlisting"><span class="special">*</span> example/loop_erased_random_weighted_tree.hpp
+<span class="special">*</span> example/loop_erased_random_weighted_tree.cpp
+</pre>
+<p>
+ Note that this program will not compile if <code class="computeroutput"><span class="identifier">BOOST_PARAMETER_MAX_ARITY</span></code>
+ is set lower than its default value of 5.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011 Cromwell D. Enage<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="../index.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="vertex_property_map_gen.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/loop_erased_random_tree.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,577 @@
+[/=============================================================================
+ Copyright (C) 2011 Cromwell D. Enage
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+=============================================================================/]
+
+[section:loop_erased_random_tree
+`loop_erased_random_tree` and `loop_erased_random_weighted_tree`]
+
+[section Prototypes]
+
+[section:loop_erased_random_tree `loop_erased_random_tree`]
+The function prototype that takes in __old_style_named_parameters__ is always
+defined.
+
+[reference__loop_erased_random_tree__prototype_old]
+
+The function prototype that explicitly takes in all parameters is defined if
+the `BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS` preprocessor token
+is defined--that is, if you set `BOOST_PARAMETER_MAX_ARITY` to 8 or higher.
+
+``
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename RNGEngine
+ , typename PredecessorMap
+ , typename VertexColorMap
+ , typename Visitor
+ , typename TerminatePredicate
+ >
+ bool
+ loop_erased_random_tree(
+ InputGraph const& input_graph
+ , RNGEngine& rng_engine
+ , PredecessorMap predecessor_map
+ , typename graph_traits<Graph>::vertex_descriptor root_vertex
+ , typename graph_traits<Graph>::vertex_descriptor source_vertex
+ , VertexColorMap color_map
+ , Visitor visitor
+ , TerminatePredicate terminate_predicate
+ );
+} // namespace boost
+``
+
+Otherwise, the following function prototype is defined if the
+`BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_5_PARAMS` preprocessor token is
+defined--that is, if you /don't/ set `BOOST_PARAMETER_MAX_ARITY` lower than its
+default value of 5.
+
+``
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename RNGEngine
+ , typename PredecessorMap
+ >
+ bool
+ loop_erased_random_tree(
+ InputGraph const& input_graph
+ , RNGEngine& rng_engine
+ , PredecessorMap predecessor_map
+ , typename graph_traits<Graph>::vertex_descriptor root_vertex
+ , typename graph_traits<Graph>::vertex_descriptor source_vertex
+ );
+} // namespace boost
+``
+
+If you need to pass in any additional arguments, then either you must set
+`BOOST_PARAMETER_MAX_ARITY` to 8 or higher, or you must use the first prototype
+instead.
+[endsect] [/ loop_erased_random_tree]
+
+[section:loop_erased_random_weighted_tree `loop_erased_random_weighted_tree`]
+The function prototype that takes in __old_style_named_parameters__ is always
+defined.
+
+[reference__loop_erased_random_weighted_tree__prototype_old]
+
+The function prototype that explicitly takes in all parameters is defined if
+the `BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS`
+preprocessor token is defined--that is, if you set `BOOST_PARAMETER_MAX_ARITY`
+to 11 or higher.
+
+``
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename RNGEngine
+ , typename PredecessorMap
+ , typename EdgeWeightMap
+ , typename VertexColorMap
+ , typename Visitor
+ , typename DistanceCompare
+ , typename DistanceCombine
+ , typename TerminatePredicate
+ >
+ bool
+ loop_erased_random_weighted_tree(
+ InputGraph const& input_graph
+ , RNGEngine& rng_engine
+ , PredecessorMap predecessor_map
+ , typename graph_traits<Graph>::vertex_descriptor root_vertex
+ , typename graph_traits<Graph>::vertex_descriptor source_vertex
+ , EdgeWeightMap weight_map
+ , VertexColorMap color_map
+ , Visitor visitor
+ , DistanceCompare distance_compare
+ , DistanceCombine distance_combine
+ , TerminatePredicate terminate_predicate
+ );
+} // namespace boost
+``
+
+Otherwise, the following function prototype is defined if the
+`BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_5_PARAMS` preprocessor
+token is defined--that is, if you /don't/ set `BOOST_PARAMETER_MAX_ARITY` lower
+than its default value of 5.
+
+``
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename RNGEngine
+ , typename PredecessorMap
+ >
+ bool
+ loop_erased_random_weighted_tree(
+ InputGraph const& input_graph
+ , RNGEngine& rng_engine
+ , PredecessorMap predecessor_map
+ , typename graph_traits<Graph>::vertex_descriptor root_vertex
+ , typename graph_traits<Graph>::vertex_descriptor source_vertex
+ );
+} // namespace boost
+``
+
+If you need to pass in any additional arguments, then either you must set
+`BOOST_PARAMETER_MAX_ARITY` to 11 or higher, or you must use the first
+protype instead.
+[endsect] [/ loop_erased_random_weighted_tree]
+
+[endsect] [/ Prototypes]
+
+[section Description]
+These functions implement both the __RandomTree__ and __RandomTreeWithRoot__
+algorithms by __James_Gary_Propp__ and __David_Bruce_Wilson__, located at
+__algorithm_link__. The `loop_erased_random_tree` function assumes the input
+graph to be unweighted, while the `loop_erased_random_weighted_tree` function
+will use either the specified weight map or the input graph's internal
+__weight_map__ property to compute the probability of an edge being chosen as a
+successor. The predecessor map will hold the output.
+
+If neither vertex is specified, then the function invoked will use the
+`RandomTree()` algorithm. The function will return `true` unless it detects
+more than one dead-end vertex (one with out-degree zero), in which case it will
+return `false`.
+
+If both vertices are specified, then the function invoked will search for a
+random path from the source vertex to the root vertex. Essentially, it will
+run only one iteration of the __RandomTreeWithRoot__ algorithm. The function
+will return `true` immediately upon success, `false` as soon as it detects a
+dead-end vertex that is not the root vertex.
+
+If only the root vertex is specified, then the function invoked will use the
+__RandomTreeWithRoot__ algorithm. The function will return `true` unless it
+detects a dead-end vertex that is not the root vertex, in which case it will
+return `false` after visiting every vertex (indicating that the output is
+actually a forest).
+
+In each of the previous cases, the predecessor map is actually a successor map,
+i.e. for each edge `e` in the graph that is part of the output:
+
+``
+ predecessor_map[source(e, g)] == target(e, g)
+``
+
+If only the source vertex is specified, then the function will use the
+__RandomTreeWithRoot__ algorithm as before, except that the predecessor map
+will follow the usual convention:
+
+``
+ predecessor_map[target(e, g)] == source(e, g)
+``
+
+We recommend that the `InputGraph` type model the __Bidirectional_Graph__
+concept so that this usage runs efficiently.
+
+[section:random_tree_with_root `RandomTreeWithRoot()` Outline]
+This algorithm attempts to build random paths from every other vertex to the
+root vertex (or from the source vertex to every other vertex). The visitor
+event points for this algorithm are indicated by the labels on the right.
+
+``
+for each vertex v in V[G] initialize_vertex(v)
+ color[v] := WHITE
+ p[v] := v
+end for start_vertex(root)
+ discover_vertex(root)
+color[root] := BLACK
+for each vertex v in V[G]
+ while (color[v] != BLACK)
+ if (color[v] = WHITE) discover_vertex(v)
+ ...
+ color[v] := GRAY examine_vertex(v)
+ Let edge e := RandomEdge(v) examine_edge(e)
+ Let vertex u := e.opposite
+ if (color[u] = GRAY) back_edge(e)
+ for each vertex w in loop from p[u] to u
+ color[w] := RED
+ p[w] := w loop_erased_vertex(w)
+ end for
+ else tree_edge(e)
+ p[v] := u
+ v := u
+ end while
+ Reset v
+ while (color[v] != BLACK)
+ color[v] := BLACK finish_vertex(v)
+ v := p[v]
+ end while
+end for finish_vertex(root)
+``
+[endsect]
+
+[section:random_tree `RandomTree()` Outline]
+This algorithm repeatedly attempts to pick random vertices as roots until it
+picks only one vertex to be the root. The visitor event points for this
+algorithm are indicated by the labels on the right.
+
+``
+for each vertex v in V[G] initialize_vertex(v)
+ color[v] := WHITE
+ p[v] := v
+end for
+success := FALSE
+epsilon := 0.5
+while success != TRUE
+ Let root_count := 0;
+ for each vertex v in V[G]
+ while (color[v] != BLACK)
+ if (color[v] = WHITE) discover_vertex(v)
+ ...
+ color[v] := GRAY examine_vertex(v)
+ if (Chance() < epsilon)
+ root_count := root_count + 1
+ break while
+ Let edge e := RandomEdge(v) examine_edge(e)
+ Let vertex u := e.opposite
+ if (color[u] = GRAY) back_edge(e)
+ for each vertex w in loop from p[u] to u
+ color[w] := RED
+ p[w] := w loop_erased_vertex(w)
+ end for
+ else tree_edge(e)
+ p[v] := u
+ v := u
+ end while
+ Reset v
+ while (color[v] != BLACK)
+ color[v] := BLACK finish_vertex(v)
+ v := p[v]
+ end while
+ end for
+ if (root_count > 1)
+ epsilon := epsilon / 2
+ else
+ success := TRUE
+end while
+``
+[endsect]
+
+[endsect] [/ Description]
+
+[section:definition Where Defined]
+The __boost_graph_loop_erased_random_tree_hpp__ header file defines the
+`loop_erased_random_tree` function, while the
+__boost_graph_loop_erased_random_weighted_tree_hpp__ header file defines the
+`loop_erased_random_weighted_tree` function.
+[endsect]
+
+[section Type Requirements]
+
+ * `InputGraph` must model the __Incidence_Graph__, __Vertex_List_Graph__, and
+ (if `weight_map` is used but unspecified) __Property_Graph__ concepts.
+ * `RNGEngine` must model the __Uniform_Random_Number_Generator__ concept.
+ * `PredecessorMap` must model the __Read_Write_Property_Map__ concept.
+ * The __vertex_descriptor_type__ of `InputGraph` must be usable as both the
+ key type and the value type of `PredecessorMap`.
+ * `EdgeWeightMap` must model the __Readable_Property_Map__ concept.
+ * The __edge_descriptor_type__ of `InputGraph` must be usable as the key
+ type of `EdgeWeightMap`.
+ * `VertexColorMap` must model the __Read_Write_Property_Map__ concept.
+ * The __vertex_descriptor_type__ of `InputGraph` must be usable as the key
+ type of `VertexColorMap`.
+ * The value type of `VertexColorMap` must model the __Color_Value__ concept.
+ * `Visitor` must model either the __Fusion_Forward_Sequence__ concept or
+ the __Event_Visitor_List__ concept.
+ * If `Visitor` models the __Fusion_Forward_Sequence__ concept, then the
+ second type of each __half_runtime_pair__ in `Visitor` whose first type is
+ `on_initialize_vertex`, `on_start_vertex`, `on_discover_vertex`,
+ `on_examine_vertex`, `on_loop_erased_vertex`, or `on_finish_vertex` must
+ model the __Binary_Function__ concept. Furthermore, the function call
+ operator of the second type must accept the __vertex_descriptor_type__ of
+ `InputGraph` as a valid first argument type and a reference to
+ `InputGraph const` as a valid second argument type.
+ * If `Visitor` models the __Fusion_Forward_Sequence__ concept, then the
+ second type of each __half_runtime_pair__ in `Visitor` whose first type is
+ `on_examine_edge`, `on_tree_edge`, or `on_back_edge` must model the
+ __Binary_Function__ concept. Furthermore, the function call operator of
+ the second type must accept the __edge_descriptor_type__ of `InputGraph`
+ as a valid first argument type and a reference to `InputGraph const` as a
+ valid second argument type.
+ * If `Visitor` models the __Event_Visitor_List__ concept, then the
+ __Event_Visitor__ element type whose event filter type is
+ `on_initialize_vertex`, `on_start_vertex`, `on_discover_vertex`,
+ `on_examine_vertex`, `on_loop_erased_vertex`, or `on_finish_vertex`--if one
+ exists--must accept the __vertex_descriptor_type__ of `InputGraph` as a
+ valid first argument type to its apply member function.
+ * If `Visitor` models the __Event_Visitor_List__ concept, then the
+ __Event_Visitor__ element type whose event filter type is
+ `on_examine_edge`, `on_tree_edge`, or `on_back`--if one exists--must accept
+ the __edge_descriptor_type__ of `InputGraph` as a valid first argument type
+ to its apply member function.
+ * `DistanceCompare` must model the __Strict_Weak_Ordering__ concept.
+ * The function call operator of `DistanceCompare` must accept the value type
+ of `EdgeWeightMap` as both a valid first argument type and a valid second
+ argument type.
+ * `DistanceCombine` must model the __Binary_Function__ concept.
+ * The function call operator of `DistanceCombine` must accept the value type
+ of `EdgeWeightMap` as both a valid first argument type and a valid second
+ argument type. Its result type must be convertible to the value type of
+ `EdgeWeightMap`.
+ * `TerminatePredicate` must model the __Binary_Predicate__ concept.
+ * The function call operator of `TerminatePredicate` must accept the
+ __vertex_descriptor_type__ of `InputGraph` as a valid first argument type
+ and a reference to `InputGraph const` as a valid second argument type.
+
+[endsect]
+
+[section Parameters]
+[table
+ [[Parameter][Description][Runtime requirements][Default]]
+ [
+ [`input_graph`]
+ [The input graph.]
+ [
+ If both `root_vertex` and `source_vertex` are specified, then
+ `is_connected(source_vertex, root_vertex, input_graph)` must return
+ `true`. Otherwise, the entire input graph must be at least weakly
+ connected. (This funciton may run infinitely otherwise.)
+ ]
+ [None; always required.]
+ ]
+ [
+ [`rng_engine`]
+ [
+ The number generator that the function invoked to find a random
+ successor or predecessor. If neither `root_vertex` nor
+ `source_vertex` are specified, then the function will also use the
+ number generator to execute its `Chance()` implementation. See
+ both the __RandomTree__ and __RandomTreeWithRoot__ outlines.
+ ]
+ []
+ [None; always required.]
+ ]
+ [
+ [`predecessor_map`]
+ [
+ The predecessor map. It records the edges in the tree that the
+ function invoked computes. If `source_vertex` is specified but
+ `root_vertex` is not, then the edges `(predecessor_map[u], u)` for
+ each vertex `u` in `input_graph` are in the tree; otherwise, the
+ edges `(u, predecessor_map[u])` for each vertex `u` in
+ `input_graph` are in the tree. If `predecessor_map[u] == u`, then
+ `u` is either a root vertex, a dead-end vertex, or an unvisited
+ vertex.
+ ]
+ []
+ [None; always required.]
+ ]
+ [
+ [`root_vertex`]
+ [The root vertex.]
+ [
+ If this parameter is specified, then the argument must be a valid
+ dereferenced value for some __vertex_iterator__ in the range
+ returned by [^_vertices_(input_graph)].
+ ]
+ [[^_graph_traits_<InputGraph>::null_vertex()]]
+ ]
+ [
+ [`source_vertex`]
+ [The source vertex.]
+ [
+ If this parameter is specified, then the argument must be a valid
+ dereferenced value for some __vertex_iterator__ in the range
+ returned by [^_vertices_(input_graph)].
+ ]
+ [[^_graph_traits_<InputGraph>::null_vertex()]]
+ ]
+ [
+ [`weight_map`]
+ [
+ The weight map. Recognized and used only by the
+ `loop_erased_random_weighted_tree` function. Does not need to be
+ stochastic by default: in other words, the weights of the
+ successor edges of a vertex need not add up to one.
+ ]
+ [All values must be non-negative.]
+ [[^_get_map_(_weight_map_, input_graph)]]
+ ]
+ [
+ [`color_map`]
+ [
+ Used by the function invoked to keep track of its progress through
+ the input graph. `WHITE` vertices are undiscovered. `RED`
+ vertices have been loop-erased. `GRAY` vertices are part of the
+ current search for a `BLACK` vertex. As soon at the search
+ succeeds, these vertices will also become `BLACK`.
+ ]
+ []
+ [[^_make_vertex_property_map_(input_graph, white_color)]]
+ ]
+ [
+ [`visitor`]
+ [
+ A heterogeneous container of event visitors. See the
+ __RandomTree__ and __RandomTreeWithRoot__ outlines for an
+ explanation of the event points and when they are triggered.
+ ]
+ []
+ [`null_visitor()`]
+ ]
+ [
+ [`distance_compare`]
+ [
+ A function object that compares probabilities based on edge
+ weights. Recognized and used only by the
+ `loop_erased_random_weighted_tree` function, for efficient
+ searching through successor edges.
+ ]
+ []
+ [[^_std_less_<_property_traits_<EdgeWeightMap>::value_type>()]]
+ ]
+ [
+ [`distance_combine`]
+ [
+ A function object that assists in the computation of probabilities
+ based on edge weights by combining them with each other or with the
+ results of other such computations. Recognized and used only by
+ the `loop_erased_random_weighted_tree` function.
+ ]
+ []
+ [[^_std_plus_<_property_traits_<EdgeWeightMap>::value_type>()]]
+ ]
+ [
+ [`terminate_predicate`]
+ [
+ A function object that stops the function invoked from discovering
+ a vertex if passing it to the predicate causes the predicate to
+ return `true`.
+ ]
+ []
+ [A __Binary_Predicate__ object that always returns `false`.]
+ ]
+]
+[endsect] [/ Parameters]
+
+[section:tree_example `loop_erased_random_tree` Example]
+The following routine displays the output of several random spanning trees
+without a specified root vertex.
+
+[loop_erased_random_tree_example]
+
+The following routine displays the output of several random spanning trees with
+the specified root vertex.
+
+[loop_erased_random_tree_with_target_example]
+
+The following routine displays the output of several random spanning trees with
+the source vertex passed in by __named_parameter__. The
+`loop_erased_random_tree` function recognizes its __parameters__ this way by
+prepending the name of each parameter with a single underscore. The __BGL__
+defines all such __Boost_Parameter__ objects in the `boost::graph::keywords`
+namespace.
+
+[loop_erased_random_tree_with_source_example]
+
+The following routine displays several random paths from the start vertex to
+the end vertex.
+
+[loop_erased_random_path_example]
+
+Code that assembles an __Event_Visitor_List__ object composed of many event
+visitors can become tedious to write or maintain. (Aside: note the use of
+the `BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS` preprocessor token
+to separate __Boost_Parameter__-style invocation from the use of
+__old_style_named_parameters__.)
+
+[loop_erased_random_tree_example_with_visitor_list]
+
+The __fusion_make_list__ and __fusion_make_pair__ functions allow user code to
+associate the appropriate event filter types with their visitor objects in a
+manner that is much more straightforward. (For writing vertex property values
+and edge connections to an output stream, the __fuse_property_writer__ and
+__fuse_simple_edge_writer__ functions provide added convenience.)
+
+[loop_erased_random_tree_example_with_fusion_visitor_list]
+
+The complete example program can be compiled from these files:
+
+ * __example_loop_erased_random_tree_hpp__
+ * __example_loop_erased_random_tree_cpp__
+
+Note that this program will not compile if `BOOST_PARAMETER_MAX_ARITY` is set
+lower than its default value of 5.
+[endsect] [/ loop_erased_random_tree Example]
+
+[section:weighted_tree_example `loop_erased_random_weighted_tree` Example]
+The following routine displays the output of several random spanning trees
+without a specified root vertex.
+
+[loop_erased_random_weighted_tree_example]
+
+The following routine displays the output of several random spanning trees with
+the specified root vertex.
+
+[loop_erased_random_weighted_tree_with_target_example]
+
+The following routine displays the output of several random spanning trees with
+the source vertex passed in by __named_parameter__. The
+`loop_erased_random_weighted_tree` function recognizes its __parameters__ this
+way by prepending the name of each parameter with a single underscore. The
+__BGL__ defines all such __Boost_Parameter__ objects in the
+`boost::graph::keywords` namespace.
+
+[loop_erased_random_weighted_tree_with_source_example]
+
+The following routine displays several random paths from the start vertex to
+the end vertex.
+
+[loop_erased_random_weighted_path_example]
+
+Code that assembles an __Event_Visitor_List__ object composed of many event
+visitors can become tedious to write or maintain. (Aside: note the use of the
+`BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS` preprocessor
+token to separate __Boost_Parameter__-style invocation from the use of
+__old_style_named_parameters__.)
+
+[loop_erased_random_weighted_tree_example_with_visitor_list]
+
+The __fusion_make_list__ and __fusion_make_pair__ functions allow user code to
+associate the appropriate event filter types with their visitor objects in a
+manner that is much more straightforward. (For writing vertex property values
+and edge connections to an output stream, the __fuse_property_writer__ and
+__fuse_simple_edge_writer__ functions provide added convenience.)
+
+[loop_erased_random_weighted_tree_example_with_fusion_visitor_list]
+
+The complete example program can be compiled from these files:
+
+ * __example_loop_erased_random_weighted_tree_hpp__
+ * __example_loop_erased_random_weighted_tree_cpp__
+
+Note that this program will not compile if `BOOST_PARAMETER_MAX_ARITY` is set
+lower than its default value of 5.
+[endsect] [/ loop_erased_random_weighted_tree Example]
+
+[endsect] [/ loop_erased_random_tree and loop_erased_random_weighted_tree]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.html
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.html 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,426 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>simple_edge_writer&lt;VertexPropertyMap, OutputStream, CharT, Filter&gt;</title>
+<link rel="stylesheet" href="../doc/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="index 0.1">
+<link rel="up" href="../index.html" title="index 0.1">
+<link rel="prev" href="fuse_property_writer.html" title="fuse_property_writer">
+<link rel="next" href="call_visitors.html" title="call_visitors">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="C++ Boost" width="277" height="86" src="../../../boost.png"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="fuse_property_writer.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="call_visitors.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="index.simple_edge_writer"></a><a class="link" href="simple_edge_writer.html" title="simple_edge_writer&lt;VertexPropertyMap, OutputStream, CharT, Filter&gt;"><code class="computeroutput"><span class="identifier">simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">VertexPropertyMap</span><span class="special">,</span> <span class="identifier">OutputStream</span><span class="special">,</span> <span class="identifier">CharT</span><span class="special">,</span>
+ <span class="identifier">Filter</span><span class="special">&gt;</span></code></a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.synopsis"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.synopsis" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">VertexPropertyMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputStream</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CharT</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Filter</span>
+ <span class="special">&gt;</span>
+ <span class="keyword">class</span> <span class="identifier">simple_edge_writer</span>
+ <span class="special">{</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="identifier">Filter</span> <span class="identifier">event_filter</span><span class="special">;</span>
+
+ <span class="identifier">simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">VertexPropertyMap</span> <span class="identifier">property_map</span>
+ <span class="special">,</span> <span class="identifier">OutputStream</span><span class="special">&amp;</span> <span class="identifier">os</span>
+ <span class="special">,</span> <span class="identifier">CharT</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">suffix</span>
+ <span class="special">);</span>
+
+ <span class="identifier">simple_edge_writer</span><span class="special">(</span><span class="identifier">simple_edge_writer</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">copy</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">&gt;</span>
+ <span class="keyword">void</span>
+ <span class="keyword">operator</span><span class="special">()(</span>
+ <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span>
+ <span class="special">,</span> <span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span>
+ <span class="special">);</span>
+ <span class="special">};</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.description"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.description" title="Description">Description</a>
+</h3></div></div></div>
+<p>
+ This <a href="http://www.boost.org/libs/graph/doc/EventVisitor.html" target="_top"><span class="bold"><strong>Event
+ Visitor</strong></span></a> uses the property map values of the source and
+ target vertices of edges that an algorithm visits at some event point.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.definition"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.definition" title="Where defined">Where defined</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span>boost/graph/simple_edge_writer.hpp<span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.model_of"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.model_of" title="Model of">Model of</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="special">*</span> Event Visitor
+<span class="special">*</span> Binary Function
+<span class="special">*</span> Copy Constructible
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.tpl_param"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.tpl_param" title="Template Parameters">Template Parameters</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ VertexPropertyMap
+ </p>
+ </td>
+<td>
+ <p>
+ A Readable Property Map whose key
+ type is the vertex descriptor of the graph.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ OutputStream
+ </p>
+ </td>
+<td>
+ <p>
+ The type of stream to which the values of <code class="computeroutput"><span class="identifier">VertexPropertyMap</span></code>
+ will be output.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ CharT
+ </p>
+ </td>
+<td>
+ <p>
+ The character type of the suffix string that will be output after
+ each edge connection on which this event visitor is invoked.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Filter
+ </p>
+ </td>
+<td>
+ <p>
+ The tag to specify when the <code class="computeroutput"><span class="identifier">simple_edge_writer</span></code>
+ should be invoked by the graph algorithm.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.members"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.members" title="Members">Members</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ Event filter type
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">event_filter</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="computeroutput"><span class="identifier">Filter</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Constructor
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">VertexPropertyMap</span> <span class="identifier">property_map</span>
+ <span class="special">,</span> <span class="identifier">OutputStream</span><span class="special">&amp;</span> <span class="identifier">os</span>
+ <span class="special">,</span> <span class="identifier">CharT</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">suffix</span>
+<span class="special">);</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Constructs a <code class="computeroutput"><span class="identifier">simple_edge_writer</span></code>
+ object that will use the property map to output the source and
+ target vertices of the visited edges to the specified stream, followed
+ by the specified suffix.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Copy constructor
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">simple_edge_writer</span><span class="special">(</span><span class="identifier">simple_edge_writer</span>
+ <span class="keyword">const</span><span class="special">&amp;</span>
+ <span class="identifier">copy</span><span class="special">);</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Defined by the Copy Constructible concept.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Function call operator
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">&gt;</span>
+<span class="keyword">void</span>
+ <span class="keyword">operator</span><span class="special">()(</span>
+ <span class="keyword">typename</span> graph_traits<span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">edge_descriptor</span> <span class="identifier">e</span>
+ <span class="special">,</span> <span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span>
+ <span class="special">);</span>
+</pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Writes the property values of the source and target vertices of
+ <code class="computeroutput"><span class="identifier">e</span></code> to the output
+ stream, along with the suffix string.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.simple_edge_writer.non_members"></a><a class="link" href="simple_edge_writer.html#index.simple_edge_writer.non_members" title="Non-members">Non-members</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ Simple edge writer creation
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">VertexPropertyMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputStream</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CharT</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Filter</span>
+ <span class="special">&gt;</span>
+ <span class="identifier">simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">VertexPropertyMap</span><span class="special">,</span><span class="identifier">OutputStream</span><span class="special">,</span><span class="identifier">CharT</span><span class="special">,</span><span class="identifier">Filter</span><span class="special">&gt;</span>
+ <span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">VertexPropertyMap</span> <span class="identifier">property_map</span>
+ <span class="special">,</span> <span class="identifier">OutputStream</span><span class="special">&amp;</span> <span class="identifier">os</span>
+ <span class="special">,</span> <span class="identifier">CharT</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">suffix</span>
+ <span class="special">,</span> <span class="identifier">Filter</span>
+ <span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Requires a <code class="computeroutput"><span class="identifier">Filter</span></code>
+ object to be explicitly passed in as the second argument. Creates
+ and returns a <code class="computeroutput"><span class="identifier">simple_edge_writer</span></code>
+ object that will be invoked when the algorithm reaches the appropriate
+ event point.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Simple edge writer creation with filter
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span>
+ <span class="keyword">typename</span> <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">VertexPropertyMap</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputStream</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CharT</span>
+ <span class="special">&gt;</span>
+ <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">fusion</span><span class="special">::</span><span class="identifier">pair</span><span class="special">&lt;</span>
+ <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="identifier">simple_edge_writer</span><span class="special">&lt;</span><span class="identifier">VertexPropertyMap</span><span class="special">,</span><span class="identifier">OutputStream</span><span class="special">,</span><span class="identifier">CharT</span><span class="special">,</span><span class="identifier">Filter</span><span class="special">&gt;</span>
+ <span class="special">&gt;</span>
+ <span class="identifier">fuse_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">VertexPropertyMap</span> <span class="identifier">property_map</span>
+ <span class="special">,</span> <span class="identifier">OutputStream</span><span class="special">&amp;</span> <span class="identifier">os</span>
+ <span class="special">,</span> <span class="identifier">CharT</span> <span class="keyword">const</span><span class="special">*</span> <span class="identifier">suffix</span>
+ <span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Requires the <code class="computeroutput"><span class="identifier">Filter</span></code>
+ type to be explicitly passed in as a template parameter. Creates
+ and returns a boost::fusion::pair that matches the
+ filter type with a <code class="computeroutput"><span class="identifier">simple_edge_writer</span></code>
+ object that will be invoked when the algorithm reaches the appropriate
+ event point.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011 Cromwell D. Enage<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="fuse_property_writer.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="call_visitors.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/simple_edge_writer.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,142 @@
+[/=============================================================================
+ Copyright (C) 2011 Cromwell D. Enage
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+=============================================================================/]
+
+[section:simple_edge_writer
+`simple_edge_writer<VertexPropertyMap, OutputStream, CharT, Filter>`]
+
+[section Synopsis]
+[reference__simple_edge_writer]
+[endsect]
+
+[section Description]
+This __Event_Visitor__ uses the property map values of the source and target
+vertices of edges that an algorithm visits at some event point.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_simple_edge_writer_hpp__>
+``
+[endsect]
+
+[section:model_of Model of]
+
+ * __Event_Visitor__
+ * __Binary_Function__
+ * __Copy_Constructible__
+
+[endsect]
+
+[section:tpl_param Template Parameters]
+[table
+ [[Parameter][Description]]
+ [
+ [VertexPropertyMap]
+ [
+ A __Readable_Property_Map__ whose key type is the vertex descriptor
+ of the graph.
+ ]
+ ]
+ [
+ [OutputStream]
+ [
+ The type of stream to which the values of `VertexPropertyMap` will
+ be output.
+ ]
+ ]
+ [
+ [CharT]
+ [
+ The character type of the suffix string that will be output after
+ each edge connection on which this event visitor is invoked.
+ ]
+ ]
+ [
+ [Filter]
+ [
+ The tag to specify when the `simple_edge_writer` should be invoked
+ by the graph algorithm.
+ ]
+ ]
+]
+[endsect]
+
+[section Members]
+[table
+ [[Name][Expression][Description]]
+ [
+ [Event filter type]
+ [`event_filter`]
+ [Same as `Filter`]
+ ]
+ [
+ [Constructor]
+ [``
+ simple_edge_writer(
+ VertexPropertyMap property_map
+ , OutputStream& os
+ , CharT const* suffix
+ );
+ ``]
+ [
+ Constructs a `simple_edge_writer` object that will use the property
+ map to output the source and target vertices of the visited edges
+ to the specified stream, followed by the specified suffix.
+ ]
+ ]
+ [
+ [Copy constructor]
+ [`simple_edge_writer(simple_edge_writer const& copy);`]
+ [Defined by the __Copy_Constructible__ concept.]
+ ]
+ [
+ [Function call operator]
+ [``
+ template <typename Graph>
+ void
+ operator()(
+ typename _graph_traits_<Graph>::edge_descriptor e
+ , Graph const& g
+ );
+ ``]
+ [
+ Writes the property values of the source and target vertices of `e`
+ to the output stream, along with the suffix string.
+ ]
+ ]
+]
+[endsect]
+
+[section:non_members Non-members]
+[table
+ [[Name][Expression][Description]]
+ [
+ [Simple edge writer creation]
+ [[reference__make_simple_edge_writer]]
+ [
+ Requires a `Filter` object to be explicitly passed in as the second
+ argument. Creates and returns a `simple_edge_writer` object that
+ will be invoked when the algorithm reaches the appropriate event
+ point.
+ ]
+ ]
+ [
+ [Simple edge writer creation with filter]
+ [[reference__fuse_simple_edge_writer]]
+ [
+ Requires the `Filter` type to be explicitly passed in as a template
+ parameter. Creates and returns a __fusion_pair__ that matches the
+ filter type with a `simple_edge_writer` object that will be
+ invoked when the algorithm reaches the appropriate event point.
+ ]
+ ]
+]
+[endsect]
+
+[endsect] [/ simple_edge_writer]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.html
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.html 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,433 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>vertex_property_map_gen&lt;Graph, Value&gt;</title>
+<link rel="stylesheet" href="../doc/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
+<link rel="home" href="../index.html" title="index 0.1">
+<link rel="up" href="../index.html" title="index 0.1">
+<link rel="prev" href="loop_erased_random_tree.html" title="loop_erased_random_tree and loop_erased_random_weighted_tree">
+<link rel="next" href="fuse_property_writer.html" title="fuse_property_writer">
+</head>
+<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
+<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="C++ Boost" width="277" height="86" src="../../../boost.png"></td></tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="loop_erased_random_tree.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="fuse_property_writer.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="index.vertex_property_map_gen"></a><a class="link" href="vertex_property_map_gen.html" title="vertex_property_map_gen&lt;Graph, Value&gt;"><code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span>
+ <span class="identifier">Value</span><span class="special">&gt;</span></code></a>
+</h2></div></div></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.synopsis"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.synopsis" title="Synopsis">Synopsis</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Value</span><span class="special">&gt;</span>
+ <span class="keyword">class</span> <span class="identifier">vertex_property_map_gen</span>
+ <span class="special">{</span>
+
+ <span class="keyword">public</span><span class="special">:</span>
+ <span class="keyword">typedef</span> <span class="comment">// implementation_defined
+</span> <span class="identifier">type</span><span class="special">;</span>
+ <span class="special">};</span>
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.description"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.description" title="Description">Description</a>
+</h3></div></div></div>
+<p>
+ This metafunction returns a type that models the Lvalue Property Map concept. If the <code class="computeroutput"><span class="identifier">Graph</span></code> type models the Vertex List Graph concept and possesses an
+ internal vertex_index property map whose
+ value type is an integer type, then the return type will wrap an iterator_property_map around a
+ std::deque
+ of <code class="computeroutput"><span class="identifier">Value</span></code> elements; otherwise,
+ the return type will wrap an associative_property_map around
+ a std::map
+ that associates vertices with <code class="computeroutput"><span class="identifier">Value</span></code>
+ objects. This latter quality frees BGL
+ algorithms such as <a class="link" href="loop_erased_random_tree.html" title="loop_erased_random_tree and loop_erased_random_weighted_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span><span class="special">()</span></code></a>
+ from requiring a vertex_index property map (either
+ as an input argument or stored internally by the input graph) if some other
+ utility property map is not specified.
+ </p>
+<p>
+ Also, unlike iterator_property_map and associative_property_map instances,
+ a <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span></code>
+ object can stand alone in a persistent setting, e.g.:
+ </p>
+<p>
+
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">&gt;</span>
+<span class="keyword">void</span> <span class="identifier">foo</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">;</span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">default_color_type</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">color_map</span><span class="special">;</span>
+
+ <span class="comment">// Do something with color_map.
+</span><span class="special">}</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.definition"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.definition" title="Where defined">Where defined</a>
+</h3></div></div></div>
+<p>
+
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span>boost/graph/vertex_property_map_gen.hpp<span class="special">&gt;</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.model_of"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.model_of" title="Model of">Model of</a>
+</h3></div></div></div>
+<pre class="programlisting"><span class="special">*</span> Lvalue Property Map
+<span class="special">*</span> Copy Constructible
+<span class="special">*</span> Assignable
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.return_type_members"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.return_type_members" title="Return Type Members">Return
+ Type Members</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ Key type
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">key_type</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="literal">graph_traits&lt;Graph&gt;::vertex_descriptor</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Value type
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">value_type</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="computeroutput"><span class="identifier">Value</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Reference type
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">reference</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="computeroutput"><span class="identifier">Value</span><span class="special">&amp;</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Category type
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">category</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="computeroutput"><span class="identifier">lvalue_property_map_tag</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Constructor
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">(</span><span class="identifier">Graph</span>
+ <span class="keyword">const</span><span class="special">&amp;);</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Constructs a <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span></code>
+ object that will associate vertices of the specified graph with
+ <code class="computeroutput"><span class="identifier">Value</span></code> objects.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Copy constructor
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">(</span><span class="identifier">type</span>
+ <span class="keyword">const</span><span class="special">&amp;);</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Defined by the Copy Constructible concept.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Assignment operator
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">&amp;</span> <span class="keyword">operator</span><span class="special">=(</span><span class="identifier">type</span>
+ <span class="keyword">const</span><span class="special">&amp;);</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Defined by the Assignable concept.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Property access
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">reference</span> <span class="keyword">operator</span><span class="special">[](</span><span class="identifier">key_type</span>
+ <span class="keyword">const</span><span class="special">&amp;)</span>
+ <span class="keyword">const</span><span class="special">;</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Accesses the property value of the specified vertex.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="index.vertex_property_map_gen.non_members"></a><a class="link" href="vertex_property_map_gen.html#index.vertex_property_map_gen.non_members" title="Non-members">Non-members</a>
+</h3></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Name
+ </p>
+ </th>
+<th>
+ <p>
+ Expression
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+</tr></thead>
+<tbody>
+<tr>
+<td>
+ <p>
+ Vertex property map creation
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Value</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Value</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_vertex_property_map</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span><span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Requires the <code class="computeroutput"><span class="identifier">Value</span></code>
+ type to be explicitly passed in as a template parameter. Creates
+ and returns a <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span></code>
+ object that will associate vertices of the specified graph with
+ <code class="computeroutput"><span class="identifier">Value</span></code> objects.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Vertex property map creation with value
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Value</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Value</span><span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_vertex_property_map</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span><span class="special">,</span> <span class="identifier">Value</span><span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Requires a <code class="computeroutput"><span class="identifier">Value</span></code>
+ object to be explicitly passed in as the second argument. Creates
+ and returns a <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span></code>
+ object that will associate vertices of the specified graph with
+ <code class="computeroutput"><span class="identifier">Value</span></code> objects.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Vertex predecessor map creation
+ </p>
+ </td>
+<td>
+ <p>
+
+</p>
+<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span>
+
+ <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">&gt;</span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special">&lt;</span>
+ <span class="identifier">Graph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special">&lt;</span><span class="identifier">Graph</span><span class="special">&gt;::</span><span class="identifier">vertex_descriptor</span>
+ <span class="special">&gt;::</span><span class="identifier">type</span>
+ <span class="identifier">make_vertex_predecessor_map</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&amp;</span> <span class="identifier">g</span><span class="special">);</span>
+
+<span class="special">}</span> <span class="comment">// namespace boost
+</span></pre>
+<p>
+ </p>
+ </td>
+<td>
+ <p>
+ Creates and returns a <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span></code>
+ object that will associate vertices of the specified graph with
+ each other.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="important"><table border="0" summary="Important">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../doc/images/important.png"></td>
+<th align="left">Important</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ The <code class="computeroutput"><span class="identifier">vertex_property_map_gen</span></code>
+ metafunction is a simple wrapper around either an iterator_property_map or an associative_property_map; neither
+ the constructor nor the non-member creation functions will initialize the
+ objects returned the way some data structures (e.g. adjacency_list with vertex selector
+ <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">vecS</span></code>) or algorithms (e.g. depth_first_search) initialize
+ their respective property maps.
+ </p></td></tr>
+</table></div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"></td>
+<td align="right"><div class="copyright-footer">Copyright &#169; 2011 Cromwell D. Enage<p>
+ Distributed under the Boost Software License, Version 1.0. (See accompanying
+ file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+ </p>
+</div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav">
+<a accesskey="p" href="loop_erased_random_tree.html"><img src="../doc/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../doc/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../doc/images/home.png" alt="Home"></a><a accesskey="n" href="fuse_property_writer.html"><img src="../doc/images/next.png" alt="Next"></a>
+</div>
+</body>
+</html>

Added: sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/doc/vertex_property_map_gen.qbk 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,150 @@
+[/=============================================================================
+ Copyright (C) 2011 Cromwell D. Enage
+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ [@http://www.boost.org/LICENSE_1_0.txt])
+=============================================================================/]
+
+[section:vertex_property_map_gen `vertex_property_map_gen<Graph, Value>`]
+
+[section Synopsis]
+[reference__vertex_property_map_gen]
+[endsect]
+
+[section Description]
+This metafunction returns a type that models the __Lvalue_Property_Map__
+concept. If the `Graph` type models the __Vertex_List_Graph__ concept and
+possesses an internal __vertex_index__ property map whose value type is an
+integer type, then the return type will wrap an __iterator_property_map__
+around a __std_deque__ of `Value` elements; otherwise, the return type will
+wrap an __associative_property_map__ around a __std_map__ that associates
+vertices with `Value` objects. This latter quality frees __BGL__ algorithms
+such as __loop_erased_random_tree__ from requiring a __vertex_index__ property
+map (either as an input argument or stored internally by the input graph) if
+some other utility property map is not specified.
+
+Also, unlike __iterator_property_map__ and __associative_property_map__
+instances, a `vertex_property_map_gen::type` object can stand alone in a
+persistent setting, e.g.:
+
+``
+template <typename Graph>
+void foo(Graph const& g)
+{
+ using namespace boost;
+ typename vertex_property_map_gen<Graph,default_color_type>::type color_map;
+
+ // Do something with color_map.
+}
+``
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_vertex_property_map_gen_hpp__>
+``
+[endsect]
+
+[section:model_of Model of]
+
+ * __Lvalue_Property_Map__
+ * __Copy_Constructible__
+ * __Assignable__
+
+[endsect]
+
+[section Return Type Members]
+[table
+ [[Name][Expression][Description]]
+ [
+ [Key type]
+ [`key_type`]
+ [Same as [^_graph_traits_<Graph>::vertex_descriptor]]
+ ]
+ [
+ [Value type]
+ [`value_type`]
+ [Same as `Value`]
+ ]
+ [
+ [Reference type]
+ [`reference`]
+ [Same as `Value&`]
+ ]
+ [
+ [Category type]
+ [`category`]
+ [Same as `lvalue_property_map_tag`]
+ ]
+ [
+ [Constructor]
+ [`vertex_property_map_gen::type(Graph const&);`]
+ [
+ Constructs a `vertex_property_map_gen::type` object that will
+ associate vertices of the specified graph with `Value` objects.
+ ]
+ ]
+ [
+ [Copy constructor]
+ [`vertex_property_map_gen::type(type const&);`]
+ [Defined by the __Copy_Constructible__ concept.]
+ ]
+ [
+ [Assignment operator]
+ [`vertex_property_map_gen::type& operator=(type const&);`]
+ [Defined by the __Assignable__ concept.]
+ ]
+ [
+ [Property access]
+ [`reference operator[](key_type const&) const;`]
+ [Accesses the property value of the specified vertex.]
+ ]
+]
+[endsect]
+
+[section:non_members Non-members]
+[table
+ [[Name][Expression][Description]]
+ [
+ [Vertex property map creation]
+ [[reference__make_vertex_property_map]]
+ [
+ Requires the `Value` type to be explicitly passed in as a template
+ parameter. Creates and returns a `vertex_property_map_gen::type`
+ object that will associate vertices of the specified graph with
+ `Value` objects.
+ ]
+ ]
+ [
+ [Vertex property map creation with value]
+ [[reference__make_vertex_property_map__with_value]]
+ [
+ Requires a `Value` object to be explicitly passed in as the second
+ argument. Creates and returns a `vertex_property_map_gen::type`
+ object that will associate vertices of the specified graph with
+ `Value` objects.
+ ]
+ ]
+ [
+ [Vertex predecessor map creation]
+ [[reference__make_vertex_predecessor_map]]
+ [
+ Creates and returns a `vertex_property_map_gen::type` object that
+ will associate vertices of the specified graph with each other.
+ ]
+ ]
+]
+[endsect]
+
+[important
+ The `vertex_property_map_gen` metafunction is a simple wrapper around
+ either an __iterator_property_map__ or an __associative_property_map__;
+ neither the constructor nor the non-member creation functions will
+ initialize the objects returned the way some data structures (e.g.
+ __adjacency_list__ with vertex selector `boost::vecS`) or algorithms (e.g.
+ __depth_first_search__) initialize their respective property maps.
+]
+
+[endsect] [/ vertex_property_map_gen]
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.cpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,82 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// std::cout and std::endl
+#include <iostream>
+// std::tr1::mt19937
+#include <boost/tr1/random.hpp>
+// vec_adjacency_list_example
+#include "loop_erased_random_tree.hpp"
+
+int usage()
+{
+ std::cout << "Options:" << std::endl;
+ std::cout << "-s#, where # is an integer between 0 and 23, inclusive";
+ std::cout << " (default is 0)" << std::endl;
+ std::cout << "-e#, where # is an integer between 0 and 23, inclusive";
+ std::cout << " (default is 22)" << std::endl;
+ std::cout << "-n#, where # is a nonnegative integer";
+ std::cout << " (default is 16)" << std::endl;
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+ unsigned int start_index = 0;
+ unsigned int end_index = 22;
+ unsigned int num_runs = 16;
+ char* arg;
+
+ while (--argc > 0)
+ {
+ arg = argv[argc];
+
+ if ((std::strlen(arg) > 2) && (arg[0] == '-'))
+ {
+ switch (arg[1])
+ {
+ case 's':
+ start_index = std::atoi(&arg[2]);
+
+ if (start_index > 23)
+ {
+ return usage();
+ }
+
+ break;
+
+ case 'e':
+ end_index = std::atoi(&arg[2]);
+
+ if (end_index > 23)
+ {
+ return usage();
+ }
+
+ break;
+
+ case 'n':
+ num_runs = std::atoi(&arg[2]);
+ break;
+
+ default:
+ return usage();
+ }
+ }
+ else
+ {
+ return usage();
+ }
+ }
+
+ vec_adjacency_list_example<boost::listS,std::tr1::mt19937>(
+ start_index
+ , end_index
+ , num_runs
+ );
+
+ return 0;
+}
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_tree.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,811 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_TREE_HPP
+#define LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_TREE_HPP
+
+// maximum number of named arguments in a function
+//#define BOOST_PARAMETER_MAX_ARITY 8
+
+// std::cout and std::endl
+#include <iostream>
+// std::ostream_iterator
+#include <iterator>
+// std::make_pair
+#include <utility>
+// boost::fusion::make_list
+#include <boost/fusion/container/generation/make_list.hpp>
+// boost::property_traits, boost::get, and boost::put
+#include <boost/property_map/property_map.hpp>
+// boost::graph_traits
+#include <boost/graph/graph_traits.hpp>
+// boost::property_map and vertex and edge property tags
+#include <boost/graph/properties.hpp>
+// boost::write_property and event visitor filters
+#include <boost/graph/visitors.hpp>
+// boost::bidirectionalS, boost::directedS, and boost::undirectedS
+#include <boost/graph/graph_selectors.hpp>
+// boost::adjacency_list and associated functions
+#include <boost/graph/adjacency_list.hpp>
+// boost::print_graph
+#include <boost/graph/graph_utility.hpp>
+// boost::vertex_property_map_gen
+#include <boost/graph/vertex_property_map_gen.hpp>
+// boost::fuse_property_writer
+#include <boost/graph/fuse_property_writer.hpp>
+// boost::make_simple_edge_writer and boost::fuse_simple_edge_writer
+#include <boost/graph/simple_edge_writer.hpp>
+// boost::loop_erased_random_tree
+#include <boost/graph/loop_erased_random_tree.hpp>
+
+template <typename Graph>
+void initialize_graph(Graph& g)
+{
+ boost::add_edge(boost::vertex(0, g), boost::vertex(7, g), g);
+ boost::add_edge(boost::vertex(1, g), boost::vertex(2, g), g);
+ boost::add_edge(boost::vertex(2, g), boost::vertex(10, g), g);
+ boost::add_edge(boost::vertex(2, g), boost::vertex(5, g), g);
+ boost::add_edge(boost::vertex(3, g), boost::vertex(10, g), g);
+ boost::add_edge(boost::vertex(3, g), boost::vertex(0, g), g);
+ boost::add_edge(boost::vertex(4, g), boost::vertex(5, g), g);
+ boost::add_edge(boost::vertex(4, g), boost::vertex(0, g), g);
+ boost::add_edge(boost::vertex(5, g), boost::vertex(14, g), g);
+ boost::add_edge(boost::vertex(6, g), boost::vertex(3, g), g);
+ boost::add_edge(boost::vertex(7, g), boost::vertex(17, g), g);
+ boost::add_edge(boost::vertex(7, g), boost::vertex(11, g), g);
+ boost::add_edge(boost::vertex(8, g), boost::vertex(17, g), g);
+ boost::add_edge(boost::vertex(8, g), boost::vertex(1, g), g);
+ boost::add_edge(boost::vertex(9, g), boost::vertex(11, g), g);
+ boost::add_edge(boost::vertex(9, g), boost::vertex(1, g), g);
+ boost::add_edge(boost::vertex(10, g), boost::vertex(19, g), g);
+ boost::add_edge(boost::vertex(10, g), boost::vertex(15, g), g);
+ boost::add_edge(boost::vertex(10, g), boost::vertex(8, g), g);
+ boost::add_edge(boost::vertex(11, g), boost::vertex(19, g), g);
+ boost::add_edge(boost::vertex(11, g), boost::vertex(15, g), g);
+ boost::add_edge(boost::vertex(11, g), boost::vertex(4, g), g);
+ boost::add_edge(boost::vertex(12, g), boost::vertex(19, g), g);
+ boost::add_edge(boost::vertex(12, g), boost::vertex(8, g), g);
+ boost::add_edge(boost::vertex(12, g), boost::vertex(4, g), g);
+ boost::add_edge(boost::vertex(13, g), boost::vertex(15, g), g);
+ boost::add_edge(boost::vertex(13, g), boost::vertex(8, g), g);
+ boost::add_edge(boost::vertex(13, g), boost::vertex(4, g), g);
+ boost::add_edge(boost::vertex(14, g), boost::vertex(22, g), g);
+ boost::add_edge(boost::vertex(14, g), boost::vertex(12, g), g);
+ boost::add_edge(boost::vertex(15, g), boost::vertex(22, g), g);
+ boost::add_edge(boost::vertex(15, g), boost::vertex(6, g), g);
+ boost::add_edge(boost::vertex(16, g), boost::vertex(12, g), g);
+ boost::add_edge(boost::vertex(16, g), boost::vertex(6, g), g);
+ boost::add_edge(boost::vertex(17, g), boost::vertex(20, g), g);
+ boost::add_edge(boost::vertex(18, g), boost::vertex(9, g), g);
+ boost::add_edge(boost::vertex(19, g), boost::vertex(23, g), g);
+ boost::add_edge(boost::vertex(19, g), boost::vertex(18, g), g);
+ boost::add_edge(boost::vertex(20, g), boost::vertex(23, g), g);
+ boost::add_edge(boost::vertex(20, g), boost::vertex(13, g), g);
+ boost::add_edge(boost::vertex(21, g), boost::vertex(18, g), g);
+ boost::add_edge(boost::vertex(21, g), boost::vertex(13, g), g);
+ boost::add_edge(boost::vertex(22, g), boost::vertex(21, g), g);
+ boost::add_edge(boost::vertex(23, g), boost::vertex(16, g), g);
+}
+
+//[loop_erased_random_tree_example_with_visitor_list
+template <typename Graph, typename RNGEngine>
+void loop_erased_random_tree_example_with_visitor_list()
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+
+ for (;;)
+ {
+ std::cout << std::endl << std::endl;
+
+ if (
+#ifdef BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_tree(
+ g
+ , engine
+ , pred_map
+ , boost::graph::keywords::_visitor = std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ , boost::on_discover_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ , boost::on_examine_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ , boost::on_loop_erased_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout," finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " is a tree edge.\t"
+ , boost::on_tree_edge()
+ )
+ , boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ , boost::on_back_edge()
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+#else // !def BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_tree(
+ g
+ ,boost::make_loop_erased_random_tree_params().rng_engine(
+ engine
+ ).predecessor_map(
+ pred_map
+ ).visitor(
+ std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ , boost::on_discover_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ , boost::on_examine_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ , boost::on_loop_erased_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout," finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " is a tree edge.\t"
+ , boost::on_tree_edge()
+ )
+ , boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ , boost::on_back_edge()
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ )
+ {
+ std::cout << " Done!" << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ std::cout << boost::get(index_map, boost::get(pred_map, *vi));
+ std::cout << std::endl;
+ }
+
+ break;
+ }
+
+ std::cout << std::endl << "Trying again...";
+ }
+}
+//]
+
+//[loop_erased_random_tree_example_with_fusion_visitor_list
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_tree_example_with_fusion_visitor_list(
+ std::size_t root_index
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ Vertex root = boost::vertex(root_index, g);
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << std::endl << "Target = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+
+ for (;;)
+ {
+ std::cout << std::endl << std::endl;
+
+ if (
+#ifdef BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_tree(
+ g
+ , engine
+ , pred_map
+ , root
+ , boost::graph::keywords::_visitor = boost::fusion::make_list(
+ boost::fuse_property_writer<boost::on_initialize_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_discover_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ )
+ , boost::fuse_property_writer<boost::on_examine_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ )
+ , boost::fuse_property_writer<boost::on_loop_erased_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_tree_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_back_edge>(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ )
+ )
+ )
+#else // !def BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_tree(
+ g
+ , boost::make_loop_erased_random_tree_params().rng_engine(
+ engine
+ ).source_vertex(
+ root
+ ).predecessor_map(
+ pred_map
+ ).visitor(
+ boost::fusion::make_list(
+ boost::fuse_property_writer<
+ boost::on_initialize_vertex
+ >(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_discover_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ )
+ , boost::fuse_property_writer<boost::on_examine_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ )
+ , boost::fuse_property_writer<
+ boost::on_loop_erased_vertex
+ >(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_tree_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_back_edge>(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ )
+ )
+ )
+ )
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_TAKES_ALL_PARAMS
+ )
+ {
+ std::cout << " Done!" << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ std::cout << boost::get(index_map, boost::get(pred_map, *vi));
+ std::cout << std::endl;
+ }
+
+ break;
+ }
+
+ std::cout << std::endl << "Trying again...";
+ }
+}
+//]
+
+//[loop_erased_random_tree_example
+template <typename Graph, typename RNGEngine>
+void loop_erased_random_tree_example(unsigned int num_runs)
+{
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << std::endl << "Graph:" << std::endl;
+ boost::print_graph(g);
+
+ while (num_runs)
+ {
+ if (boost::loop_erased_random_tree(g, engine, pred_map))
+ {
+ std::cout << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ std::cout << boost::get(index_map, boost::get(pred_map, *vi));
+ std::cout << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_tree_with_source_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_tree_with_source_example(
+ std::size_t const root_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+
+ Graph g(24);
+ Vertex root = boost::vertex(root_index, g);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << std::endl << "Source = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+
+ while (num_runs)
+ {
+ if (
+ boost::loop_erased_random_tree(
+ g
+ , engine
+ , pred_map
+ , boost::graph::keywords::_source_vertex = root
+ )
+ )
+ {
+ std::cout << std::endl << "Predecessors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " <-- ";
+ std::cout << boost::get(index_map, boost::get(pred_map, *vi));
+ std::cout << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_tree_with_target_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_tree_with_target_example(
+ std::size_t const root_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+
+ Graph g(24);
+ Vertex root = boost::vertex(root_index, g);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << std::endl << "Target = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+
+ while (num_runs)
+ {
+ if (boost::loop_erased_random_tree(g, engine, pred_map, root))
+ {
+ std::cout << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ std::cout << boost::get(index_map, boost::get(pred_map, *vi));
+ std::cout << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_path_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_path_example(
+ std::size_t const start_index
+ , std::size_t const end_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+
+ Graph g(24);
+ Vertex start = boost::vertex(start_index, g);
+ Vertex end = boost::vertex(end_index, g);
+ Vertex v;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ initialize_graph(g);
+ std::cout << std::endl << "Start = " << boost::get(index_map, start);
+ std::cout << ", End = " << boost::get(index_map, end);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+
+ while (num_runs)
+ {
+ if (boost::loop_erased_random_tree(g, engine, pred_map, end, start))
+ {
+ std::cout << "Path: " << boost::get(index_map, v = start);
+
+ while (v != end)
+ {
+ v = boost::get(pred_map, v);
+ std::cout << " -> " << boost::get(index_map, v);
+ }
+
+ std::cout << std::endl;
+ --num_runs;
+ }
+ }
+}
+//]
+
+template <typename EdgeContainerSelector, typename RNGEngine>
+void
+ vec_adjacency_list_example(
+ unsigned int const start_index
+ , unsigned int const end_index
+ , unsigned int const num_runs
+ )
+{
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::undirectedS
+ >
+ UndirectedGraph;
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::bidirectionalS
+ >
+ BidirectionalGraph;
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::directedS
+ >
+ DirectedGraph;
+
+ std::cout << "Running loop_erased_random_tree function template on ";
+ std::cout << "undirected graph." << std::endl;
+ loop_erased_random_tree_example_with_visitor_list<
+ UndirectedGraph
+ , RNGEngine
+ >();
+ loop_erased_random_tree_example_with_fusion_visitor_list<
+ UndirectedGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_tree_example<UndirectedGraph,RNGEngine>(num_runs);
+ loop_erased_random_tree_with_source_example<
+ UndirectedGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_tree_with_target_example<
+ UndirectedGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_path_example<
+ UndirectedGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+ std::cout << std::endl << std::endl;
+
+ std::cout << "Running loop_erased_random_tree function template on ";
+ std::cout << "directed graph." << std::endl;
+ loop_erased_random_tree_example_with_visitor_list<
+ DirectedGraph
+ , RNGEngine
+ >();
+ loop_erased_random_tree_example_with_fusion_visitor_list<
+ DirectedGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_tree_example<DirectedGraph,RNGEngine>(num_runs);
+ loop_erased_random_tree_with_source_example<
+ DirectedGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_tree_with_target_example<
+ DirectedGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_path_example<
+ DirectedGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+ std::cout << std::endl << std::endl;
+
+ std::cout << "Running loop_erased_random_tree function template on ";
+ std::cout << "bidirectional graph." << std::endl;
+ loop_erased_random_tree_example_with_visitor_list<
+ BidirectionalGraph
+ , RNGEngine
+ >();
+ loop_erased_random_tree_example_with_fusion_visitor_list<
+ BidirectionalGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_tree_example<BidirectionalGraph,RNGEngine>(num_runs);
+ loop_erased_random_tree_with_source_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_tree_with_target_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_path_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+}
+
+#endif // LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_TREE_HPP
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.cpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,82 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+// std::cout and std::endl
+#include <iostream>
+// std::tr1::mt19937
+#include <boost/tr1/random.hpp>
+// vec_adjacency_list_example
+#include "loop_erased_random_weighted_tree.hpp"
+
+int usage()
+{
+ std::cout << "Options:" << std::endl;
+ std::cout << "-s#, where # is an integer between 0 and 23, inclusive";
+ std::cout << " (default is 0)" << std::endl;
+ std::cout << "-e#, where # is an integer between 0 and 23, inclusive";
+ std::cout << " (default is 22)" << std::endl;
+ std::cout << "-n#, where # is a nonnegative integer";
+ std::cout << " (default is 16)" << std::endl;
+ return 0;
+}
+
+int main(int argc, char** argv)
+{
+ unsigned int start_index = 0;
+ unsigned int end_index = 22;
+ unsigned int num_runs = 16;
+ char* arg;
+
+ while (--argc > 0)
+ {
+ arg = argv[argc];
+
+ if ((std::strlen(arg) > 2) && (arg[0] == '-'))
+ {
+ switch (arg[1])
+ {
+ case 's':
+ start_index = std::atoi(&arg[2]);
+
+ if (start_index > 23)
+ {
+ return usage();
+ }
+
+ break;
+
+ case 'e':
+ end_index = std::atoi(&arg[2]);
+
+ if (end_index > 23)
+ {
+ return usage();
+ }
+
+ break;
+
+ case 'n':
+ num_runs = std::atoi(&arg[2]);
+ break;
+
+ default:
+ return usage();
+ }
+ }
+ else
+ {
+ return usage();
+ }
+ }
+
+ vec_adjacency_list_example<boost::listS,std::tr1::mt19937>(
+ start_index
+ , end_index
+ , num_runs
+ );
+
+ return 0;
+}
+

Added: sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-loop_erased_random_tree/libs/graph/example/loop_erased_random_weighted_tree.hpp 2011-09-10 11:16:37 EDT (Sat, 10 Sep 2011)
@@ -0,0 +1,972 @@
+// Copyright (C) 2004-2011 Cromwell D. Enage
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+#define LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+
+// maximum number of named arguments in a function
+//#define BOOST_PARAMETER_MAX_ARITY 11
+
+// std::cout and std::endl
+#include <iostream>
+// std::ostream_iterator
+#include <iterator>
+// std::make_pair
+#include <utility>
+// std::tr1::tie
+#include <boost/tr1/tuple.hpp>
+// std::tr1::uniform_real and std::tr1::variate_generator
+#include <boost/tr1/random.hpp>
+// boost::fusion::make_list
+#include <boost/fusion/container/generation/make_list.hpp>
+// boost::property_traits, boost::get, and boost::put
+#include <boost/property_map/property_map.hpp>
+// boost::graph_traits
+#include <boost/graph/graph_traits.hpp>
+// boost::property_map and vertex and edge property tags
+#include <boost/graph/properties.hpp>
+// boost::write_property and event visitor filters
+#include <boost/graph/visitors.hpp>
+// boost::bidirectionalS, boost::directedS, and boost::undirectedS
+#include <boost/graph/graph_selectors.hpp>
+// boost::adjacency_list and associated functions
+#include <boost/graph/adjacency_list.hpp>
+// boost::print_graph
+#include <boost/graph/graph_utility.hpp>
+// boost::vertex_property_map_gen
+#include <boost/graph/vertex_property_map_gen.hpp>
+// boost::fuse_property_writer
+#include <boost/graph/fuse_property_writer.hpp>
+// boost::make_simple_edge_writer and boost::fuse_simple_edge_writer
+#include <boost/graph/simple_edge_writer.hpp>
+// boost::loop_erased_random_weighted_tree
+#include <boost/graph/loop_erased_random_weighted_tree.hpp>
+
+template <typename Graph, typename WeightGen>
+void
+ add_edge_with_random_weight(
+ Graph& g
+ , WeightGen& weight_gen
+ , std::size_t source_index
+ , std::size_t target_index
+ )
+{
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+
+ std::tr1::tie(e, b) = boost::add_edge(
+ boost::vertex(source_index, g)
+ , boost::vertex(target_index, g)
+ , g
+ );
+
+ if (b)
+ {
+ boost::put(boost::edge_weight, g, e, weight_gen());
+ }
+}
+
+template <typename Graph, typename WeightGen>
+void initialize_graph(Graph& g, WeightGen& weight_gen)
+{
+ add_edge_with_random_weight(g, weight_gen, 0, 7);
+ add_edge_with_random_weight(g, weight_gen, 1, 2);
+ add_edge_with_random_weight(g, weight_gen, 2, 10);
+ add_edge_with_random_weight(g, weight_gen, 2, 5);
+ add_edge_with_random_weight(g, weight_gen, 3, 10);
+ add_edge_with_random_weight(g, weight_gen, 3, 0);
+ add_edge_with_random_weight(g, weight_gen, 4, 5);
+ add_edge_with_random_weight(g, weight_gen, 4, 0);
+ add_edge_with_random_weight(g, weight_gen, 5, 14);
+ add_edge_with_random_weight(g, weight_gen, 6, 3);
+ add_edge_with_random_weight(g, weight_gen, 7, 17);
+ add_edge_with_random_weight(g, weight_gen, 7, 11);
+ add_edge_with_random_weight(g, weight_gen, 8, 17);
+ add_edge_with_random_weight(g, weight_gen, 8, 1);
+ add_edge_with_random_weight(g, weight_gen, 9, 11);
+ add_edge_with_random_weight(g, weight_gen, 9, 1);
+ add_edge_with_random_weight(g, weight_gen, 10, 19);
+ add_edge_with_random_weight(g, weight_gen, 10, 15);
+ add_edge_with_random_weight(g, weight_gen, 10, 8);
+ add_edge_with_random_weight(g, weight_gen, 11, 19);
+ add_edge_with_random_weight(g, weight_gen, 11, 15);
+ add_edge_with_random_weight(g, weight_gen, 11, 4);
+ add_edge_with_random_weight(g, weight_gen, 12, 19);
+ add_edge_with_random_weight(g, weight_gen, 12, 8);
+ add_edge_with_random_weight(g, weight_gen, 12, 4);
+ add_edge_with_random_weight(g, weight_gen, 13, 15);
+ add_edge_with_random_weight(g, weight_gen, 13, 8);
+ add_edge_with_random_weight(g, weight_gen, 13, 4);
+ add_edge_with_random_weight(g, weight_gen, 14, 22);
+ add_edge_with_random_weight(g, weight_gen, 14, 12);
+ add_edge_with_random_weight(g, weight_gen, 15, 22);
+ add_edge_with_random_weight(g, weight_gen, 15, 6);
+ add_edge_with_random_weight(g, weight_gen, 16, 12);
+ add_edge_with_random_weight(g, weight_gen, 16, 6);
+ add_edge_with_random_weight(g, weight_gen, 17, 20);
+ add_edge_with_random_weight(g, weight_gen, 18, 9);
+ add_edge_with_random_weight(g, weight_gen, 19, 23);
+ add_edge_with_random_weight(g, weight_gen, 19, 18);
+ add_edge_with_random_weight(g, weight_gen, 20, 23);
+ add_edge_with_random_weight(g, weight_gen, 20, 13);
+ add_edge_with_random_weight(g, weight_gen, 21, 18);
+ add_edge_with_random_weight(g, weight_gen, 21, 13);
+ add_edge_with_random_weight(g, weight_gen, 22, 21);
+ add_edge_with_random_weight(g, weight_gen, 23, 16);
+}
+
+//[loop_erased_random_weighted_tree_example_with_visitor_list
+template <typename Graph, typename RNGEngine>
+void loop_erased_random_weighted_tree_example_with_visitor_list()
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeWeightMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+ initialize_graph(g, rng);
+
+ EdgeWeightMap e_map = boost::get(boost::edge_weight, g);
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+ Vertex u;
+
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, e_map);
+
+ for (;;)
+ {
+ std::cout << std::endl << std::endl;
+
+ if (
+#ifdef BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_weighted_tree(
+ g
+ , engine
+ , pred_map
+ , boost::graph::keywords::_visitor = std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ , boost::on_discover_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ , boost::on_examine_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ , boost::on_loop_erased_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout," finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " is a tree edge.\t"
+ , boost::on_tree_edge()
+ )
+ , boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ , boost::on_back_edge()
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+#else // !def BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_weighted_tree(
+ g
+ ,boost::make_loop_erased_random_tree_params().rng_engine(
+ engine
+ ).predecessor_map(
+ pred_map
+ ).visitor(
+ std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ , boost::on_discover_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ , boost::on_examine_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ , boost::on_loop_erased_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout," finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ , std::make_pair(
+ boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " is a tree edge.\t"
+ , boost::on_tree_edge()
+ )
+ , boost::make_simple_edge_writer(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ , boost::on_back_edge()
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ )
+ {
+ std::cout << " Done!" << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ u = boost::get(pred_map, *vi);
+ std::cout << boost::get(index_map, u) << " (";
+ boost::tie(e, b) = boost::edge(*vi, u, g);
+
+ if (b)
+ {
+ std::cout << boost::get(e_map, e);
+ }
+
+ std::cout << ')' << std::endl;
+ }
+
+ break;
+ }
+
+ std::cout << std::endl << "Trying again...\t";
+ }
+}
+//]
+
+//[loop_erased_random_weighted_tree_example_with_fusion_visitor_list
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_weighted_tree_example_with_fusion_visitor_list(
+ std::size_t root_index
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeWeightMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+ initialize_graph(g, rng);
+
+ EdgeWeightMap e_map = boost::get(boost::edge_weight, g);
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+ Vertex u, root = boost::vertex(root_index, g);
+
+ std::cout << std::endl << "Target = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, e_map);
+
+ for (;;)
+ {
+ std::cout << std::endl << std::endl;
+
+ if (
+#ifdef BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_weighted_tree(
+ g
+ , engine
+ , pred_map
+ , root
+ , boost::graph::keywords::_visitor = boost::fusion::make_list(
+ boost::fuse_property_writer<boost::on_initialize_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_discover_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ )
+ , boost::fuse_property_writer<boost::on_examine_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ )
+ , boost::fuse_property_writer<boost::on_loop_erased_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_tree_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_back_edge>(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ )
+ )
+ )
+#else // !def BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ boost::loop_erased_random_weighted_tree(
+ g
+ , boost::make_loop_erased_random_tree_params().rng_engine(
+ engine
+ ).source_vertex(
+ root
+ ).predecessor_map(
+ pred_map
+ ).visitor(
+ boost::fusion::make_list(
+ boost::fuse_property_writer<
+ boost::on_initialize_vertex
+ >(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_discover_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " discovered...\t")
+ )
+ , boost::fuse_property_writer<boost::on_examine_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " examined...\t")
+ )
+ , boost::fuse_property_writer<
+ boost::on_loop_erased_vertex
+ >(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " erased from loop.\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ index_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_tree_edge>(
+ index_map
+ , std::cout
+ , " examined...\t"
+ )
+ , boost::fuse_simple_edge_writer<boost::on_back_edge>(
+ index_map
+ , std::cout
+ , " leads to a loop.\t"
+ )
+ )
+ )
+ )
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+ )
+ {
+ std::cout << " Done!" << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ u = boost::get(pred_map, *vi);
+ std::cout << boost::get(index_map, u) << " (";
+ boost::tie(e, b) = boost::edge(*vi, u, g);
+
+ if (b)
+ {
+ std::cout << boost::get(e_map, e);
+ }
+
+ std::cout << ')' << std::endl;
+ }
+
+ break;
+ }
+
+ std::cout << std::endl << "Trying again...\t";
+ }
+}
+//]
+
+//[loop_erased_random_weighted_tree_example
+template <typename Graph, typename RNGEngine>
+void loop_erased_random_weighted_tree_example(unsigned int num_runs)
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeWeightMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+ initialize_graph(g, rng);
+
+ EdgeWeightMap e_map = boost::get(boost::edge_weight, g);
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+ Vertex u;
+
+ std::cout << std::endl << "Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, e_map);
+
+ while (num_runs)
+ {
+ if (boost::loop_erased_random_weighted_tree(g, engine, pred_map))
+ {
+ std::cout << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ u = boost::get(pred_map, *vi);
+ std::cout << boost::get(index_map, u) << " (";
+ boost::tie(e, b) = boost::edge(*vi, u, g);
+
+ if (b)
+ {
+ std::cout << boost::get(e_map, e);
+ }
+
+ std::cout << ')' << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_weighted_tree_with_source_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_weighted_tree_with_source_example(
+ std::size_t const root_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeWeightMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ Vertex root = boost::vertex(root_index, g);
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+ initialize_graph(g, rng);
+
+ EdgeWeightMap e_map = boost::get(boost::edge_weight, g);
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+ Vertex u;
+
+ std::cout << std::endl << "Source = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, e_map);
+
+ while (num_runs)
+ {
+ if (
+ boost::loop_erased_random_weighted_tree(
+ g
+ , engine
+ , pred_map
+ , boost::graph::keywords::_source_vertex = root
+ )
+ )
+ {
+ std::cout << std::endl << "Predecessors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " <-- ";
+ u = boost::get(pred_map, *vi);
+ std::cout << boost::get(index_map, u) << " (";
+ boost::tie(e, b) = boost::edge(u, *vi, g);
+
+ if (b)
+ {
+ std::cout << boost::get(e_map, e);
+ }
+
+ std::cout << ')' << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_weighted_tree_with_target_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_weighted_tree_with_target_example(
+ std::size_t const root_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_iterator
+ VertexIterator;
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeWeightMap;
+
+ Graph g(24);
+ VertexIterator vi, vi_end;
+ Vertex root = boost::vertex(root_index, g);
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+ initialize_graph(g, rng);
+
+ EdgeWeightMap e_map = boost::get(boost::edge_weight, g);
+ typename boost::graph_traits<Graph>::edge_descriptor e;
+ bool b;
+ Vertex u;
+
+ std::cout << std::endl << "Target = " << boost::get(index_map, root);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, e_map);
+
+ while (num_runs)
+ {
+ if (boost::loop_erased_random_weighted_tree(g, engine, pred_map, root))
+ {
+ std::cout << std::endl << "Successors:" << std::endl;
+
+ for (
+ boost::tie(vi, vi_end) = boost::vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ std::cout << '\t' << boost::get(index_map, *vi) << " --> ";
+ u = boost::get(pred_map, *vi);
+ std::cout << boost::get(index_map, u) << " (";
+ boost::tie(e, b) = boost::edge(*vi, u, g);
+
+ if (b)
+ {
+ std::cout << boost::get(e_map, e);
+ }
+
+ std::cout << ')' << std::endl;
+ }
+
+ --num_runs;
+ }
+ }
+}
+//]
+
+//[loop_erased_random_weighted_path_example
+template <typename Graph, typename RNGEngine>
+void
+ loop_erased_random_weighted_path_example(
+ std::size_t const start_index
+ , std::size_t const end_index
+ , unsigned int num_runs
+ )
+{
+ typedef typename boost::graph_traits<Graph>::vertex_descriptor
+ Vertex;
+ typedef typename boost::vertex_property_map_gen<Graph,Vertex>::type
+ PredecessorMap;
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+
+ Graph g(24);
+ Vertex start = boost::vertex(start_index, g);
+ Vertex end = boost::vertex(end_index, g);
+ Vertex v;
+ PredecessorMap pred_map(g);
+ VertexIndexMap index_map = boost::get(boost::vertex_index, g);
+ RNGEngine engine;
+
+ std::tr1::variate_generator<RNGEngine&,std::tr1::uniform_real<> > rng(
+ engine
+ , std::tr1::uniform_real<>(0.2, 0.8)
+ );
+
+ initialize_graph(g, rng);
+ std::cout << std::endl << "Start = " << boost::get(index_map, start);
+ std::cout << ", End = " << boost::get(index_map, end);
+ std::cout << ", Graph:" << std::endl;
+ boost::print_graph(g);
+ boost::print_edges2(g, index_map, boost::get(boost::edge_weight, g));
+
+ while (num_runs)
+ {
+ if (
+ boost::loop_erased_random_weighted_tree(
+ g
+ , engine
+ , pred_map
+ , end
+ , start
+ )
+ )
+ {
+ std::cout << "Path: " << boost::get(index_map, v = start);
+
+ while (v != end)
+ {
+ v = boost::get(pred_map, v);
+ std::cout << " -> " << boost::get(index_map, v);
+ }
+
+ std::cout << std::endl;
+ --num_runs;
+ }
+ }
+}
+//]
+
+template <typename EdgeContainerSelector, typename RNGEngine>
+void
+ vec_adjacency_list_example(
+ unsigned int const start_index
+ , unsigned int const end_index
+ , unsigned int const num_runs
+ )
+{
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::undirectedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,double>
+ >
+ UndirectedGraph;
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::bidirectionalS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,double>
+ >
+ BidirectionalGraph;
+ typedef boost::adjacency_list<
+ EdgeContainerSelector
+ , boost::vecS
+ , boost::directedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,double>
+ >
+ DirectedGraph;
+
+ std::cout << "Running loop_erased_random_weighted_tree function template ";
+ std::cout << "on undirected graph." << std::endl;
+ loop_erased_random_weighted_tree_example_with_visitor_list<
+ UndirectedGraph
+ , RNGEngine
+ >();
+ loop_erased_random_weighted_tree_example_with_fusion_visitor_list<
+ UndirectedGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_weighted_tree_example<
+ UndirectedGraph
+ , RNGEngine
+ >(num_runs);
+ loop_erased_random_weighted_tree_with_source_example<
+ UndirectedGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_weighted_tree_with_target_example<
+ UndirectedGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_weighted_path_example<
+ UndirectedGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+ std::cout << std::endl << std::endl;
+
+ std::cout << "Running loop_erased_random_weighted_tree function template ";
+ std::cout << "on directed graph." << std::endl;
+ loop_erased_random_weighted_tree_example_with_visitor_list<
+ DirectedGraph
+ , RNGEngine
+ >();
+ loop_erased_random_weighted_tree_example_with_fusion_visitor_list<
+ DirectedGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_weighted_tree_example<
+ DirectedGraph
+ , RNGEngine
+ >(num_runs);
+ loop_erased_random_weighted_tree_with_source_example<
+ DirectedGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_weighted_tree_with_target_example<
+ DirectedGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_weighted_path_example<
+ DirectedGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+ std::cout << std::endl << std::endl;
+
+ std::cout << "Running loop_erased_random_weighted_tree function template ";
+ std::cout << "on bidirectional graph." << std::endl;
+ loop_erased_random_weighted_tree_example_with_visitor_list<
+ BidirectionalGraph
+ , RNGEngine
+ >();
+ loop_erased_random_weighted_tree_example_with_fusion_visitor_list<
+ BidirectionalGraph
+ , RNGEngine
+ >(end_index);
+ loop_erased_random_weighted_tree_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(num_runs);
+ loop_erased_random_weighted_tree_with_source_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(start_index, num_runs);
+ loop_erased_random_weighted_tree_with_target_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(end_index, num_runs);
+ loop_erased_random_weighted_path_example<
+ BidirectionalGraph
+ , RNGEngine
+ >(start_index, end_index, num_runs);
+}
+
+#endif // LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RANDOM_WEIGHTED_TREE_HPP
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk