Storing vertex descriptors when removing a vertex

Hi all, I am using the boost graph library for my project and encountered a small problem I don't know how to solve. I had to keep in an extern storage some of the vertex_descriptor in order to have access to their adjacent vertices and their properties. But as it is written in the boost documentation, when I remove a vertex, the vertex_descriptors change and I am not able to keep the right ones in my storage. Is there something else apart from vertex_descriptor that won't change but from which I could also access adjacent vertices and properties ? Thank you in advance for your help. Orianne

On Thu, 7 Jul 2011, Orianne Siret wrote:
Hi all, I am using the boost graph library for my project and encountered a small problem I don't know how to solve. I had to keep in an extern storage some of the vertex_descriptor in order to have access to their adjacent vertices and their properties. But as it is written in the boost documentation, when I remove a vertex, the vertex_descriptors change and I am not able to keep the right ones in my storage. Is there something else apart from vertex_descriptor that won't change but from which I could also access adjacent vertices and properties ? Thank you in advance for your help.
If you use listS as your vertex container type, vertex descriptors will be stable across deletions. They will not be stable across saving and reloading the graph, though, since the descriptors become pointers when you use listS. If you need more stability than that, have a vertex property that you keep manually, and an external table mapping from those to vertex descriptors; you would probably need to update that table on vertex deletions. If you are not doing too many deletions, you could also use a filtered_graph to hide the vertices you don't want without deleting them; that would keep even vecS vertex descriptors stable. -- Jeremiah Willcock
participants (2)
-
Jeremiah Willcock
-
Orianne Siret