$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: asutton_at_[hidden]
Date: 2007-08-11 11:45:01
Author: asutton
Date: 2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
New Revision: 38598
URL: http://svn.boost.org/trac/boost/changeset/38598
Log:
Various cleanups and rewrites as per modifications to the
core library
Text files modified: 
   sandbox/SOC/2007/graphs/libs/graph/test/Jamfile.v2                |   140 +++++++++++---------------------------  
   sandbox/SOC/2007/graphs/libs/graph/test/closeness_centrality.cpp  |   143 ++++++++++++++++++++------------------- 
   sandbox/SOC/2007/graphs/libs/graph/test/constant_property_map.cpp |     1                                         
   sandbox/SOC/2007/graphs/libs/graph/test/degree_centrality.cpp     |   104 +++++++++++++++++++---------            
   sandbox/SOC/2007/graphs/libs/graph/test/eccentricity.cpp          |    22 +++--                                   
   sandbox/SOC/2007/graphs/libs/graph/test/exterior.cpp              |    13 +-                                      
   sandbox/SOC/2007/graphs/libs/graph/test/k_pairs.cpp               |     6 +                                       
   sandbox/SOC/2007/graphs/libs/graph/test/mean_geodesic.cpp         |    20 +++--                                   
   8 files changed, 222 insertions(+), 227 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-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -1,102 +1,42 @@
 
-exe properties
-    : properties.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe mutable
-    : mutable.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe index
-    : index.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe range
-    : range.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe misc
-    : misc.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe components
-    : components.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe degree_centrality
-    : degree_centrality.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe closeness_centrality
-    : closeness_centrality.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe mean_geodesic
-    : mean_geodesic.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe eccentricity
-    : eccentricity.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe cluster
-    : cluster.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe generate
-    : generate.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe exterior
-    : exterior.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe cycle
-    : cycle.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe clique
-    : clique.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
-
-exe mapping
-    : mapping.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
+import testing ;
 
-exe k_pairs
-    : k_pairs.cpp
-    : <include>$BOOST_ROOT
-    : <include>../../../
-    ;
+project
+    : requirements
+        <include>../../../
+        <include>$BOOST_ROOT
+    ;
+
+test-suite graph_test :
+    [ run constant_property_map.cpp ]
+    [ run degree_centrality.cpp ]
+    [ run closeness_centrality.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 mean_geodesic : mean_geodesic.cpp ;
+#
+# exe eccentricity : eccentricity.cpp ;
+#
+# exe cluster : cluster.cpp ;
+#
+# exe generate : generate.cpp ;
+#
+# exe exterior : exterior.cpp ;
+#
+# exe cycle : cycle.cpp ;
+#
+# exe clique : clique.cpp ;
+#
+# exe mapping : mapping.cpp ;
Modified: sandbox/SOC/2007/graphs/libs/graph/test/closeness_centrality.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/closeness_centrality.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/closeness_centrality.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -5,87 +5,89 @@
 // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 #include <iostream>
-#include <iterator>
-#include <algorithm>
 #include <vector>
-#include <tr1/unordered_map>
 
-#include <boost/graph/adjacency_list.hpp>
 #include <boost/graph/undirected_graph.hpp>
 #include <boost/graph/directed_graph.hpp>
 #include <boost/graph/exterior_property.hpp>
-
-#include <boost/graph/dijkstra_shortest_paths.hpp>
+#include <boost/graph/constant_property_map.hpp>
 #include <boost/graph/floyd_warshall_shortest.hpp>
 #include <boost/graph/closeness_centrality.hpp>
 
 using namespace std;
 using namespace boost;
 
-struct VertexProp
-{
-    int dummy;
-};
+// useful types
+// number of vertices in the graph
+static const unsigned N = 5;
 
-struct EdgeProp
+template <typename Graph>
+struct vertex_vector
 {
-    int weight;
+    typedef graph_traits<Graph> traits;
+    typedef vector<typename traits::vertex_descriptor> type;
 };
 
 template <typename Graph>
-void build_graph(Graph& g)
+void build_graph(Graph& g,
+                 typename vertex_vector<Graph>::type& v)
 {
-    typedef typename Graph::vertex_descriptor Vertex;
-    typedef typename Graph::edge_descriptor Edge;
-
-    static const unsigned N = 5;
-    vector<Vertex> v(N);
-    vector<Edge> e;
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
 
-    // add some vertices
+    // add vertices
     for(size_t i = 0; i < N; ++i) {
-        // v[i] = add_vertex(g);
         v[i] = add_vertex(g);
     }
 
-    // add some edges (with weights)
-    e.push_back(add_edge(v[0], v[1], g).first);
-    e.push_back(add_edge(v[1], v[2], g).first);
-    e.push_back(add_edge(v[2], v[0], g).first);
-    e.push_back(add_edge(v[3], v[4], g).first);
-    e.push_back(add_edge(v[4], v[0], g).first);
-
-    g[e[0]].weight = 1;
-    g[e[1]].weight = 1;
-    g[e[2]].weight = 1;
-    g[e[3]].weight = 1;
-    g[e[4]].weight = 1;
+    // add edges
+    add_edge(v[0], v[1], g);
+    add_edge(v[1], v[2], g);
+    add_edge(v[2], v[0], g);
+    add_edge(v[3], v[4], g);
+    add_edge(v[4], v[0], g);
 };
 
-template <typename Graph, typename PropertyMap>
-void print_map(const Graph& g, PropertyMap pm)
-{
-    typename Graph::vertex_iterator i, end;
-    cout << "{ ";
-    for(tie(i, end) = vertices(g); i != end; ++i) {
-        cout << pm[*i] << " ";
-    }
-    cout << "}\n";
-}
 
-template <typename Graph, typename Matrix>
-void print_matrix(const Graph& g, Matrix m)
+template <typename Graph>
+void test_undirected()
 {
-    cout << "[\n";
-    typename Graph::vertex_iterator i, j, end;
-    for(tie(i, end) = vertices(g); i != end; ++i) {
-        print_map(g, m[*i]);
-    }
-    cout << "]\n";
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+    typedef typename graph_traits<Graph>::edge_descriptor Edge;
+
+    typedef exterior_vertex_property<Graph, float> CentralityProperty;
+    typedef typename CentralityProperty::container_type CentralityContainer;
+    typedef typename CentralityProperty::map_type CentralityMap;
+
+    typedef exterior_vertex_property<Graph, int> DistanceProperty;
+    typedef typename DistanceProperty::matrix_type DistanceMatrix;
+    typedef typename DistanceProperty::matrix_map_type DistanceMatrixMap;
+
+    typedef constant_property_map<Edge, int> WeightMap;
+
+    Graph g;
+    vector<Vertex> v(N);
+    build_graph(g, v);
+
+    CentralityContainer centralities(num_vertices(g));
+    DistanceMatrix distances(num_vertices(g));
+
+    CentralityMap cm(centralities, g);
+    DistanceMatrixMap dm(distances, g);
+
+    WeightMap wm(1);
+
+    floyd_warshall_all_pairs_shortest_paths(g, dm, weight_map(wm));
+    closeness_centrality(g, dm, cm);
+
+    BOOST_ASSERT(cm[v[0]] == float(1)/5);
+    BOOST_ASSERT(cm[v[1]] == float(1)/7);
+    BOOST_ASSERT(cm[v[2]] == float(1)/7);
+    BOOST_ASSERT(cm[v[3]] == float(1)/9);
+    BOOST_ASSERT(cm[v[4]] == float(1)/6);
 }
 
 template <typename Graph>
-void test()
+void test_directed()
 {
     typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
     typedef typename graph_traits<Graph>::edge_descriptor Edge;
@@ -96,34 +98,39 @@
 
     typedef exterior_vertex_property<Graph, int> DistanceProperty;
     typedef typename DistanceProperty::matrix_type DistanceMatrix;
+    typedef typename DistanceProperty::matrix_map_type DistanceMatrixMap;
 
-    typedef typename property_map<Graph, int EdgeProp::*>::type WeightMap;
+    typedef constant_property_map<Edge, int> WeightMap;
 
     Graph g;
-    build_graph(g);
+    vector<Vertex> v(N);
+    build_graph(g, v);
 
     CentralityContainer centralities(num_vertices(g));
-    CentralityMap cent(centralities, g);
-    DistanceMatrix dist(num_vertices(g), g);
-    WeightMap weights(get(&EdgeProp::weight, g));
+    DistanceMatrix distances(num_vertices(g));
+
+    CentralityMap cm(centralities, g);
+    DistanceMatrixMap dm(distances, g);
 
-    floyd_warshall_all_pairs_shortest_paths(g, dist, weight_map(weights));
-    closeness_centrality(g, dist, cent);
+    WeightMap wm(1);
 
-    print_matrix(g, dist);
-    print_map(g, cent);
+    floyd_warshall_all_pairs_shortest_paths(g, dm, weight_map(wm));
+    closeness_centrality(g, dm, cm);
 
+    BOOST_ASSERT(cm[v[0]] == float(0));
+    BOOST_ASSERT(cm[v[1]] == float(0));
+    BOOST_ASSERT(cm[v[2]] == float(0));
+    BOOST_ASSERT(cm[v[3]] == float(1)/10);
+    BOOST_ASSERT(cm[v[4]] == float(0));
 }
 
+
 int
 main(int argc, char *argv[])
 {
-    typedef undirected_graph<VertexProp, EdgeProp> Graph;
-    typedef directed_graph<VertexProp, EdgeProp> Digraph;
-
-    cout << "\n*** undirected_graph<> *** \n";
-    test<Graph>();
+    typedef undirected_graph<> Graph;
+    typedef directed_graph<> Digraph;
 
-    cout << "\n*** directed_graph<> *** \n";
-    test<Digraph>();
+    test_undirected<Graph>();
+    test_directed<Digraph>();
 }
Modified: sandbox/SOC/2007/graphs/libs/graph/test/constant_property_map.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/constant_property_map.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/constant_property_map.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -13,7 +13,6 @@
 #include <boost/graph/constant_property_map.hpp>
 #include <boost/graph/floyd_warshall_shortest.hpp>
 #include <boost/graph/closeness_centrality.hpp>
-#include "io.hpp"
 
 using namespace std;
 using namespace boost;
Modified: sandbox/SOC/2007/graphs/libs/graph/test/degree_centrality.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/degree_centrality.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/degree_centrality.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -4,11 +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 <iterator>
-#include <algorithm>
 #include <vector>
-#include <tr1/unordered_map>
 
 #include <boost/graph/undirected_graph.hpp>
 #include <boost/graph/directed_graph.hpp>
@@ -18,23 +14,22 @@
 using namespace std;
 using namespace boost;
 
+// useful types
+// number of vertices in the graph
+static const unsigned N = 5;
+
 template <typename Graph>
-void build_graph(Graph& g)
+void build_graph(Graph& g,
+                 vector<typename graph_traits<Graph>::vertex_descriptor>& v)
 {
-    typedef typename Graph::vertex_descriptor Vertex;
-    typedef typename Graph::edge_descriptor Edge;
-
-    static const unsigned N = 5;
-    vector<Vertex> v(N);
-    vector<Edge> e;
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
 
-    // add some vertices
+    // add vertices
     for(size_t i = 0; i < N; ++i) {
-        // v[i] = add_vertex(g);
         v[i] = add_vertex(g);
     }
 
-    // add some edges (with weights)
+    // add edges
     add_edge(v[0], v[1], g);
     add_edge(v[1], v[2], g);
     add_edge(v[2], v[0], g);
@@ -42,35 +37,78 @@
     add_edge(v[4], v[0], g);
 };
 
-template <typename Graph, typename PropertyMap>
-void print_map(const Graph& g, PropertyMap pm)
+template <typename Graph>
+void test_undirected()
 {
-    typename Graph::vertex_iterator i, end;
-    cout << "{ ";
-    for(tie(i, end) = vertices(g); i != end; ++i) {
-        cout << pm[*i] << " ";
-    }
-    cout << "}\n";
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+
+    typedef exterior_vertex_property<Graph, unsigned> CentralityProperty;
+    typedef typename CentralityProperty::container_type CentralityContainer;
+    typedef typename CentralityProperty::map_type CentralityMap;
+
+    Graph g;
+    vector<Vertex> v(N);
+    build_graph(g, v);
+
+    CentralityContainer cents(num_vertices(g));
+    CentralityMap cm(cents, g);
+    degree_centrality(g, cm);
+
+    BOOST_ASSERT(cm[v[0]] == 3);
+    BOOST_ASSERT(cm[v[1]] == 2);
+    BOOST_ASSERT(cm[v[2]] == 2);
+    BOOST_ASSERT(cm[v[3]] == 1);
+    BOOST_ASSERT(cm[v[4]] == 2);
 }
 
 template <typename Graph>
-void test()
+void test_influence()
 {
     typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
-    typedef typename graph_traits<Graph>::edge_descriptor Edge;
 
     typedef exterior_vertex_property<Graph, unsigned> CentralityProperty;
     typedef typename CentralityProperty::container_type CentralityContainer;
     typedef typename CentralityProperty::map_type CentralityMap;
 
     Graph g;
-    build_graph(g);
 
-    CentralityContainer centralities(num_vertices(g));
-    CentralityMap cents(centralities, g);
-    degree_centrality(g, cents);
+    vector<Vertex> v(N);
+    build_graph(g, v);
 
-    print_map(g, cents);
+    CentralityContainer cents(num_vertices(g));
+    CentralityMap cm(cents, g);
+    degree_centrality(g, cm, measure_influence(g));
+
+    BOOST_ASSERT(cm[v[0]] == 1);
+    BOOST_ASSERT(cm[v[1]] == 1);
+    BOOST_ASSERT(cm[v[2]] == 1);
+    BOOST_ASSERT(cm[v[3]] == 1);
+    BOOST_ASSERT(cm[v[4]] == 1);
+}
+
+template <typename Graph>
+void test_prestige()
+{
+    typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
+
+    typedef exterior_vertex_property<Graph, unsigned> CentralityProperty;
+    typedef typename CentralityProperty::container_type CentralityContainer;
+    typedef typename CentralityProperty::map_type CentralityMap;
+
+    Graph g;
+
+    vector<Vertex> v(N);
+    build_graph(g, v);
+
+    CentralityContainer cents(num_vertices(g));
+    CentralityMap cm(cents, g);
+    degree_centrality(g, cm, measure_prestige(g));
+
+    BOOST_ASSERT(cm[v[0]] == 2);
+    BOOST_ASSERT(cm[v[1]] == 1);
+    BOOST_ASSERT(cm[v[2]] == 1);
+    BOOST_ASSERT(cm[v[3]] == 0);
+    BOOST_ASSERT(cm[v[4]] == 1);
 }
 
 int
@@ -79,9 +117,7 @@
     typedef undirected_graph<> Graph;
     typedef directed_graph<> Digraph;
 
-    cout << "\n*** undirected_graph<> *** \n";
-    test<Graph>();
-
-    cout << "\n*** directed_graph<> *** \n";
-    test<Digraph>();
+    test_undirected<Graph>();
+    test_influence<Digraph>();
+    test_prestige<Digraph>();
 }
Modified: sandbox/SOC/2007/graphs/libs/graph/test/eccentricity.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/eccentricity.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/eccentricity.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -124,6 +124,7 @@
 
     typedef exterior_vertex_property<Graph, int> DistanceProperty;
     typedef typename DistanceProperty::matrix_type DistanceMatrix;
+    typedef typename DistanceProperty::matrix_map_type DistanceMatrixMap;
 
     typedef typename property_map<Graph, int EdgeProp::*>::type WeightMap;
 
@@ -131,18 +132,21 @@
     build_graph(g);
 
     EccentricityContainer eccs(num_vertices(g));
-    EccentricityMap ecc(eccs, g);
-    DistanceMatrix dist(num_vertices(g), g);
-    WeightMap weights(get(&EdgeProp::weight, g));
+    EccentricityMap em(eccs, g);
 
-    floyd_warshall_all_pairs_shortest_paths(g, dist, weight_map(weights));
-    eccentricity(g, dist, ecc);
+    DistanceMatrix dist(num_vertices(g));
+    DistanceMatrixMap dm(dist, g);
 
-    print_matrix(g, dist);
-    print_map(g, ecc);
+    WeightMap wm(get(&EdgeProp::weight, g));
 
-    std::cout << "radius: " << make_numeric(graph_radius(g, ecc)) << "\n";
-    std::cout << "diameter: " << make_numeric(graph_diameter(g, ecc)) << "\n";
+    floyd_warshall_all_pairs_shortest_paths(g, dm, weight_map(wm));
+    eccentricity(g, dm, em);
+
+    print_matrix(g, dm);
+    print_map(g, em);
+
+    std::cout << "radius: " << make_numeric(graph_radius(g, em)) << "\n";
+    std::cout << "diameter: " << make_numeric(graph_diameter(g, em)) << "\n";
 }
 
 int
Modified: sandbox/SOC/2007/graphs/libs/graph/test/exterior.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/exterior.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/exterior.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -108,18 +108,19 @@
     {
         typedef typename property_map<Graph, int EdgeProp::*>::type WeightMap;
         typedef typename DistanceProperty::matrix_type DistanceMatrix;
+        typedef typename DistanceProperty::matrix_map_type DistanceMatrixMap;
 
-        DistanceMatrix dx(num_vertices(g), g);
+        DistanceMatrix dist(num_vertices(g));
+        DistanceMatrixMap dm(dist, g);
         WeightMap wm(get(&EdgeProp::weight, g));
 
-        floyd_warshall_all_pairs_shortest_paths(g, dx,
-                weight_map(wm));
+        floyd_warshall_all_pairs_shortest_paths(g, dm, weight_map(wm));
 
         VertexIterator i, j, end;
         for(tie(i, end) = vertices(g); i != end; ++i) {
             for(j = vertices(g).first; j != end; ++j) {
                 Vertex u = *i, v = *j;
-                std::cout << dx[u][v] << " ";
+                std::cout << dm[u][v] << " ";
             }
             std::cout << "\n";
         }
@@ -128,9 +129,9 @@
         // a new property map... Good stuff.
         std::cout << "slice:\n";
         for(tie(i, end) = vertices(g); i != end; ++i) {
-            DistanceMap dm(dx[*i]);
+            DistanceMap d(dm[*i]);
             for(tie(j, end) = vertices(g); j != end; ++j) {
-                std::cout << dm[*j] << " ";
+                std::cout << d[*j] << " ";
             }
             std::cout << "\n";
         }
Modified: sandbox/SOC/2007/graphs/libs/graph/test/k_pairs.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/k_pairs.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/k_pairs.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -16,6 +16,11 @@
 using namespace std;
 using namespace boost;
 
+// I think I see how this is done. Basically, there's an initial search
+// for a baseline path from every vertex to v. A second search can be
+// used to build heaps that record the off-path distance between the source
+// the off-path vertex and the target. Or something like that. I'm not sure.
+
 typedef property<edge_index_t, unsigned> EdgeIndex;
 
 struct path_visitor
@@ -250,7 +255,6 @@
     EdgeIterator i, end;
     for(tie(i, end) = edges(g); i != end; ++i) {
         elm[*i] = lost_distance(g, *i, dm, wm);
-        cout << print_edge(*i, g) << " : " << elm[*i] << "\n";
     }
 
     // this becomes one of the shortest paths...
Modified: sandbox/SOC/2007/graphs/libs/graph/test/mean_geodesic.cpp
==============================================================================
--- sandbox/SOC/2007/graphs/libs/graph/test/mean_geodesic.cpp	(original)
+++ sandbox/SOC/2007/graphs/libs/graph/test/mean_geodesic.cpp	2007-08-11 11:45:00 EDT (Sat, 11 Aug 2007)
@@ -120,6 +120,7 @@
 
     typedef exterior_vertex_property<Graph, int> DistanceProperty;
     typedef typename DistanceProperty::matrix_type DistanceMatrix;
+    typedef typename DistanceProperty::matrix_map_type DistanceMatrixMap;
 
     typedef typename property_map<Graph, int EdgeProp::*>::type WeightMap;
 
@@ -127,17 +128,20 @@
     build_graph(g);
 
     GeodesicContainer geodesics(num_vertices(g));
-    GeodesicMap geo(geodesics, g);
-    DistanceMatrix dist(num_vertices(g), g);
-    WeightMap weights(get(&EdgeProp::weight, g));
+    GeodesicMap gm(geodesics, g);
 
-    floyd_warshall_all_pairs_shortest_paths(g, dist, weight_map(weights));
-    mean_geodesic(g, dist, geo);
+    DistanceMatrix dist(num_vertices(g));
+    DistanceMatrixMap dm(dist, g);
 
-    print_matrix(g, dist);
-    print_map(g, geo);
+    WeightMap wm(get(&EdgeProp::weight, g));
 
-    std::cout << "mgeo: " << make_numeric(graph_mean_geodesic(g, geo)) << "\n";
+    floyd_warshall_all_pairs_shortest_paths(g, dm, weight_map(wm));
+    mean_geodesic(g, dm, gm);
+
+    print_matrix(g, dm);
+    print_map(g, gm);
+
+    std::cout << "mgeo: " << make_numeric(graph_mean_geodesic(g, gm)) << "\n";
 }
 
 int