/Src/Dependencies/Boost/boost/graph/stanford_graph.hpp

http://hadesmem.googlecode.com/ · C++ Header · 565 lines · 466 code · 53 blank · 46 comment · 5 complexity · 15f3d8649cd9826d4887280ec8dac002 MD5 · raw file

  1. //=======================================================================
  2. // Copyright 1997-2001 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. #ifndef BOOST_GRAPH_SGB_GRAPH_HPP
  10. #define BOOST_GRAPH_SGB_GRAPH_HPP
  11. #include <boost/config.hpp>
  12. #include <boost/iterator.hpp>
  13. #include <boost/operators.hpp>
  14. #include <boost/property_map/property_map.hpp>
  15. #include <boost/graph/graph_traits.hpp>
  16. #include <boost/graph/properties.hpp>
  17. // Thanks to Andreas Scherer for numerous suggestions and fixes!
  18. // This file adapts a Stanford GraphBase (SGB) Graph pointer into a
  19. // VertexListGraph. Note that a graph adaptor class is not needed,
  20. // SGB's Graph* is used as is. The VertexListGraph concept is fulfilled by
  21. // defining the appropriate non-member functions for Graph*.
  22. //
  23. // The PROTOTYPES change file extensions to SGB must be applied so
  24. // that the SGB functions have real prototypes which are necessary for
  25. // the C++ compiler. To apply the PROTOTYPES extensions, before you do
  26. // "make tests install" for SGB do "ln -s PROTOTYPES/* ." to the SGB
  27. // root directory (or just copy all the files from the PROTOTYPES
  28. // directory to the SGB root directory).
  29. //
  30. extern "C" {
  31. // We include all global definitions for the general stuff
  32. // of The Stanford GraphBase and its various graph generator
  33. // functions by reading all SGB headerfiles as in section 2 of
  34. // the "test_sample" program.
  35. #include <gb_graph.h> /* SGB data structures */
  36. #include <gb_io.h> /* SGB input/output routines */
  37. #include <gb_flip.h> /* random number generator */
  38. #include <gb_dijk.h> /* routines for shortest paths */
  39. #include <gb_basic.h> /* the basic graph operations */
  40. #undef empty /* avoid name clash with C++ standard library */
  41. inline Graph* empty( long n ) /* and provide workaround */
  42. { return board(n,0L,0L,0L,2L,0L,0L); }
  43. #include <gb_books.h> /* graphs based on literature */
  44. #include <gb_econ.h> /* graphs based on economic data */
  45. #include <gb_games.h> /* graphs based on football scores */
  46. #include <gb_gates.h> /* graphs based on logic circuits */
  47. #undef val /* avoid name clash with g++ headerfile stl_tempbuf.h */
  48. // val ==> Vertex::x.I
  49. #include <gb_lisa.h> /* graphs based on Mona Lisa */
  50. #include <gb_miles.h> /* graphs based on mileage data */
  51. #include <gb_plane.h> /* planar graphs */
  52. #include <gb_raman.h> /* Ramanujan graphs */
  53. #include <gb_rand.h> /* random graphs */
  54. #include <gb_roget.h> /* graphs based on Roget's Thesaurus */
  55. #include <gb_save.h> /* we save results in ASCII format */
  56. #include <gb_words.h> /* five-letter-word graphs */
  57. #undef weight /* avoid name clash with BGL parameter */
  58. // weight ==> Vertex::u.I
  59. }
  60. namespace boost {
  61. class sgb_edge;
  62. }
  63. class sgb_out_edge_iterator;
  64. class sgb_adj_iterator;
  65. class sgb_vertex_iterator;
  66. namespace boost {
  67. typedef Graph* sgb_graph_ptr;
  68. typedef const Graph* sgb_const_graph_ptr;
  69. struct sgb_traversal_tag :
  70. public virtual vertex_list_graph_tag,
  71. public virtual incidence_graph_tag,
  72. public virtual adjacency_graph_tag { };
  73. template <> struct graph_traits<sgb_graph_ptr> {
  74. typedef Vertex* vertex_descriptor;
  75. typedef boost::sgb_edge edge_descriptor;
  76. typedef sgb_out_edge_iterator out_edge_iterator;
  77. typedef void in_edge_iterator;
  78. typedef sgb_adj_iterator adjacency_iterator;
  79. typedef sgb_vertex_iterator vertex_iterator;
  80. typedef void edge_iterator;
  81. typedef long vertices_size_type;
  82. typedef long edge_size_type;
  83. typedef long degree_size_type;
  84. typedef directed_tag directed_category;
  85. typedef sgb_traversal_tag traversal_category;
  86. typedef allow_parallel_edge_tag edge_parallel_category;
  87. };
  88. template <> struct graph_traits<sgb_const_graph_ptr> {
  89. typedef Vertex* vertex_descriptor;
  90. typedef boost::sgb_edge edge_descriptor;
  91. typedef sgb_out_edge_iterator out_edge_iterator;
  92. typedef void in_edge_iterator;
  93. typedef sgb_adj_iterator adjacency_iterator;
  94. typedef sgb_vertex_iterator vertex_iterator;
  95. typedef void edge_iterator;
  96. typedef long vertices_size_type;
  97. typedef long edge_size_type;
  98. typedef long degree_size_type;
  99. typedef directed_tag directed_category;
  100. typedef sgb_traversal_tag traversal_category;
  101. typedef allow_parallel_edge_tag edge_parallel_category;
  102. };
  103. }
  104. namespace boost {
  105. struct edge_length_t {
  106. typedef edge_property_tag kind;
  107. };
  108. // We could just use Arc* as the edge descriptor type, but
  109. // we want to add the source(e,g) function which requires
  110. // that we carry along a pointer to the source vertex.
  111. class sgb_edge {
  112. typedef sgb_edge self;
  113. public:
  114. sgb_edge() : _arc(0), _src(0) { }
  115. sgb_edge(Arc* a, Vertex* s) : _arc(a), _src(s) { }
  116. friend Vertex* source(self e, sgb_const_graph_ptr) { return e._src; }
  117. friend Vertex* target(self e, sgb_const_graph_ptr) { return e._arc->tip; }
  118. friend bool operator==(const self& a, const self& b) {
  119. return a._arc == b._arc; }
  120. friend bool operator!=(const self& a, const self& b) {
  121. return a._arc != b._arc; }
  122. #if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
  123. template <class Ref> friend class sgb_edge_length_map;
  124. template <class Tag, class Ref> friend class sgb_edge_util_map;
  125. friend long get(edge_length_t, const sgb_graph_ptr&, const sgb_edge& key);
  126. friend long get(edge_length_t, const sgb_const_graph_ptr&, const sgb_edge& key);
  127. friend void put(edge_length_t, sgb_graph_ptr&, const sgb_edge& key, long value);
  128. protected:
  129. #endif
  130. Arc* _arc;
  131. Vertex* _src;
  132. };
  133. } // namespace boost
  134. class sgb_out_edge_iterator
  135. : public boost::forward_iterator_helper<
  136. sgb_out_edge_iterator, boost::sgb_edge,
  137. std::ptrdiff_t, boost::sgb_edge*, boost::sgb_edge>
  138. {
  139. typedef sgb_out_edge_iterator self;
  140. public:
  141. sgb_out_edge_iterator() : _src(0), _arc(0) {}
  142. sgb_out_edge_iterator(Vertex* s, Arc* d) : _src(s), _arc(d) {}
  143. boost::sgb_edge operator*() { return boost::sgb_edge(_arc, _src); }
  144. self& operator++() { _arc = _arc->next; return *this; }
  145. friend bool operator==(const self& x, const self& y) {
  146. return x._arc == y._arc; }
  147. protected:
  148. Vertex* _src;
  149. Arc* _arc;
  150. };
  151. class sgb_adj_iterator
  152. : public boost::forward_iterator_helper<
  153. sgb_adj_iterator, Vertex*, std::ptrdiff_t, Vertex**,Vertex*>
  154. {
  155. typedef sgb_adj_iterator self;
  156. public:
  157. sgb_adj_iterator() : _arc(0) {}
  158. sgb_adj_iterator(Arc* d) : _arc(d) {}
  159. Vertex* operator*() { return _arc->tip; }
  160. self& operator++() { _arc = _arc->next; return *this; }
  161. friend bool operator==(const self& x, const self& y) {
  162. return x._arc == y._arc; }
  163. protected:
  164. Arc* _arc;
  165. };
  166. // The reason we have this instead of just using Vertex* is that we
  167. // want to use Vertex* as the vertex_descriptor instead of just
  168. // Vertex, which avoids problems with boost passing vertex descriptors
  169. // by value and how that interacts with the sgb_vertex_id_map.
  170. class sgb_vertex_iterator
  171. : public boost::forward_iterator_helper<
  172. sgb_vertex_iterator, Vertex*, std::ptrdiff_t, Vertex**, Vertex*>
  173. {
  174. typedef sgb_vertex_iterator self;
  175. public:
  176. sgb_vertex_iterator() : _v(0) { }
  177. sgb_vertex_iterator(Vertex* v) : _v(v) { }
  178. Vertex* operator*() { return _v; }
  179. self& operator++() { ++_v; return *this; }
  180. friend bool operator==(const self& x, const self& y) {
  181. return x._v == y._v; }
  182. protected:
  183. Vertex* _v;
  184. };
  185. namespace boost {
  186. inline std::pair<sgb_vertex_iterator,sgb_vertex_iterator>
  187. vertices(sgb_const_graph_ptr g)
  188. {
  189. return std::make_pair(sgb_vertex_iterator(g->vertices),
  190. sgb_vertex_iterator(g->vertices + g->n));
  191. }
  192. inline std::pair<sgb_out_edge_iterator,sgb_out_edge_iterator>
  193. out_edges(Vertex* u, sgb_const_graph_ptr)
  194. {
  195. return std::make_pair( sgb_out_edge_iterator(u, u->arcs),
  196. sgb_out_edge_iterator(u, 0) );
  197. }
  198. inline boost::graph_traits<sgb_graph_ptr>::degree_size_type
  199. out_degree(Vertex* u, sgb_const_graph_ptr g)
  200. {
  201. boost::graph_traits<sgb_graph_ptr>::out_edge_iterator i, i_end;
  202. boost::tie(i, i_end) = out_edges(u, g);
  203. return std::distance(i, i_end);
  204. }
  205. // in_edges?
  206. inline std::pair<sgb_adj_iterator,sgb_adj_iterator>
  207. adjacent_vertices(Vertex* u, sgb_const_graph_ptr)
  208. {
  209. return std::make_pair( sgb_adj_iterator(u->arcs),
  210. sgb_adj_iterator(0) );
  211. }
  212. inline long num_vertices(sgb_const_graph_ptr g) { return g->n; }
  213. inline long num_edges(sgb_const_graph_ptr g) { return g->m; }
  214. inline Vertex* vertex(long v, sgb_const_graph_ptr g)
  215. { return g->vertices + v; }
  216. // Various Property Maps
  217. // Vertex ID
  218. class sgb_vertex_id_map
  219. : public boost::put_get_helper<long, sgb_vertex_id_map>
  220. {
  221. public:
  222. typedef boost::readable_property_map_tag category;
  223. typedef long value_type;
  224. typedef long reference;
  225. typedef Vertex* key_type;
  226. sgb_vertex_id_map() : _g(0) { }
  227. sgb_vertex_id_map(sgb_graph_ptr g) : _g(g) { }
  228. long operator[](Vertex* v) const { return v - _g->vertices; }
  229. protected:
  230. sgb_graph_ptr _g;
  231. };
  232. inline sgb_vertex_id_map get(vertex_index_t, sgb_graph_ptr g) {
  233. return sgb_vertex_id_map(g);
  234. }
  235. // Vertex Name
  236. class sgb_vertex_name_map
  237. : public boost::put_get_helper<char*, sgb_vertex_name_map>
  238. {
  239. public:
  240. typedef boost::readable_property_map_tag category;
  241. typedef char* value_type;
  242. typedef char* reference;
  243. typedef Vertex* key_type;
  244. char* operator[](Vertex* v) const { return v->name; }
  245. };
  246. inline sgb_vertex_name_map get(vertex_name_t, sgb_graph_ptr) {
  247. return sgb_vertex_name_map();
  248. }
  249. // Vertex Property Tags
  250. #define SGB_PROPERTY_TAG(KIND,TAG) \
  251. template <class T> struct TAG##_property { \
  252. typedef KIND##_property_tag kind; \
  253. typedef T type; \
  254. };
  255. SGB_PROPERTY_TAG(vertex, u)
  256. SGB_PROPERTY_TAG(vertex, v)
  257. SGB_PROPERTY_TAG(vertex, w)
  258. SGB_PROPERTY_TAG(vertex, x)
  259. SGB_PROPERTY_TAG(vertex, y)
  260. SGB_PROPERTY_TAG(vertex, z)
  261. // Edge Property Tags
  262. SGB_PROPERTY_TAG(edge, a)
  263. SGB_PROPERTY_TAG(edge, b)
  264. // Various Utility Maps
  265. // helpers
  266. inline Vertex*& get_util(util& u, Vertex*) { return u.V; }
  267. inline Arc*& get_util(util& u, Arc*) { return u.A; }
  268. inline sgb_graph_ptr& get_util(util& u, sgb_graph_ptr) { return u.G; }
  269. inline char*& get_util(util& u, char*) { return u.S; }
  270. inline long& get_util(util& u, long) { return u.I; }
  271. #define SGB_GET_UTIL_FIELD(KIND,X) \
  272. template <class T> \
  273. inline T& get_util_field(KIND* k, X##_property<T>) { \
  274. return get_util(k->X, T()); }
  275. SGB_GET_UTIL_FIELD(Vertex, u)
  276. SGB_GET_UTIL_FIELD(Vertex, v)
  277. SGB_GET_UTIL_FIELD(Vertex, w)
  278. SGB_GET_UTIL_FIELD(Vertex, x)
  279. SGB_GET_UTIL_FIELD(Vertex, y)
  280. SGB_GET_UTIL_FIELD(Vertex, z)
  281. SGB_GET_UTIL_FIELD(Arc, a)
  282. SGB_GET_UTIL_FIELD(Arc, b)
  283. // Vertex Utility Map
  284. template <class Tag, class Ref>
  285. class sgb_vertex_util_map
  286. : public boost::put_get_helper<Ref, sgb_vertex_util_map<Tag, Ref> >
  287. {
  288. public:
  289. typedef boost::lvalue_property_map_tag category;
  290. typedef typename Tag::type value_type;
  291. typedef Vertex* key_type;
  292. typedef Ref reference;
  293. reference operator[](Vertex* v) const {
  294. return get_util_field(v, Tag());
  295. }
  296. };
  297. // Edge Utility Map
  298. template <class Tag, class Ref>
  299. class sgb_edge_util_map
  300. : public boost::put_get_helper<Ref, sgb_edge_util_map<Tag, Ref> >
  301. {
  302. public:
  303. typedef boost::lvalue_property_map_tag category;
  304. typedef typename Tag::type value_type;
  305. typedef Vertex* key_type;
  306. typedef Ref reference;
  307. reference operator[](const sgb_edge& e) const {
  308. return get_util_field(e._arc, Tag());
  309. }
  310. };
  311. #if !defined BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  312. template <class Tag>
  313. inline sgb_vertex_util_map<Tag, const typename Tag::type&>
  314. get_property_map(Tag, const sgb_graph_ptr& g, vertex_property_tag) {
  315. return sgb_vertex_util_map<Tag, const typename Tag::type&>();
  316. }
  317. template <class Tag>
  318. inline sgb_vertex_util_map<Tag, typename Tag::type&>
  319. get_property_map(Tag, sgb_graph_ptr& g, vertex_property_tag) {
  320. return sgb_vertex_util_map<Tag, typename Tag::type&>();
  321. }
  322. template <class Tag>
  323. inline sgb_edge_util_map<Tag, const typename Tag::type&>
  324. get_property_map(Tag, const sgb_graph_ptr& g, edge_property_tag) {
  325. return sgb_edge_util_map<Tag, const typename Tag::type&>();
  326. }
  327. template <class Tag>
  328. inline sgb_edge_util_map<Tag, typename Tag::type&>
  329. get_property_map(Tag, sgb_graph_ptr& g, edge_property_tag) {
  330. return sgb_edge_util_map<Tag, typename Tag::type&>();
  331. }
  332. #endif // ! BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  333. // Edge Length Access
  334. template <class Ref>
  335. class sgb_edge_length_map
  336. : public boost::put_get_helper<Ref, sgb_edge_length_map<Ref> >
  337. {
  338. public:
  339. typedef boost::lvalue_property_map_tag category;
  340. typedef long value_type;
  341. typedef sgb_edge key_type;
  342. typedef Ref reference;
  343. reference operator[](const sgb_edge& e) const {
  344. return e._arc->len;
  345. }
  346. };
  347. inline sgb_edge_length_map<const long&>
  348. get(edge_length_t, const sgb_graph_ptr&) {
  349. return sgb_edge_length_map<const long&>();
  350. }
  351. inline sgb_edge_length_map<const long&>
  352. get(edge_length_t, const sgb_const_graph_ptr&) {
  353. return sgb_edge_length_map<const long&>();
  354. }
  355. inline sgb_edge_length_map<long&>
  356. get(edge_length_t, sgb_graph_ptr&) {
  357. return sgb_edge_length_map<long&>();
  358. }
  359. inline long
  360. get(edge_length_t, const sgb_graph_ptr&, const sgb_edge& key) {
  361. return key._arc->len;
  362. }
  363. inline long
  364. get(edge_length_t, const sgb_const_graph_ptr&, const sgb_edge& key) {
  365. return key._arc->len;
  366. }
  367. inline void
  368. put(edge_length_t, sgb_graph_ptr&, const sgb_edge& key, long value)
  369. {
  370. key._arc->len = value;
  371. }
  372. // Property Map Traits Classes
  373. template <>
  374. struct property_map<sgb_graph_ptr, edge_length_t> {
  375. typedef sgb_edge_length_map<long&> type;
  376. typedef sgb_edge_length_map<const long&> const_type;
  377. };
  378. template <>
  379. struct property_map<sgb_graph_ptr, vertex_index_t> {
  380. typedef sgb_vertex_id_map type;
  381. typedef sgb_vertex_id_map const_type;
  382. };
  383. template <>
  384. struct property_map<sgb_graph_ptr, vertex_name_t> {
  385. typedef sgb_vertex_name_map type;
  386. typedef sgb_vertex_name_map const_type;
  387. };
  388. template <>
  389. struct property_map<sgb_const_graph_ptr, edge_length_t> {
  390. typedef sgb_edge_length_map<const long&> const_type;
  391. };
  392. template <>
  393. struct property_map<sgb_const_graph_ptr, vertex_index_t> {
  394. typedef sgb_vertex_id_map const_type;
  395. };
  396. template <>
  397. struct property_map<sgb_const_graph_ptr, vertex_name_t> {
  398. typedef sgb_vertex_name_map const_type;
  399. };
  400. #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
  401. namespace detail {
  402. template <class Kind, class PropertyTag>
  403. struct sgb_choose_property_map { };
  404. template <class PropertyTag>
  405. struct sgb_choose_property_map<vertex_property_tag, PropertyTag> {
  406. typedef typename PropertyTag::type value_type;
  407. typedef sgb_vertex_util_map<PropertyTag, value_type&> type;
  408. typedef sgb_vertex_util_map<PropertyTag, const value_type&> const_type;
  409. };
  410. template <class PropertyTag>
  411. struct sgb_choose_property_map<edge_property_tag, PropertyTag> {
  412. typedef typename PropertyTag::type value_type;
  413. typedef sgb_edge_util_map<PropertyTag, value_type&> type;
  414. typedef sgb_edge_util_map<PropertyTag, const value_type&> const_type;
  415. };
  416. } // namespace detail
  417. template <class PropertyTag>
  418. struct property_map<sgb_graph_ptr, PropertyTag> {
  419. typedef typename property_kind<PropertyTag>::type Kind;
  420. typedef detail::sgb_choose_property_map<Kind, PropertyTag> Choice;
  421. typedef typename Choice::type type;
  422. typedef typename Choice::const_type const_type;
  423. };
  424. template <class PropertyTag>
  425. struct property_map<sgb_const_graph_ptr, PropertyTag> {
  426. typedef typename property_kind<PropertyTag>::type Kind;
  427. typedef detail::sgb_choose_property_map<Kind, PropertyTag> Choice;
  428. typedef typename Choice::const_type const_type;
  429. };
  430. #define SGB_UTIL_ACCESSOR(KIND,X) \
  431. template <class T> \
  432. inline sgb_##KIND##_util_map< X##_property<T>, T&> \
  433. get(X##_property<T>, sgb_graph_ptr&) { \
  434. return sgb_##KIND##_util_map< X##_property<T>, T&>(); \
  435. } \
  436. template <class T> \
  437. inline sgb_##KIND##_util_map< X##_property<T>, const T&> \
  438. get(X##_property<T>, const sgb_graph_ptr&) { \
  439. return sgb_##KIND##_util_map< X##_property<T>, const T&>(); \
  440. } \
  441. template <class T> \
  442. inline sgb_##KIND##_util_map< X##_property<T>, const T&> \
  443. get(X##_property<T>, const sgb_const_graph_ptr&) { \
  444. return sgb_##KIND##_util_map< X##_property<T>, const T&>(); \
  445. } \
  446. template <class T, class Key> \
  447. inline typename \
  448. sgb_##KIND##_util_map< X##_property<T>, const T&>::value_type \
  449. get(X##_property<T>, const sgb_graph_ptr&, const Key& key) { \
  450. return sgb_##KIND##_util_map< X##_property<T>, const T&>()[key]; \
  451. } \
  452. template <class T, class Key> \
  453. inline typename \
  454. sgb_##KIND##_util_map< X##_property<T>, const T&>::value_type \
  455. get(X##_property<T>, const sgb_const_graph_ptr&, const Key& key) { \
  456. return sgb_##KIND##_util_map< X##_property<T>, const T&>()[key]; \
  457. } \
  458. template <class T, class Key, class Value> \
  459. inline void \
  460. put(X##_property<T>, sgb_graph_ptr&, const Key& key, const Value& value) { \
  461. sgb_##KIND##_util_map< X##_property<T>, T&>()[key] = value; \
  462. }
  463. #else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  464. #define SGB_UTIL_ACCESSOR_TYPE(KIND,TAG,TYPE) \
  465. inline sgb_##KIND##_util_map< TAG<TYPE>, TYPE& > \
  466. get(TAG<TYPE>, sgb_graph_ptr&) { \
  467. return sgb_##KIND##_util_map< TAG<TYPE>, TYPE& >(); \
  468. } \
  469. inline sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& > \
  470. get(TAG<TYPE>, const sgb_graph_ptr&) { \
  471. return sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >(); \
  472. } \
  473. inline sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& > \
  474. get(TAG<TYPE>, const sgb_const_graph_ptr&) { \
  475. return sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >(); \
  476. } \
  477. template <class Key> \
  478. inline typename sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >::value_type \
  479. get(TAG<TYPE>, const sgb_graph_ptr&, const Key& key) { \
  480. return sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >()[key]; \
  481. } \
  482. template <class Key> \
  483. inline typename sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >::value_type \
  484. get(TAG<TYPE>, const sgb_const_graph_ptr&, const Key& key) { \
  485. return sgb_##KIND##_util_map< TAG<TYPE>, const TYPE& >()[key]; \
  486. } \
  487. template <class Key, class Value> \
  488. inline void \
  489. put(TAG<TYPE>, sgb_graph_ptr&, const Key& key, const Value& value) { \
  490. sgb_##KIND##_util_map< TAG<TYPE>, TYPE& >()[key] = value; \
  491. } \
  492. template <> struct property_map<sgb_graph_ptr, TAG<TYPE> > { \
  493. typedef sgb_##KIND##_util_map< TAG<TYPE>, TYPE&> type; \
  494. typedef sgb_##KIND##_util_map< TAG<TYPE>, const TYPE&> const_type; \
  495. }
  496. #define SGB_UTIL_ACCESSOR(KIND,TAG) \
  497. SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, Vertex*); \
  498. SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, Arc*); \
  499. SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, sgb_graph_ptr); \
  500. SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, long); \
  501. SGB_UTIL_ACCESSOR_TYPE(KIND, TAG##_property, char*);
  502. #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
  503. SGB_UTIL_ACCESSOR(vertex, u)
  504. SGB_UTIL_ACCESSOR(vertex, v)
  505. SGB_UTIL_ACCESSOR(vertex, w)
  506. SGB_UTIL_ACCESSOR(vertex, x)
  507. SGB_UTIL_ACCESSOR(vertex, y)
  508. SGB_UTIL_ACCESSOR(vertex, z)
  509. SGB_UTIL_ACCESSOR(edge, a)
  510. SGB_UTIL_ACCESSOR(edge, b)
  511. } // namespace boost
  512. #endif // BOOST_GRAPH_SGB_GRAPH_HPP