From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-03-25 18:06:48


Dear Jeremy,

I am using BGL in a project to analyse very large (tens of millions of
vertexes) graph. May I inquire about your availability to help with a
certain problem I have?

In order to make things more efficient I am attempting to use specialised
allocators that implement persistent storage using memory-mapping. The
allocator conforms to STL <memory> and is a template class allocator<T>.
I can't work out how to specify T to the adjacency_list definition. My
attempt at this is as follows:

#include "boost/graph/adjacency_list.hpp"
#include <string>

namespace lg {
  template <class Allocator>
  struct vector_with_allocatorS {};
}

namespace boost {
  template <class Alloc, class ValueType>
  struct container_gen<lg::vector_with_allocatorS<Alloc>, ValueType> {
    typedef typename Alloc::template rebind<ValueType>::other Allocator;
    typedef std::vector<ValueType, Allocator> type;
  };
}

namespace lg {
  //Property for edges
  typedef boost::property<boost::edge_weight_t, unsigned int> EdgeProperty;

  // Properties for vertices
  typedef boost::property <boost::vertex_name_t, std::string,
    boost::property <boost::vertex_color_t, boost::default_color_type,
      boost::property <boost::vertex_discover_time_t, int,
        boost::property <boost::vertex_finish_time_t, int > > > > VertexProperty;

  // ==> what should X be?
  typedef boost::adjacency_list<vector_with_allocatorS<X>, vector_with_allocatorS<X>, boost::bidirectionalS, VertexProperty,
EdgeProperty> Graph;

  typedef boost::graph_traits<Graph> Traits;
  typedef Traits::vertex_descriptor Vertex;
  typedef Traits::edge_descriptor Edge;
}

The difficulty seems to be that X requires the definition of Graph that it
is itself a part of.

Any assistance with this you can provide would be gratefully received.

Sincerely,

Ken Appleby
Soft Optics Ltd.
Cambridge UK.