~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/graph/test/adj_list_cc.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
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
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
80
    BOOST_CONCEPT_ASSERT(( 
 
81
      LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
 
82
    BOOST_CONCEPT_ASSERT(( 
 
83
      LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
 
84
  }
 
85
  {
 
86
    typedef adjacency_list< listS, listS, undirectedS, 
 
87
      property<vertex_color_t, int>,
 
88
      property<edge_weight_t, int>
 
89
    > Graph;
 
90
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
91
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
92
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
93
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
94
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
95
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
96
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
97
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
98
    BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
 
99
    BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
 
100
    BOOST_CONCEPT_ASSERT(( 
 
101
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
102
    BOOST_CONCEPT_ASSERT(( 
 
103
      LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
 
104
    BOOST_CONCEPT_ASSERT(( 
 
105
      LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
 
106
  }
 
107
  // Checking adjacency_list with EdgeList=setS
 
108
  {
 
109
    typedef adjacency_list<setS, vecS, bidirectionalS, 
 
110
      property<vertex_color_t, int>,
 
111
      property<edge_weight_t, int>
 
112
    > Graph;
 
113
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
114
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
115
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
116
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
117
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
118
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
119
    BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
 
120
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
121
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
122
    BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
 
123
    BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
 
124
    BOOST_CONCEPT_ASSERT(( 
 
125
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
126
    BOOST_CONCEPT_ASSERT(( 
 
127
      LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
 
128
    BOOST_CONCEPT_ASSERT(( 
 
129
      LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
 
130
  }
 
131
  {
 
132
    typedef adjacency_list< setS, listS, directedS, 
 
133
      property<vertex_color_t, int>,
 
134
      property<edge_weight_t, int>
 
135
    > Graph;
 
136
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
137
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
138
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
139
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
140
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
141
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
142
    BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
 
143
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
144
    BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
 
145
    BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
 
146
    BOOST_CONCEPT_ASSERT(( 
 
147
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
148
    BOOST_CONCEPT_ASSERT(( 
 
149
      LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
 
150
    BOOST_CONCEPT_ASSERT(( 
 
151
      LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
 
152
  }
 
153
  {
 
154
    typedef adjacency_list< setS, listS, undirectedS, 
 
155
      property<vertex_color_t, int>,
 
156
      property<edge_weight_t, int>
 
157
    > Graph;
 
158
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
159
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
160
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
161
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
162
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
163
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
164
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
165
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
166
    BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
 
167
    BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
 
168
    BOOST_CONCEPT_ASSERT(( 
 
169
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
170
    BOOST_CONCEPT_ASSERT(( 
 
171
      LvaluePropertyGraphConcept<Graph, Vertex, vertex_color_t> ));
 
172
    BOOST_CONCEPT_ASSERT(( 
 
173
      LvaluePropertyGraphConcept<Graph, Edge, edge_weight_t> ));
 
174
  }
 
175
  // Check adjacency_list without any properties
 
176
  {
 
177
    typedef adjacency_list<vecS, vecS, directedS > Graph;
 
178
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
179
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
180
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
181
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
182
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
183
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
184
    BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
 
185
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
186
    BOOST_CONCEPT_ASSERT(( VertexMutablePropertyGraphConcept<Graph> ));
 
187
    BOOST_CONCEPT_ASSERT(( EdgeMutablePropertyGraphConcept<Graph> ));
 
188
    BOOST_CONCEPT_ASSERT(( 
 
189
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
190
  }
 
191
  {
 
192
    typedef adjacency_list<vecS, vecS, bidirectionalS> Graph;
 
193
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
194
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
195
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
196
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
197
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
198
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
199
    BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
 
200
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
201
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
202
    BOOST_CONCEPT_ASSERT(( 
 
203
      ReadablePropertyGraphConcept<Graph, Vertex, vertex_index_t> ));
 
204
  }
 
205
  {
 
206
    typedef adjacency_list< listS, listS, directedS> Graph;
 
207
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
208
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
209
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
210
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
211
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
212
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
213
    BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
 
214
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
215
  }
 
216
  {
 
217
    typedef adjacency_list< listS, listS, undirectedS> Graph;
 
218
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
219
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
220
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
221
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
222
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
223
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
224
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
225
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
226
  }
 
227
  // Checking EdgeList=setS with no properties
 
228
  {
 
229
    typedef adjacency_list<setS, vecS, bidirectionalS> Graph;
 
230
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
231
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
232
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
233
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
234
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
235
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
236
    BOOST_CONCEPT_ASSERT(( BidirectionalGraphConcept<Graph> ));
 
237
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
238
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
239
    BOOST_CONCEPT_ASSERT(( ReadablePropertyGraphConcept<Graph, 
 
240
      Vertex, vertex_index_t> ));
 
241
  }
 
242
  {
 
243
    typedef adjacency_list< setS, listS, directedS> Graph;
 
244
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
245
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
246
    BOOST_CONCEPT_ASSERT(( MutableIncidenceGraphConcept<Graph> ));
 
247
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
248
  }
 
249
  {
 
250
    typedef adjacency_list< setS, listS, undirectedS> Graph;
 
251
    typedef graph_traits<Graph>::vertex_descriptor Vertex;
 
252
    typedef graph_traits<Graph>::edge_descriptor Edge;
 
253
    BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
 
254
    BOOST_CONCEPT_ASSERT(( EdgeListGraphConcept<Graph> ));
 
255
    BOOST_CONCEPT_ASSERT(( IncidenceGraphConcept<Graph> ));
 
256
    BOOST_CONCEPT_ASSERT(( AdjacencyGraphConcept<Graph> ));
 
257
    BOOST_CONCEPT_ASSERT(( MutableBidirectionalGraphConcept<Graph> ));
 
258
    BOOST_CONCEPT_ASSERT(( MutableEdgeListGraphConcept<Graph> ));
 
259
  }
 
260
  return 0;
 
261
}