/* transpose_graph.cpp source file * * Copyright Cromwell D. Enage 2004. Use, modification, and distribution are * subject to 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) */ /* * Defines the std::ios class and std::cout, its global output instance. */ #include /* * Defines the boost::get and boost::put function templates. */ #include /* * Defines the boost::graph_traits class template. */ #include /* * Defines the vertex and edge property tags. */ #include /* * Defines the boost::directedS and boost::undirectedS selector tags. */ #include /* * Defines the boost::print_graph function template. */ #include /* * Defines the boost::transpose_graph function template. */ #include /* * Defines the boost::bgl_named_params class template and its helper function * templates. */ #include /* * Defines the boost::adjacency_list class template and its associated * non-member function templates. */ #include /* * Defines the boost::adjacency_matrix class template and its associated * non-member function templates. */ #include template void test() { InputGraph in_g(4); boost::add_edge(boost::vertex(0, in_g), boost::vertex(1, in_g), in_g); boost::add_edge(boost::vertex(0, in_g), boost::vertex(2, in_g), in_g); boost::add_edge(boost::vertex(1, in_g), boost::vertex(2, in_g), in_g); boost::add_edge(boost::vertex(1, in_g), boost::vertex(3, in_g), in_g); boost::add_edge(boost::vertex(2, in_g), boost::vertex(3, in_g), in_g); std::cout << "Input:" << std::endl; boost::print_graph(in_g); #if 0 UtilGraph u_g(4); #else UtilGraph u_g; #endif boost::transpose_graph(in_g, u_g); std::cout << "Output:" << std::endl; boost::print_graph(u_g); } int main() { typedef boost::adjacency_list AdjList; test(); #if 0 typedef boost::adjacency_matrix AdjMatrix; test(); test(); test(); #endif return 0; }