|
Boost-Commit : |
From: asutton_at_[hidden]
Date: 2007-08-11 11:42:21
Author: asutton
Date: 2007-08-11 11:42:18 EDT (Sat, 11 Aug 2007)
New Revision: 38595
URL: http://svn.boost.org/trac/boost/changeset/38595
Log:
Adding concept check for closeness centrality
Added:
sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality_check.cpp (contents, props changed)
Text files modified:
sandbox/SOC/2007/graphs/libs/graph/test/concept/Jamfile.v2 | 1
sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp | 45 ++++++++++++++++-----------------------
2 files changed, 20 insertions(+), 26 deletions(-)
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-11 11:42:18 EDT (Sat, 11 Aug 2007)
@@ -9,4 +9,5 @@
test-suite graph_test :
[ compile degree_centrality_check.cpp ]
+ [ compile closeness_centrality_check.cpp ]
;
\ No newline at end of file
Added: sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality_check.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/closeness_centrality_check.cpp 2007-08-11 11:42:18 EDT (Sat, 11 Aug 2007)
@@ -0,0 +1,41 @@
+// (C) Copyright Andrew Sutton 2007
+//
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0 (See accompanying file
+// LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+#include "archetypes.hpp"
+#include <boost/graph/closeness_centrality.hpp>
+
+using namespace std;
+using namespace boost;
+
+int
+main(int argc, char *argv[])
+{
+ {
+ typedef descriptor_archetype Vertex;
+ typedef incidence_graph_archetype<
+ Vertex,
+ undirected_tag,
+ allow_parallel_edge_tag
+ > IncidenceGraph;
+ typedef vertex_list_graph_archetype<
+ Vertex,
+ undirected_tag,
+ allow_parallel_edge_tag,
+ IncidenceGraph
+ > Graph;
+ 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;
+
+ Graph& g = static_object<Graph>::get();
+ CentralityMap cm;
+ DistanceMatrix dm;
+
+ closeness_centrality(g, dm, cm);
+ }
+
+ return 0;
+}
Modified: sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp (original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/concept/degree_centrality_check.cpp 2007-08-11 11:42:18 EDT (Sat, 11 Aug 2007)
@@ -7,32 +7,29 @@
#include "archetypes.hpp"
#include <boost/graph/degree_centrality.hpp>
+using namespace std;
using namespace boost;
int
main(int argc, char *argv[])
{
{
- typedef descriptor_archetype vertex_type;
+ typedef descriptor_archetype Vertex;
typedef incidence_graph_archetype<
- vertex_type,
+ Vertex,
undirected_tag,
allow_parallel_edge_tag
- > incidence_graph_type;
+ > IncidenceGraph;
typedef vertex_list_graph_archetype<
- vertex_type,
+ Vertex,
undirected_tag,
allow_parallel_edge_tag,
- incidence_graph_type
- > graph_type;
- typedef graph_traits<graph_type>::degree_size_type degree_type;
- typedef read_write_property_map_archetype<
- vertex_type,
- degree_type
- > centrality_map_type;
+ IncidenceGraph
+ > Graph;
+ typedef writable_property_map_archetype<Vertex, size_t> CentralityMap;
- graph_type& g = static_object<graph_type>::get();
- centrality_map_type cm;
+ Graph& g = static_object<Graph>::get();
+ CentralityMap cm;
degree_centrality(g, cm);
degree_centrality(g, cm, measure_influence(g));
@@ -42,31 +39,27 @@
// how to test this. Even If I build one, it won't compile very
// easily.
{
- typedef descriptor_archetype vertex_type;
+ typedef descriptor_archetype Vertex;
typedef bidirectional_graph_archetype<
- vertex_type,
+ Vertex,
directed_tag,
allow_parallel_edge_tag
- > bidirectional_graph_type;
+ > BidirectionalGraph;
typedef vertex_list_graph_archetype<
- vertex_type,
+ Vertex,
directed_tag,
allow_parallel_edge_tag,
- bidirectional_graph_type
+ BidirectionalGraph
> graph_type;
- typedef graph_traits<graph_type>::degree_size_type degree_type;
- typedef read_write_property_map_archetype<
- vertex_type,
- degree_type
- > centrality_map_type;
-
- graph_type& g = static_object<graph_type>::get();
- centrality_map_type cm;
+ typedef read_write_property_map_archetype<Vertex, size_t> CentralityMap;
// These don't actually work - apparently, it's not very easy
// to generate archetypes across concept hierarchies and have
// them concept-checked very easily.
+ // graph_type& g = static_object<graph_type>::get();
+ // centrality_map_type cm;
+
// degree_centrality(g, cm);
// degree_centrality(g, cm, measure_prestige(g));
}
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