1 //=======================================================================
2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
3 // Author: Jeremy G. Siek
4 //
5 // Distributed under the Boost Software License, Version 1.0. (See
6 // accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //=======================================================================
9 #include <boost/config.hpp>
10 #include <iostream>
11 #include <boost/graph/adjacency_matrix.hpp>
12 #include <boost/graph/graph_utility.hpp>
13 
14 
main()15 int main()
16 {
17   using namespace boost;
18   enum { A, B, C, D, E, F, N };
19   const char* name = "ABCDEF";
20 
21   // A directed graph
22 
23   typedef adjacency_matrix<directedS> Graph;
24   Graph g(N);
25   add_edge(B, C, g);
26   add_edge(B, F, g);
27   add_edge(C, A, g);
28   add_edge(C, C, g);
29   add_edge(D, E, g);
30   add_edge(E, D, g);
31   add_edge(F, A, g);
32 
33   std::cout << "vertex set: ";
34   print_vertices(g, name);
35   std::cout << std::endl;
36 
37   std::cout << "edge set: ";
38   print_edges(g, name);
39   std::cout << std::endl;
40 
41   std::cout << "out-edges: " << std::endl;
42   print_graph(g, name);
43   std::cout << std::endl;
44 
45   // An undirected graph
46 
47   typedef adjacency_matrix<undirectedS> UGraph;
48   UGraph ug(N);
49   add_edge(B, C, ug);
50   add_edge(B, F, ug);
51   add_edge(C, A, ug);
52   add_edge(D, E, ug);
53   add_edge(F, A, ug);
54 
55   std::cout << "vertex set: ";
56   print_vertices(ug, name);
57   std::cout << std::endl;
58 
59   std::cout << "edge set: ";
60   print_edges(ug, name);
61   std::cout << std::endl;
62 
63   std::cout << "incident edges: " << std::endl;
64   print_graph(ug, name);
65   std::cout << std::endl;
66   return 0;
67 }
68