how provide a vertex_index property for my graph

Solution 1:

The solution is just to: 1) Say the vertex descriptor is defined as typedef Graph::vertex_descriptor NodeID; then you need to define an associative property map as following:

typedef map<NodeID, size_t> IndexMap;
IndexMap mapIndex;
associative_property_map<IndexMap> propmapIndex(mapIndex);

2) In the code, index all vertices as following:

int i=0;
BGL_FORALL_VERTICES(v, g, Graph)
{
   put(propmapIndex, v, i++);
}

3) You can now use graphvize to drow/visualize your graph as following:

ofstream myfile;
myfile.open ("example.txt");
write_graphviz(myfile, g, default_writer(), default_writer(), default_writer(), propmapIndex);
myfile.close();

The graph will be described in example.txt, you can visualize it using graphviz.