1 //=======================================================================
2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, 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/graph/graph_concepts.hpp>
10 #include <boost/graph/graph_archetypes.hpp>
11 #include <boost/graph/adjacency_list.hpp>
12 #include <boost/concept/assert.hpp>
13 
main(int,char * [])14 int main(int,char*[])
15 {
16   using namespace boost;
17   // Check adjacency_list with properties
18   {
19     typedef adjacency_list<vecS, vecS, directedS,
20       property<vertex_color_t, int>,
21       property<edge_weight_t, int>
22     > Graph;
23     typedef graph_traits<Graph>::vertex_descriptor Vertex;
24     typedef graph_traits<Graph>::edge_descriptor Edge;
25     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
26     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
27     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
28     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
29     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
30     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
31     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
32     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
33     BOOST_CONCEPT_ASSERT((
34       ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
35     BOOST_CONCEPT_ASSERT((
36       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
37     BOOST_CONCEPT_ASSERT((
38       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
39   }
40   {
41     typedef adjacency_list<vecS, vecS, bidirectionalS,
42       property<vertex_color_t, int>,
43       property<edge_weight_t, int>
44     > Graph;
45     typedef graph_traits<Graph>::vertex_descriptor Vertex;
46     typedef graph_traits<Graph>::edge_descriptor Edge;
47     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
48     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
49     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
50     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
51     BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
52     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
53     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
54     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
55     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
56     BOOST_CONCEPT_ASSERT((
57       ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
58     BOOST_CONCEPT_ASSERT((
59       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
60     BOOST_CONCEPT_ASSERT((
61       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
62   }
63   {
64     typedef adjacency_list< listS, listS, directedS,
65       property<vertex_color_t, int>,
66       property<edge_weight_t, int>
67     > Graph;
68     typedef graph_traits<Graph>::vertex_descriptor Vertex;
69     typedef graph_traits<Graph>::edge_descriptor Edge;
70     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
71     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
72     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
73     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
74     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
75     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
76     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
77     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
78     BOOST_CONCEPT_ASSERT((
79       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
80     BOOST_CONCEPT_ASSERT((
81       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
82   }
83   {
84     typedef adjacency_list< listS, listS, undirectedS,
85       property<vertex_color_t, int>,
86       property<edge_weight_t, int>
87     > Graph;
88     typedef graph_traits<Graph>::vertex_descriptor Vertex;
89     typedef graph_traits<Graph>::edge_descriptor Edge;
90     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
91     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
92     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
93     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
94     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
95     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
96     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
97     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
98     BOOST_CONCEPT_ASSERT((
99       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
100     BOOST_CONCEPT_ASSERT((
101       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
102   }
103   // Checking adjacency_list with EdgeList=setS
104   {
105     typedef adjacency_list<setS, vecS, bidirectionalS,
106       property<vertex_color_t, int>,
107       property<edge_weight_t, int>
108     > Graph;
109     typedef graph_traits<Graph>::vertex_descriptor Vertex;
110     typedef graph_traits<Graph>::edge_descriptor Edge;
111     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
112     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
113     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
114     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
115     BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
116     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
117     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
118     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
119     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
120     BOOST_CONCEPT_ASSERT((
121       ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
122     BOOST_CONCEPT_ASSERT((
123       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
124     BOOST_CONCEPT_ASSERT((
125       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
126   }
127   {
128     typedef adjacency_list< setS, listS, directedS,
129       property<vertex_color_t, int>,
130       property<edge_weight_t, int>
131     > Graph;
132     typedef graph_traits<Graph>::vertex_descriptor Vertex;
133     typedef graph_traits<Graph>::edge_descriptor Edge;
134     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
135     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
136     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
137     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
138     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
139     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
140     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
141     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
142     BOOST_CONCEPT_ASSERT((
143       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
144     BOOST_CONCEPT_ASSERT((
145       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
146   }
147   {
148     typedef adjacency_list< setS, listS, undirectedS,
149       property<vertex_color_t, int>,
150       property<edge_weight_t, int>
151     > Graph;
152     typedef graph_traits<Graph>::vertex_descriptor Vertex;
153     typedef graph_traits<Graph>::edge_descriptor Edge;
154     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
155     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
156     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
157     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
158     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
159     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
160     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
161     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
162     BOOST_CONCEPT_ASSERT((
163       LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
164     BOOST_CONCEPT_ASSERT((
165       LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
166   }
167   // Check adjacency_list without any properties
168   {
169     typedef adjacency_list<vecS, vecS, directedS > Graph;
170     typedef graph_traits<Graph>::vertex_descriptor Vertex;
171     typedef graph_traits<Graph>::edge_descriptor Edge;
172     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
173     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
174     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
175     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
176     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
177     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
178     BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
179     BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
180     BOOST_CONCEPT_ASSERT((
181       ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
182   }
183   {
184     typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
185     typedef graph_traits<Graph>::vertex_descriptor Vertex;
186     typedef graph_traits<Graph>::edge_descriptor Edge;
187     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
188     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
189     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
190     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
191     BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
192     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
193     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
194     BOOST_CONCEPT_ASSERT((
195       ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
196   }
197   {
198     typedef adjacency_list< listS, listS, directedS> Graph;
199     typedef graph_traits<Graph>::vertex_descriptor Vertex;
200     typedef graph_traits<Graph>::edge_descriptor Edge;
201     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
202     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
203     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
204     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
205     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
206     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
207   }
208   {
209     typedef adjacency_list< listS, listS, undirectedS> Graph;
210     typedef graph_traits<Graph>::vertex_descriptor Vertex;
211     typedef graph_traits<Graph>::edge_descriptor Edge;
212     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
213     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
214     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
215     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
216     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
217     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
218   }
219   // Checking EdgeList=setS with no properties
220   {
221     typedef adjacency_list<setS, vecS, bidirectionalS> Graph;
222     typedef graph_traits<Graph>::vertex_descriptor Vertex;
223     typedef graph_traits<Graph>::edge_descriptor Edge;
224     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
225     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
226     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
227     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
228     BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
229     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
230     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
231     BOOST_CONCEPT_ASSERT(( ReadablePropertyGraphConcept<Graph,
232       Vertex, vertex_index_t> ));
233   }
234   {
235     typedef adjacency_list< setS, listS, directedS> Graph;
236     typedef graph_traits<Graph>::vertex_descriptor Vertex;
237     typedef graph_traits<Graph>::edge_descriptor Edge;
238     BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
239     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
240   }
241   {
242     typedef adjacency_list< setS, listS, undirectedS> Graph;
243     typedef graph_traits<Graph>::vertex_descriptor Vertex;
244     typedef graph_traits<Graph>::edge_descriptor Edge;
245     BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
246     BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
247     BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
248     BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
249     BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
250     BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
251   }
252   return 0;
253 }
254