Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r64935 - in trunk: boost/graph boost/pending libs/graph/test
From: asutton_at_[hidden]
Date: 2010-08-20 08:35:24


Author: asutton
Date: 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
New Revision: 64935
URL: http://svn.boost.org/trac/boost/changeset/64935

Log:
Adding graph properties to CSR graph. Updating tests.

Text files modified:
   trunk/boost/graph/compressed_sparse_row_graph.hpp | 37 +++-
   trunk/boost/pending/property.hpp | 2
   trunk/libs/graph/test/csr_graph_test.cpp | 6
   trunk/libs/graph/test/test_graphs.cpp | 303 ++++++++++++++++++++++-----------------
   trunk/libs/graph/test/typestr.hpp | 9
   5 files changed, 200 insertions(+), 157 deletions(-)

Modified: trunk/boost/graph/compressed_sparse_row_graph.hpp
==============================================================================
--- trunk/boost/graph/compressed_sparse_row_graph.hpp (original)
+++ trunk/boost/graph/compressed_sparse_row_graph.hpp 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
@@ -38,6 +38,7 @@
 #include <boost/iterator/iterator_facade.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/graph/graph_selectors.hpp>
+#include <boost/graph/properties.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/functional/hash.hpp>
 #include <boost/utility.hpp>
@@ -170,7 +171,7 @@
  * Vertex and EdgeIndex should be unsigned integral types and should
  * specialize numeric_limits.
  */
-template<typename Directed = directedS,
+template<typename Directed = directedS,
          typename VertexProperty = no_property,
          typename EdgeProperty = no_property,
          typename GraphProperty = no_property,
@@ -194,13 +195,14 @@
 
  public:
   // For Property Graph
- typedef GraphProperty graph_property_type;
+ typedef typename graph_detail::graph_prop<GraphProperty>::property graph_property_type;
+ typedef typename graph_detail::graph_prop<GraphProperty>::bundle graph_bundled;
 
   typedef detail::compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex> forward_type;
 
  public:
   /* At this time, the compressed sparse row graph can only be used to
- * create directed and bidirectional graphs. In the future,
+ * create directed and bidirectional graphs. In the future,
    * undirected CSR graphs will also be supported.
    */
   // BOOST_STATIC_ASSERT((is_same<Directed, directedS>::value));
@@ -623,7 +625,7 @@
     m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>(), global_to_local);
   }
 
- template <typename BidirectionalIteratorOrig, typename EPIterOrig,
+ template <typename BidirectionalIteratorOrig, typename EPIterOrig,
             typename GlobalToLocal>
   void
   add_edges_sorted_internal_global(
@@ -637,7 +639,7 @@
   // Add edges from a range of (source, target) pairs that are unsorted
   template <typename InputIterator, typename GlobalToLocal>
   inline void
- add_edges_internal(InputIterator first, InputIterator last,
+ add_edges_internal(InputIterator first, InputIterator last,
                      const GlobalToLocal& global_to_local) {
     typedef compressed_sparse_row_graph Graph;
     typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;
@@ -711,6 +713,13 @@
   const edge_push_back_type& operator[](const edge_descriptor& v) const
   { return m_forward.m_edge_properties[get(edge_index, *this, v)]; }
 
+ // Directly access a graph bundle
+ graph_bundled& operator[](graph_bundle_t)
+ { return get_property(*this); }
+
+ const graph_bundled& operator[](graph_bundle_t) const
+ { return get_property(*this); }
+
   // private: non-portable, requires friend templates
   inherited_vertex_properties& vertex_properties() {return *this;}
   const inherited_vertex_properties& vertex_properties() const {return *this;}
@@ -737,7 +746,9 @@
 
  public:
   // For Property Graph
- typedef GraphProperty graph_property_type;
+ typedef typename graph_detail::graph_prop<GraphProperty>::property graph_property_type;
+ typedef typename graph_detail::graph_prop<GraphProperty>::bundle graph_bundled;
+ // typedef GraphProperty graph_property_type;
 
   typedef detail::compressed_sparse_row_structure<EdgeProperty, Vertex, EdgeIndex> forward_type;
   typedef EdgeIndex /* typename boost::mpl::if_c<boost::is_same<EdgeProperty, boost::no_property>, boost::no_property, EdgeIndex> */ backward_edge_property;
@@ -990,7 +1001,7 @@
     m_forward.add_edges_sorted_internal(first_sorted, last_sorted, detail::default_construct_iterator<edge_bundled>(), global_to_local);
   }
 
- template <typename BidirectionalIteratorOrig, typename EPIterOrig,
+ template <typename BidirectionalIteratorOrig, typename EPIterOrig,
             typename GlobalToLocal>
   void
   add_edges_sorted_internal_global(
@@ -1004,7 +1015,7 @@
   // Add edges from a range of (source, target) pairs that are unsorted
   template <typename InputIterator, typename GlobalToLocal>
   inline void
- add_edges_internal(InputIterator first, InputIterator last,
+ add_edges_internal(InputIterator first, InputIterator last,
                      const GlobalToLocal& global_to_local) {
     typedef compressed_sparse_row_graph Graph;
     typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_t;
@@ -1098,7 +1109,7 @@
 
 template<BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS>
 inline Vertex
-add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g,
+add_vertex(BOOST_DIR_CSR_GRAPH_TYPE& g,
            typename BOOST_DIR_CSR_GRAPH_TYPE::vertex_bundled const& p) {
   Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size();
   g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back());
@@ -1108,7 +1119,7 @@
 
 template<BOOST_BIDIR_CSR_GRAPH_TEMPLATE_PARMS>
 inline Vertex
-add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g,
+add_vertex(BOOST_BIDIR_CSR_GRAPH_TYPE& g,
            typename BOOST_BIDIR_CSR_GRAPH_TYPE::vertex_bundled const& p) {
   Vertex old_num_verts_plus_one = g.m_forward.m_rowstart.size();
   g.m_forward.m_rowstart.push_back(g.m_forward.m_rowstart.back());
@@ -1160,7 +1171,7 @@
       EPIterOrig ep_iter_sorted,
       const GlobalToLocal& global_to_local,
       BOOST_DIR_CSR_GRAPH_TYPE& g) {
- g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted,
+ g.add_edges_sorted_internal_global(first_sorted, last_sorted, ep_iter_sorted,
                                        global_to_local);
   }
 
@@ -1180,7 +1191,7 @@
   template <BOOST_DIR_CSR_GRAPH_TEMPLATE_PARMS, typename InputIterator,
             typename GlobalToLocal>
   inline void
- add_edges_global(InputIterator first, InputIterator last,
+ add_edges_global(InputIterator first, InputIterator last,
                    const GlobalToLocal& global_to_local, BOOST_DIR_CSR_GRAPH_TYPE& g) {
     g.add_edges_internal(first, last, global_to_local);
   }
@@ -1303,7 +1314,7 @@
 // Extra, common functions
 template<BOOST_CSR_GRAPH_TEMPLATE_PARMS>
 inline typename graph_traits<BOOST_CSR_GRAPH_TYPE>::vertex_descriptor
-vertex(typename graph_traits<BOOST_CSR_GRAPH_TYPE>::vertex_descriptor i,
+vertex(typename graph_traits<BOOST_CSR_GRAPH_TYPE>::vertex_descriptor i,
        const BOOST_CSR_GRAPH_TYPE&)
 {
   return i;

Modified: trunk/boost/pending/property.hpp
==============================================================================
--- trunk/boost/pending/property.hpp (original)
+++ trunk/boost/pending/property.hpp 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
@@ -150,7 +150,7 @@
         typedef FinalType retagged;
     };
 
- // A final base case of the retag_propert_list, this will terminate a
+ // A final base case of the retag_property_list, this will terminate a
     // properly structured list.
     template<typename FinalTag>
     struct retag_property_list<FinalTag, no_property>

Modified: trunk/libs/graph/test/csr_graph_test.cpp
==============================================================================
--- trunk/libs/graph/test/csr_graph_test.cpp (original)
+++ trunk/libs/graph/test/csr_graph_test.cpp 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
@@ -39,12 +39,12 @@
 typedef boost::adjacency_list<> GraphT;
 typedef boost::erdos_renyi_iterator<boost::minstd_rand, GraphT> ERGen;
 
-struct VertexData
+struct VertexData
 {
   int index;
 };
 
-struct EdgeData
+struct EdgeData
 {
   int index_e;
 };
@@ -194,7 +194,7 @@
 
   // Check constructing a graph from iterators
   CSRGraphT g3(boost::edges_are_sorted,
- boost::make_transform_iterator(edges(g2).first,
+ boost::make_transform_iterator(edges(g2).first,
                                               boost::detail::make_edge_to_index_pair(g2)),
                boost::make_transform_iterator(edges(g2).second,
                                               boost::detail::make_edge_to_index_pair(g2)),

Modified: trunk/libs/graph/test/test_graphs.cpp
==============================================================================
--- trunk/libs/graph/test/test_graphs.cpp (original)
+++ trunk/libs/graph/test/test_graphs.cpp 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
@@ -5,13 +5,13 @@
 // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 #include <iostream>
-
 #include "typestr.hpp"
 
 #include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/adjacency_matrix.hpp>
 #include <boost/graph/undirected_graph.hpp>
 #include <boost/graph/directed_graph.hpp>
+#include <boost/graph/compressed_sparse_row_graph.hpp>
 #include <boost/graph/labeled_graph.hpp>
 #include <boost/graph/subgraph.hpp>
 
@@ -27,142 +27,173 @@
   // Bootstrap all of the tests by declaring a kind graph and asserting some
   // basic properties about it.
   {
- typedef undirected_graph<VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_undirected_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_mutable_graph<Graph>);
- BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
- Graph g;
- test_graph(g);
- }
- {
- typedef directed_graph<VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_mutable_graph<Graph>);
- BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
- Graph g;
- test_graph(g);
- }
- {
- typedef adjacency_list<vecS, vecS, undirectedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_undirected_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
- Graph g;
- test_graph(g);
- }
- {
- typedef adjacency_list<vecS, vecS, directedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
- Graph g;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(!is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_directed_unidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
- test_graph(g);
- }
- {
- // Common bidi adjlist
- typedef adjacency_list<vecS, vecS, bidirectionalS, VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
- Graph g;
- test_graph(g);
- }
- {
- // Same as above, but testing VL==listS
- typedef adjacency_list<vecS, listS, bidirectionalS, VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
- Graph g;
- test_graph(g);
- }
- {
- typedef adjacency_matrix<directedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(!is_multigraph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_mutable_edge_graph<Graph>);
- BOOST_META_ASSERT(is_mutable_edge_property_graph<Graph>);
- Graph g(N);
- test_graph(g);
- }
- {
- typedef adjacency_matrix<directedS, VertexBundle, EdgeBundle> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(!is_multigraph<Graph>);
- BOOST_META_ASSERT(has_vertex_property<Graph>);
- BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(has_edge_property<Graph>);
- BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_mutable_edge_graph<Graph>);
- BOOST_META_ASSERT(is_mutable_edge_property_graph<Graph>);
- Graph g(N);
- test_graph(g);
- }
- /*
- {
- typedef labeled_graph<directed_graph<>, unsigned> Graph;
- BOOST_META_ASSERT(is_directed_graph<Graph>);
- BOOST_META_ASSERT(is_multigraph<Graph>);
- BOOST_META_ASSERT(is_incidence_graph<Graph>);
- BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
- BOOST_META_ASSERT(is_labeled_mutable_property_graph<Graph>);
- BOOST_META_ASSERT(is_labeled_graph<Graph>);
- BOOST_META_ASSERT(!has_vertex_property<Graph>);
- BOOST_META_ASSERT(!has_bundled_vertex_property<Graph>);
- BOOST_META_ASSERT(!has_edge_property<Graph>);
- BOOST_META_ASSERT(!has_bundled_edge_property<Graph>);
- BOOST_META_ASSERT(is_labeled_mutable_graph<Graph>);
- Graph g;
- test_graph(g);
+ typedef undirected_graph<VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_undirected_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_mutable_graph<Graph>);
+ BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+ {
+ typedef directed_graph<VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_mutable_graph<Graph>);
+ BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+ {
+ typedef adjacency_list<vecS, vecS, undirectedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_undirected_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+ {
+ typedef adjacency_list<vecS, vecS, directedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
+ Graph g;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(!is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_directed_unidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
+ test_graph(g);
+ }
+ {
+ // Common bidi adjlist
+ typedef adjacency_list<vecS, vecS, bidirectionalS, VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_add_only_property_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+ {
+ // Same as above, but testing VL==listS
+ typedef adjacency_list<vecS, listS, bidirectionalS, VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_mutable_property_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+ {
+ typedef adjacency_matrix<directedS, VertexBundle, EdgeBundle, GraphBundle> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(!is_multigraph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_mutable_edge_graph<Graph>);
+ BOOST_META_ASSERT(is_mutable_edge_property_graph<Graph>);
+ Graph g(N);
+ test_graph(g);
+ }
+ {
+ typedef adjacency_matrix<directedS, VertexBundle, EdgeBundle> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(!is_multigraph<Graph>);
+ BOOST_META_ASSERT(has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_mutable_edge_graph<Graph>);
+ BOOST_META_ASSERT(is_mutable_edge_property_graph<Graph>);
+ Graph g(N);
+ test_graph(g);
+ }
+ {
+ typedef labeled_graph<directed_graph<>, unsigned> Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(is_incidence_graph<Graph>);
+ BOOST_META_ASSERT(is_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_directed_bidirectional_graph<Graph>);
+ BOOST_META_ASSERT(is_labeled_mutable_property_graph<Graph>);
+ BOOST_META_ASSERT(is_labeled_graph<Graph>);
+ BOOST_META_ASSERT(!has_vertex_property<Graph>);
+ BOOST_META_ASSERT(!has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(!has_edge_property<Graph>);
+ BOOST_META_ASSERT(!has_bundled_edge_property<Graph>);
+ BOOST_META_ASSERT(is_labeled_mutable_graph<Graph>);
+ Graph g;
+ test_graph(g);
+ }
+
+ // FIXME: CSR doesn't have mutability traits so we can't generalize the
+ // constructions of the required graph. Just assert the properties for now.
+ // NOTE: CSR graphs are also atypical in that they don't have "normal"
+ // vertex and edge properties. They're "abnormal" in the sense that they have
+ // a valid bundled type, but the property types are no_property.
+ {
+ typedef compressed_sparse_row_graph<
+ directedS, VertexBundle, EdgeBundle, GraphBundle
+ > Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(has_graph_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_graph_property<Graph>);
+ BOOST_META_ASSERT(!has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(!has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
+ }
+ {
+ typedef compressed_sparse_row_graph<
+ bidirectionalS, VertexBundle, EdgeBundle, GraphBundle
+ > Graph;
+ BOOST_META_ASSERT(is_directed_graph<Graph>);
+ BOOST_META_ASSERT(is_multigraph<Graph>);
+ BOOST_META_ASSERT(has_graph_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_graph_property<Graph>);
+ BOOST_META_ASSERT(!has_vertex_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_vertex_property<Graph>);
+ BOOST_META_ASSERT(!has_edge_property<Graph>);
+ BOOST_META_ASSERT(has_bundled_edge_property<Graph>);
   }
- */
+
 
   // TODO: What other kinds of graphs do we have here...
 

Modified: trunk/libs/graph/test/typestr.hpp
==============================================================================
--- trunk/libs/graph/test/typestr.hpp (original)
+++ trunk/libs/graph/test/typestr.hpp 2010-08-20 08:35:20 EDT (Fri, 20 Aug 2010)
@@ -15,6 +15,8 @@
 #include <cxxabi.h>
 #endif
 
+template<typename T> struct type_name { };
+
 /**
  * Return a string that describes the type of the given template parameter.
  * The type name depends on the results of the typeid operator.
@@ -22,16 +24,15 @@
  * @todo Rewrite this so that demangle will dynamically allocate the memory.
  */
 template <typename T>
-std::string typestr()
-{
+std::string typestr() {
 #if defined(__GNUC__)
     std::size_t const BUFSIZE = 8192;
     std::size_t n = BUFSIZE;
     char buf[BUFSIZE];
- abi::__cxa_demangle(typeid(T).name(), buf, &n, 0);
+ abi::__cxa_demangle(typeid(type_name<T>).name(), buf, &n, 0);
     return std::string(buf, ::strlen(buf));
 #else
- return typeid(T).name();
+ return typeid(type_name<T>).name();
 #endif
 }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk