I think you are pursuing the wrong problem.
Most BGL search algorithms require an โindexโ โ โvertexโ mapping, where the index changes in the interval [0, num_vertices (g)). For example, DFS, BFS, connection component, A *, etc. You must first transfer each vertex to a "white" color. Instead, they essentially use a vector of size num_vertices (g).
In BGL, this central mapping is called the vertex_index property mapping, and the algorithms simply cannot work if this property map is incorrect.
So, your AFAICT task is to make sure that you can list your vertices correctly, in continuous mode. For this purpose, a vector combination with some additional hash map or STL is often required.
In any case, as you correct this index mapping error, you are likely to get some class that implements the mapping. Then your next step will be to teach Boost that this is a vertex index property.
If your MyMappingClass behaves like an associative container (i.e. implemented as an STL or Boost unordered_map map), you can pass it to DFS-like algorithms using idiom make_assoc_property_map(mymap) , where mymap is of type MyMappingClass.
Alternatively, you can do this in more detail, but more flexibly, as described below. This flexibility can translate to more efficient code.
Since this property is usually read-only, you add code like:
namespace boost { template<> struct property_map< MyGraph, vertex_index_t > { typedef MyMappingClass const_type;
Further, your MyMappingClass can be a fully compatible BGL property base, i.e. it will have some declarations like
class MyMappingClass { public: typedef readable_property_map_tag category; typedef int value_type; typedef value_type reference; typedef MyGraph::vertex_descriptor key_type; };
In addition, in order to work with such a configuration of BGL properties, you need to provide two different โgetโ functions: first, how to โgetโ a property map from your graph (it may be unnecessary or trivial if you create a class MyMappingClass a graph property).
The second function is how to "get" the value of the property (aka "vertex_descriptor") from the given value of the property key (aka integer in the interval [0, num_vertices (g))).
This second function may have a prototype similar to the following:
MyMappingClass::value_type
(Note that according to BGL, MyMappingClass should be lightweight and copied).