// Copyright 2008-2010 Gordon Woodhull // 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 #include #include #include namespace mpl_graph = boost::msm::mpl_graph; namespace mpl = boost::mpl; // vertices struct A{}; struct B{}; struct C{}; struct D{}; struct E{}; struct F{}; struct G{}; // edges struct A_B{}; struct B_C{}; struct C_D{}; struct C_E{}; struct C_F{}; struct B_F{}; /* incidence list test graph: A -> B -> C -\--> D \ |--> E \ \--> F \-----/ */ typedef mpl::vector, mpl::vector, mpl::vector, mpl::vector, mpl::vector, mpl::vector > some_incidence_list; typedef mpl_graph::incidence_list_graph some_incidence_list_graph; /* adjacency list test graph: A -> B -> C -\--> D \ |--> E \ \--> F \-----/ G */ typedef mpl::vector< mpl::pair > >, mpl::pair, mpl::pair > >, mpl::pair, mpl::pair, mpl::pair > >, mpl::pair > > some_adjacency_list; typedef mpl_graph::adjacency_list_graph some_adjacency_list_graph; struct preordering_visitor : mpl_graph::bfs_default_visitor_operations { template struct discover_vertex : mpl::push_back {}; }; struct postordering_visitor : mpl_graph::bfs_default_visitor_operations { template struct finish_vertex : mpl::push_back {}; }; struct examine_edge_visitor : mpl_graph::bfs_default_visitor_operations { template struct examine_edge : mpl::push_back {}; }; struct tree_edge_visitor : mpl_graph::bfs_default_visitor_operations { template struct tree_edge : mpl::push_back {}; }; // adjacency list tests // preordering, start from A typedef mpl::first, A>::type>::type preorder_adj_a; BOOST_MPL_ASSERT(( mpl::equal > )); // examine edges, start from A typedef mpl::first, A>::type>::type ex_edges_adj_a; BOOST_MPL_ASSERT(( mpl::equal > )); // tree edges, start from A typedef mpl::first, A>::type>::type tree_edges_adj_a; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering, search all, default start node (first) typedef mpl::first >::type>::type preorder_adj; BOOST_MPL_ASSERT(( mpl::equal > )); // postordering, starting at A (same as preordering because BFS fully processes one vertex b4 moving to next) typedef mpl::first, A>::type>::type postorder_adj_a; BOOST_MPL_ASSERT(( mpl::equal > )); // postordering, default start node (same as preordering because BFS fully processes one vertex b4 moving to next) typedef mpl::first >::type>::type postorder_adj; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering starting at C typedef mpl::first, C>::type>::type preorder_adj_from_c; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering, search all, starting at C typedef mpl::first, C>::type>::type preorder_adj_from_c_all; BOOST_MPL_ASSERT(( mpl::equal > )); // incidence list tests // preordering, start from A typedef mpl::first, A>::type>::type preorder_inc_a; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering, start from C typedef mpl::first, C>::type>::type preorder_inc_c; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering, default start node (first) typedef mpl::first >::type>::type preorder_inc; BOOST_MPL_ASSERT(( mpl::equal > )); // postordering, default start node typedef mpl::first >::type>::type postorder_inc; BOOST_MPL_ASSERT(( mpl::equal > )); // preordering, search all, starting at C typedef mpl::first, C>::type>::type preorder_inc_from_c; BOOST_MPL_ASSERT(( mpl::equal > )); int main() { return 0; }