|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80469 - in sandbox: graph-loop_erased_random_tree graph-path graph-path/boost graph-path/boost/detail graph-path/boost/detail/metafunction graph-path/boost/graph graph-path/boost/graph/detail graph-path/boost/graph/detail/metafunction graph-path/boost/graph/keywords graph-path/libs graph-path/libs/graph graph-path/libs/graph/doc graph-path/libs/graph/doc/src graph-path/libs/graph/doc/src/call_visitors graph-path/libs/graph/doc/src/find_eulerian_cycle graph-path/libs/graph/doc/src/find_eulerian_trail graph-path/libs/graph/doc/src/fuse_property_writer graph-path/libs/graph/doc/src/has_eulerian_cycle graph-path/libs/graph/doc/src/has_eulerian_trail graph-path/libs/graph/doc/src/loop_erased_random_tree graph-path/libs/graph/doc/src/simple_edge_writer graph-path/libs/graph/doc/src/vertex_property_map_gen graph-path/libs/graph/doc/src/weak_components graph-path/libs/graph/example graph-path/libs/graph/test
From: sponage_at_[hidden]
Date: 2012-09-09 14:28:00
Author: expaler
Date: 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
New Revision: 80469
URL: http://svn.boost.org/trac/boost/changeset/80469
Log:
Renamed Boost.Graph.LoopErasedRandomTree to Boost.Graph.Path; added Euler tour algorithms.
Added:
sandbox/graph-path/
sandbox/graph-path/LICENSE_1_0.txt (contents, props changed)
sandbox/graph-path/boost/
sandbox/graph-path/boost.png (contents, props changed)
sandbox/graph-path/boost/detail/
sandbox/graph-path/boost/detail/metafunction/
sandbox/graph-path/boost/detail/metafunction/data_type.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/has_event_filter.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/has_iterator_category.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/has_key_type.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/has_traversal_category.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/has_value_type.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/is_output_iterator.hpp (contents, props changed)
sandbox/graph-path/boost/detail/metafunction/is_property_map.hpp (contents, props changed)
sandbox/graph-path/boost/graph/
sandbox/graph-path/boost/graph/call_visitors.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/
sandbox/graph-path/boost/graph/detail/default_combine_function.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/default_compare_predicate.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/default_terminate_predicate.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/find_eulerian_path.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/loop_erased_random_tree.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/loop_erased_random_tree_prm.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/
sandbox/graph-path/boost/graph/detail/metafunction/has_vertex_descriptor.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_edge_property_map.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_incidence_graph.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_predecessor_map.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_descriptor.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_list_graph.hpp (contents, props changed)
sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_property_map.hpp (contents, props changed)
sandbox/graph-path/boost/graph/find_eulerian_cycle.hpp (contents, props changed)
sandbox/graph-path/boost/graph/find_eulerian_trail.hpp (contents, props changed)
sandbox/graph-path/boost/graph/fuse_property_writer.hpp (contents, props changed)
sandbox/graph-path/boost/graph/has_eulerian_cycle.hpp (contents, props changed)
sandbox/graph-path/boost/graph/has_eulerian_trail.hpp (contents, props changed)
sandbox/graph-path/boost/graph/keywords/
sandbox/graph-path/boost/graph/keywords/input_graph.hpp (contents, props changed)
sandbox/graph-path/boost/graph/keywords/result.hpp (contents, props changed)
sandbox/graph-path/boost/graph/keywords/rng_engine.hpp (contents, props changed)
sandbox/graph-path/boost/graph/keywords/source_vertex.hpp (contents, props changed)
sandbox/graph-path/boost/graph/keywords/terminate_predicate.hpp (contents, props changed)
sandbox/graph-path/boost/graph/loop_erased_rand_w_tree.hpp (contents, props changed)
sandbox/graph-path/boost/graph/loop_erased_random_tree.hpp (contents, props changed)
sandbox/graph-path/boost/graph/simple_edge_writer.hpp (contents, props changed)
sandbox/graph-path/boost/graph/vertex_property_map_gen.hpp (contents, props changed)
sandbox/graph-path/boost/graph/weak_components.hpp (contents, props changed)
sandbox/graph-path/libs/
sandbox/graph-path/libs/graph/
sandbox/graph-path/libs/graph/doc/
sandbox/graph-path/libs/graph/doc/call_visitors.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/find_eulerian_cycle.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/find_eulerian_trail.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/fuse_property_writer.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/has_eulerian_cycle.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/has_eulerian_trail.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/loop_erased_random_tree.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/simple_edge_writer.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/
sandbox/graph-path/libs/graph/doc/src/call_visitors/
sandbox/graph-path/libs/graph/doc/src/call_visitors/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/call_visitors/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/
sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/
sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/
sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/
sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/
sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/
sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/
sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/
sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/weak_components/
sandbox/graph-path/libs/graph/doc/src/weak_components/Jamroot (contents, props changed)
sandbox/graph-path/libs/graph/doc/src/weak_components/doc.qbk (contents, props changed)
sandbox/graph-path/libs/graph/doc/vertex_property_map_gen.html (contents, props changed)
sandbox/graph-path/libs/graph/doc/weak_components.html (contents, props changed)
sandbox/graph-path/libs/graph/example/
sandbox/graph-path/libs/graph/example/find_eulerian_cycle.cpp (contents, props changed)
sandbox/graph-path/libs/graph/example/find_eulerian_cycle.hpp (contents, props changed)
sandbox/graph-path/libs/graph/example/find_eulerian_trail.cpp (contents, props changed)
sandbox/graph-path/libs/graph/example/find_eulerian_trail.hpp (contents, props changed)
sandbox/graph-path/libs/graph/example/loop_erased_rand_w_tree.cpp (contents, props changed)
sandbox/graph-path/libs/graph/example/loop_erased_rand_w_tree.hpp (contents, props changed)
sandbox/graph-path/libs/graph/example/loop_erased_random_tree.cpp (contents, props changed)
sandbox/graph-path/libs/graph/example/loop_erased_random_tree.hpp (contents, props changed)
sandbox/graph-path/libs/graph/test/
sandbox/graph-path/libs/graph/test/eulerian_path_visitor.hpp (contents, props changed)
sandbox/graph-path/libs/graph/test/find_eulerian_cycle.cpp (contents, props changed)
sandbox/graph-path/libs/graph/test/find_eulerian_cycle.hpp (contents, props changed)
sandbox/graph-path/libs/graph/test/find_eulerian_trail.cpp (contents, props changed)
sandbox/graph-path/libs/graph/test/find_eulerian_trail.hpp (contents, props changed)
sandbox/graph-path/libs/graph/test/initialize_complete_graph.hpp (contents, props changed)
sandbox/graph-path/libs/graph/test/initialize_euler_graphs.hpp (contents, props changed)
Removed:
sandbox/graph-loop_erased_random_tree/
Added: sandbox/graph-path/LICENSE_1_0.txt
==============================================================================
--- (empty file)
+++ sandbox/graph-path/LICENSE_1_0.txt 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,23 @@
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
Added: sandbox/graph-path/boost.png
==============================================================================
Binary file. No diff available.
Added: sandbox/graph-path/boost/detail/metafunction/data_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/data_type.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,52 @@
+// Copyright (C) 2007-2012 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 { namespace metafunction {
+
+ 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::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_DATA_TYPE_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/has_event_filter.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/has_event_filter.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012 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_HAS_EVENT_FILTER_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_EVENT_FILTER_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_event_filter metafunction will determine whether or not the
+ // specified type has a nested 'event_filter' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(event_filter)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_EVENT_FILTER_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/has_iterator_category.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/has_iterator_category.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012 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_HAS_ITERATOR_CATEGORY_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_ITERATOR_CATEGORY_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_iterator_category metafunction will determine whether or not the
+ // specified type has a nested 'iterator_category' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_ITERATOR_CATEGORY_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/has_key_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/has_key_type.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2007-2012 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_HAS_KEY_TYPE_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_KEY_TYPE_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_key_type metafunction will determine whether or not the
+ // specified type has a nested 'key_type' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(key_type)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_KEY_TYPE_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/has_traversal_category.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/has_traversal_category.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012 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_HAS_TRAVERSAL_CATEGORY_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_TRAVERSAL_CATEGORY_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_traversal_category metafunction will determine whether or not
+ // the specified type has a nested 'traversal_category' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(traversal_category)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_TRAVERSAL_CATEGORY_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/has_value_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/has_value_type.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2007-2012 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_HAS_VALUE_TYPE_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_HAS_VALUE_TYPE_HPP_INCLUDED
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ // The has_value_type metafunction will determine whether or not the
+ // specified type has a nested 'value_type' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_HAS_VALUE_TYPE_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/is_output_iterator.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/is_output_iterator.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,48 @@
+// Copyright (C) 2012 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_IS_OUTPUT_ITERATOR_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_IS_OUTPUT_ITERATOR_HPP_INCLUDED
+
+#include <iterator>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/iterator/iterator_traits.hpp>
+#include <boost/detail/metafunction/has_iterator_category.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ template <typename T>
+ struct is_output_iterator_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_convertible<
+ typename ::boost::BOOST_ITERATOR_CATEGORY<T>::type
+ , ::std::output_iterator_tag
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T>
+ struct is_output_iterator
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::has_iterator_category<
+ ::std::iterator_traits<T>
+ >
+ , is_output_iterator_impl<T>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_output_iterator,(T))
+ };
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_IS_OUTPUT_ITERATOR_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/detail/metafunction/is_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/detail/metafunction/is_property_map.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,33 @@
+// Copyright (C) 2012 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_IS_PROPERTY_MAP_HPP_INCLUDED
+#define BOOST_DETAIL_METAFUNCTION_IS_PROPERTY_MAP_HPP_INCLUDED
+
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/detail/metafunction/has_key_type.hpp>
+#include <boost/detail/metafunction/has_value_type.hpp>
+
+namespace boost { namespace detail { namespace metafunction {
+
+ template <typename T>
+ struct is_property_map
+ : ::boost::mpl::and_<
+ ::boost::detail::metafunction::has_key_type<
+ ::boost::property_traits<T>
+ >
+ , ::boost::detail::metafunction::has_value_type<
+ ::boost::property_traits<T>
+ >
+ >
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_property_map,(T))
+ };
+}}} // namespace boost::detail::metafunction
+
+#endif // BOOST_DETAIL_METAFUNCTION_IS_PROPERTY_MAP_HPP_INCLUDED
+
Added: sandbox/graph-path/boost/graph/call_visitors.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/call_visitors.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,279 @@
+// Copyright (C) 2011-2012 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 <boost/config.hpp>
+#include <boost/graph/visitors.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <utility>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/equal_to.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>
+#endif
+
+namespace boost {
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ namespace detail {
+
+ // 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
+ >()
+ );
+ }
+
+ template <typename Filter>
+ struct matches_event_filter
+ {
+ template <typename Pair>
+ struct apply
+ {
+ typedef ::std::tr1::is_same<
+ Filter
+ , typename Pair::first_type
+ >
+ 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>
+ >
+ 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>
+ >
+ 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
+#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+ //[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
+ )
+ {
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ invoke_visitors(visitors, t, input_graph, Filter());
+#else
+ detail::call_visitors_dispatch<Filter>(
+ visitors
+ , t
+ , input_graph
+ , typename ::boost::fusion::traits::is_sequence<VisitorList>::type()
+ );
+#endif
+ }
+} // namespace boost
+
+#endif // BOOST_GRAPH_CALL_VISITORS_HPP
+
Added: sandbox/graph-path/boost/graph/detail/default_combine_function.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/default_combine_function.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,25 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/detail/default_compare_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/default_compare_predicate.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,25 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/detail/default_terminate_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/default_terminate_predicate.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,32 @@
+// Copyright (C) 2004-2012 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;
+ }
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_DEFAULT_TERMINATE_PREDICATE_HPP
+
Added: sandbox/graph-path/boost/graph/detail/find_eulerian_path.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/find_eulerian_path.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,419 @@
+// Copyright (C) 2012 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_FIND_EULERIAN_PATH_HPP
+#define BOOST_GRAPH_DETAIL_FIND_EULERIAN_PATH_HPP
+
+#include <algorithm>
+#include <list>
+#include <set>
+#include <utility>
+#include <boost/property_map/property_map.hpp>
+#include <boost/tr1/tuple.hpp>
+#include <boost/intrusive/list.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/vertex_property_map_gen.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ struct eulerian_vertex;
+
+ template <typename InputGraph>
+ struct eulerian_edge
+ {
+ typename graph_traits<InputGraph>::edge_descriptor edge;
+ eulerian_vertex<InputGraph>* source;
+ eulerian_vertex<InputGraph>* target;
+ };
+
+ template <typename InputGraph>
+ inline bool
+ operator<(
+ eulerian_edge<InputGraph> const& lhs
+ , eulerian_edge<InputGraph> const& rhs
+ )
+ {
+ return (lhs.edge) < (rhs.edge);
+ }
+
+ template <typename InputGraph>
+ struct eulerian_vertex
+ {
+ typedef ::std::list<eulerian_edge<InputGraph> > edge_list;
+
+ ::boost::intrusive::list_member_hook<> hook;
+ edge_list edges;
+ typename graph_traits<InputGraph>::vertex_descriptor vertex;
+ typename edge_list::iterator in_edge_itr;
+
+ eulerian_vertex();
+ };
+
+ template <typename InputGraph>
+ eulerian_vertex<InputGraph>::eulerian_vertex()
+ : hook()
+ , edges()
+ , vertex(graph_traits<InputGraph>::null_vertex())
+ , in_edge_itr()
+ {
+ }
+
+ template <typename InputGraph, typename OutIterator, typename Visitors>
+ void
+ find_eulerian_path_impl(
+ InputGraph const& graph
+ , OutIterator output_edges
+ , typename graph_traits<InputGraph>::vertex_descriptor start
+ , Visitors visitors
+ , undirected_tag
+ )
+ {
+ typedef eulerian_edge<InputGraph> EulerEdge;
+ typedef eulerian_vertex<InputGraph> EulerVertex;
+ typedef ::std::multiset<EulerEdge> AllEdges;
+ typedef typename EulerVertex::edge_list PathEdges;
+ typedef ::boost::intrusive::list<
+ EulerVertex
+ , ::boost::intrusive::member_hook<
+ EulerVertex
+ , ::boost::intrusive::list_member_hook<>
+ , &EulerVertex::hook
+ >
+ >
+ VertexRefs;
+
+ typename vertex_property_map_gen<
+ InputGraph
+ , EulerVertex
+ >::type euler_map(graph);
+ VertexRefs path_vertices;
+ AllEdges all_edges;
+ typename VertexRefs::iterator path_vertex_itr;
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ EulerVertex& e_u = get(euler_map, *vi);
+
+ e_u.vertex = *vi;
+ call_visitors<on_initialize_vertex>(visitors, *vi, graph);
+
+ if (*vi == start)
+ {
+ path_vertex_itr = path_vertices.insert(
+ path_vertices.end()
+ , e_u
+ );
+ }
+
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ EulerEdge e_edge;
+ EulerVertex& e_v = get(euler_map, target(*ei, graph));
+
+ e_edge.edge = *ei;
+ e_edge.source = &e_u;
+ e_edge.target = &e_v;
+ e_u.edges.push_back(e_edge);
+ all_edges.insert(e_edge);
+ }
+ }
+
+ call_visitors<on_start_vertex>(visitors, start, graph);
+
+ PathEdges path_edges;
+ typename PathEdges::iterator path_edge_itr = path_edges.insert(
+ path_edges.end()
+ , path_vertex_itr->edges.front()
+ );
+
+ path_vertex_itr->edges.pop_front();
+ call_visitors<on_examine_edge>(
+ visitors
+ , path_edge_itr->edge
+ , graph
+ );
+ path_vertex_itr->in_edge_itr = path_edges.begin();
+ all_edges.erase(
+ all_edges.lower_bound(*path_edge_itr)
+ , all_edges.upper_bound(*path_edge_itr)
+ );
+
+ if (path_vertex_itr->edges.empty())
+ {
+ call_visitors<on_finish_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ path_vertex_itr = path_vertices.erase(path_vertex_itr);
+ }
+
+ path_vertex_itr = path_vertices.insert(
+ path_vertex_itr
+ , *path_edge_itr->target
+ );
+ path_vertex_itr->in_edge_itr = path_edge_itr;
+
+ for (;;)
+ {
+ if (path_vertex_itr->edges.empty())
+ {
+ call_visitors<on_finish_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ path_vertices.erase(path_vertex_itr);
+
+ if (path_vertices.empty())
+ {
+ break;
+ }
+ else
+ {
+ path_vertex_itr = path_vertices.begin();
+ path_edge_itr = path_vertex_itr->in_edge_itr;
+ call_visitors<on_start_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ continue;
+ }
+ }
+
+ EulerEdge& e_edge = path_vertex_itr->edges.front();
+ typename AllEdges::iterator e_itr = all_edges.lower_bound(e_edge);
+ typename AllEdges::iterator e_end = all_edges.upper_bound(e_edge);
+
+ if (e_itr == e_end)
+ {
+ path_vertex_itr->edges.pop_front();
+ continue;
+ }
+ else
+ {
+ path_edge_itr = path_edges.insert(
+ path_vertex_itr->in_edge_itr
+ , e_edge
+ );
+ call_visitors<on_examine_edge>(
+ visitors
+ , path_edge_itr->edge
+ , graph
+ );
+ all_edges.erase(e_itr, e_end);
+ path_vertex_itr->edges.pop_front();
+ }
+
+ if (path_vertex_itr->edges.empty())
+ {
+ path_vertex_itr = path_vertices.erase(path_vertex_itr);
+ }
+
+ EulerVertex& e_v = *path_edge_itr->target;
+
+ if (e_v.hook.is_linked())
+ {
+ path_vertex_itr = path_vertices.iterator_to(e_v);
+ }
+ else
+ {
+ path_vertex_itr = path_vertices.insert(path_vertex_itr, e_v);
+ }
+
+ path_vertex_itr->in_edge_itr = path_edge_itr;
+ }
+
+ for (
+ typename PathEdges::reverse_iterator r_itr = path_edges.rbegin();
+ r_itr != path_edges.rend();
+ ++r_itr
+ )
+ {
+ *output_edges = r_itr->edge;
+ ++output_edges;
+ }
+ }
+
+ template <typename InputGraph, typename OutIterator, typename Visitors>
+ void
+ find_eulerian_path_impl(
+ InputGraph const& graph
+ , OutIterator output_edges
+ , typename graph_traits<InputGraph>::vertex_descriptor start
+ , Visitors visitors
+ , directed_tag
+ )
+ {
+ typedef eulerian_edge<InputGraph> EulerEdge;
+ typedef eulerian_vertex<InputGraph> EulerVertex;
+ typedef typename EulerVertex::edge_list PathEdges;
+ typedef ::boost::intrusive::list<
+ EulerVertex
+ , ::boost::intrusive::member_hook<
+ EulerVertex
+ , ::boost::intrusive::list_member_hook<>
+ , &EulerVertex::hook
+ >
+ >
+ VertexRefs;
+
+ typename vertex_property_map_gen<
+ InputGraph
+ , EulerVertex
+ >::type euler_map(graph);
+ VertexRefs path_vertices;
+ typename VertexRefs::iterator path_vertex_itr;
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ EulerVertex& e_u = get(euler_map, *vi);
+
+ e_u.vertex = *vi;
+ call_visitors<on_initialize_vertex>(visitors, *vi, graph);
+
+ if (*vi == start)
+ {
+ path_vertex_itr = path_vertices.insert(
+ path_vertices.end()
+ , e_u
+ );
+ }
+
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ EulerEdge e_edge;
+ EulerVertex& e_v = get(euler_map, target(*ei, graph));
+
+ e_edge.edge = *ei;
+ e_edge.source = &e_u;
+ e_edge.target = &e_v;
+ e_u.edges.push_back(e_edge);
+ }
+ }
+
+ call_visitors<on_start_vertex>(visitors, start, graph);
+
+ PathEdges path_edges;
+ typename PathEdges::iterator path_edge_itr = path_edges.insert(
+ path_edges.end()
+ , path_vertex_itr->edges.front()
+ );
+
+ call_visitors<on_examine_edge>(
+ visitors
+ , path_edge_itr->edge
+ , graph
+ );
+ path_vertex_itr->in_edge_itr = path_edges.begin();
+ path_vertex_itr->edges.pop_front();
+
+ if (path_vertex_itr->edges.empty())
+ {
+ call_visitors<on_finish_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ path_vertex_itr = path_vertices.erase(path_vertex_itr);
+ }
+
+ path_vertex_itr = path_vertices.insert(
+ path_vertex_itr
+ , *path_edge_itr->target
+ );
+ path_vertex_itr->in_edge_itr = path_edge_itr;
+
+ for (;;)
+ {
+ if (path_vertex_itr->edges.empty())
+ {
+ call_visitors<on_finish_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ path_vertices.erase(path_vertex_itr);
+
+ if (path_vertices.empty())
+ {
+ break;
+ }
+ else
+ {
+ path_vertex_itr = path_vertices.begin();
+ path_edge_itr = path_vertex_itr->in_edge_itr;
+ call_visitors<on_start_vertex>(
+ visitors
+ , path_vertex_itr->vertex
+ , graph
+ );
+ continue;
+ }
+ }
+
+ path_edge_itr = path_edges.insert(
+ path_vertex_itr->in_edge_itr
+ , path_vertex_itr->edges.front()
+ );
+ call_visitors<on_examine_edge>(
+ visitors
+ , path_edge_itr->edge
+ , graph
+ );
+ path_vertex_itr->edges.pop_front();
+
+ if (path_vertex_itr->edges.empty())
+ {
+ path_vertex_itr = path_vertices.erase(path_vertex_itr);
+ }
+
+ EulerVertex& e_v = *path_edge_itr->target;
+
+ if (e_v.hook.is_linked())
+ {
+ path_vertex_itr = path_vertices.iterator_to(e_v);
+ }
+ else
+ {
+ path_vertex_itr = path_vertices.insert(path_vertex_itr, e_v);
+ }
+
+ path_vertex_itr->in_edge_itr = path_edge_itr;
+ }
+
+ for (
+ typename PathEdges::reverse_iterator r_itr = path_edges.rbegin();
+ r_itr != path_edges.rend();
+ ++r_itr
+ )
+ {
+ *output_edges = r_itr->edge;
+ ++output_edges;
+ }
+ }
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_FIND_EULERIAN_PATH_HPP
+
Added: sandbox/graph-path/boost/graph/detail/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/loop_erased_random_tree.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,794 @@
+// Copyright (C) 2004-2012 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::metafunction::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::metafunction::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::metafunction::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::metafunction::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-path/boost/graph/detail/loop_erased_random_tree_prm.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/loop_erased_random_tree_prm.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,299 @@
+// Copyright (C) 2004-2012 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_PRM_HPP
+#define BOOST_GRAPH_DETAIL_LOOP_ERASED_RANDOM_TREE_PRM_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_REF(predecessor_map, vertex_predecessor) \
+ BOOST_BGL_ONE_PARAM_CREF(root_vertex, root_vertex) \
+ BOOST_BGL_ONE_PARAM_REF(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
+ {
+ typedef loop_erased_random_tree_params self;
+ typedef Base next_type;
+ typedef Tag tag_type;
+ typedef T value_type;
+
+ T m_value;
+ Base m_base;
+
+ loop_erased_random_tree_params(T v = T())
+ : m_value(v), m_base()
+ {
+ }
+
+ loop_erased_random_tree_params(T v, Base const& b)
+ : m_value(v), m_base(b)
+ {
+ }
+
+#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_loop_erased_random_tree_params const&)
+ {
+ return type();
+ }
+ };
+
+ template <typename P, typename R>
+ struct convert_bgl_params_to_boost_parameter<
+ loop_erased_random_tree_params<P,int,R>
+ >
+ {
+ typedef convert_bgl_params_to_boost_parameter<R> rest_conv;
+ typedef typename rest_conv::type type;
+
+ static type conv(loop_erased_random_tree_params<P,int,R> const& x)
+ {
+ return rest_conv::conv(x.m_base);
+ }
+ };
+}} // namespace boost::detail
+
+namespace boost {
+
+ inline detail::no_loop_erased_random_tree_params
+ make_loop_erased_random_tree_params()
+ {
+ return detail::no_loop_erased_random_tree_params();
+ }
+
+ template <typename T, typename Tag, typename Base>
+ struct lookup_named_param<
+ Tag
+ , detail::loop_erased_random_tree_params<T,Tag,Base>
+ >
+ {
+ typedef T type;
+
+ static type const&
+ get(detail::loop_erased_random_tree_params<T,Tag,Base> const& p)
+ {
+ return p.m_value;
+ }
+ };
+
+ template <typename Tag1, typename T, typename Tag, typename Base>
+ struct lookup_named_param<
+ Tag1
+ , detail::loop_erased_random_tree_params<T,Tag,Base>
+ >
+ {
+ typedef typename lookup_named_param<Tag1,Base>::type type;
+
+ static type const&
+ get(detail::loop_erased_random_tree_params<T,Tag,Base> const& p)
+ {
+ return lookup_named_param<Tag1,Base>::get(p.m_base);
+ }
+ };
+
+ template <typename T, typename Tag, typename Base, typename Def>
+ struct lookup_named_param_def<
+ Tag
+ , detail::loop_erased_random_tree_params<T,Tag,Base>
+ , Def
+ >
+ {
+ typedef T type;
+
+ static const type&
+ get(
+ detail::loop_erased_random_tree_params<T,Tag,Base> const& p
+ , Def const& def
+ )
+ {
+ return p.m_value;
+ }
+ };
+
+ template <
+ typename Tag1
+ , typename T
+ , typename Tag
+ , typename Base
+ , typename Def
+ >
+ struct lookup_named_param_def<
+ Tag1
+ , detail::loop_erased_random_tree_params<T,Tag,Base>
+ , Def
+ >
+ {
+ typedef typename lookup_named_param_def<Tag1,Base,Def>::type type;
+
+ static const type&
+ get(
+ detail::loop_erased_random_tree_params<T,Tag,Base> const& p
+ , Def const& def
+ )
+ {
+ return lookup_named_param_def<Tag1,Base,Def>::get(p.m_base, def);
+ }
+ };
+
+#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_PRM_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/has_vertex_descriptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/has_vertex_descriptor.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,19 @@
+// Copyright (C) 2012 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_METAFUNCTION_HAS_VERTEX_DESCRIPTOR_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_HAS_VERTEX_DESCRIPTOR_HPP
+
+#include <boost/mpl/has_xxx.hpp>
+
+namespace boost { namespace detail {
+
+ // The has_vertex_descriptor metafunction will determine whether or not the
+ // specified type has a nested 'vertex_descriptor' type definition.
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(vertex_descriptor)
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_HAS_VERTEX_DESCRIPTOR_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_edge_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_edge_property_map.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,46 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_EDGE_PROPERTY_MAP_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_EDGE_PROPERTY_MAP_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/detail/metafunction/is_property_map.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T, typename G>
+ struct is_edge_property_map_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_same<
+ typename ::boost::property_traits<T>::key_type
+ , typename graph_traits<G>::edge_descriptor
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T, typename G>
+ struct is_edge_property_map
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::is_property_map<T>
+ , is_edge_property_map_impl<T,G>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_edge_property_map,(T,G))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_EDGE_PROPERTY_MAP_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_incidence_graph.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_incidence_graph.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,47 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_INCIDENCE_GRAPH_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_INCIDENCE_GRAPH_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/detail/metafunction/has_traversal_category.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T>
+ struct is_incidence_graph_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_convertible<
+ typename graph_traits<T>::traversal_category
+ , incidence_graph_tag
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T>
+ struct is_incidence_graph
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::has_traversal_category<
+ graph_traits<T>
+ >
+ , is_incidence_graph_impl<T>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incidence_graph,(T))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_INCIDENCE_GRAPH_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_predecessor_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_predecessor_map.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,45 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_PREDECESSOR_MAP_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_PREDECESSOR_MAP_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/detail/metafunction/is_property_map.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T>
+ struct is_predecessor_map_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_same<
+ typename ::boost::property_traits<T>::key_type
+ , typename ::boost::property_traits<T>::value_type
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T>
+ struct is_predecessor_map
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::is_property_map<T>
+ , is_predecessor_map_impl<T>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_predecessor_map,(T))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_PREDECESSOR_MAP_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_descriptor.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_descriptor.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,45 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_VERTEX_DESCRIPTOR_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_DESCRIPTOR_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/detail/metafunction/has_vertex_descriptor.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename V, typename G>
+ struct is_vertex_descriptor_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_convertible<
+ V
+ , typename graph_traits<G>::vertex_descriptor
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename V, typename G>
+ struct is_vertex_descriptor
+ : ::boost::mpl::eval_if<
+ has_vertex_descriptor<graph_traits<G> >
+ , is_vertex_descriptor_impl<V,G>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_vertex_descriptor,(V,G))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_DESCRIPTOR_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_list_graph.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_list_graph.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,47 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_VERTEX_LIST_GRAPH_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_LIST_GRAPH_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/detail/metafunction/has_traversal_category.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T>
+ struct is_vertex_list_graph_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_convertible<
+ typename graph_traits<T>::traversal_category
+ , vertex_list_graph_tag
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T>
+ struct is_vertex_list_graph
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::has_traversal_category<
+ graph_traits<T>
+ >
+ , is_vertex_list_graph_impl<T>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_vertex_list_graph,(T))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_LIST_GRAPH_HPP
+
Added: sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_property_map.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/detail/metafunction/is_vertex_property_map.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,46 @@
+// Copyright (C) 2012 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_METAFUNCTION_IS_VERTEX_PROPERTY_MAP_HPP
+#define BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_PROPERTY_MAP_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/detail/metafunction/is_property_map.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename T, typename G>
+ struct is_vertex_property_map_impl
+ : ::boost::mpl::if_<
+ ::std::tr1::is_same<
+ typename ::boost::property_traits<T>::key_type
+ , typename graph_traits<G>::vertex_descriptor
+ >
+ , ::boost::mpl::true_
+ , ::boost::mpl::false_
+ >
+ {
+ };
+
+ template <typename T, typename G>
+ struct is_vertex_property_map
+ : ::boost::mpl::eval_if<
+ ::boost::detail::metafunction::is_property_map<T>
+ , is_vertex_property_map_impl<T,G>
+ , ::boost::mpl::false_
+ >::type
+ {
+ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,is_vertex_property_map,(T,G))
+ };
+}} // namespace boost::detail
+
+#endif // BOOST_GRAPH_DETAIL_METAFUNCTION_IS_VERTEX_PROPERTY_MAP_HPP
+
Added: sandbox/graph-path/boost/graph/find_eulerian_cycle.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/find_eulerian_cycle.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,250 @@
+// Copyright (C) 2012 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_FIND_EULERIAN_CYCLE_HPP
+#define BOOST_GRAPH_FIND_EULERIAN_CYCLE_HPP
+
+#include <boost/config.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/parameter/preprocessor.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/named_function_params.hpp>
+#include <boost/graph/keywords/input_graph.hpp>
+#include <boost/graph/keywords/result.hpp>
+#include <boost/graph/detail/find_eulerian_path.hpp>
+#include <boost/graph/has_eulerian_cycle.hpp>
+#include <boost/assert.hpp>
+
+#if !defined BOOST_MSVC
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/graph/detail/metafunction/is_incidence_graph.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_list_graph.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_descriptor.hpp>
+#include <boost/detail/metafunction/is_output_iterator.hpp>
+#include <boost/detail/metafunction/has_event_filter.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/support/is_sequence.hpp>
+#include <boost/fusion/support/pair.hpp>
+#endif
+#endif
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph, typename OutputIterator, typename Params>
+ inline bool
+ find_eulerian_cycle_dispatch(
+ InputGraph const& input_graph
+ , OutputIterator result
+ , Params const& params
+ )
+ {
+ BOOST_ASSERT(has_eulerian_cycle(input_graph));
+
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+
+ find_eulerian_path_impl(
+ input_graph
+ , result
+ , arg_pack[::boost::graph::keywords::_root_vertex]
+ , arg_pack[::boost::graph::keywords::_visitor]
+ , typename graph_traits<InputGraph>::directed_category()
+ );
+ return true;
+ }
+}} // namespace boost::detail
+
+//[reference__find_eulerian_cycle
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename OutputIterator
+ , typename P
+ , typename T
+ , typename R
+ >
+ bool
+ find_eulerian_cycle(
+ InputGraph const& input_graph
+ , OutputIterator result
+ , bgl_named_params<P,T,R> const& params
+ );
+
+ //<-
+ template <
+ typename InputGraph
+ , typename OutputIterator
+ , typename P
+ , typename T
+ , typename R
+ >
+ inline bool
+ find_eulerian_cycle(
+ InputGraph const& input_graph
+ , OutputIterator result
+ , bgl_named_params<P,T,R> const& params
+ )
+ {
+ typedef bgl_named_params<P,T,R> Params;
+ BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(Params, params)
+
+ return detail::find_eulerian_cycle_dispatch(
+ input_graph
+ , result
+ , ::boost::root_vertex(
+ arg_pack[
+ ::boost::graph::keywords::_root_vertex
+ | *vertices(input_graph).first
+ ]
+ ).visitor(
+ arg_pack[
+ ::boost::graph::keywords::_visitor
+ | null_visitor()
+ ]
+ )
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+#if BOOST_PP_LESS(3, BOOST_PARAMETER_MAX_ARITY)
+namespace boost {
+
+#if defined BOOST_MSVC
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , find_eulerian_cycle
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *
+ )
+ (out(result)
+ , *
+ )
+ )
+ (optional
+ (root_vertex
+ , *
+ , (*(vertices(input_graph).first))
+ )
+ (visitor
+ , *
+ , null_visitor()
+ )
+ )
+ )
+#else // Okay, we can impose type requirements. Awesome.
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , find_eulerian_cycle
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (out(result)
+ , *(
+ ::boost::detail::metafunction::is_output_iterator<
+ ::boost::mpl::_
+ >
+ )
+ )
+ )
+ (deduced
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , (*(vertices(input_graph).first))
+ )
+ (visitor
+ , *(
+ ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , find_eulerian_cycle
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (out(result)
+ , *(
+ ::boost::detail::metafunction::is_output_iterator<
+ ::boost::mpl::_
+ >
+ )
+ )
+ )
+ (deduced
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , (*(vertices(input_graph).first))
+ )
+ (visitor
+ , *(
+ ::boost::mpl::or_<
+ ::boost::fusion::traits::is_sequence<
+ ::boost::mpl::_
+ >
+ , ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#endif // BOOST_MSVC
+ {
+ return detail::find_eulerian_cycle_dispatch(
+ input_graph
+ , result
+ , ::boost::root_vertex(root_vertex).visitor(visitor)
+ );
+ }
+} // namespace boost
+#endif // 3 < BOOST_PARAMETER_MAX_ARITY
+
+#endif // BOOST_GRAPH_FIND_EULERIAN_CYCLE_HPP
+
Added: sandbox/graph-path/boost/graph/find_eulerian_trail.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/find_eulerian_trail.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,179 @@
+// Copyright (C) 2012 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_FIND_EULERIAN_TRAIL_HPP
+#define BOOST_GRAPH_FIND_EULERIAN_TRAIL_HPP
+
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/detail/find_eulerian_path.hpp>
+#include <boost/graph/has_eulerian_trail.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+#include <boost/assert.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ typename graph_traits<InputGraph>::vertex_descriptor
+ find_eulerian_trail_root(
+ InputGraph const& graph
+ , undirected_tag
+ )
+ {
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ ::std::tr1::tie(vi, vi_end) = vertices(graph);
+
+ typename graph_traits<InputGraph>::vertex_descriptor result = *vi;
+
+ while (++vi != vi_end)
+ {
+ if (out_degree(*vi, graph) & 1)
+ {
+ result = *vi;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ template <typename InputGraph>
+ typename graph_traits<InputGraph>::vertex_descriptor
+ find_eulerian_trail_root(
+ InputGraph const& graph
+ , bidirectional_tag
+ )
+ {
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ ::std::tr1::tie(vi, vi_end) = vertices(graph);
+
+ typename graph_traits<InputGraph>::vertex_descriptor result = *vi;
+
+ while (++vi != vi_end)
+ {
+ if (in_degree(*vi, graph) < out_degree(*vi, graph))
+ {
+ result = *vi;
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ template <typename InputGraph>
+ typename graph_traits<InputGraph>::vertex_descriptor
+ find_eulerian_trail_root(
+ InputGraph const& graph
+ , directed_tag
+ )
+ {
+ typedef typename graph_traits<InputGraph>::degree_size_type Degree;
+
+ typename vertex_property_map_gen<InputGraph,Degree>::type in_deg(
+ graph
+ );
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ put(in_deg, *vi, 0);
+ }
+
+ for (vi = vertices(graph).first; vi != vi_end; ++vi)
+ {
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ typename graph_traits<InputGraph>::vertex_descriptor
+ u = target(*ei, graph);
+
+ put(in_deg, u, 1 + get(in_deg, u));
+ }
+ }
+
+ vi = vertices(graph).first;
+
+ typename graph_traits<InputGraph>::vertex_descriptor result = *vi;
+
+ while (++vi != vi_end)
+ {
+ if (get(in_deg, *vi) < out_degree(*vi, graph))
+ {
+ result = *vi;
+ break;
+ }
+ }
+
+ return result;
+ }
+}} // namespace boost::detail
+
+//[reference__find_eulerian_trail
+namespace boost {
+
+ template <typename InputGraph, typename OutputIterator, typename Visitor>
+ bool
+ find_eulerian_trail(
+ InputGraph const& input_graph
+ , OutputIterator result
+ , Visitor visitor
+ );
+
+ //<-
+ template <typename InputGraph, typename OutputIterator, typename Visitor>
+ inline bool
+ find_eulerian_trail(
+ InputGraph const& input_graph
+ , OutputIterator result
+ , Visitor visitor
+ )
+ {
+ BOOST_ASSERT(has_eulerian_trail(input_graph));
+
+ detail::find_eulerian_path_impl(
+ input_graph
+ , result
+ , detail::find_eulerian_trail_root(
+ input_graph
+ , typename graph_traits<InputGraph>::directed_category()
+ )
+ , visitor
+ , typename graph_traits<InputGraph>::directed_category()
+ );
+ return true;
+ }
+ //->
+
+ template <typename InputGraph, typename OutputIterator>
+ bool
+ find_eulerian_trail(
+ InputGraph const& input_graph
+ , OutputIterator result
+ );
+
+ //<-
+ template <typename InputGraph, typename OutputIterator>
+ inline bool
+ find_eulerian_trail(
+ InputGraph const& input_graph
+ , OutputIterator result
+ )
+ {
+ return find_eulerian_trail(input_graph, result, null_visitor());
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_FIND_EULERIAN_TRAIL_HPP
+
Added: sandbox/graph-path/boost/graph/fuse_property_writer.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/fuse_property_writer.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,45 @@
+// Copyright (C) 2011-2012 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-path/boost/graph/has_eulerian_cycle.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/has_eulerian_cycle.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,128 @@
+// Copyright (C) 2012 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_HAS_EULERIAN_CYCLE_HPP
+#define BOOST_GRAPH_HAS_EULERIAN_CYCLE_HPP
+
+#include <boost/property_map/property_map.hpp>
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/connected_components.hpp>
+#include <boost/graph/strong_components.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ bool has_eulerian_cycle_impl(InputGraph const& graph, undirected_tag)
+ {
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ if (out_degree(*vi, graph) & 1)
+ {
+ return false;
+ }
+ }
+
+ typename vertex_property_map_gen<
+ InputGraph
+ , typename graph_traits<InputGraph>::vertices_size_type
+ >::type component_map(graph);
+
+ return 1 == connected_components(graph, component_map);
+ }
+
+ template <typename InputGraph>
+ bool has_eulerian_cycle_impl(InputGraph const& graph, bidirectional_tag)
+ {
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ if (in_degree(*vi, graph) != out_degree(*vi, graph))
+ {
+ return false;
+ }
+ }
+
+ typename vertex_property_map_gen<
+ InputGraph
+ , typename graph_traits<InputGraph>::vertices_size_type
+ >::type component_map(graph);
+
+ return 1 == strong_components(graph, component_map);
+ }
+
+ template <typename InputGraph>
+ bool has_eulerian_cycle_impl(InputGraph const& graph, directed_tag)
+ {
+ typename vertex_property_map_gen<
+ InputGraph
+ , typename graph_traits<InputGraph>::degree_size_type
+ >::type in_deg(graph);
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ put(in_deg, *vi, 0);
+ }
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ typename graph_traits<InputGraph>::vertex_descriptor
+ u = target(*ei, graph);
+
+ put(in_deg, u, 1 + get(in_deg, u));
+ }
+ }
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ if (get(in_deg, *vi) != out_degree(*vi, graph))
+ {
+ return false;
+ }
+ }
+
+ typename vertex_property_map_gen<
+ InputGraph
+ , typename graph_traits<InputGraph>::vertices_size_type
+ >::type component_map(graph);
+
+ return 1 == strong_components(graph, component_map);
+ }
+}} // namespace boost::detail
+
+//[reference__has_eulerian_cycle
+namespace boost {
+
+ template <typename InputGraph>
+ bool has_eulerian_cycle(InputGraph const& input_graph);
+
+ //<-
+ template <typename InputGraph>
+ inline bool has_eulerian_cycle(InputGraph const& input_graph)
+ {
+ return detail::has_eulerian_cycle_impl(
+ input_graph
+ , typename graph_traits<InputGraph>::directed_category()
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_HAS_EULERIAN_TRAIL_HPP
+
Added: sandbox/graph-path/boost/graph/has_eulerian_trail.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/has_eulerian_trail.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,183 @@
+// Copyright (C) 2012 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_HAS_EULERIAN_TRAIL_HPP
+#define BOOST_GRAPH_HAS_EULERIAN_TRAIL_HPP
+
+#include <boost/property_map/property_map.hpp>
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/connected_components.hpp>
+#include <boost/graph/weak_components.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+
+namespace boost { namespace detail {
+
+ template <typename InputGraph>
+ bool has_eulerian_trail_impl(InputGraph const& graph, undirected_tag)
+ {
+ typedef typename graph_traits<InputGraph>::vertices_size_type Count;
+
+ Count odd_count = 0;
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ if (out_degree(*vi, graph) & 1)
+ {
+ if (2 < ++odd_count)
+ {
+ return false;
+ }
+ }
+ }
+
+ typename vertex_property_map_gen<InputGraph,Count>::type component_map(
+ graph
+ );
+
+ return 1 == connected_components(graph, component_map);
+ }
+
+ template <typename InputGraph>
+ bool has_eulerian_trail_impl(InputGraph const& graph, bidirectional_tag)
+ {
+ typedef typename graph_traits<InputGraph>::vertices_size_type Count;
+
+ Count in_count = 0, out_count = 0;
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+ typename graph_traits<InputGraph>::degree_size_type d_in, d_out;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ d_in = in_degree(*vi, graph);
+ d_out = out_degree(*vi, graph);
+
+ if (d_out + 1 < d_in)
+ {
+ return false;
+ }
+ else if (d_out + 1 == d_in)
+ {
+ if (1 < ++in_count)
+ {
+ return false;
+ }
+ }
+
+ if (d_in + 1 < d_out)
+ {
+ return false;
+ }
+ else if (d_in + 1 == d_out)
+ {
+ if (1 < ++out_count)
+ {
+ return false;
+ }
+ }
+ }
+
+ typename vertex_property_map_gen<InputGraph,Count>::type component_map(
+ graph
+ );
+
+ return 1 == weak_components(graph, component_map);
+ }
+
+ template <typename InputGraph>
+ bool has_eulerian_trail_impl(InputGraph const& graph, directed_tag)
+ {
+ typedef typename graph_traits<InputGraph>::degree_size_type Degree;
+
+ typename vertex_property_map_gen<InputGraph,Degree>::type in_deg(
+ graph
+ );
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ put(in_deg, *vi, 0);
+ }
+
+ for (vi = vertices(graph).first; vi != vi_end; ++vi)
+ {
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ typename graph_traits<InputGraph>::vertex_descriptor
+ u = target(*ei, graph);
+
+ put(in_deg, u, 1 + get(in_deg, u));
+ }
+ }
+
+ typedef typename graph_traits<InputGraph>::vertices_size_type Count;
+
+ Count in_count = 0, out_count = 0;
+
+ for (vi = vertices(graph).first; vi != vi_end; ++vi)
+ {
+ Degree d_in = get(in_deg, *vi), d_out = out_degree(*vi, graph);
+
+ if (d_out + 1 < d_in)
+ {
+ return false;
+ }
+ else if (d_out + 1 == d_in)
+ {
+ if (1 < ++in_count)
+ {
+ return false;
+ }
+ }
+
+ if (d_in + 1 < d_out)
+ {
+ return false;
+ }
+ else if (d_in + 1 == d_out)
+ {
+ if (1 < ++out_count)
+ {
+ return false;
+ }
+ }
+ }
+
+ typename vertex_property_map_gen<InputGraph,Count>::type component_map(
+ graph
+ );
+
+ return 1 == weak_components(graph, component_map);
+ }
+}} // namespace boost::detail
+
+//[reference__has_eulerian_trail
+namespace boost {
+
+ template <typename InputGraph>
+ bool has_eulerian_trail(InputGraph const& input_graph);
+
+ //<-
+ template <typename InputGraph>
+ inline bool has_eulerian_trail(InputGraph const& input_graph)
+ {
+ return detail::has_eulerian_trail_impl(
+ input_graph
+ , typename graph_traits<InputGraph>::directed_category()
+ );
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_HAS_EULERIAN_TRAIL_HPP
+
Added: sandbox/graph-path/boost/graph/keywords/input_graph.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/keywords/input_graph.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,17 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/keywords/result.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/keywords/result.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,17 @@
+// Copyright (C) 2012 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_RESULT_HPP
+#define BOOST_GRAPH_KEYWORDS_RESULT_HPP
+
+#include <boost/parameter/name.hpp>
+
+namespace boost { namespace graph { namespace keywords {
+
+ BOOST_PARAMETER_NAME(result)
+}}} // namespace boost::graph::keywords
+
+#endif // BOOST_GRAPH_KEYWORDS_RESULT_HPP
+
Added: sandbox/graph-path/boost/graph/keywords/rng_engine.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/keywords/rng_engine.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/keywords/source_vertex.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/keywords/source_vertex.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/keywords/terminate_predicate.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/keywords/terminate_predicate.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,33 @@
+// Copyright (C) 2004-2012 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-path/boost/graph/loop_erased_rand_w_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/loop_erased_rand_w_tree.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,833 @@
+// Copyright (C) 2004-2012 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_RAND_W_TREE_HPP
+#define BOOST_GRAPH_LOOP_ERASED_RAND_W_TREE_HPP
+
+#include <boost/config.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/parameter/preprocessor.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/parameter.hpp>
+#include <boost/ref.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/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_prm.hpp>
+#include <boost/graph/detail/loop_erased_random_tree.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>
+#include <boost/detail/metafunction/data_type.hpp>
+
+#if !defined BOOST_MSVC
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/graph/detail/metafunction/is_incidence_graph.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_list_graph.hpp>
+#include <boost/graph/detail/metafunction/is_predecessor_map.hpp>
+#include <boost/graph/detail/metafunction/is_edge_property_map.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_property_map.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_descriptor.hpp>
+#include <boost/detail/metafunction/has_event_filter.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/support/is_sequence.hpp>
+#endif
+#endif
+
+#if BOOST_PP_LESS(10, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_ALL_PARAMS
+#elif BOOST_PP_LESS(7, BOOST_PARAMETER_MAX_ARITY)
+#define BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_8_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)
+ typedef typename ::boost::detail::metafunction::data_type<
+ typename ::boost::parameter::binding<
+ arg_pack_type
+ , ::boost::graph::keywords::tag::predecessor_map
+ >::type
+ >::type
+ OutputPredecessorMap;
+
+ 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
+ ];
+ OutputPredecessorMap& out_pred_map = ::boost::unwrap_ref(
+ arg_pack[::boost::graph::keywords::_predecessor_map]
+ );
+
+ if (root == graph_traits<InputGraph>::null_vertex())
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , out_pred_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
+ , out_pred_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
+ , out_pred_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
+ , out_pred_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::metafunction::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 == graph_traits<input_graph_type>::null_vertex())
+ {
+ if (source_vertex == graph_traits<input_graph_type>::null_vertex())
+ {
+ 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 == graph_traits<input_graph_type>::null_vertex()
+ )
+ {
+ 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
+
+#if defined BOOST_MSVC
+ 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
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (weight_map
+ , *
+ , get(edge_weight, 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::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#else // Okay, we can impose type requirements. Awesome.
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (weight_map
+ , *(
+ detail::is_edge_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , get(edge_weight, input_graph)
+ )
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ (optional
+ (distance_compare
+ , *
+ , detail::make_default_compare_predicate(weight_map)
+ )
+ (distance_combine
+ , *
+ , detail::make_default_combine_function(weight_map)
+ )
+ (terminate_predicate
+ , *
+ , detail::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (weight_map
+ , *(
+ detail::is_edge_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , get(edge_weight, input_graph)
+ )
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::mpl::or_<
+ ::boost::fusion::traits::is_sequence<
+ ::boost::mpl::_
+ >
+ , ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ (optional
+ (distance_compare
+ , *
+ , detail::make_default_compare_predicate(weight_map)
+ )
+ (distance_combine
+ , *
+ , detail::make_default_combine_function(weight_map)
+ )
+ (terminate_predicate
+ , *
+ , detail::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#endif // BOOST_MSVC
+ {
+ 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_8_PARAMS
+#if defined BOOST_MSVC
+ 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
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (weight_map
+ , *
+ , get(edge_weight, input_graph)
+ )
+ (in_out(color_map)
+ , *
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *
+ , null_visitor()
+ )
+ )
+ )
+#else // Okay, we can impose type requirements. Awesome.
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (weight_map
+ , *(
+ detail::is_edge_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , get(edge_weight, input_graph)
+ )
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_weighted_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (weight_map
+ , *(
+ detail::is_edge_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , get(edge_weight, input_graph)
+ )
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::mpl::or_<
+ ::boost::fusion::traits::is_sequence<
+ ::boost::mpl::_
+ >
+ , ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#endif // BOOST_MSVC
+ {
+ 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
+ ).weight_map(
+ weight_map
+ ).color_map(
+ color_map
+ ).visitor(
+ visitor
+ )
+ );
+ }
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_WEIGHTED_TREE_TAKES_*_PARAMS
+} // namespace boost
+
+#endif // BOOST_GRAPH_LOOP_ERASED_RAND_W_TREE_HPP
+
Added: sandbox/graph-path/boost/graph/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/loop_erased_random_tree.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,475 @@
+// Copyright (C) 2004-2012 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 <boost/config.hpp>
+#include <boost/preprocessor/comparison/less.hpp>
+#include <boost/parameter/preprocessor.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/parameter.hpp>
+#include <boost/ref.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/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_prm.hpp>
+#include <boost/graph/detail/loop_erased_random_tree.hpp>
+#include <boost/graph/detail/default_terminate_predicate.hpp>
+#include <boost/detail/metafunction/data_type.hpp>
+
+#if !defined BOOST_MSVC
+#include <boost/mpl/placeholders.hpp>
+#include <boost/mpl/not.hpp>
+#include <boost/mpl/and.hpp>
+#include <boost/mpl/or.hpp>
+#include <boost/graph/detail/metafunction/is_incidence_graph.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_list_graph.hpp>
+#include <boost/graph/detail/metafunction/is_predecessor_map.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_property_map.hpp>
+#include <boost/graph/detail/metafunction/is_vertex_descriptor.hpp>
+#include <boost/detail/metafunction/has_event_filter.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/support/is_sequence.hpp>
+#endif
+#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)
+ typedef typename ::boost::detail::metafunction::data_type<
+ typename ::boost::parameter::binding<
+ arg_pack_type
+ , ::boost::graph::keywords::tag::predecessor_map
+ >::type
+ >::type
+ OutputPredecessorMap;
+
+ 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
+ ];
+ OutputPredecessorMap& out_pred_map = ::boost::unwrap_ref(
+ arg_pack[::boost::graph::keywords::_predecessor_map]
+ );
+
+ if (root == graph_traits<InputGraph>::null_vertex())
+ {
+ if (src == graph_traits<InputGraph>::null_vertex())
+ {
+ return loop_erased_random_tree_impl(
+ input_graph
+ , out_pred_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
+ , out_pred_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
+ , out_pred_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
+ , out_pred_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
+//]
+
+#if BOOST_PP_LESS(7, BOOST_PARAMETER_MAX_ARITY)
+namespace boost {
+
+#if defined BOOST_MSVC
+ 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
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (in_out(color_map)
+ , *
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *
+ , null_visitor()
+ )
+ (terminate_predicate
+ , *
+ , detail::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#else // Okay, we can impose type requirements. Awesome.
+#if defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ (optional
+ (terminate_predicate
+ , *
+ , detail::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#else // !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ BOOST_PARAMETER_FUNCTION(
+ (bool)
+ , loop_erased_random_tree
+ , ::boost::graph::keywords::tag
+ , (required
+ (input_graph
+ , *(
+ ::boost::mpl::and_<
+ detail::is_incidence_graph< ::boost::mpl::_>
+ , detail::is_vertex_list_graph< ::boost::mpl::_>
+ >
+ )
+ )
+ (in_out(rng_engine)
+ , *
+ )
+ (out(predecessor_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ )
+ )
+ )
+ (optional
+ (root_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ (source_vertex
+ , *(
+ detail::is_vertex_descriptor<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ )
+ , graph_traits<input_graph_type>::null_vertex()
+ )
+ )
+ (deduced // Doesn't work yet.
+ (optional
+ (in_out(color_map)
+ , *(
+ ::boost::mpl::and_<
+ detail::is_vertex_property_map<
+ ::boost::mpl::_
+ , ::boost::graph::keywords::tag::input_graph::_
+ >
+ , ::boost::mpl::not_<
+ detail::is_predecessor_map< ::boost::mpl::_>
+ >
+ >
+ )
+ , make_vertex_property_map(input_graph, white_color)
+ )
+ (visitor
+ , *(
+ ::boost::mpl::or_<
+ ::boost::fusion::traits::is_sequence<
+ ::boost::mpl::_
+ >
+ , ::boost::detail::metafunction::has_event_filter<
+ ::boost::mpl::_
+ >
+ >
+ )
+ , null_visitor()
+ )
+ )
+ )
+ (optional
+ (terminate_predicate
+ , *
+ , detail::default_terminate_predicate<input_graph_type>()
+ )
+ )
+ )
+#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#endif // BOOST_MSVC
+ {
+ if (root_vertex == graph_traits<input_graph_type>::null_vertex())
+ {
+ if (source_vertex == graph_traits<input_graph_type>::null_vertex())
+ {
+ 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 == graph_traits<input_graph_type>::null_vertex()
+ )
+ {
+ 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_()
+ );
+ }
+ }
+} // namespace boost
+#endif // 7 < BOOST_PARAMETER_MAX_ARITY
+
+#endif // BOOST_GRAPH_LOOP_ERASED_RANDOM_TREE_HPP
+
Added: sandbox/graph-path/boost/graph/simple_edge_writer.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/simple_edge_writer.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,215 @@
+// Copyright (C) 2011-2012 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/config.hpp>
+#include <boost/tuple/tuple_io.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/support/pair.hpp>
+#endif
+
+//[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
+//]
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+//[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_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#endif // BOOST_GRAPH_SIMPLE_EDGE_WRITER_HPP
+
Added: sandbox/graph-path/boost/graph/vertex_property_map_gen.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/vertex_property_map_gen.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,211 @@
+// Copyright (C) 2011-2012 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/tuple.hpp>
+#include <boost/tr1/type_traits.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/utility/value_init.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)
+ {
+ _initialize(g, ::std::tr1::is_same<key_type,value_type>());
+ }
+
+ 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];
+ }
+
+ private:
+ void _initialize(Graph const& g, ::std::tr1::true_type)
+ {
+ typename graph_traits<Graph>::vertex_iterator vi, vi_end;
+
+ for (
+ ::std::tr1::tie(vi, vi_end) = vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ put(_map, *vi, *vi);
+ }
+ }
+
+ void _initialize(Graph const& g, ::std::tr1::false_type)
+ {
+ typename graph_traits<Graph>::vertex_iterator vi, vi_end;
+
+ for (
+ ::std::tr1::tie(vi, vi_end) = vertices(g);
+ vi != vi_end;
+ ++vi
+ )
+ {
+ put(_map, *vi, value_type());
+ }
+ }
+ };
+ //->
+
+ 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-path/boost/graph/weak_components.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/boost/graph/weak_components.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,85 @@
+// Copyright (C) 2012 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_WEAK_COMPONENTS_HPP
+#define BOOST_GRAPH_WEAK_COMPONENTS_HPP
+
+#include <boost/property_map/property_map.hpp>
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/connected_components.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+
+//[reference__weak_components
+namespace boost {
+
+ template <typename InputGraph, typename ComponentMap>
+ typename ::boost::property_traits<ComponentMap>::value_type
+ weak_components(InputGraph const& graph, ComponentMap component_map);
+
+ //<-
+ template <typename InputGraph, typename ComponentMap>
+ typename ::boost::property_traits<ComponentMap>::value_type
+ weak_components(InputGraph const& graph, ComponentMap component_map)
+ {
+ if (num_vertices(graph) == 0)
+ {
+ return 0;
+ }
+
+ typedef adjacency_list<setS,vecS,undirectedS> UGraph;
+
+ UGraph u_graph;
+ typename vertex_property_map_gen<
+ InputGraph
+ , UGraph::vertex_descriptor
+ >::type graph2u(graph);
+ typename graph_traits<InputGraph>::vertex_iterator vi, vi_end;
+
+ for (::std::tr1::tie(vi, vi_end) = vertices(graph); vi != vi_end; ++vi)
+ {
+ put(graph2u, *vi, add_vertex(u_graph));
+ }
+
+ for (vi = vertices(graph).first; vi != vi_end; ++vi)
+ {
+ typename graph_traits<InputGraph>::out_edge_iterator ei, ei_end;
+
+ for (
+ ::std::tr1::tie(ei, ei_end) = out_edges(*vi, graph);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ add_edge(
+ get(graph2u, source(*ei, graph))
+ , get(graph2u, target(*ei, graph))
+ , u_graph
+ );
+ }
+ }
+
+ typedef typename ::boost::property_traits<ComponentMap>::value_type
+ Result;
+
+ typename vertex_property_map_gen<UGraph,Result>::type u_comp_map(
+ u_graph
+ );
+ Result result = connected_components(u_graph, u_comp_map);
+
+ for (vi = vertices(graph).first; vi != vi_end; ++vi)
+ {
+ put(component_map, *vi, get(u_comp_map, get(graph2u, *vi)));
+ }
+
+ return result;
+ }
+ //->
+} // namespace boost
+//]
+
+#endif // BOOST_GRAPH_WEAK_COMPONENTS_HPP
+
Added: sandbox/graph-path/libs/graph/doc/call_visitors.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/call_visitors.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,188 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>call_visitors</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" 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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="call_visitors"></a>call_visitors</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="call_visitors.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+<dt><span class="section">Type Requirements</span></dt>
+<dt><span class="section">Parameters</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="call_visitors.synopsis"></a><a class="link" href="call_visitors.html#call_visitors.synopsis" title="Synopsis">Synopsis</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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">></span>
+<span class="keyword">void</span>
+ <span class="identifier">call_visitors</span><span class="special">(</span>
+ <span class="identifier">VisitorList</span><span class="special">&</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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">);</span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="call_visitors.description"></a><a class="link" href="call_visitors.html#call_visitors.description" title="Description">Description</a>
+</h2></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 find_eulerian_trail()
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><h2 class="title" style="clear: both">
+<a name="call_visitors.definition"></a><a class="link" href="call_visitors.html#call_visitors.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/call_visitors.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="call_visitors.type_requirements"></a><a class="link" href="call_visitors.html#call_visitors.type_requirements" title="Type Requirements">Type Requirements</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="call_visitors.parameters"></a><a class="link" href="call_visitors.html#call_visitors.parameters" title="Parameters">Parameters</a>
+</h2></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"><p><small>Last revised: September 09, 2012 at 18:12:07 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/find_eulerian_cycle.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/find_eulerian_cycle.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,550 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>find_eulerian_cycle</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="find_eulerian_cycle.html" title="find_eulerian_cycle">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="find_eulerian_cycle"></a>find_eulerian_cycle</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="find_eulerian_cycle.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Prototypes</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where Defined</span></dt>
+<dt><span class="section">Type Requirements</span></dt>
+<dt><span class="section">Parameters</span></dt>
+<dt><span class="section">Complexity</span></dt>
+<dt><span class="section">Example</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.prototypes"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.prototypes" title="Prototypes">Prototypes</a>
+</h2></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"><</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputIterator</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">P</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">R</span>
+ <span class="special">></span>
+ <span class="keyword">bool</span>
+ <span class="identifier">find_eulerian_cycle</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">OutputIterator</span> <span class="identifier">result</span>
+ <span class="special">,</span> <span class="identifier">bgl_named_params</span><span class="special"><</span><span class="identifier">P</span><span class="special">,</span><span class="identifier">T</span><span class="special">,</span><span class="identifier">R</span><span class="special">></span> <span class="keyword">const</span><span class="special">&</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 following function prototype is defined 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 4.
+ </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"><</span>
+ <span class="keyword">typename</span> <span class="identifier">InputGraph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Result</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Visitor</span>
+ <span class="special">></span>
+ <span class="keyword">bool</span>
+ <span class="identifier">find_eulerian_cycle</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">Result</span> <span class="identifier">result</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="identifier">Visitor</span> <span class="identifier">visitor</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><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.description"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.description" title="Description">Description</a>
+</h2></div></div></div>
+<p>
+ The algorithm first examines a trail of edges from <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ and adds each edge to the tour until it returns to <code class="computeroutput"><span class="identifier">root_vertex</span></code>
+ and has visited all out-edges from it. As long as there exists a vertex <code class="computeroutput"><span class="identifier">v</span></code> that belongs to the current tour but has
+ unexamined out-edges, the algorithm will examine another trail from <code class="computeroutput"><span class="identifier">v</span></code> until it cycles back to <code class="computeroutput"><span class="identifier">v</span></code>,
+ joining the tour formed in this way to the previous tour. The outline is described
+ in "Ueber die Moglichkeit, einen Linienzug ohne Wiederholung und ohne
+ Unterbrechung zu umfahren" by <a href="http://en.wikipedia.org/wiki/Carl_Hierholzer" target="_top">Carl
+ Hierholzer</a> (1873).
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.definition"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.definition" title="Where Defined">Where Defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/find_eulerian_cycle.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.type_requirements"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.type_requirements" title="Type Requirements">Type Requirements</a>
+</h2></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="keyword">and</span> Vertex List Graph
+ <span class="identifier">concepts</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">Result</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Output Iterator <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">belong</span> <span class="identifier">to</span> <span class="identifier">the</span> <span class="identifier">set</span> <span class="identifier">of</span>
+ <span class="identifier">value</span> <span class="identifier">types</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">Result</span><span class="error">`</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="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="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="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="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>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.parameters"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.parameters" title="Parameters">Parameters</a>
+</h2></div></div></div>
+<div class="informaltable"><table class="table">
+<colgroup>
+<col>
+<col>
+<col>
+<col>
+<col>
+</colgroup>
+<thead><tr>
+<th>
+ <p>
+ Parameter
+ </p>
+ </th>
+<th>
+ <p>
+ Description
+ </p>
+ </th>
+<th>
+ <p>
+ Deduced?
+ </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>
+ No
+ </p>
+ </td>
+<td>
+ <p>
+ <code class="literal">has_eulerian_cycle(input_graph)</code>
+ must return <code class="computeroutput"><span class="keyword">true</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">result</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ An Output Iterator into which every edge
+ in the graph will be stored exactly once and in tour order.
+ </p>
+ </td>
+<td>
+ <p>
+ No
+ </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 start of the cycle.
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </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">*vertices(input_graph).first</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. The algorithm will fire
+ the <code class="computeroutput"><span class="identifier">on_initialize_vertex</span></code>
+ event on each vertex before it begins its actual work; it will fire
+ the <code class="computeroutput"><span class="identifier">on_start_vertex</span></code>
+ event on each vertex from which it starts a tour; it will fire the
+ <code class="computeroutput"><span class="identifier">on_finish_vertex</span></code>
+ event on each vertex at which it ends a tour; and it will fire the
+ <code class="computeroutput"><span class="identifier">on_examine_edge</span></code> event
+ on each edge that it adds to the current tour.
+ </p>
+ </td>
+<td>
+ <p>
+ Yes
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">null_visitor</span><span class="special">()</span></code>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+<p>
+ Parameters that can be <span class="bold"><strong>deduced</strong></span> do not have
+ to be explicitly named as long as the arguments to which they are bound fulfill
+ the corresponding type requirements. However, if any of the non-deduced parameters
+ are explicitly named out of their formal positions, then all succeeding parameters
+ must be either explicitly named or in their formal positions.
+ </p>
+<div class="caution"><table border="0" summary="Caution">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="http://www.boost.org/doc/libs/release/doc/src/images/caution.png"></td>
+<th align="left">Caution</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ As of version 10.0, Microsoft Visual C++ ships with its own implementation
+ of TR1, which does not play nice with Boost.Parameter.
+ Therefore, parameter deduction has been disabled for users of this compiler.
+ </p></td></tr>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.complexity"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.complexity" title="Complexity">Complexity</a>
+</h2></div></div></div>
+<p>
+ The time complexity is <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">+</span> <span class="identifier">E</span>
+ <span class="identifier">log</span> <span class="identifier">E</span><span class="special">)</span></code> for undirected graphs and <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">+</span>
+ <span class="identifier">E</span><span class="special">)</span></code>
+ for directed graphs. The reason for the difference is that for undirected graphs,
+ the algorithm uses a std::multiset
+ to group opposite out-edges together.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_cycle.example"></a><a class="link" href="find_eulerian_cycle.html#find_eulerian_cycle.example" title="Example">Example</a>
+</h2></div></div></div>
+<p>
+ The following routine displays the output of an Eulerian cycle by passing an
+ <a href="http://www.boost.org/libs/graph/doc/EventVisitorList.html" target="_top"><span class="bold"><strong>Event
+ Visitor List</strong></span></a> to the algorithm. The <code class="computeroutput"><span class="identifier">visitor</span></code>
+ parameter has been deduced in this case. However, code that assembles an <a href="http://www.boost.org/libs/graph/doc/EventVisitorList.html" target="_top"><span class="bold"><strong>Event
+ Visitor List</strong></span></a> object composed of many event visitors can
+ become tedious to write or maintain.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">find_eulerian_cycle_example_with_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">vertex_count</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">property_map</span><span class="special"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</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"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">edge_descriptor</span><span class="special">></span>
+ <span class="identifier">EdgeList</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">vertex_count</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">i_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">initialize_complete_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"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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="identifier">boost</span><span class="special">::</span><span class="identifier">has_eulerian_cycle</span><span class="special">(</span><span class="identifier">g</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">EdgeList</span> <span class="identifier">path</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">find_eulerian_cycle</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">back_inserter</span><span class="special">(</span><span class="identifier">path</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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">i_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="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"><<</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="keyword">typename</span> <span class="identifier">EdgeList</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">itr</span> <span class="special">=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">itr</span> <span class="special">!=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">++</span><span class="identifier">itr</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"><<</span> <span class="char">'\t'</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">source</span><span class="special">(*</span><span class="identifier">itr</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"><<</span> <span class="string">" --> "</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">target</span><span class="special">(*</span><span class="identifier">itr</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"><<</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="keyword">else</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">"...has no Eulerian cycle."</span> <span class="special"><<</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>
+</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 fuse_property_writer()
and fuse_simple_edge_writer()
+ functions provide added convenience.)
+ </p>
+<p>
+ The following routine displays the same output by passing a Fusion Forward Sequence to the algorithm by
+ named parameter.
+ The algorithm 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 <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"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></span>
+<span class="keyword">void</span>
+ <span class="identifier">find_eulerian_cycle_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">vertex_count</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">property_map</span><span class="special"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</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"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">edge_descriptor</span><span class="special">></span>
+ <span class="identifier">EdgeList</span><span class="special">;</span>
+
+ <span class="identifier">Graph</span> <span class="identifier">g</span><span class="special">(</span><span class="identifier">vertex_count</span><span class="special">);</span>
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">i_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">initialize_complete_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"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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="identifier">boost</span><span class="special">::</span><span class="identifier">has_eulerian_cycle</span><span class="special">(</span><span class="identifier">g</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">EdgeList</span> <span class="identifier">path</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">find_eulerian_cycle</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">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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">>(</span>
+ <span class="identifier">i_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="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">_result</span> <span class="special">=</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">back_inserter</span><span class="special">(</span><span class="identifier">path</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"><<</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="keyword">typename</span> <span class="identifier">EdgeList</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">itr</span> <span class="special">=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">itr</span> <span class="special">!=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">++</span><span class="identifier">itr</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"><<</span> <span class="char">'\t'</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">source</span><span class="special">(*</span><span class="identifier">itr</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"><<</span> <span class="string">" --> "</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">target</span><span class="special">(*</span><span class="identifier">itr</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"><<</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="keyword">else</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">"...has no Eulerian cycle."</span> <span class="special"><<</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>
+</pre>
+<p>
+ </p>
+<p>
+ The complete example program can be compiled from these files:
+ </p>
+<pre class="programlisting"><span class="special">*</span> example/find_eulerian_cycle.hpp
+<span class="special">*</span> example/find_eulerian_cycle.cpp
+</pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: September 09, 2012 at 18:01:42 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/find_eulerian_trail.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/find_eulerian_trail.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,451 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>find_eulerian_trail</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="find_eulerian_trail.html" title="find_eulerian_trail">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="find_eulerian_trail"></a>find_eulerian_trail</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="find_eulerian_trail.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Prototypes</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where Defined</span></dt>
+<dt><span class="section">Type Requirements</span></dt>
+<dt><span class="section">Parameters</span></dt>
+<dt><span class="section">Complexity</span></dt>
+<dt><span class="section">Example</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.prototypes"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.prototypes" title="Prototypes">Prototypes</a>
+</h2></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"><</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Visitor</span><span class="special">></span>
+ <span class="keyword">bool</span>
+ <span class="identifier">find_eulerian_trail</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">OutputIterator</span> <span class="identifier">result</span>
+ <span class="special">,</span> <span class="identifier">Visitor</span> <span class="identifier">visitor</span>
+ <span class="special">);</span>
+
+
+ <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">OutputIterator</span><span class="special">></span>
+ <span class="keyword">bool</span>
+ <span class="identifier">find_eulerian_trail</span><span class="special">(</span>
+ <span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">OutputIterator</span> <span class="identifier">result</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><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.description"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.description" title="Description">Description</a>
+</h2></div></div></div>
+<p>
+ For undirected graphs without an Eulerian cycle, the algorithm finds the first
+ vertex with an odd out-degree and examines a trail of edges from this vertex,
+ adding each edge to the tour until it finds the other vertex with an odd out-degree
+ and has visited all out-edges from it. For directed graphs without an Eulerian
+ cycle, the algorithm first finds the vertex whose out-degree is one greater
+ than its in-degree and examines a trail of edges from this vertex, adding each
+ edge to the tour until it finds the vertex whose in-degree is one greater than
+ its out-degree. Thereafter, as long as there exists a vertex <code class="computeroutput"><span class="identifier">v</span></code> that belongs to the current tour but has
+ unexamined out-edges, the algorithm will examine another trail from <code class="computeroutput"><span class="identifier">v</span></code> until it cycles back to <code class="computeroutput"><span class="identifier">v</span></code>,
+ joining the tour formed in this way to the previous tour.
+ </p>
+<p>
+ If the input graph contains an Eulerian cycle, then the algorithm is equivalent
+ to <code class="literal">find_eulerian_cycle(input_graph,
+ result, *vertices(input_graph).first,
+ visitor)</code>.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.definition"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.definition" title="Where Defined">Where Defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/find_eulerian_trail.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.type_requirements"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.type_requirements" title="Type Requirements">Type Requirements</a>
+</h2></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="keyword">and</span> Vertex List Graph
+ <span class="identifier">concepts</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">Result</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">model</span> <span class="identifier">the</span> Output Iterator <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">belong</span> <span class="identifier">to</span> <span class="identifier">the</span> <span class="identifier">set</span> <span class="identifier">of</span>
+ <span class="identifier">value</span> <span class="identifier">types</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">Result</span><span class="error">`</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="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="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="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="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>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.parameters"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.parameters" title="Parameters">Parameters</a>
+</h2></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>
+ <code class="literal">has_eulerian_trail(input_graph)</code>
+ must return <code class="computeroutput"><span class="keyword">true</span></code>.
+ </p>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">result</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ An Output Iterator into which every edge
+ in the graph will be stored exactly once and in tour order.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ None; always required.
+ </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. The algorithm will fire
+ the <code class="computeroutput"><span class="identifier">on_initialize_vertex</span></code>
+ event on each vertex before it begins its actual work; it will fire
+ the <code class="computeroutput"><span class="identifier">on_start_vertex</span></code>
+ event on each vertex from which it starts a trail; it will fire the
+ <code class="computeroutput"><span class="identifier">on_finish_vertex</span></code>
+ event on each vertex at which it ends a trail; and it will fire the
+ <code class="computeroutput"><span class="identifier">on_examine_edge</span></code> event
+ on each edge that it adds to the current trail.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">null_visitor</span><span class="special">()</span></code>
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.complexity"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.complexity" title="Complexity">Complexity</a>
+</h2></div></div></div>
+<p>
+ The time complexity is <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">+</span> <span class="identifier">E</span>
+ <span class="identifier">log</span> <span class="identifier">E</span><span class="special">)</span></code> for undirected graphs, <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">+</span>
+ <span class="identifier">E</span><span class="special">)</span></code>
+ for bidirectional graphs, and <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">*</span>
+ <span class="identifier">E</span><span class="special">)</span></code>
+ for directed graphs. The reason for the difference is that for undirected graphs,
+ the algorithm uses a std::multiset
+ to group opposite out-edges together, while for non-bidirectional directed
+ graphs, the algorithm must perform its own tally of in-edges in order to find
+ the correct starting vertex.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="find_eulerian_trail.example"></a><a class="link" href="find_eulerian_trail.html#find_eulerian_trail.example" title="Example">Example</a>
+</h2></div></div></div>
+<p>
+ The following routine displays the output of an Eulerian trail by passing an
+ <a href="http://www.boost.org/libs/graph/doc/EventVisitorList.html" target="_top"><span class="bold"><strong>Event
+ Visitor List</strong></span></a> to the algorithm. However, code that assembles
+ an <a href="http://www.boost.org/libs/graph/doc/EventVisitorList.html" target="_top"><span class="bold"><strong>Event
+ Visitor List</strong></span></a> object composed of many event visitors can
+ become tedious to write or maintain.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">find_eulerian_trail_example_with_visitor_list</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">g</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">property_map</span><span class="special"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</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"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">edge_descriptor</span><span class="special">></span>
+ <span class="identifier">EdgeList</span><span class="special">;</span>
+
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">i_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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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="identifier">boost</span><span class="special">::</span><span class="identifier">has_eulerian_trail</span><span class="special">(</span><span class="identifier">g</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">EdgeList</span> <span class="identifier">path</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">find_eulerian_trail</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">back_inserter</span><span class="special">(</span><span class="identifier">path</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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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">boost</span><span class="special">::</span><span class="identifier">make_simple_edge_writer</span><span class="special">(</span>
+ <span class="identifier">i_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="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"><<</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="keyword">typename</span> <span class="identifier">EdgeList</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">itr</span> <span class="special">=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">itr</span> <span class="special">!=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">++</span><span class="identifier">itr</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"><<</span> <span class="char">'\t'</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">source</span><span class="special">(*</span><span class="identifier">itr</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"><<</span> <span class="string">" --> "</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">target</span><span class="special">(*</span><span class="identifier">itr</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"><<</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="keyword">else</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">"...has no Eulerian trail."</span> <span class="special"><<</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>
+</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 fuse_property_writer()
and fuse_simple_edge_writer()
+ functions provide added convenience.) The following routine displays the same
+ output by passing a Fusion Forward Sequence to the algorithm.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></span>
+<span class="keyword">void</span> <span class="identifier">find_eulerian_trail_example_with_fusion_visitor_list</span><span class="special">(</span><span class="identifier">Graph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">g</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">property_map</span><span class="special"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</span><span class="identifier">value_type</span>
+ <span class="identifier">VertexIndex</span><span class="special">;</span>
+ <span class="keyword">typedef</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">list</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"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">edge_descriptor</span><span class="special">></span>
+ <span class="identifier">EdgeList</span><span class="special">;</span>
+
+ <span class="identifier">VertexIndexMap</span> <span class="identifier">i_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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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="identifier">boost</span><span class="special">::</span><span class="identifier">has_eulerian_trail</span><span class="special">(</span><span class="identifier">g</span><span class="special">))</span>
+ <span class="special">{</span>
+ <span class="identifier">EdgeList</span> <span class="identifier">path</span><span class="special">;</span>
+
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">find_eulerian_trail</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">back_inserter</span><span class="special">(</span><span class="identifier">path</span><span class="special">)</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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</span><span class="special">>(</span>
+ <span class="identifier">i_map</span>
+ <span class="special">,</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</span><span class="special">>(</span>
+ <span class="identifier">i_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="special">);</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</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="keyword">typename</span> <span class="identifier">EdgeList</span><span class="special">::</span><span class="identifier">const_iterator</span> <span class="identifier">itr</span> <span class="special">=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">begin</span><span class="special">();</span>
+ <span class="identifier">itr</span> <span class="special">!=</span> <span class="identifier">path</span><span class="special">.</span><span class="identifier">end</span><span class="special">();</span>
+ <span class="special">++</span><span class="identifier">itr</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"><<</span> <span class="char">'\t'</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">source</span><span class="special">(*</span><span class="identifier">itr</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"><<</span> <span class="string">" --> "</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">i_map</span><span class="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">target</span><span class="special">(*</span><span class="identifier">itr</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"><<</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="keyword">else</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">"...has no Eulerian trail."</span> <span class="special"><<</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>
+</pre>
+<p>
+ </p>
+<p>
+ The complete example program can be compiled from these files:
+ </p>
+<pre class="programlisting"><span class="special">*</span> example/find_eulerian_trail.hpp
+<span class="special">*</span> example/find_eulerian_trail.cpp
+</pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: September 09, 2012 at 18:03:37 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/fuse_property_writer.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/fuse_property_writer.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,86 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>fuse_property_writer</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" 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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="fuse_property_writer"></a>fuse_property_writer</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="fuse_property_writer.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="fuse_property_writer.synopsis"></a><a class="link" href="fuse_property_writer.html#fuse_property_writer.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</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">></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"><</span>
+ <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="identifier">property_writer</span><span class="special"><</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">></span>
+ <span class="special">></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><h2 class="title" style="clear: both">
+<a name="fuse_property_writer.description"></a><a class="link" href="fuse_property_writer.html#fuse_property_writer.description" title="Description">Description</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="fuse_property_writer.definition"></a><a class="link" href="fuse_property_writer.html#fuse_property_writer.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/fuse_property_writer.hpp<span class="special">></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"><p><small>Last revised: September 09, 2012 at 18:14:21 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/has_eulerian_cycle.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/has_eulerian_cycle.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,83 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>has_eulerian_cycle</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="has_eulerian_cycle.html" title="has_eulerian_cycle">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="has_eulerian_cycle"></a>has_eulerian_cycle</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="has_eulerian_cycle.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="has_eulerian_cycle.synopsis"></a><a class="link" href="has_eulerian_cycle.html#has_eulerian_cycle.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">></span>
+ <span class="keyword">bool</span> <span class="identifier">has_eulerian_cycle</span><span class="special">(</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</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><h2 class="title" style="clear: both">
+<a name="has_eulerian_cycle.description"></a><a class="link" href="has_eulerian_cycle.html#has_eulerian_cycle.description" title="Description">Description</a>
+</h2></div></div></div>
+<p>
+ For an undirected graph, returns <code class="computeroutput"><span class="keyword">true</span></code>
+ if every vertex has an even out-degree and if all of its vertices belong to
+ a single connected component; for a directed graph, returns <code class="computeroutput"><span class="keyword">true</span></code>
+ if the in-degree of every vertex is equal to its out-degree and if all of its
+ vertices belong to a single strongly connected component; returns <code class="computeroutput"><span class="keyword">false</span></code> otherwise.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="has_eulerian_cycle.definition"></a><a class="link" href="has_eulerian_cycle.html#has_eulerian_cycle.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/has_eulerian_cycle.hpp<span class="special">></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"><p><small>Last revised: September 09, 2012 at 18:07:14 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/has_eulerian_trail.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/has_eulerian_trail.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,85 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>has_eulerian_trail</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="has_eulerian_trail.html" title="has_eulerian_trail">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="has_eulerian_trail"></a>has_eulerian_trail</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="has_eulerian_trail.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="has_eulerian_trail.synopsis"></a><a class="link" href="has_eulerian_trail.html#has_eulerian_trail.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">></span>
+ <span class="keyword">bool</span> <span class="identifier">has_eulerian_trail</span><span class="special">(</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">input_graph</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><h2 class="title" style="clear: both">
+<a name="has_eulerian_trail.description"></a><a class="link" href="has_eulerian_trail.html#has_eulerian_trail.description" title="Description">Description</a>
+</h2></div></div></div>
+<p>
+ For an undirected graph, returns <code class="computeroutput"><span class="keyword">true</span></code>
+ if either zero or two vertices have odd out-degrees and if all of its vertices
+ belong to a single connected component; for a directed graph, returns <code class="computeroutput"><span class="keyword">true</span></code> if the out-degree of exactly one vertex
+ is one more than its in-degree, the in-degree of exactly one other vertex is
+ one more than its out-degree, and all of its vertices belong to a weakly connected
+ component, or if the in-degree of every vertex is equal to its out-degree and
+ all of its vertices belong to a strongly connected component; returns <code class="computeroutput"><span class="keyword">false</span></code> otherwise.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="has_eulerian_trail.definition"></a><a class="link" href="has_eulerian_trail.html#has_eulerian_trail.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/has_eulerian_trail.hpp<span class="special">></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"><p><small>Last revised: September 09, 2012 at 18:10:33 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/loop_erased_random_tree.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/loop_erased_random_tree.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,2071 @@
+<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="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="loop_erased_random_tree.html" title="loop_erased_random_tree and loop_erased_random_weighted_tree">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree"></a>loop_erased_random_tree and loop_erased_random_weighted_tree</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Prototypes</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section"><a href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.definition">Where
+ Defined</a></span></dt>
+<dt><span class="section"><a href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.type_requirements">Type
+ Requirements</a></span></dt>
+<dt><span class="section">Parameters</span></dt>
+<dt><span class="section">loop_erased_random_tree
Example</span></dt>
+<dt><span class="section">loop_erased_random_weighted_tree
Example</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.prototypes"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.prototypes" title="Prototypes">Prototypes</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section">loop_erased_random_tree
</span></dt>
+<dt><span class="section">loop_erased_random_weighted_tree
</span></dt>
+</dl></div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.prototypes.loop_erased_random_tree"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.prototypes.loop_erased_random_tree" title="loop_erased_random_tree"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code></a>
+</h3></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"><</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">></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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">Params</span> <span class="keyword">const</span><span class="special">&</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 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 8.
+ </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"><</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">></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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span><span class="special">&</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">source_vertex</span>
+ <span class="special">,</span> <span class="identifier">VertexColorMap</span><span class="special">&</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>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h3 class="title">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.prototypes.loop_erased_random_weighted_tree"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_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>
+</h3></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"><</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">></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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">Params</span> <span class="keyword">const</span><span class="special">&</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"><</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">></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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span><span class="special">&</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</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="special">&</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_8_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 8.
+ </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"><</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">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">&</span> <span class="identifier">input_graph</span>
+ <span class="special">,</span> <span class="identifier">RNGEngine</span><span class="special">&</span> <span class="identifier">rng_engine</span>
+ <span class="special">,</span> <span class="identifier">PredecessorMap</span><span class="special">&</span> <span class="identifier">predecessor_map</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span> <span class="identifier">root_vertex</span>
+ <span class="special">,</span> <span class="keyword">typename</span> graph_traits<span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</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="special">&</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="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><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.description"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description" title="Description">Description</a>
+</h2></div></div></div>
+<div class="toc"><dl>
+<dt><span class="section"><a href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree_with_root"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code>
+ Outline</a></span></dt>
+<dt><span class="section"><a href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code>
+ Outline</a></span></dt>
+</dl></div>
+<p>
+ These functions implement both the RandomTree()
+ and RandomTreeWithRoot()
+ 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><span class="special">()</span></code> function assumes the input graph to be unweighted,
+ while the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">()</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 RandomTreeWithRoot()
+ 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
+ RandomTreeWithRoot()
+ 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 RandomTreeWithRoot()
+ 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><h3 class="title">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree_with_root"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree_with_root" title="RandomTreeWithRoot() Outline"><code class="computeroutput"><span class="identifier">RandomTreeWithRoot</span><span class="special">()</span></code>
+ Outline</a>
+</h3></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><h3 class="title">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree" title="RandomTree() Outline"><code class="computeroutput"><span class="identifier">RandomTree</span><span class="special">()</span></code>
+ Outline</a>
+</h3></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"><</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">></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><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.definition"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.definition" title="Where Defined">Where
+ Defined</a>
+</h2></div></div></div>
+<p>
+ The <code class="literal"><boost/graph/loop_erased_random_tree.hpp></code>
+ header file defines the <code class="computeroutput"><span class="identifier">loop_erased_random_tree</span><span class="special">()</span></code> function, while the <code class="literal"><boost/graph/loop_erased_rand_w_tree.hpp></code>
+ header file defines the <code class="computeroutput"><span class="identifier">loop_erased_random_weighted_tree</span><span class="special">()</span></code> function.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.type_requirements"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.type_requirements" title="Type Requirements">Type
+ Requirements</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.parameters"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.parameters" title="Parameters">Parameters</a>
+</h2></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 function 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 RandomTree()
+ and RandomTreeWithRoot()
+ 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<InputGraph>::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<InputGraph>::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">make_vertex_property_map(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 RandomTree()
+ and RandomTreeWithRoot()
+ 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><span class="special">()</span></code> function, for efficient searching
+ through successor edges.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="literal">std::less<property_traits<EdgeWeightMap>::value_type>()</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><span class="special">()</span></code> function.
+ </p>
+ </td>
+<td>
+ </td>
+<td>
+ <p>
+ <code class="literal">std::plus<property_traits<EdgeWeightMap>::value_type>()</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><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.tree_example"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.tree_example" title="loop_erased_random_tree Example"><code class="computeroutput"><span class="identifier">loop_erased_random_tree</span></code> Example</a>
+</h2></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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Successors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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="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"><<</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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Target = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Successors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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="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"><<</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><span class="special">()</span></code> 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 <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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Source = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Predecessors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" <-- "</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="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"><<</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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Start = "</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">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"><<</span> <span class="string">", End = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="string">"Path: "</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">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"><<</span> <span class="string">" -> "</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">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"><<</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.
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</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"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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="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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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="special">)</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">" Done!"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Tree edges:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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="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"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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 fuse_property_writer()
and fuse_simple_edge_writer()
+ functions provide added convenience.)
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Target = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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="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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</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="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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</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="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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</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="special">)</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"><<</span> <span class="string">" Done!"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Tree edges:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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="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"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="loop_erased_random_tree_and_loop_erased_random_weighted_tree.weighted_tree_example"></a><a class="link" href="loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_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>
+</h2></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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Successors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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"><<</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"><<</span> <span class="string">" ("</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">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"><<</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"><<</span> <span class="char">')'</span> <span class="special"><<</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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Target = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Successors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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"><<</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"><<</span> <span class="string">" ("</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">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"><<</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"><<</span> <span class="char">')'</span> <span class="special"><<</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><span class="special">()</span></code> 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 <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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Source = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Predecessors:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" <-- "</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"><<</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"><<</span> <span class="string">" ("</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">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"><<</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"><<</span> <span class="char">')'</span> <span class="special"><<</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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Start = "</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">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"><<</span> <span class="string">", End = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="string">"Path: "</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">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"><<</span> <span class="string">" -> "</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">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"><<</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"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><<</span> <span class="string">"Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><<</span> <span class="string">" Done!"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Tree edges:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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"><<</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"><<</span> <span class="string">" ("</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">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"><<</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"><<</span> <span class="char">')'</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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 fuse_property_writer()
and fuse_simple_edge_writer()
+ functions provide added convenience.)
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</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">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Vertex</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">VertexIndexMap</span><span class="special">>::</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"><</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">>::</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"><</span><span class="identifier">RNGEngine</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"><></span> <span class="special">></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"><>(</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"><</span><span class="identifier">Graph</span><span class="special">>::</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Target = "</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">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"><<</span> <span class="string">", Graph:"</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</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="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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</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="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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</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="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"><</span>
+ <span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_initialize_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_start_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_discover_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_property_writer</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="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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_finish_vertex</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"><</span>
+ <span class="identifier">VertexIndex</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">" 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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_examine_edge</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="special">,</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">fuse_simple_edge_writer</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="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"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">on_back_edge</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="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"><<</span> <span class="string">" Done!"</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</span> <span class="string">"Tree edges:"</span> <span class="special"><<</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">std</span><span class="special">::</span><span class="identifier">tr1</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"><<</span> <span class="char">'\t'</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">index_map</span><span class="special">,</span> <span class="special">*</span><span class="identifier">vi</span><span class="special">)</span> <span class="special"><<</span> <span class="string">" --> "</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"><<</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"><<</span> <span class="string">" ("</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">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"><<</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"><<</span> <span class="char">')'</span> <span class="special"><<</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"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span> <span class="special"><<</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_rand_w_tree.hpp
+<span class="special">*</span> example/loop_erased_rand_w_tree.cpp
+</pre>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: September 09, 2012 at 17:48:56 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/simple_edge_writer.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/simple_edge_writer.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,431 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>simple_edge_writer</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="simple_edge_writer.html" title="simple_edge_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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="simple_edge_writer"></a>simple_edge_writer</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="simple_edge_writer.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+<dt><span class="section">Model of</span></dt>
+<dt><span class="section">Template Parameters</span></dt>
+<dt><span class="section">Members</span></dt>
+<dt><span class="section">Non-members</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.synopsis"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</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">></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">&</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">&</span> <span class="identifier">copy</span><span class="special">);</span>
+
+ <span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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">&</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><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.description"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.description" title="Description">Description</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.definition"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/simple_edge_writer.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.model_of"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.model_of" title="Model of">Model of</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.tpl_param"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.tpl_param" title="Template Parameters">Template Parameters</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.members"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.members" title="Members">Members</a>
+</h2></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">&</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">&</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"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></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"><</span><span class="identifier">Graph</span><span class="special">>::</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">&</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><h2 class="title" style="clear: both">
+<a name="simple_edge_writer.non_members"></a><a class="link" href="simple_edge_writer.html#simple_edge_writer.non_members" title="Non-members">Non-members</a>
+</h2></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"><</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">></span>
+ <span class="identifier">simple_edge_writer</span><span class="special"><</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">></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">&</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"><</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">></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"><</span>
+ <span class="identifier">Filter</span>
+ <span class="special">,</span> <span class="identifier">simple_edge_writer</span><span class="special"><</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">></span>
+ <span class="special">></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">&</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"><p><small>Last revised: September 09, 2012 at 18:15:51 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/src/call_visitors/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/call_visitors/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml call_visitors : doc.qbk ;
+boostbook standalone
+ :
+ call_visitors
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=call_visitors
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/call_visitors/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/call_visitors/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,83 @@
+[article call_visitors
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __Binary_Function__ [@http://www.sgi.com/tech/stl/BinaryFunction.html [*Binary Function]]]
+[def __Boost_Fusion__ [@boost:libs/fusion/doc/html/ Boost.Fusion]]
+[def __BGL__ [@boost:libs/graph/doc/index.html BGL]]
+[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 __Event_Visitor_List__ [@boost:/libs/graph/doc/EventVisitorList.html [*Event Visitor List]]]
+[def __boost_graph_call_visitors_hpp__ [@../../../boost/graph/call_visitors.hpp boost/graph/call_visitors.hpp]]
+[def __find_eulerian_trail__ [@find_eulerian_trail.html `find_eulerian_trail()`]]
+
+[import ../../../../../boost/graph/call_visitors.hpp]
+
+[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 __find_eulerian_trail__ 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]
+
Added: sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml find_eulerian_cycle : doc.qbk ;
+boostbook standalone
+ :
+ find_eulerian_cycle
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=find_eulerian_cycle
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/find_eulerian_cycle/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,220 @@
+[article find_eulerian_cycle
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __Carl_Hierholzer__ [@http://en.wikipedia.org/wiki/Carl_Hierholzer Carl Hierholzer]]
+[def __Output_Iterator__ [@http://www.sgi.com/tech/stl/OutputIterator.html [*Output Iterator]]]
+[def __Binary_Function__ [@http://www.sgi.com/tech/stl/BinaryFunction.html [*Binary Function]]]
+[def __std_multiset__ [@http://www.sgi.com/tech/stl/multiset.html `std::multiset`]]
+[def __Boost_Parameter__ [@boost:libs/parameter/doc/html/index.html Boost.Parameter]]
+[def __BGL__ [@boost:libs/graph/doc/index.html BGL]]
+[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 __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 __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[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]]
+[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 _vertices_ [@boost:libs/graph/doc/VertexListGraph.html vertices]]
+[def __boost_graph_find_eulerian_cycle_hpp__ [@../../../boost/graph/find_eulerian_cycle.hpp boost/graph/find_eulerian_cycle.hpp]]
+[def __example_find_eulerian_cycle_hpp__ [@../example/find_eulerian_cycle.hpp example/find_eulerian_cycle.hpp]]
+[def __example_find_eulerian_cycle_cpp__ [@../example/find_eulerian_cycle.cpp example/find_eulerian_cycle.cpp]]
+[def _has_eulerian_cycle_ [@has_eulerian_cycle.html has_eulerian_cycle]]
+[def __find_eulerian_cycle_parameters__ [@find_eulerian_cycle.html#find_eulerian_cycle.parameters parameters]]
+[def __fuse_property_writer__ [@fuse_property_writer.html `fuse_property_writer()`]]
+[def __fuse_simple_edge_writer__ [@simple_edge_writer.html#simple_edge_writer.non_members `fuse_simple_edge_writer()`]]
+
+[import ../../../../../boost/graph/find_eulerian_cycle.hpp]
+[import ../../../example/find_eulerian_cycle.hpp]
+[import ../../../example/find_eulerian_cycle.cpp]
+
+[section Prototypes]
+The function prototype that takes in __old_style_named_parameters__ is always
+defined.
+
+[reference__find_eulerian_cycle]
+
+The following function prototype is defined if you /don't/ set
+`BOOST_PARAMETER_MAX_ARITY` lower than 4.
+
+``
+namespace boost {
+
+ template <
+ typename InputGraph
+ , typename Result
+ , typename Visitor
+ >
+ bool
+ find_eulerian_cycle(
+ InputGraph const& input_graph
+ , Result result
+ , typename graph_traits<Graph>::vertex_descriptor root_vertex
+ , Visitor visitor
+ );
+} // namespace boost
+``
+[endsect]
+
+[section Description]
+The algorithm first examines a trail of edges from `root_vertex` and adds each
+edge to the tour until it returns to `root_vertex` and has visited all
+out-edges from it. As long as there exists a vertex `v` that belongs to the
+current tour but has unexamined out-edges, the algorithm will examine another
+trail from `v` until it cycles back to `v`, joining the tour formed in this way
+to the previous tour. The outline is described in "Ueber die Moglichkeit,
+einen Linienzug ohne Wiederholung und ohne Unterbrechung zu umfahren" by
+__Carl_Hierholzer__ (1873).
+[endsect]
+
+[section:definition Where Defined]
+``
+#include <__boost_graph_find_eulerian_cycle_hpp__>
+``
+[endsect]
+
+[section Type Requirements]
+
+ * `InputGraph` must model the __Incidence_Graph__ and __Vertex_List_Graph__
+ concepts.
+ * `Result` must model the __Output_Iterator__ concept.
+ * The __edge_descriptor_type__ of `InputGraph` must belong to the set of
+ value types of `Result`.
+ * `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`, 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` 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`, 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`--if one exists--must accept the __edge_descriptor_type__
+ of `InputGraph` as a valid first argument type to its apply member
+ function.
+
+[endsect]
+
+[section Parameters]
+[table
+ [[Parameter][Description][Deduced?][Runtime requirements][Default]]
+ [
+ [`input_graph`]
+ [The input graph.]
+ [No]
+ [[^_has_eulerian_cycle_(input_graph)] must return `true`.]
+ [None; always required.]
+ ]
+ [
+ [`result`]
+ [
+ An __Output_Iterator__ into which every edge in the graph will be
+ stored exactly once and in tour order.
+ ]
+ [No]
+ []
+ [None; always required.]
+ ]
+ [
+ [`root_vertex`]
+ [The start of the cycle.]
+ [Yes]
+ [
+ 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)].
+ ]
+ [[^*_vertices_(input_graph).first]]
+ ]
+ [
+ [`visitor`]
+ [
+ A heterogeneous container of event visitors. The algorithm will
+ fire the `on_initialize_vertex` event on each vertex before it
+ begins its actual work; it will fire the `on_start_vertex` event on
+ each vertex from which it starts a tour; it will fire the
+ `on_finish_vertex` event on each vertex at which it ends a tour;
+ and it will fire the `on_examine_edge` event on each edge that it
+ adds to the current tour.
+ ]
+ [Yes]
+ []
+ [`null_visitor()`]
+ ]
+]
+
+Parameters that can be *deduced* do not have to be explicitly named as long as
+the arguments to which they are bound fulfill the corresponding type
+requirements. However, if any of the non-deduced parameters are explicitly
+named out of their formal positions, then all succeeding parameters must be
+either explicitly named or in their formal positions.
+
+[caution
+ As of version 10.0, Microsoft Visual C++ ships with its own implementation
+ of TR1, which does not play nice with __Boost_Parameter__. Therefore,
+ parameter deduction has been disabled for users of this compiler.
+]
+[endsect]
+
+[section Complexity]
+The time complexity is `O(V + E log E)` for undirected graphs and `O(V + E)`
+for directed graphs. The reason for the difference is that for undirected
+graphs, the algorithm uses a __std_multiset__ to group opposite out-edges
+together.
+[endsect]
+
+[section Example]
+The following routine displays the output of an Eulerian cycle by passing an
+__Event_Visitor_List__ to the algorithm. The `visitor` parameter has been
+deduced in this case. However, code that assembles an __Event_Visitor_List__
+object composed of many event visitors can become tedious to write or maintain.
+
+[find_eulerian_cycle_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.)
+
+The following routine displays the same output by passing a
+__Fusion_Forward_Sequence__ to the algorithm by __named_parameter__. The
+algorithm recognizes its __find_eulerian_cycle_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.
+
+[find_eulerian_cycle_example_with_fusion_visitor_list]
+
+The complete example program can be compiled from these files:
+
+ * __example_find_eulerian_cycle_hpp__
+ * __example_find_eulerian_cycle_cpp__
+
+[endsect]
+
Added: sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml find_eulerian_trail : doc.qbk ;
+boostbook standalone
+ :
+ find_eulerian_trail
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=find_eulerian_trail
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/find_eulerian_trail/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,169 @@
+[article find_eulerian_trail
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __Output_Iterator__ [@http://www.sgi.com/tech/stl/OutputIterator.html [*Output Iterator]]]
+[def __Binary_Function__ [@http://www.sgi.com/tech/stl/BinaryFunction.html [*Binary Function]]]
+[def __std_multiset__ [@http://www.sgi.com/tech/stl/multiset.html `std::multiset`]]
+[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 __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 __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[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]]
+[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 _vertices_ [@boost:libs/graph/doc/VertexListGraph.html vertices]]
+[def __boost_graph_find_eulerian_trail_hpp__ [@../../../boost/graph/find_eulerian_trail.hpp boost/graph/find_eulerian_trail.hpp]]
+[def __example_find_eulerian_trail_hpp__ [@../example/find_eulerian_trail.hpp example/find_eulerian_trail.hpp]]
+[def __example_find_eulerian_trail_cpp__ [@../example/find_eulerian_trail.cpp example/find_eulerian_trail.cpp]]
+[def _has_eulerian_trail_ [@has_eulerian_trail.html has_eulerian_trail]]
+[def _find_eulerian_cycle_ [@find_eulerian_cycle.html find_eulerian_cycle]]
+[def __fuse_property_writer__ [@fuse_property_writer.html `fuse_property_writer()`]]
+[def __fuse_simple_edge_writer__ [@simple_edge_writer.html#simple_edge_writer.non_members `fuse_simple_edge_writer()`]]
+
+[import ../../../../../boost/graph/find_eulerian_trail.hpp]
+[import ../../../example/find_eulerian_trail.hpp]
+[import ../../../example/find_eulerian_trail.cpp]
+
+[section Prototypes]
+[reference__find_eulerian_trail]
+[endsect]
+
+[section Description]
+For undirected graphs without an Eulerian cycle, the algorithm finds the first
+vertex with an odd out-degree and examines a trail of edges from this vertex,
+adding each edge to the tour until it finds the other vertex with an odd
+out-degree and has visited all out-edges from it. For directed graphs without
+an Eulerian cycle, the algorithm first finds the vertex whose out-degree is one
+greater than its in-degree and examines a trail of edges from this vertex,
+adding each edge to the tour until it finds the vertex whose in-degree is one
+greater than its out-degree. Thereafter, as long as there exists a vertex `v`
+that belongs to the current tour but has unexamined out-edges, the algorithm
+will examine another trail from `v` until it cycles back to `v`, joining the
+tour formed in this way to the previous tour.
+
+If the input graph contains an Eulerian cycle, then the algorithm is equivalent
+to [^_find_eulerian_cycle_(input_graph, result, *_vertices_(input_graph).first,
+visitor)].
+[endsect]
+
+[section:definition Where Defined]
+``
+#include <__boost_graph_find_eulerian_trail_hpp__>
+``
+[endsect]
+
+[section Type Requirements]
+
+ * `InputGraph` must model the __Incidence_Graph__ and __Vertex_List_Graph__
+ concepts.
+ * `Result` must model the __Output_Iterator__ concept.
+ * The __edge_descriptor_type__ of `InputGraph` must belong to the set of
+ value types of `Result`.
+ * `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`, 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` 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`, 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`--if one exists--must accept the __edge_descriptor_type__
+ of `InputGraph` as a valid first argument type to its apply member
+ function.
+
+[endsect]
+
+[section Parameters]
+[table
+ [[Parameter][Description][Runtime requirements][Default]]
+ [
+ [`input_graph`]
+ [The input graph.]
+ [[^_has_eulerian_trail_(input_graph)] must return `true`.]
+ [None; always required.]
+ ]
+ [
+ [`result`]
+ [
+ An __Output_Iterator__ into which every edge in the graph will be
+ stored exactly once and in tour order.
+ ]
+ []
+ [None; always required.]
+ ]
+ [
+ [`visitor`]
+ [
+ A heterogeneous container of event visitors. The algorithm will
+ fire the `on_initialize_vertex` event on each vertex before it
+ begins its actual work; it will fire the `on_start_vertex` event on
+ each vertex from which it starts a trail; it will fire the
+ `on_finish_vertex` event on each vertex at which it ends a trail;
+ and it will fire the `on_examine_edge` event on each edge that it
+ adds to the current trail.
+ ]
+ []
+ [`null_visitor()`]
+ ]
+]
+[endsect]
+
+[section Complexity]
+The time complexity is `O(V + E log E)` for undirected graphs, `O(V + E)` for
+bidirectional graphs, and `O(V * E)` for directed graphs. The reason for the
+difference is that for undirected graphs, the algorithm uses a __std_multiset__
+to group opposite out-edges together, while for non-bidirectional directed
+graphs, the algorithm must perform its own tally of in-edges in order to find
+the correct starting vertex.
+[endsect]
+
+[section Example]
+The following routine displays the output of an Eulerian trail by passing an
+__Event_Visitor_List__ to the algorithm. However, code that assembles an
+__Event_Visitor_List__ object composed of many event visitors can become
+tedious to write or maintain.
+
+[find_eulerian_trail_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.) The
+following routine displays the same output by passing a
+__Fusion_Forward_Sequence__ to the algorithm.
+
+[find_eulerian_trail_example_with_fusion_visitor_list]
+
+The complete example program can be compiled from these files:
+
+ * __example_find_eulerian_trail_hpp__
+ * __example_find_eulerian_trail_cpp__
+
+[endsect]
+
Added: sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml fuse_property_writer : doc.qbk ;
+boostbook standalone
+ :
+ fuse_property_writer
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=fuse_property_writer
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/fuse_property_writer/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,33 @@
+[article fuse_property_writer
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __fusion_pair__ [@boost:libs/fusion/doc/html/fusion/support/pair.html `boost::fusion::pair`]]
+[def __property_writer__ [@boost:libs/graph/doc/property_writer.html `property_writer`]]
+[def __boost_graph_fuse_property_writer_hpp__ [@../../../boost/graph/fuse_property_writer.hpp boost/graph/fuse_property_writer.hpp]]
+
+[import ../../../../../boost/graph/fuse_property_writer.hpp]
+
+[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]
+
Added: sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml has_eulerian_cycle : doc.qbk ;
+boostbook standalone
+ :
+ has_eulerian_cycle
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=has_eulerian_cycle
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/has_eulerian_cycle/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,32 @@
+[article has_eulerian_cycle
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __boost_graph_has_eulerian_cycle_hpp__ [@../../../boost/graph/has_eulerian_cycle.hpp boost/graph/has_eulerian_cycle.hpp]]
+
+[import ../../../../../boost/graph/has_eulerian_cycle.hpp]
+
+[section Synopsis]
+[reference__has_eulerian_cycle]
+[endsect]
+
+[section Description]
+For an undirected graph, returns `true` if every vertex has an even out-degree
+and if all of its vertices belong to a single connected component; for a
+directed graph, returns `true` if the in-degree of every vertex is equal to its
+out-degree and if all of its vertices belong to a single strongly connected
+component; returns `false` otherwise.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_has_eulerian_cycle_hpp__>
+``
+[endsect]
+
Added: sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml has_eulerian_trail : doc.qbk ;
+boostbook standalone
+ :
+ has_eulerian_trail
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=has_eulerian_trail
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/has_eulerian_trail/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,35 @@
+[article has_eulerian_trail
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __boost_graph_has_eulerian_trail_hpp__ [@../../../boost/graph/has_eulerian_trail.hpp boost/graph/has_eulerian_trail.hpp]]
+
+[import ../../../../../boost/graph/has_eulerian_trail.hpp]
+
+[section Synopsis]
+[reference__has_eulerian_trail]
+[endsect]
+
+[section Description]
+For an undirected graph, returns `true` if either zero or two vertices have odd
+out-degrees and if all of its vertices belong to a single connected component;
+for a directed graph, returns `true` if the out-degree of exactly one vertex is
+one more than its in-degree, the in-degree of exactly one other vertex is one
+more than its out-degree, and all of its vertices belong to a weakly connected
+component, or if the in-degree of every vertex is equal to its out-degree and
+all of its vertices belong to a strongly connected component; returns `false`
+otherwise.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_has_eulerian_trail_hpp__>
+``
+[endsect]
+
Added: sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml loop_erased_random_tree : doc.qbk ;
+boostbook standalone
+ :
+ loop_erased_random_tree
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=loop_erased_random_tree
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/loop_erased_random_tree/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,602 @@
+[article loop_erased_random_tree and loop_erased_random_weighted_tree
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[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]]
+[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]]]
+[def __std_multiset__ [@http://www.sgi.com/tech/stl/multiset.html `std::multiset`]]
+[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]]
+[def __Boost_Parameter__ [@boost:libs/parameter/doc/html/index.html Boost.Parameter]]
+[def __BGL__ [@boost:libs/graph/doc/index.html BGL]]
+[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 __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 __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[def __Bidirectional_Graph__ [@boost:libs/graph/doc/BidirectionalGraph.html [*Bidirectional Graph]]]
+[def __Property_Graph__ [@boost:libs/graph/doc/PropertyGraph.html [*Property Graph]]]
+[def __Color_Value__ [@boost:libs/graph/doc/ColorValue.html [*Color Value]]]
+[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]]
+[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 _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 __property_writer__ [@boost:libs/graph/doc/property_writer.html `property_writer`]]
+[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_rand_w_tree_hpp__ [@../../../boost/graph/loop_erased_rand_w_tree.hpp boost/graph/loop_erased_rand_w_tree.hpp]]
+[def __example_loop_erased_random_tree_hpp__ [@../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 example/loop_erased_random_tree.cpp]]
+[def __example_loop_erased_rand_w_tree_hpp__ [@../example/loop_erased_rand_w_tree.hpp example/loop_erased_rand_w_tree.hpp]]
+[def __example_loop_erased_rand_w_tree_cpp__ [@../example/loop_erased_rand_w_tree.cpp example/loop_erased_rand_w_tree.cpp]]
+[def __RandomTree__ [@loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree `RandomTree()`]]
+[def __RandomTreeWithRoot__ [@loop_erased_random_tree.html#loop_erased_random_tree_and_loop_erased_random_weighted_tree.description.random_tree_with_root `RandomTreeWithRoot()`]]
+[def __lert_parameters__ [@loop_erased_random_tree.html#loop_erased_random_tree.parameters parameters]]
+[def __fuse_property_writer__ [@fuse_property_writer.html `fuse_property_writer()`]]
+[def __fuse_simple_edge_writer__ [@simple_edge_writer.html#simple_edge_writer.non_members `fuse_simple_edge_writer()`]]
+[def _make_vertex_property_map_ [@vertex_property_map_gen.html#vertex_property_map_gen.non_members make_vertex_property_map]]
+
+[import ../../../../../boost/graph/loop_erased_random_tree.hpp]
+[import ../../../../../boost/graph/loop_erased_rand_w_tree.hpp]
+[import ../../../example/loop_erased_random_tree.hpp]
+[import ../../../example/loop_erased_random_tree.cpp]
+[import ../../../example/loop_erased_rand_w_tree.hpp]
+[import ../../../example/loop_erased_rand_w_tree.cpp]
+
+[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
+if you /don't/ set `BOOST_PARAMETER_MAX_ARITY` lower than its default value of
+8.
+
+``
+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
+``
+[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_8_PARAMS` preprocessor
+token is defined--that is, if you /don't/ set `BOOST_PARAMETER_MAX_ARITY` lower
+than its default value of 8.
+
+``
+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
+ , EdgeWeightMap weight_map
+ , VertexColorMap& color_map
+ , Visitor visitor
+ );
+} // 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_rand_w_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 function 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 __lert_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.
+
+[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__
+
+[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
+__lert_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_rand_w_tree_hpp__
+ * __example_loop_erased_rand_w_tree_cpp__
+
+[endsect] [/ loop_erased_random_weighted_tree Example]
+
Added: sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml simple_edge_writer : doc.qbk ;
+boostbook standalone
+ :
+ simple_edge_writer
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=simple_edge_writer
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/simple_edge_writer/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,149 @@
+[article simple_edge_writer
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __Binary_Function__ [@http://www.sgi.com/tech/stl/BinaryFunction.html [*Binary Function]]]
+[def __Copy_Constructible__ [@boost:libs/utility/CopyConstructible.html [*Copy Constructible]]]
+[def __Readable_Property_Map__ [@boost:/libs/property_map/doc/ReadablePropertyMap.html [*Readable Property Map]]]
+[def __Event_Visitor__ [@boost:/libs/graph/doc/EventVisitor.html [*Event Visitor]]]
+[def __fusion_pair__ [@boost:libs/fusion/doc/html/fusion/support/pair.html `boost::fusion::pair`]]
+[def _graph_traits_ [@boost:libs/graph/doc/graph_traits.html graph_traits]]
+[def __boost_graph_simple_edge_writer_hpp__ [@../../../boost/graph/simple_edge_writer.hpp boost/graph/simple_edge_writer.hpp]]
+
+[import ../../../../../boost/graph/simple_edge_writer.hpp]
+
+[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]
+
Added: sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml vertex_property_map_gen : doc.qbk ;
+boostbook standalone
+ :
+ vertex_property_map_gen
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=vertex_property_map_gen
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/vertex_property_map_gen/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,164 @@
+[article vertex_property_map_gen
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[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 __BGL__ [@boost:libs/graph/doc/index.html BGL]]
+[def __Copy_Constructible__ [@boost:libs/utility/CopyConstructible.html [*Copy Constructible]]]
+[def __Assignable__ [@boost:libs/utility/Assignable.html [*Assignable]]]
+[def __Lvalue_Property_Map__ [@boost:/libs/property_map/doc/LvaluePropertyMap.html [*Lvalue Property Map]]]
+[def __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[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 __vertex_index__ [@boost:libs/graph/doc/PropertyTag.html `vertex_index`]]
+[def _graph_traits_ [@boost:libs/graph/doc/graph_traits.html graph_traits]]
+[def __boost_graph_vertex_property_map_gen_hpp__ [@../../../boost/graph/vertex_property_map_gen.hpp boost/graph/vertex_property_map_gen.hpp]]
+[def __weak_components__ [@weak_components.html `weak_components()`]]
+[def __loop_erased_random_tree__ [@loop_erased_random_tree.html `loop_erased_random_tree()`]]
+[def __vertex_property_map_gen__ [@vertex_property_map_gen.html `vertex_property_map_gen`]]
+[def _make_vertex_property_map_ [@vertex_property_map_gen.html#vertex_property_map_gen.non_members make_vertex_property_map]]
+
+[import ../../../../../boost/graph/vertex_property_map_gen.hpp]
+
+[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 __weak_components__ 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:members Return Type Members]
+[table
+ [[Name][Expression][Description]]
+ [
+ [Key type]
+ [`vertex_property_map_gen::type::key_type`]
+ [Same as [^_graph_traits_<Graph>::vertex_descriptor]]
+ ]
+ [
+ [Value type]
+ [`vertex_property_map_gen::type::value_type`]
+ [Same as `Value`]
+ ]
+ [
+ [Reference type]
+ [`vertex_property_map_gen::type::reference`]
+ [Same as `Value&`]
+ ]
+ [
+ [Category type]
+ [`vertex_property_map_gen::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;
+ initially, each vertex is associated with a default-constructed
+ `Value` object (or with itself if this object will be used as a
+ predecessor map).
+ ]
+ ]
+ [
+ [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]
+ [
+ `vertex_property_map_gen::type::reference
+ operator[](key_type const&) const;`
+ ]
+ [Accesses the property value of the specified vertex.]
+ ]
+]
+[endsect]
+
+[section:non_members Return Type 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]
+
Added: sandbox/graph-path/libs/graph/doc/src/weak_components/Jamroot
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/weak_components/Jamroot 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,63 @@
+project
+ : requirements
+ # Path for links to Boost:
+ # <xsl:param>boost.root=../../..
+ <xsl:param>boost.root=http://www.boost.org
+
+ # Some general style settings:
+ <xsl:param>table.footnote.number.format=1
+ <xsl:param>footnote.number.format=1
+
+ # HTML options first:
+ # Use graphics not text for navigation:
+ <xsl:param>navig.graphics=1
+ # PDF Options:
+ # TOC Generation: this is needed for FOP-0.9 and later:
+ <xsl:param>fop1.extensions=0
+ <xsl:param>xep.extensions=1
+ # TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
+ <xsl:param>fop.extensions=0
+ # No indent on body text:
+ <xsl:param>body.start.indent=0pt
+ # Margin size:
+ <xsl:param>page.margin.inner=0.5in
+ # Margin size:
+ <xsl:param>page.margin.outer=0.5in
+ # Paper type = A4
+ <xsl:param>paper.type=A4
+ # Yes, we want graphics for admonishments:
+ <xsl:param>admon.graphics=1
+ # Set this one for PDF generation *only*:
+ # default pnd graphics are awful in PDF form,
+ # better use SVG's instead:
+ <format>pdf:<xsl:param>admon.graphics.extension=".svg"
+ <format>pdf:<xsl:param>admon.graphics.path=http://www.boost.org/doc/src/images/
+ <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/libs/graph/doc
+ ;
+
+import boostbook : boostbook ;
+using quickbook ;
+
+xml weak_components : doc.qbk ;
+boostbook standalone
+ :
+ weak_components
+ :
+ <xsl:param>base.dir=../../..
+ <xsl:param>root.filename=weak_components
+ <xsl:param>admon.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <xsl:param>navig.graphics.path=http://www.boost.org/doc/libs/release/doc/src/images/
+ <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=http://www.boost.org/doc/libs/release/doc/src/boostbook.css
+ <xsl:param>nav.layout=none
+ <xsl:param>chunk.section.depth=0
+ <xsl:param>chunk.first.sections=0
+ <xsl:param>toc.section.depth=1
+ <xsl:param>toc.max.depth=1
+ <xsl:param>generate.section.toc.level=1
+ ;
+
Added: sandbox/graph-path/libs/graph/doc/src/weak_components/doc.qbk
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/src/weak_components/doc.qbk 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,70 @@
+[article weak_components
+ [quickbook 1.5]
+ [copyright 2012 Cromwell Enage]
+ [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])
+ ]
+]
+
+[def __Read_Write_Property_Map__ [@boost:/libs/property_map/doc/ReadWritePropertyMap.html [*Read/Write Property Map]]]
+[def __Incidence_Graph__ [@boost:libs/graph/doc/IndicenceGraph.html [*Incidence Graph]]]
+[def __Vertex_List_Graph__ [@boost:libs/graph/doc/VertexListGraph.html [*Vertex List Graph]]]
+[def __vertex_descriptor_type__ [@boost:libs/graph/doc/graph_traits.html vertex descriptor type]]
+[def __traversal_category_type__ [@boost:libs/graph/doc/graph_traits.html traversal category type]]
+[def __boost_graph_weak_components_hpp__ [@../../../boost/graph/weak_components.hpp boost/graph/weak_components.hpp]]
+
+[import ../../../../../boost/graph/weak_components.hpp]
+
+[section Synopsis]
+[reference__weak_components]
+[endsect]
+
+[section Description]
+This algorithm computes the weakly connected components of a directed graph by
+computing the connected components of an isomorphic undirected graph. Returns
+the total number of components it computes.
+[endsect]
+
+[section:definition Where defined]
+``
+#include <__boost_graph_weak_components_hpp__>
+``
+[endsect]
+
+[section Type Requirements]
+
+ * `InputGraph` must model the __Incidence_Graph__ and __Vertex_List_Graph__
+ concepts.
+ * The __traversal_category_type__ of `InputGraph` must inherit from
+ `boost::directed_category_tag`.
+ * `ComponentMap` must model the __Read_Write_Property_Map__ concept.
+ * The key type of `ComponentMap` must be the same as the
+ __vertex_descriptor_type__ of `InputGraph`.
+ * The value type of `ComponentMap` must be an unsigned integral type.
+
+[endsect]
+
+[section Parameters]
+[table
+ [[Parameter][Description]]
+ [
+ [`input_graph`]
+ [A directed graph.]
+ ]
+ [
+ [`component_map`]
+ [
+ A property map that stores the output of the algorithm. Each
+ vertex will be associated with an integer label. All vertices with
+ the same integer label belong to the same weak component.
+ ]
+ ]
+]
+[endsect]
+
+[section Complexity]
+The time complexity is `O(V + E)`.
+[endsect]
+
Added: sandbox/graph-path/libs/graph/doc/vertex_property_map_gen.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/vertex_property_map_gen.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,422 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>vertex_property_map_gen</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="vertex_property_map_gen.html" title="vertex_property_map_gen">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="vertex_property_map_gen"></a>vertex_property_map_gen</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="vertex_property_map_gen.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+<dt><span class="section">Model of</span></dt>
+<dt><span class="section">Return Type Members</span></dt>
+<dt><span class="section">Return Type Non-members</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.synopsis"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</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">></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><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.description"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.description" title="Description">Description</a>
+</h2></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 weak_components()
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"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></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">&</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"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">default_color_type</span><span class="special">>::</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><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.definition"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/vertex_property_map_gen.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.model_of"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.model_of" title="Model of">Model of</a>
+</h2></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><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.members"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.members" title="Return Type Members">Return Type Members</a>
+</h2></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">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">key_type</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="literal">graph_traits<Graph>::vertex_descriptor</code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Value type
+ </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">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">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><span class="identifier">reference</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ Same as <code class="computeroutput"><span class="identifier">Value</span><span class="special">&</span></code>
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ Category type
+ </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">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">&);</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; initially,
+ each vertex is associated with a default-constructed <code class="computeroutput"><span class="identifier">Value</span></code> object (or with itself if
+ this object will be used as a predecessor map).
+ </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">&);</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">&</span> <span class="keyword">operator</span><span class="special">=(</span><span class="identifier">type</span>
+ <span class="keyword">const</span><span class="special">&);</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">vertex_property_map_gen</span><span class="special">::</span><span class="identifier">type</span><span class="special">::</span><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">&)</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><h2 class="title" style="clear: both">
+<a name="vertex_property_map_gen.non_members"></a><a class="link" href="vertex_property_map_gen.html#vertex_property_map_gen.non_members" title="Return Type Non-members">Return Type Non-members</a>
+</h2></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"><</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">></span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Value</span><span class="special">>::</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">&</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"><</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">></span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special"><</span><span class="identifier">Graph</span><span class="special">,</span><span class="identifier">Value</span><span class="special">>::</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">&</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"><</span><span class="keyword">typename</span> <span class="identifier">Graph</span><span class="special">></span>
+ <span class="keyword">typename</span> <span class="identifier">vertex_property_map_gen</span><span class="special"><</span>
+ <span class="identifier">Graph</span>
+ <span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">graph_traits</span><span class="special"><</span><span class="identifier">Graph</span><span class="special">>::</span><span class="identifier">vertex_descriptor</span>
+ <span class="special">>::</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">&</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>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: September 09, 2012 at 18:19:03 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/doc/weak_components.html
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/doc/weak_components.html 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,158 @@
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
+<title>weak_components</title>
+<link rel="stylesheet" href="http://www.boost.org/doc/libs/release/doc/src/boostbook.css" type="text/css">
+<meta name="generator" content="DocBook XSL Stylesheets V1.77.1">
+<link rel="home" href="weak_components.html" title="weak_components">
+</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"></div>
+<div class="article">
+<div class="titlepage">
+<div>
+<div><h2 class="title">
+<a name="weak_components"></a>weak_components</h2></div>
+<div><p class="copyright">Copyright © 2012 Cromwell Enage</p></div>
+<div><div class="legalnotice">
+<a name="weak_components.legal"></a><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></div>
+</div>
+<hr>
+</div>
+<div class="toc">
+<p><b>Table of Contents</b></p>
+<dl>
+<dt><span class="section">Synopsis</span></dt>
+<dt><span class="section">Description</span></dt>
+<dt><span class="section">Where defined</span></dt>
+<dt><span class="section">Type Requirements</span></dt>
+<dt><span class="section">Parameters</span></dt>
+<dt><span class="section">Complexity</span></dt>
+</dl>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="weak_components.synopsis"></a><a class="link" href="weak_components.html#weak_components.synopsis" title="Synopsis">Synopsis</a>
+</h2></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"><</span><span class="keyword">typename</span> <span class="identifier">InputGraph</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">ComponentMap</span><span class="special">></span>
+ <span class="keyword">typename</span> <span class="special">::</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">property_traits</span><span class="special"><</span><span class="identifier">ComponentMap</span><span class="special">>::</span><span class="identifier">value_type</span>
+ <span class="identifier">weak_components</span><span class="special">(</span><span class="identifier">InputGraph</span> <span class="keyword">const</span><span class="special">&</span> <span class="identifier">graph</span><span class="special">,</span> <span class="identifier">ComponentMap</span> <span class="identifier">component_map</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><h2 class="title" style="clear: both">
+<a name="weak_components.description"></a><a class="link" href="weak_components.html#weak_components.description" title="Description">Description</a>
+</h2></div></div></div>
+<p>
+ This algorithm computes the weakly connected components of a directed graph
+ by computing the connected components of an isomorphic undirected graph. Returns
+ the total number of components it computes.
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="weak_components.definition"></a><a class="link" href="weak_components.html#weak_components.definition" title="Where defined">Where defined</a>
+</h2></div></div></div>
+<p>
+</p>
+<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span>boost/graph/weak_components.hpp<span class="special">></span>
+</pre>
+<p>
+ </p>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="weak_components.type_requirements"></a><a class="link" href="weak_components.html#weak_components.type_requirements" title="Type Requirements">Type Requirements</a>
+</h2></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="keyword">and</span> Vertex List Graph
+ <span class="identifier">concepts</span><span class="special">.</span>
+<span class="special">*</span> <span class="identifier">The</span> traversal category 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">inherit</span> <span class="identifier">from</span>
+ <span class="error">`</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">directed_category_tag</span><span class="error">`</span><span class="special">.</span>
+<span class="special">*</span> <span class="error">`</span><span class="identifier">ComponentMap</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> <span class="identifier">key</span> <span class="identifier">type</span> <span class="identifier">of</span> <span class="error">`</span><span class="identifier">ComponentMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">the</span> <span class="identifier">same</span> <span class="identifier">as</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="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">ComponentMap</span><span class="error">`</span> <span class="identifier">must</span> <span class="identifier">be</span> <span class="identifier">an</span> <span class="keyword">unsigned</span> <span class="identifier">integral</span> <span class="identifier">type</span><span class="special">.</span>
+</pre>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="weak_components.parameters"></a><a class="link" href="weak_components.html#weak_components.parameters" title="Parameters">Parameters</a>
+</h2></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>
+ <code class="computeroutput"><span class="identifier">input_graph</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A directed graph.
+ </p>
+ </td>
+</tr>
+<tr>
+<td>
+ <p>
+ <code class="computeroutput"><span class="identifier">component_map</span></code>
+ </p>
+ </td>
+<td>
+ <p>
+ A property map that stores the output of the algorithm. Each vertex
+ will be associated with an integer label. All vertices with the same
+ integer label belong to the same weak component.
+ </p>
+ </td>
+</tr>
+</tbody>
+</table></div>
+</div>
+<div class="section">
+<div class="titlepage"><div><div><h2 class="title" style="clear: both">
+<a name="weak_components.complexity"></a><a class="link" href="weak_components.html#weak_components.complexity" title="Complexity">Complexity</a>
+</h2></div></div></div>
+<p>
+ The time complexity is <code class="computeroutput"><span class="identifier">O</span><span class="special">(</span><span class="identifier">V</span> <span class="special">+</span> <span class="identifier">E</span><span class="special">)</span></code>.
+ </p>
+</div>
+</div>
+<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
+<td align="left"><p><small>Last revised: September 09, 2012 at 18:17:58 GMT</small></p></td>
+<td align="right"><div class="copyright-footer"></div></td>
+</tr></table>
+<hr>
+<div class="spirit-nav"></div>
+</body>
+</html>
Added: sandbox/graph-path/libs/graph/example/find_eulerian_cycle.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/find_eulerian_cycle.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,15 @@
+// Copyright (C) 2012 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)
+
+#include "find_eulerian_cycle.hpp"
+
+int main()
+{
+ vec_adjacency_list_example<boost::listS>(4);
+ vec_adjacency_list_example<boost::listS>(5);
+
+ return 0;
+}
+
Added: sandbox/graph-path/libs/graph/example/find_eulerian_cycle.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/find_eulerian_cycle.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,264 @@
+// Copyright (C) 2012 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_FIND_EULERIAN_CYCLE_HPP
+#define LIBS_GRAPH_EXAMPLE_FIND_EULERIAN_CYCLE_HPP
+
+#include <iostream>
+#include <iterator>
+#include <list>
+#include <utility>
+#include <boost/config.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_utility.hpp>
+#include <boost/graph/simple_edge_writer.hpp>
+#include <boost/graph/has_eulerian_cycle.hpp>
+#include <boost/graph/find_eulerian_cycle.hpp>
+
+#if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/graph/fuse_property_writer.hpp>
+#endif
+
+#include "../test/initialize_complete_graph.hpp"
+
+//[find_eulerian_cycle_example_with_visitor_list
+template <typename Graph>
+void find_eulerian_cycle_example_with_visitor_list(std::size_t vertex_count)
+{
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+
+ Graph g(vertex_count);
+ VertexIndexMap i_map = boost::get(boost::vertex_index, g);
+
+ initialize_complete_graph(g);
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+ std::cout << std::endl;
+
+ if (boost::has_eulerian_cycle(g))
+ {
+ EdgeList path;
+
+ boost::find_eulerian_cycle(
+ g
+ , std::back_inserter(path)
+//<-
+#if defined BOOST_MSVC
+ , boost::graph::keywords::_visitor = std::make_pair(
+#else
+//->
+ , std::make_pair(
+//<-
+#endif
+//->
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , boost::make_simple_edge_writer(
+ i_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ )
+ )
+ )
+ );
+ std::cout << std::endl;
+
+ for (
+ typename EdgeList::const_iterator itr = path.begin();
+ itr != path.end();
+ ++itr
+ )
+ {
+ std::cout << '\t' << boost::get(i_map, boost::source(*itr, g));
+ std::cout << " --> " << boost::get(i_map, boost::target(*itr, g));
+ std::cout << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "...has no Eulerian cycle." << std::endl;
+ }
+}
+//]
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+//[find_eulerian_cycle_example_with_fusion_visitor_list
+template <typename Graph>
+void
+ find_eulerian_cycle_example_with_fusion_visitor_list(
+ std::size_t vertex_count
+ )
+{
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+
+ Graph g(vertex_count);
+ VertexIndexMap i_map = boost::get(boost::vertex_index, g);
+
+ initialize_complete_graph(g);
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+ std::cout << std::endl;
+
+ if (boost::has_eulerian_cycle(g))
+ {
+ EdgeList path;
+
+ boost::find_eulerian_cycle(
+ g
+ , boost::graph::keywords::_visitor = boost::fusion::make_list(
+ boost::fuse_property_writer<boost::on_initialize_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ i_map
+ , std::cout
+ , " examined...\t"
+ )
+ )
+ , boost::graph::keywords::_result = std::back_inserter(path)
+ );
+ std::cout << std::endl;
+
+ for (
+ typename EdgeList::const_iterator itr = path.begin();
+ itr != path.end();
+ ++itr
+ )
+ {
+ std::cout << '\t' << boost::get(i_map, boost::source(*itr, g));
+ std::cout << " --> " << boost::get(i_map, boost::target(*itr, g));
+ std::cout << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "...has no Eulerian cycle." << std::endl;
+ }
+}
+//]
+
+#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+template <typename EdgeContainerSelector>
+void vec_adjacency_list_example(std::size_t vertex_count)
+{
+ 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 << std::endl << std::endl;
+ std::cout << "Running find_eulerian_cycle algorithm on " << vertex_count;
+ std::cout << "-vertex complete undirected graph." << std::endl;
+ std::cout << std::endl;
+ find_eulerian_cycle_example_with_visitor_list<UndirectedGraph>(
+ vertex_count
+ );
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_cycle_example_with_fusion_visitor_list<UndirectedGraph>(
+ vertex_count
+ );
+#endif
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_cycle algorithm on " << vertex_count;
+ std::cout << "-vertex complete directed graph." << std::endl << std::endl;
+ find_eulerian_cycle_example_with_visitor_list<DirectedGraph>(
+ vertex_count
+ );
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_cycle_example_with_fusion_visitor_list<DirectedGraph>(
+ vertex_count
+ );
+#endif
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_cycle algorithm on " << vertex_count;
+ std::cout << "-vertex complete bidirectional graph." << std::endl;
+ std::cout << std::endl;
+ find_eulerian_cycle_example_with_visitor_list<BidirectionalGraph>(
+ vertex_count
+ );
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_cycle_example_with_fusion_visitor_list<BidirectionalGraph>(
+ vertex_count
+ );
+#endif
+}
+
+#endif // LIBS_GRAPH_EXAMPLE_FIND_EULERIAN_CYCLE_HPP
+
Added: sandbox/graph-path/libs/graph/example/find_eulerian_trail.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/find_eulerian_trail.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,14 @@
+// Copyright (C) 2012 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)
+
+#include "find_eulerian_trail.hpp"
+
+int main()
+{
+ vec_adjacency_list_example<boost::listS>();
+
+ return 0;
+}
+
Added: sandbox/graph-path/libs/graph/example/find_eulerian_trail.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/find_eulerian_trail.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,265 @@
+// Copyright (C) 2012 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_FIND_EULERIAN_TRAIL_HPP
+#define LIBS_GRAPH_EXAMPLE_FIND_EULERIAN_TRAIL_HPP
+
+#include <iostream>
+#include <iterator>
+#include <list>
+#include <utility>
+#include <boost/config.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_utility.hpp>
+#include <boost/graph/simple_edge_writer.hpp>
+#include <boost/graph/has_eulerian_trail.hpp>
+#include <boost/graph/find_eulerian_trail.hpp>
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/graph/fuse_property_writer.hpp>
+#endif
+
+#include "../test/initialize_euler_graphs.hpp"
+
+template <typename Graph>
+void initialize_bridges(Graph& g)
+{
+ boost::add_edge(boost::vertex(0, g), boost::vertex(1, g), g);
+ boost::add_edge(boost::vertex(0, g), boost::vertex(1, g), g);
+ boost::add_edge(boost::vertex(0, g), boost::vertex(2, g), g);
+ boost::add_edge(boost::vertex(0, g), boost::vertex(2, g), g);
+ boost::add_edge(boost::vertex(0, g), boost::vertex(3, g), g);
+ boost::add_edge(boost::vertex(1, g), boost::vertex(3, g), g);
+ boost::add_edge(boost::vertex(2, g), boost::vertex(3, g), g);
+}
+
+//[find_eulerian_trail_example_with_visitor_list
+template <typename Graph>
+void find_eulerian_trail_example_with_visitor_list(Graph const& g)
+{
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+
+ VertexIndexMap i_map = boost::get(boost::vertex_index, g);
+
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+ std::cout << std::endl;
+
+ if (boost::has_eulerian_trail(g))
+ {
+ EdgeList path;
+
+ boost::find_eulerian_trail(
+ g
+ , std::back_inserter(path)
+ , std::make_pair(
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ , boost::on_initialize_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ , boost::on_start_vertex()
+ )
+ , std::make_pair(
+ boost::write_property(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ , boost::on_finish_vertex()
+ )
+ , boost::make_simple_edge_writer(
+ i_map
+ , std::cout
+ , " examined...\t"
+ , boost::on_examine_edge()
+ )
+ )
+ )
+ )
+ );
+ std::cout << std::endl;
+
+ for (
+ typename EdgeList::const_iterator itr = path.begin();
+ itr != path.end();
+ ++itr
+ )
+ {
+ std::cout << '\t' << boost::get(i_map, boost::source(*itr, g));
+ std::cout << " --> " << boost::get(i_map, boost::target(*itr, g));
+ std::cout << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "...has no Eulerian trail." << std::endl;
+ }
+}
+//]
+
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+//[find_eulerian_trail_example_with_fusion_visitor_list
+template <typename Graph>
+void find_eulerian_trail_example_with_fusion_visitor_list(Graph const& g)
+{
+ typedef typename boost::property_map<Graph,boost::vertex_index_t>::type
+ VertexIndexMap;
+ typedef typename boost::property_traits<VertexIndexMap>::value_type
+ VertexIndex;
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+
+ VertexIndexMap i_map = boost::get(boost::vertex_index, g);
+
+ std::cout << "Graph:" << std::endl;
+ boost::print_graph(g);
+ std::cout << std::endl;
+
+ if (boost::has_eulerian_trail(g))
+ {
+ EdgeList path;
+
+ boost::find_eulerian_trail(
+ g
+ , std::back_inserter(path)
+ , boost::fusion::make_list(
+ boost::fuse_property_writer<boost::on_initialize_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " initialized...\t")
+ )
+ , boost::fuse_property_writer<boost::on_start_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " started...\t")
+ )
+ , boost::fuse_property_writer<boost::on_finish_vertex>(
+ i_map
+ , std::ostream_iterator<
+ VertexIndex
+ >(std::cout, " finished.\t")
+ )
+ , boost::fuse_simple_edge_writer<boost::on_examine_edge>(
+ i_map
+ , std::cout
+ , " examined...\t"
+ )
+ )
+ );
+ std::cout << std::endl;
+
+ for (
+ typename EdgeList::const_iterator itr = path.begin();
+ itr != path.end();
+ ++itr
+ )
+ {
+ std::cout << '\t' << boost::get(i_map, boost::source(*itr, g));
+ std::cout << " --> " << boost::get(i_map, boost::target(*itr, g));
+ std::cout << std::endl;
+ }
+ }
+ else
+ {
+ std::cout << "...has no Eulerian trail." << std::endl;
+ }
+}
+//]
+
+#endif
+
+template <typename EdgeContainerSelector>
+void vec_adjacency_list_example()
+{
+ 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;
+
+ UndirectedGraph konigsberg(4), paper_clip(4);
+ BidirectionalGraph bidigraph(5);
+ DirectedGraph digraph(5);
+
+ initialize_bridges(konigsberg);
+ initialize_two_triangles(paper_clip);
+ initialize_almost_complete_graph(bidigraph);
+ initialize_almost_complete_graph(digraph);
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_trail algorithm on Konigsberg.";
+ std::cout << std::endl << std::endl;
+ find_eulerian_trail_example_with_visitor_list(konigsberg);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_trail_example_with_fusion_visitor_list(konigsberg);
+#endif
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_trail algorithm on two triangles.";
+ std::cout << std::endl << std::endl;
+ find_eulerian_trail_example_with_visitor_list(paper_clip);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_trail_example_with_fusion_visitor_list(paper_clip);
+#endif
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_trail algorithm on bidigraph.";
+ std::cout << std::endl << std::endl;
+ find_eulerian_trail_example_with_visitor_list(bidigraph);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_trail_example_with_fusion_visitor_list(bidigraph);
+#endif
+
+ std::cout << std::endl << std::endl;
+ std::cout << "Running find_eulerian_trail algorithm on digraph.";
+ std::cout << std::endl << std::endl;
+ find_eulerian_trail_example_with_visitor_list(digraph);
+#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+ std::cout << std::endl;
+ find_eulerian_trail_example_with_fusion_visitor_list(digraph);
+#endif
+}
+
+#endif // LIBS_GRAPH_EXAMPLE_FIND_EULERIAN_TRAIL_HPP
+
Added: sandbox/graph-path/libs/graph/example/loop_erased_rand_w_tree.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/loop_erased_rand_w_tree.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,79 @@
+// Copyright (C) 2004-2012 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)
+
+#include <iostream>
+#include <boost/tr1/random.hpp>
+#include "loop_erased_rand_w_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-path/libs/graph/example/loop_erased_rand_w_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/loop_erased_rand_w_tree.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,955 @@
+// Copyright (C) 2004-2012 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_RAND_W_TREE_HPP
+#define LIBS_GRAPH_EXAMPLE_LOOP_ERASED_RAND_W_TREE_HPP
+
+// maximum number of named arguments in a function
+//#define BOOST_PARAMETER_MAX_ARITY 11
+
+#include <iostream>
+#include <iterator>
+#include <utility>
+#include <boost/tr1/tuple.hpp>
+#include <boost/tr1/random.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_utility.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+#include <boost/graph/fuse_property_writer.hpp>
+#include <boost/graph/simple_edge_writer.hpp>
+#include <boost/graph/loop_erased_rand_w_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 << "Tree edges:" << std::endl;
+
+ for (
+ std::tr1::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) << " (";
+ std::tr1::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 << "Tree edges:" << std::endl;
+
+ for (
+ std::tr1::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) << " (";
+ std::tr1::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 (
+ std::tr1::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) << " (";
+ std::tr1::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 (
+ std::tr1::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) << " (";
+ std::tr1::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 (
+ std::tr1::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) << " (";
+ std::tr1::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
+
Added: sandbox/graph-path/libs/graph/example/loop_erased_random_tree.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/loop_erased_random_tree.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,79 @@
+// Copyright (C) 2004-2012 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)
+
+#include <iostream>
+#include <boost/tr1/random.hpp>
+#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-path/libs/graph/example/loop_erased_random_tree.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/example/loop_erased_random_tree.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,639 @@
+// Copyright (C) 2004-2012 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
+
+#include <iostream>
+#include <iterator>
+#include <utility>
+#include <boost/tr1/tuple.hpp>
+#include <boost/fusion/container/generation/make_list.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/visitors.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_utility.hpp>
+#include <boost/graph/vertex_property_map_gen.hpp>
+#include <boost/graph/fuse_property_writer.hpp>
+#include <boost/graph/simple_edge_writer.hpp>
+#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 (
+ 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()
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ {
+ std::cout << " Done!" << std::endl << "Tree edges:" << std::endl;
+
+ for (
+ std::tr1::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 (
+ 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"
+ )
+ )
+ )
+ )
+ {
+ std::cout << " Done!" << std::endl << "Tree edges:" << std::endl;
+
+ for (
+ std::tr1::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 (
+ std::tr1::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 (
+ std::tr1::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 (
+ std::tr1::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-path/libs/graph/test/eulerian_path_visitor.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/eulerian_path_visitor.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,39 @@
+// Copyright (C) 2012 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_TEST_EULERIAN_PATH_HPP
+#define LIBS_GRAPH_TEST_EULERIAN_PATH_HPP
+
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/visitors.hpp>
+
+template <typename PropertyMap>
+class eulerian_path_test_visitor
+{
+ unsigned int& _edge_count;
+ PropertyMap& _p_map;
+
+ public:
+ typedef boost::on_examine_edge event_filter;
+
+ eulerian_path_test_visitor(unsigned int& count, PropertyMap& p_map)
+ : _edge_count(count), _p_map(p_map)
+ {
+ }
+
+ template <typename Graph>
+ inline void
+ operator()(
+ typename boost::graph_traits<Graph>::edge_descriptor e
+ , Graph& graph
+ )
+ {
+ boost::put(_p_map, e, boost::get(_p_map, e) + 1);
+ ++_edge_count;
+ }
+};
+
+#endif // LIBS_GRAPH_TEST_EULERIAN_PATH_HPP
+
Added: sandbox/graph-path/libs/graph/test/find_eulerian_cycle.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/find_eulerian_cycle.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,43 @@
+// Copyright (C) 2012 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)
+
+#include <boost/test/minimal.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/properties.hpp>
+#include "find_eulerian_cycle.hpp"
+
+int test_main(int argc, char** argv)
+{
+ find_eulerian_cycle_test<
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::undirectedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ >
+ >(5);
+ find_eulerian_cycle_test<
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::directedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ >
+ >(5);
+ find_eulerian_cycle_test<
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::bidirectionalS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ >
+ >(5);
+ return 0;
+}
+
Added: sandbox/graph-path/libs/graph/test/find_eulerian_cycle.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/find_eulerian_cycle.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,92 @@
+// Copyright (C) 2012 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_TEST_FIND_EULERIAN_CYCLE_HPP
+#define LIBS_GRAPH_TEST_FIND_EULERIAN_CYCLE_HPP
+
+#include <iterator>
+#include <list>
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/find_eulerian_cycle.hpp>
+#include "initialize_complete_graph.hpp"
+#include "eulerian_path_visitor.hpp"
+
+template <typename Graph>
+void
+ find_eulerian_cycle_test(
+ typename boost::graph_traits<Graph>::vertices_size_type vertex_count
+ )
+{
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeMap;
+
+ Graph g(vertex_count);
+ typename boost::graph_traits<Graph>::vertex_iterator vi, vi_end, ui;
+ typename boost::graph_traits<Graph>::out_edge_iterator ei, ei_end;
+ EdgeMap edge_map = boost::get(boost::edge_weight, g);
+
+ initialize_complete_graph(g);
+
+ for (std::tr1::tie(vi, vi_end) = boost::vertices(g); vi != vi_end; ++vi)
+ {
+ EdgeList path;
+ unsigned int edge_count = 0;
+
+ for (ui = boost::vertices(g).first; ui != vi_end; ++ui)
+ {
+ for (
+ std::tr1::tie(ei, ei_end) = boost::out_edges(*ui, g);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ boost::put(edge_map, *ei, 0);
+ }
+ }
+
+ boost::find_eulerian_cycle(
+ g
+ , std::back_inserter(path)
+ , boost::visitor(
+ eulerian_path_test_visitor<EdgeMap>(edge_count, edge_map)
+ ).root_vertex(*vi)
+ );
+
+ BOOST_CHECK(path.size() == edge_count);
+ BOOST_CHECK(edge_count == boost::num_edges(g));
+ BOOST_CHECK(*vi == boost::source(path.front(), g));
+ BOOST_CHECK(*vi == boost::target(path.back(), g));
+
+ typename EdgeList::const_iterator p_itr = path.begin();
+ typename EdgeList::const_iterator p_end = path.end();
+
+ for (
+ typename EdgeList::const_iterator c_itr = path.begin();
+ ++c_itr != p_end;
+ ++p_itr
+ )
+ {
+ BOOST_CHECK(boost::target(*p_itr, g) == boost::source(*c_itr, g));
+ }
+
+ for (ui = boost::vertices(g).first; ui != vi_end; ++ui)
+ {
+ for (
+ std::tr1::tie(ei, ei_end) = boost::out_edges(*ui, g);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ BOOST_CHECK(1 == boost::get(edge_map, *ei));
+ }
+ }
+ }
+}
+
+#endif // LIBS_GRAPH_TEST_FIND_EULERIAN_CYCLE_HPP
+
Added: sandbox/graph-path/libs/graph/test/find_eulerian_trail.cpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/find_eulerian_trail.cpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,46 @@
+// Copyright (C) 2012 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)
+
+#include <boost/test/minimal.hpp>
+#include <boost/graph/adjacency_list.hpp>
+#include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/properties.hpp>
+#include "initialize_euler_graphs.hpp"
+#include "find_eulerian_trail.hpp"
+
+int test_main(int argc, char** argv)
+{
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::undirectedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ > paper_clip(4);
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::directedS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ > digraph(5);
+ boost::adjacency_list<
+ boost::listS
+ , boost::vecS
+ , boost::bidirectionalS
+ , boost::no_property
+ , boost::property<boost::edge_weight_t,unsigned int>
+ > bidigraph(5);
+
+ initialize_two_triangles(paper_clip);
+ initialize_almost_complete_graph(bidigraph);
+ initialize_almost_complete_graph(digraph);
+ find_eulerian_trail_test(paper_clip);
+ find_eulerian_trail_test(digraph);
+ find_eulerian_trail_test(bidigraph);
+
+ return 0;
+}
+
Added: sandbox/graph-path/libs/graph/test/find_eulerian_trail.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/find_eulerian_trail.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,77 @@
+// Copyright (C) 2012 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_TEST_FIND_EULERIAN_TRAIL_HPP
+#define LIBS_GRAPH_TEST_FIND_EULERIAN_TRAIL_HPP
+
+#include <iterator>
+#include <list>
+#include <boost/tr1/tuple.hpp>
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <boost/graph/find_eulerian_trail.hpp>
+#include "eulerian_path_visitor.hpp"
+
+template <typename Graph>
+void find_eulerian_trail_test(Graph& g)
+{
+ typedef std::list<typename boost::graph_traits<Graph>::edge_descriptor>
+ EdgeList;
+ typedef typename boost::property_map<Graph,boost::edge_weight_t>::type
+ EdgeMap;
+
+ EdgeList path;
+ unsigned int edge_count = 0;
+ typename boost::graph_traits<Graph>::vertex_iterator vi, vi_end;
+ typename boost::graph_traits<Graph>::out_edge_iterator ei, ei_end;
+ EdgeMap edge_map = boost::get(boost::edge_weight, g);
+
+ for (std::tr1::tie(vi, vi_end) = boost::vertices(g); vi != vi_end; ++vi)
+ {
+ for (
+ std::tr1::tie(ei, ei_end) = boost::out_edges(*vi, g);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ boost::put(edge_map, *ei, 0);
+ }
+ }
+
+ boost::find_eulerian_trail(
+ g
+ , std::back_inserter(path)
+ , eulerian_path_test_visitor<EdgeMap>(edge_count, edge_map)
+ );
+
+ BOOST_CHECK(path.size() == edge_count);
+ BOOST_CHECK(edge_count == boost::num_edges(g));
+
+ typename EdgeList::const_iterator p_itr = path.begin(), p_end = path.end();
+
+ for (
+ typename EdgeList::const_iterator c_itr = path.begin();
+ ++c_itr != p_end;
+ ++p_itr
+ )
+ {
+ BOOST_CHECK(boost::target(*p_itr, g) == boost::source(*c_itr, g));
+ }
+
+ for (std::tr1::tie(vi, vi_end) = boost::vertices(g); vi != vi_end; ++vi)
+ {
+ for (
+ std::tr1::tie(ei, ei_end) = boost::out_edges(*vi, g);
+ ei != ei_end;
+ ++ei
+ )
+ {
+ BOOST_CHECK(1 == boost::get(edge_map, *ei));
+ }
+ }
+}
+
+#endif // LIBS_GRAPH_TEST_FIND_EULERIAN_TRAIL_HPP
+
Added: sandbox/graph-path/libs/graph/test/initialize_complete_graph.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/initialize_complete_graph.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,37 @@
+// Copyright (C) 2012 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_TEST_INITIALIZE_COMPLETE_GRAPH_HPP
+#define LIBS_GRAPH_TEST_INITIALIZE_COMPLETE_GRAPH_HPP
+
+#include <boost/tr1/type_traits.hpp>
+#include <boost/graph/graph_traits.hpp>
+
+template <typename Graph>
+void initialize_complete_graph(Graph& g)
+{
+ typedef typename boost::graph_traits<Graph>::vertices_size_type Index;
+
+ for (Index j = 1; j < boost::num_vertices(g); ++j)
+ {
+ for (Index i = 0; i < j; ++i)
+ {
+ boost::add_edge(boost::vertex(i, g), boost::vertex(j, g), g);
+
+ if (
+ std::tr1::is_base_of<
+ boost::directed_tag
+ , typename boost::graph_traits<Graph>::directed_category
+ >::value
+ )
+ {
+ boost::add_edge(boost::vertex(j, g), boost::vertex(i, g), g);
+ }
+ }
+ }
+}
+
+#endif // LIBS_GRAPH_TEST_INITIALIZE_COMPLETE_GRAPH_HPP
+
Added: sandbox/graph-path/libs/graph/test/initialize_euler_graphs.hpp
==============================================================================
--- (empty file)
+++ sandbox/graph-path/libs/graph/test/initialize_euler_graphs.hpp 2012-09-09 14:27:52 EDT (Sun, 09 Sep 2012)
@@ -0,0 +1,44 @@
+// Copyright (C) 2012 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_TEST_INITIALIZE_EULER_GRAPHS_HPP
+#define LIBS_GRAPH_TEST_INITIALIZE_EULER_GRAPHS_HPP
+
+#include <boost/graph/graph_traits.hpp>
+
+template <typename Graph>
+void initialize_two_triangles(Graph& g)
+{
+ boost::add_edge(boost::vertex(0, g), boost::vertex(1, g), g);
+ boost::add_edge(boost::vertex(0, g), boost::vertex(2, g), g);
+ boost::add_edge(boost::vertex(1, g), boost::vertex(2, g), g);
+ boost::add_edge(boost::vertex(1, g), boost::vertex(3, g), g);
+ boost::add_edge(boost::vertex(2, g), boost::vertex(3, g), g);
+}
+
+template <typename Graph>
+void initialize_almost_complete_graph(Graph& g)
+{
+ typedef typename boost::graph_traits<Graph>::vertices_size_type Index;
+
+ boost::add_edge(boost::vertex(0, g), boost::vertex(1, g), g);
+ boost::add_edge(
+ boost::vertex(1, g)
+ , boost::vertex(boost::num_vertices(g) - 1, g)
+ , g
+ );
+
+ for (Index j = 2; j < boost::num_vertices(g) - 1; ++j)
+ {
+ for (Index i = 1; i < j; ++i)
+ {
+ boost::add_edge(boost::vertex(i, g), boost::vertex(j, g), g);
+ boost::add_edge(boost::vertex(j, g), boost::vertex(i, g), g);
+ }
+ }
+}
+
+#endif // LIBS_GRAPH_TEST_INITIALIZE_EULER_GRAPHS_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