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

source code of boost/libs/graph/test/adj_list_cc.cpp