I've been spending quite a few days working with the boost graph library. As far as I understand, when considering VertexList and EdgeList storage :
vecS :
- possess an index, so can be access with it
- when removing vertices, iterator are invalidated
listS :
- no index
- does not invalidate iterator
It's a bit short but that's to the point for my problem. I need those index number and I want to be able to easily remove vertices later on.
I have a working algorithm with this graph structure :
typedef boost::adjacency_list<
boost::vecS, boost::vecS, boost::undirectedS,
topologicalmap::Intersection_Graph ,
boost::edge_weight_t,
boost::no_property > Graph_boost;
I have a custom structure Intersection_Graph
for my vertices that I need to use. Here I use vecS.
I want to use listS instead to be able to remove vertices. As well, I want to be able to use it later with Dijkstra algorithm.
I kind of understand that I need to have boost::vertex_index_t
in my list but I am really confused as to how to do it and keep my custom struct at the same time.
I tried something along those lines :
typedef boost::adjacency_list<
boost::listS, boost::listS, boost::undirectedS,
boost::property<boost::vertex_index_t, topologicalmap::Intersection_Graph>,
boost::edge_weight_t,
boost::no_property > Graph_boost;
But I can't even access my custom struct anymore. Plus, index access don't work.
I really need that index access capability since the algorithm my graph will depend on return the index of the parent node. I feel like I could get away with using a Vertex instead of indexes but it would imply a major re-writing of the code and I want to know if I can avoid it.
So my question is : is there any way to have listS behaving in a vecS like manner while keeping the advantages of listS ?
Please, bear with me if it sounds stupid. I'm quite confuse at the moment, so I might have say something stupid. If you need more information, just ask.