Boost logo

Boost-Commit :

From: asutton_at_[hidden]
Date: 2007-08-24 09:20:12


Author: asutton
Date: 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
New Revision: 38888
URL: http://svn.boost.org/trac/boost/changeset/38888

Log:
Rewrote the archetype code to not requrie directional/parallel args
Rewrote all the tests
Building runtime tests also builds compile-time tests

Text files modified:
   sandbox/SOC/2007/graphs/libs/graph/test/Jamfile.v2 | 22 +--------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 | 10 ++--
   sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp | 4
   sandbox/SOC/2007/graphs/libs/graph/test/concept/bron_kerbosch_all_cliques.cpp | 25 +++-------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality.cpp | 27 +++++------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/clustering_coefficient.cpp | 47 +++++++++----------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality.cpp | 62 ++++++++++----------------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/eccentricity.cpp | 32 ++++++-------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/mean_geodesic.cpp | 37 ++++++---------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/new_archetypes.hpp | 69 ++++++++++++++++-------------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/test_new_archetypes.cpp | 93 ++++++++++++++++++---------------------
   sandbox/SOC/2007/graphs/libs/graph/test/concept/tiernan_all_cycles.cpp | 19 +++-----
   12 files changed, 197 insertions(+), 250 deletions(-)

Modified: sandbox/SOC/2007/graphs/libs/graph/test/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/Jamfile.v2 (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/Jamfile.v2 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -7,6 +7,8 @@
         <include>$BOOST_ROOT
     ;
 
+build-project concept ;
+
 test-suite graph_test :
     [ run constant_property_map.cpp ]
     [ run degree_centrality.cpp ]
@@ -15,24 +17,6 @@
     [ run eccentricity.cpp ]
     [ run tiernan_all_cycles.cpp ]
     [ run bron_kerbosch_all_cliques.cpp ]
+ [ run clustering_coefficient.cpp ]
     ;
 
-# exe properties : properties.cpp ;
-#
-# exe mutable : mutable.cpp ;
-#
-# exe index : index.cpp ;
-#
-# exe range : range.cpp ;
-#
-# exe misc : misc.cpp ;
-#
-# exe components : components.cpp ;
-#
-exe clustering_coefficient : clustering_coefficient.cpp ;
-#
-# exe generate : generate.cpp ;
-#
-# exe exterior : exterior.cpp ;
-
-

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -9,11 +9,11 @@
 
 test-suite graph_test :
     [ compile test_new_archetypes.cpp ]
- [ compile degree_centrality_check.cpp ]
- [ compile closeness_centrality_check.cpp ]
- [ compile mean_geodesic_check.cpp ]
- [ compile eccentricity_check.cpp ]
+ [ compile degree_centrality.cpp ]
+ [ compile closeness_centrality.cpp ]
+ [ compile mean_geodesic.cpp ]
+ [ compile eccentricity.cpp ]
     [ compile clustering_coefficient.cpp ]
     [ compile tiernan_all_cycles.cpp ]
     [ compile bron_kerbosch_all_cliques.cpp ]
- ;
\ No newline at end of file
+ ;

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/archetypes.hpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -17,7 +17,7 @@
     struct vertex_index_graph_archetype
         : public property_graph_archetype<GraphArchetype, vertex_index_t, unsigned>
     {
- typedef unsigned vertex_index_type;
+ typedef unsigned int vertex_index_type;
         typedef property_graph_archetype<GraphArchetype, vertex_index_t, vertex_index_type> BaseType;
         typedef typename BaseType::vertex_property_type vertex_property_type;
         typedef void edge_property_type;
@@ -34,7 +34,7 @@
     struct edge_index_graph_archetype
         : public property_graph_archetype<GraphArchetype, edge_index_t, unsigned>
     {
- typedef unsigned edge_index_type;
+ typedef unsigned int edge_index_type;
         typedef property_graph_archetype<GraphArchetype, edge_index_t, edge_index_type> BaseType;
         typedef void vertex_property_type;
         typedef typename BaseType::edge_property_type edge_property_type;

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/bron_kerbosch_all_cliques.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/bron_kerbosch_all_cliques.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/bron_kerbosch_all_cliques.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -15,24 +15,15 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
     {
- typedef incidence_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > IncidenceGraph;
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- IncidenceGraph
- > VertexListGraph;
- typedef adjacency_matrix_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- VertexListGraph
- > AdjacencyMatrix;
- typedef vertex_index_graph_archetype<
- AdjacencyMatrix
- > VertexIndexGraph;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef vertex_list_graph_archetype<IncidenceGraph> VertexListGraph;
+ typedef adjacency_matrix_archetype<VertexListGraph> AdjacencyMatrix;
+ typedef vertex_index_graph_archetype<AdjacencyMatrix> VertexIndexGraph;
         typedef clique_visitor_archetype CliqueVisitor;
 
         VertexIndexGraph& g = static_object<VertexIndexGraph>::get();

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -13,18 +13,20 @@
 int
 main(int argc, char *argv[])
 {
+ // This is the base type for all graphs.
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef writable_property_map_archetype<Vertex, float> CentralityMap;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
         typedef readable_property_map_archetype<Vertex, DistanceMap> DistanceMatrix;
- typedef distance_measure_archetype<Graph, size_t, float> Measure;
+ typedef distance_measure_archetype<VertexListGraph, size_t, float> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         CentralityMap cm;
         DistanceMatrix dm;
         Measure m;
@@ -34,15 +36,12 @@
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
- typedef distance_measure_archetype<Graph, size_t, float> Measure;
+ typedef distance_measure_archetype<VertexListGraph, size_t, float> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         DistanceMap dm;
         Measure m;
 

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/clustering_coefficient.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/clustering_coefficient.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/clustering_coefficient.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -15,26 +15,29 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > VertexListGraph;
- typedef incidence_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- VertexListGraph
- > IncidenceGraph;
- typedef adjacency_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- IncidenceGraph
- > AdjacencyGraph;
- typedef adjacency_matrix_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- AdjacencyGraph
- > AdjacencyMatrix;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef incidence_graph_archetype<VertexListGraph> IncidenceGraph;
+ typedef adjacency_graph_archetype<IncidenceGraph> AdjacencyGraph;
+ typedef adjacency_matrix_archetype<AdjacencyGraph> AdjacencyMatrix;
+ typedef graph_traits<AdjacencyMatrix>::vertex_descriptor Vertex;
+ typedef writable_property_map_archetype<Vertex, float> ClusteringMap;
+
+ AdjacencyMatrix& g = static_object<AdjacencyMatrix>::get();
+ Vertex v = static_object<Vertex>::get();
+ ClusteringMap cm;
+
+ all_clustering_coefficients(g, cm);
+ }
+
+ {
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef adjacency_graph_archetype<IncidenceGraph> AdjacencyGraph;
+ typedef adjacency_matrix_archetype<AdjacencyGraph> AdjacencyMatrix;
         typedef graph_traits<AdjacencyMatrix>::vertex_descriptor Vertex;
         typedef writable_property_map_archetype<Vertex, float> ClusteringMap;
 
@@ -45,14 +48,10 @@
         num_paths_through_vertex(g, v);
         num_triangles_on_vertex(g, v);
         clustering_coefficient(g, v);
- all_clustering_coefficients(g, cm);
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > VertexListGraph;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
         typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, float> ClusteringMap;
 

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -4,6 +4,7 @@
 // Boost Software License, Version 1.0 (See accompanying file
 // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
+#include <iostream>
 #include "archetypes.hpp"
 #include <boost/graph/degree_centrality.hpp>
 
@@ -13,21 +14,19 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
+
     {
- typedef incidence_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > IncidenceGraph;
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- IncidenceGraph
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef vertex_list_graph_archetype<IncidenceGraph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef writable_property_map_archetype<Vertex, size_t> CentralityMap;
- typedef degree_measure_archetype<Graph> Measure;
+ typedef degree_measure_archetype<VertexListGraph> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         CentralityMap cm;
         Measure m;
 
@@ -36,20 +35,13 @@
     }
 
     {
- typedef vertex_list_graph_archetype<
- directed_tag,
- allow_parallel_edge_tag
- > VertexListGraph;
- typedef bidirectional_graph_archetype<
- directed_tag,
- allow_parallel_edge_tag,
- VertexListGraph
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef bidirectional_graph_archetype<VertexListGraph> BidirectionalGraph;
+ typedef graph_traits<BidirectionalGraph>::vertex_descriptor Vertex;
         typedef read_write_property_map_archetype<Vertex, size_t> CentralityMap;
- typedef degree_measure_archetype<Graph> Measure;
+ typedef degree_measure_archetype<BidirectionalGraph> Measure;
 
- Graph& g = static_object<Graph>::get();
+ BidirectionalGraph& g = static_object<BidirectionalGraph>::get();
         CentralityMap cm;
         Measure m;
 
@@ -59,14 +51,11 @@
     }
 
     {
- typedef incidence_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
- typedef degree_measure_archetype<Graph> Measure;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef graph_traits<IncidenceGraph>::vertex_descriptor Vertex;
+ typedef degree_measure_archetype<IncidenceGraph> Measure;
 
- Graph& g = static_object<Graph>::get();
+ IncidenceGraph& g = static_object<IncidenceGraph>::get();
         Vertex v = static_object<Vertex>::get();
         Measure m;
 
@@ -75,14 +64,11 @@
     }
 
     {
- typedef bidirectional_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef Graph::vertex_descriptor Vertex;
- typedef degree_measure_archetype<Graph> Measure;
+ typedef bidirectional_graph_archetype<Graph> BidirectionalGraph;
+ typedef graph_traits<BidirectionalGraph>::vertex_descriptor Vertex;
+ typedef degree_measure_archetype<BidirectionalGraph> Measure;
 
- Graph& g = static_object<Graph>::get();
+ BidirectionalGraph& g = static_object<BidirectionalGraph>::get();
         Vertex v = static_object<Vertex>::get();
         Measure m;
 

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/eccentricity.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/eccentricity.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/eccentricity.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -13,17 +13,19 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
+
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef writable_property_map_archetype<Vertex, float> EccentricityMap;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
         typedef readable_property_map_archetype<Vertex, DistanceMap> DistanceMatrix;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         EccentricityMap em;
         DistanceMatrix dm;
 
@@ -31,28 +33,22 @@
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         DistanceMap dm;
 
         eccentricity(g, dm);
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, size_t> EccentricityMap;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         EccentricityMap em;
 
         radius(g, em);

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/mean_geodesic.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/mean_geodesic.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/mean_geodesic.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -13,18 +13,19 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef writable_property_map_archetype<Vertex, float> CentralityMap;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
         typedef readable_property_map_archetype<Vertex, DistanceMap> DistanceMatrix;
- typedef distance_measure_archetype<Graph, size_t, float> Measure;
+ typedef distance_measure_archetype<VertexListGraph, size_t, float> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         CentralityMap cm;
         DistanceMatrix dm;
         Measure m;
@@ -34,15 +35,12 @@
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, size_t> DistanceMap;
- typedef distance_measure_archetype<Graph, size_t, float> Measure;
+ typedef distance_measure_archetype<VertexListGraph, size_t, float> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         DistanceMap dm;
         Measure m;
 
@@ -51,15 +49,12 @@
     }
 
     {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > Graph;
- typedef graph_traits<Graph>::vertex_descriptor Vertex;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
+ typedef graph_traits<VertexListGraph>::vertex_descriptor Vertex;
         typedef readable_property_map_archetype<Vertex, float> CentralityMap;
- typedef distance_measure_archetype<Graph, float, float> Measure;
+ typedef distance_measure_archetype<VertexListGraph, float, float> Measure;
 
- Graph& g = static_object<Graph>::get();
+ VertexListGraph& g = static_object<VertexListGraph>::get();
         CentralityMap cm;
         Measure m;
 

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/new_archetypes.hpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/new_archetypes.hpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/new_archetypes.hpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -71,6 +71,12 @@
         descriptor_archetype(detail::dummy_constructor) { }
     };
 
+ // NOTE: working with this stuff is kind of strange because the ordering
+ // of template parameters changes from the graph archetype to its refinements.
+ // Essentially, aggregate types derive their directionality and parallelism
+ // through the graph archetype using default parameters. However, the graph
+ // archetype requires those to be made explicit.
+
     //
     // Graph
     //
@@ -93,14 +99,14 @@
     //
     // IncidenceGraph
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype>
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct incidence_graph_archetype
- : public graph_archetype<Directed, Parallel, Base>
+ : public graph_archetype<Directed,Parallel,Base>
     {
         typedef graph_archetype<Directed,Parallel,Base> BaseType;
- typedef unsigned degree_size_type;
+ typedef unsigned int degree_size_type;
         typedef input_iterator_archetype<typename BaseType::edge_descriptor> out_edge_iterator;
         struct traversal_category : incidence_graph_tag, Base::traversal_category { };
     };
@@ -142,13 +148,15 @@
     //
     // BidirectionalGraph
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype>
+ // Note that this derives from incidience graph rather than just graph.
+ // This is how concepts get refined.
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct bidirectional_graph_archetype
- : public incidence_graph_archetype<Directed, Parallel, Base>
+ : public incidence_graph_archetype<Base,Directed,Parallel>
     {
- typedef incidence_graph_archetype<Directed,Parallel,Base> BaseType;
+ typedef incidence_graph_archetype<Base,Directed,Parallel> BaseType;
         typedef input_iterator_archetype<typename BaseType::edge_descriptor> in_edge_iterator;
         struct traversal_category : bidirectional_graph_tag, Base::traversal_category { };
     };
@@ -172,11 +180,11 @@
     //
     // AdjacencyGraph
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype>
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct adjacency_graph_archetype
- : public graph_archetype<Directed, Parallel, Base>
+ : public graph_archetype<Directed,Parallel,Base>
     {
         typedef graph_archetype<Directed,Parallel,Base> BaseType;
         typedef input_iterator_archetype<typename BaseType::vertex_descriptor> adjacency_iterator;
@@ -196,14 +204,14 @@
     //
     // VertexListGraph
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype >
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct vertex_list_graph_archetype
- : public graph_archetype<Directed, Parallel, Base>
+ : public graph_archetype<Directed,Parallel,Base>
     {
         typedef graph_archetype<Directed,Parallel,Base> BaseType;
- typedef unsigned vertices_size_type;
+ typedef unsigned int vertices_size_type;
         typedef input_iterator_archetype<typename BaseType::vertex_descriptor> vertex_iterator;
         struct traversal_category : public vertex_list_graph_tag, Base::traversal_category { };
     };
@@ -225,14 +233,14 @@
     //
     // EdgeListGraph
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype >
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct edge_list_graph_archetype
- : public graph_archetype<Directed, Parallel, Base>
+ : public graph_archetype<Directed,Parallel,Base>
     {
         typedef graph_archetype<Directed,Parallel,Base> BaseType;
- typedef unsigned edges_size_type;
+ typedef unsigned int edges_size_type;
         typedef input_iterator_archetype<typename BaseType::edge_descriptor> edge_iterator;
         struct traversal_category : public edge_list_graph_tag, Base::traversal_category { };
     };
@@ -255,11 +263,11 @@
     //
     // AdjacencyMatrix
     //
- template <typename Directed,
- typename Parallel,
- typename Base = detail::null_graph_archetype >
+ template <typename Base = detail::null_graph_archetype,
+ typename Directed = typename Base::directed_category,
+ typename Parallel = typename Base::edge_parallel_category>
     struct adjacency_matrix_archetype
- : public graph_archetype<Directed, Parallel, Base>
+ : public graph_archetype<Directed,Parallel,Base>
     {
         // apparently, this type doesn't contribuet a graph tag to the
         // traversal category. Fine by me...
@@ -276,7 +284,7 @@
     }
 
     //
- // ProprertyGraph
+ // PropertyGraph
     //
     // I don't know how this works for bundled properties. I might need to
     // build a separate archetype for building bundled properties - and it
@@ -361,5 +369,4 @@
     }
 }
 
-
-#endif // BOOST_GRAPH_ARCHETYPES_HPP
+#endif

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/test_new_archetypes.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/test_new_archetypes.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/test_new_archetypes.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -26,6 +26,11 @@
 bool is_edge_list(const edge_list_graph_tag&)
 { return true; }
 
+// NOTE: The rule for instantiating archetypes is as follows: Always start
+// by instantiating the graph archetype with definite directionality and
+// edge parallelism. Any other archetypes simply compose that. See below for
+// examples.
+
 int
 main(int argc, char *argv[])
 {
@@ -46,10 +51,11 @@
 
     // an incidence graph allows access to the out-edges of a vertex
     {
- typedef incidence_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > IncidenceGraph;
+ > Graph;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
         typedef IncidenceGraph::vertex_descriptor Vertex;
         typedef IncidenceGraph::edge_descriptor Edge;
         typedef IncidenceGraph::directed_category Directed;
@@ -70,10 +76,11 @@
 
     // bidirectional graphs provide accesst to both the out and in edges
     {
- typedef bidirectional_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > BidirectionalGraph;
+ > Graph;
+ typedef bidirectional_graph_archetype<Graph> BidirectionalGraph;
         typedef BidirectionalGraph::vertex_descriptor Vertex;
         typedef BidirectionalGraph::edge_descriptor Edge;
         typedef BidirectionalGraph::directed_category Directed;
@@ -99,10 +106,11 @@
     // This instantiates the non-compound adjacency list archetype
     // It shouldn't be implementing any of the other graph concepts
     {
- typedef adjacency_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > AdjacencyGraph;
+ > Graph;
+ typedef adjacency_graph_archetype<Graph> AdjacencyGraph;
         typedef AdjacencyGraph::vertex_descriptor Vertex;
         typedef AdjacencyGraph::edge_descriptor Edge;
         typedef AdjacencyGraph::directed_category Directed;
@@ -119,15 +127,12 @@
     // Make a bidirectional adjacency list (this is like part of a
     // bidirected graph).
     {
- typedef bidirectional_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > BidirectionalGraph;
- typedef adjacency_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- BidirectionalGraph
- > AdjacencyGraph;
+ > Graph;
+ typedef bidirectional_graph_archetype<Graph> BidirectionalGraph;
+ typedef adjacency_graph_archetype<BidirectionalGraph> AdjacencyGraph;
         typedef AdjacencyGraph::traversal_category Traversal;
         typedef AdjacencyGraph::vertex_descriptor Vertex;
         typedef AdjacencyGraph::edge_descriptor Edge;
@@ -149,11 +154,12 @@
     }
 
     // test a solo vertex list graph
- {
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > VertexListGraph;
+ {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
+ typedef vertex_list_graph_archetype<Graph> VertexListGraph;
         typedef VertexListGraph::vertex_descriptor Vertex;
         typedef VertexListGraph::edge_descriptor Edge;
         typedef VertexListGraph::directed_category Directed;
@@ -171,15 +177,12 @@
     // test an incident vertex list graph (common requirements for a
     // number of measures).
     {
- typedef incidence_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > IncidenceGraph;
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- IncidenceGraph
- > VertexListGraph;
+ > Graph;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef vertex_list_graph_archetype<IncidenceGraph> VertexListGraph;
         typedef VertexListGraph::vertex_descriptor Vertex;
         typedef VertexListGraph::edge_descriptor Edge;
         typedef VertexListGraph::directed_category Directed;
@@ -203,10 +206,11 @@
 
     // test a solo edge list graph
     {
- typedef edge_list_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > EdgeListGraph;
+ > Graph;
+ typedef edge_list_graph_archetype<Graph> EdgeListGraph;
         typedef EdgeListGraph::vertex_descriptor Vertex;
         typedef EdgeListGraph::edge_descriptor Edge;
         typedef EdgeListGraph::directed_category Directed;
@@ -223,20 +227,13 @@
 
     // test a bidirected, vertex/edge list graph
     {
- typedef bidirectional_graph_archetype<
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > BidirectionalGraph;
- typedef edge_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- BidirectionalGraph
- > EdgeListGraph;
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- EdgeListGraph
- > VertexListGraph;
+ > Graph;
+ typedef bidirectional_graph_archetype<Graph> BidirectionalGraph;
+ typedef edge_list_graph_archetype<BidirectionalGraph> EdgeListGraph;
+ typedef vertex_list_graph_archetype<EdgeListGraph> VertexListGraph;
         typedef VertexListGraph::vertex_descriptor Vertex;
         typedef VertexListGraph::edge_descriptor Edge;
         typedef VertexListGraph::directed_category Directed;
@@ -266,10 +263,11 @@
 
     // test a mutable property graph
     {
- typedef bidirectional_graph_archetype <
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > BidirectionalGraph;
+ > Graph;
+ typedef bidirectional_graph_archetype <Graph> BidirectionalGraph;
         typedef property_graph_archetype <
                 BidirectionalGraph,
                 vertex_index_t, // the property type
@@ -286,10 +284,11 @@
 
     // test a mutable property graph
     {
- typedef bidirectional_graph_archetype <
+ typedef graph_archetype<
                 undirected_tag,
                 allow_parallel_edge_tag
- > BidirectionalGraph;
+ > Graph;
+ typedef bidirectional_graph_archetype <Graph> BidirectionalGraph;
         typedef property_graph_archetype <
                 BidirectionalGraph,
                 vertex_index_t, // the property type
@@ -312,9 +311,7 @@
                 undirected_tag,
                 allow_parallel_edge_tag
> Graph;
- typedef vertex_index_graph_archetype<
- Graph
- > VertexIndexGraph;
+ typedef vertex_index_graph_archetype<Graph> VertexIndexGraph;
         typedef graph_traits<VertexIndexGraph>::vertex_descriptor Vertex;
         typedef VertexIndexGraph::vertex_index_type Index;
         typedef property_map<VertexIndexGraph, vertex_index_t>::type IndexMap;
@@ -333,9 +330,7 @@
                 undirected_tag,
                 allow_parallel_edge_tag
> Graph;
- typedef edge_index_graph_archetype<
- Graph
- > EdgeIndexGraph;
+ typedef edge_index_graph_archetype<Graph> EdgeIndexGraph;
         typedef graph_traits<EdgeIndexGraph>::vertex_descriptor Vertex;
         typedef EdgeIndexGraph::edge_index_type Index;
         typedef property_map<EdgeIndexGraph, edge_index_t>::type IndexMap;

Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/tiernan_all_cycles.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/tiernan_all_cycles.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/tiernan_all_cycles.cpp 2007-08-24 09:20:10 EDT (Fri, 24 Aug 2007)
@@ -15,19 +15,14 @@
 int
 main(int argc, char *argv[])
 {
+ typedef graph_archetype<
+ undirected_tag,
+ allow_parallel_edge_tag
+ > Graph;
     {
- typedef incidence_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag
- > IncidenceGraph;
- typedef vertex_list_graph_archetype<
- undirected_tag,
- allow_parallel_edge_tag,
- IncidenceGraph
- > VertexListGraph;
- typedef vertex_index_graph_archetype<
- VertexListGraph
- > VertexIndexGraph;
+ typedef incidence_graph_archetype<Graph> IncidenceGraph;
+ typedef vertex_list_graph_archetype<IncidenceGraph> VertexListGraph;
+ typedef vertex_index_graph_archetype<VertexListGraph> VertexIndexGraph;
         typedef cycle_visitor_archetype CycleVisitor;
 
         VertexIndexGraph& g = static_object<VertexIndexGraph>::get();


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