0

I am working on a project where, I first need to create a certain directed graph structures using BGL, my question is that if I never delete a vertex after adding it to graph then would there be an issue to store the vertex_descriptors in bundled properties ?

Jim
  • 45
  • 5
  • You might want to read a little more in to the documentation. The vertex_descriptor is the vertex in a way. It is the lightweight data structure that refers to a vertex. Having one in the bundled properties would be a little circular and redundant. If your descriptors are indexes like size_t, that would be fine. – pbible Apr 14 '15 at 15:26
  • my graph uses vectors for vertex & edge, so I think they would be integers ? in my case I need to have a very custom traversal for which it would help if I stored the vertex_descriptors, – Jim Apr 14 '15 at 15:37
  • I have definitely stored the vertex index in bundle properties before. So I think it would be totally fine in your case. I think problems would arise with other graphs where the descriptor is not an integer. It just seems a little conceptually awkward. You might want to look at vertex index property maps. – pbible Apr 14 '15 at 15:43
  • caveat: this the way I have done things. It may not be the 'right' way :) – pbible Apr 14 '15 at 15:44
  • do you have an example of the vertex index property maps ? – Jim Apr 14 '15 at 17:17
  • [Here](http://stackoverflow.com/a/22327218/2912901) is one of my old answers that uses one. `typedef boost::property_map< Graph, boost::vertex_index_t>::type VertexIndexMap;` then `VertexIndexMap vertexIndexMap = get(boost::vertex_index, G);` – pbible Apr 14 '15 at 19:55

0 Answers0