• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //=======================================================================
2 // Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
8 #include <boost/config.hpp>
9 
10 #include <algorithm>
11 #include <vector>
12 #include <utility>
13 #include <iostream>
14 
15 #include <boost/graph/adjacency_list.hpp>
16 #include <boost/graph/reverse_graph.hpp>
17 #include <boost/graph/graph_utility.hpp>
18 
main()19 int main()
20 {
21     using namespace boost;
22     typedef adjacency_list< vecS, vecS, bidirectionalS > Graph;
23 
24     Graph G(5);
25     add_edge(0, 2, G);
26     add_edge(1, 1, G);
27     add_edge(1, 3, G);
28     add_edge(1, 4, G);
29     add_edge(2, 1, G);
30     add_edge(2, 3, G);
31     add_edge(2, 4, G);
32     add_edge(3, 1, G);
33     add_edge(3, 4, G);
34     add_edge(4, 0, G);
35     add_edge(4, 1, G);
36 
37     std::cout << "original graph:" << std::endl;
38     print_graph(G, get(vertex_index, G));
39 
40     std::cout << std::endl << "reversed graph:" << std::endl;
41 #if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 // avoid VC++ bug...
42     reverse_graph< Graph > R(G);
43     print_graph(R, get(vertex_index, G));
44 #else
45     print_graph(make_reverse_graph(G), get(vertex_index, G));
46 #endif
47 
48     return EXIT_SUCCESS;
49 }
50