1 // Copyright (C) 2004-2006 The Trustees of Indiana University.
3 // Use, modification and distribution is subject to the Boost Software
4 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // Authors: Douglas Gregor
11 // Distributed graph concepts and helpers
14 #ifndef BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP
15 #define BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP
17 #ifndef BOOST_GRAPH_USE_MPI
18 #error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
21 #include <boost/version.hpp>
22 #include <boost/graph/graph_traits.hpp>
23 #include <boost/graph/graph_concepts.hpp>
24 #include <boost/concept/assert.hpp>
26 #if BOOST_VERSION >= 103500
27 # include <boost/concept/detail/concept_def.hpp>
32 #if BOOST_VERSION >= 103500
36 #if BOOST_VERSION < 103500
39 struct DistributedVertexListGraphConcept
41 typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
42 typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
43 typedef typename graph_traits<G>::traversal_category
46 BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
47 BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<vertex_iterator> ));
48 BOOST_CONCEPT_ASSERT(( ConvertibleConcept<traversal_category,
49 distributed_vertex_list_graph_tag> ));
51 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
52 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
53 // you want to use vector_as_graph, it is! I'm sure the graph
54 // library leaves these out all over the place. Probably a
55 // redesign involving specializing a template with a static
56 // member function is in order :(
57 using boost::vertices;
63 void const_constraints(const G& cg) {
64 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
65 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
66 // you want to use vector_as_graph, it is! I'm sure the graph
67 // library leaves these out all over the place. Probably a
68 // redesign involving specializing a template with a static
69 // member function is in order :(
70 using boost::vertices;
77 std::pair<vertex_iterator,vertex_iterator> p;
78 typename graph_traits<G>::vertex_descriptor v;
84 struct DistributedEdgeListGraphConcept
86 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
87 typedef typename graph_traits<G>::edge_iterator edge_iterator;
88 typedef typename graph_traits<G>::edges_size_type edges_size_type;
89 typedef typename graph_traits<G>::traversal_category
92 BOOST_CONCEPT_ASSERT(( GraphConcept<G> ));
93 BOOST_CONCEPT_ASSERT(( MultiPassInputIteratorConcept<edge_iterator> ));
94 BOOST_CONCEPT_ASSERT(( DefaultConstructibleConcept<edge_descriptor> ));
95 BOOST_CONCEPT_ASSERT(( EqualityComparableConcept<edge_descriptor> ));
96 BOOST_CONCEPT_ASSERT(( AssignableConcept<edge_descriptor> ));
97 BOOST_CONCEPT_ASSERT(( ConvertibleConcept<traversal_category,
98 distributed_edge_list_graph_tag> ));
104 const_constraints(g);
106 void const_constraints(const G& cg) {
113 std::pair<edge_iterator,edge_iterator> p;
114 typename graph_traits<G>::vertex_descriptor u, v;
115 typename graph_traits<G>::edge_descriptor e;
120 BOOST_concept(DistributedVertexListGraph,(G))
123 typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
124 typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
125 typedef typename graph_traits<G>::traversal_category
127 ~DistributedVertexListGraph() {
128 BOOST_CONCEPT_ASSERT((MultiPassInputIterator<vertex_iterator>));
129 BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
130 distributed_vertex_list_graph_tag>));
132 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
133 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
134 // you want to use vector_as_graph, it is! I'm sure the graph
135 // library leaves these out all over the place. Probably a
136 // redesign involving specializing a template with a static
137 // member function is in order :(
138 using boost::vertices;
142 const_constraints(g);
144 void const_constraints(const G& cg) {
145 #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
146 // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
147 // you want to use vector_as_graph, it is! I'm sure the graph
148 // library leaves these out all over the place. Probably a
149 // redesign involving specializing a template with a static
150 // member function is in order :(
151 using boost::vertices;
156 V = num_vertices(cg);
158 std::pair<vertex_iterator,vertex_iterator> p;
159 typename graph_traits<G>::vertex_descriptor v;
161 vertices_size_type V;
164 BOOST_concept(DistributedEdgeListGraph,(G))
167 typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
168 typedef typename graph_traits<G>::edge_iterator edge_iterator;
169 typedef typename graph_traits<G>::edges_size_type edges_size_type;
170 typedef typename graph_traits<G>::traversal_category
172 ~DistributedEdgeListGraph() {
173 BOOST_CONCEPT_ASSERT((MultiPassInputIterator<edge_iterator>));
174 BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>));
175 BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>));
176 BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>));
177 BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
178 distributed_edge_list_graph_tag>));
184 const_constraints(g);
186 void const_constraints(const G& cg) {
193 std::pair<edge_iterator,edge_iterator> p;
194 typename graph_traits<G>::vertex_descriptor u, v;
195 typename graph_traits<G>::edge_descriptor e;
201 #if BOOST_VERSION >= 103500
202 } // end namespace concepts
204 using concepts::DistributedVertexListGraphConcept;
205 using concepts::DistributedEdgeListGraphConcept;
207 } // end namespace boost
209 #if BOOST_VERSION >= 103500
210 # include <boost/concept/detail/concept_undef.hpp>
213 #endif // BOOST_GRAPH_DISTRIBUTED_CONCEPTS_HPP