• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // (C) Copyright 2009 Andrew Sutton
2 //
3 // Use, modification and distribution are subject to the
4 // Boost Software License, Version 1.0 (See accompanying file
5 // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6 
7 /*
8    IMPORTANT!!!
9    ~~~~~~~~~~~~
10 
11    This example does not compile, see
12    https://github.com/boostorg/graph/issues/147
13 
14 */
15 
16 #include <iostream>
17 #include <string>
18 
19 #include <boost/graph/directed_graph.hpp>
20 #include <boost/graph/labeled_graph.hpp>
21 
22 using namespace boost;
23 using namespace std;
24 
main()25 int main()
26 {
27 
28     using namespace boost::graph_detail;
29 
30     typedef directed_graph<> Digraph;
31 
32     {
33         typedef labeled_graph< Digraph, unsigned > Graph;
34         Graph g;
35         add_vertex(1, g);
36         add_vertex(2, g);
37 
38         Graph h(12);
39     }
40 
41     {
42         typedef labeled_graph< Digraph, string > Graph;
43         Graph g;
44         add_vertex("foo", g);
45         add_vertex("bar", g);
46     }
47 
48     {
49         typedef labeled_graph< Digraph, string, mapS > Graph;
50         Graph g;
51         add_vertex("foo", g);
52         add_vertex("bar", g);
53         add_vertex("foo", g);
54     }
55 
56     {
57         typedef labeled_graph< Digraph*, int > TempGraph;
58         Digraph g;
59         TempGraph h(&g);
60         add_vertex(12, h);
61     }
62 
63     {
64         // This is actually a fairly complicated specialization.
65         typedef adjacency_list< vecS, vecS, bidirectionalS > G;
66         typedef labeled_graph< G, size_t > Graph;
67         Graph g;
68         add_vertex(0, g);
69         add_vertex(1, g);
70         g.add_edge(0, 1);
71     }
72 
73     return 0;
74 }
75