I'd like to have unique vertices in a graph based on index of type
std::string. I did the following coding.
typedef property
Does "add_vertex" check the existence of added vertices of given index? No, it doesn't. Or I do something wrong.
For a short answer: never. For a longer answer... It looks like vertices are dynamically allocated and the vertex set (listS, setS, etc.) stores pointers to those vertices. In the case of associate containers, the key_type is just the pionter value. In otherwords, add_vertex will never look for a previous instance of the vertex. Andrew Sutton andrew.n.sutton@gmail.com
Andrew Sutton pisze:
Does "add_vertex" check the existence of added vertices of given index? No, it doesn't. Or I do something wrong.
For a short answer: never.
Well, it seemed that sometimes yes.
I looked at the piece of code of add_vertex in a boost/graph header file:
template
For a longer answer... It looks like vertices are dynamically allocated and the vertex set (listS, setS, etc.) stores pointers to those vertices. In the case of associate containers, the key_type is just the pionter value. In otherwords, add_vertex will never look for a previous instance of the vertex.
Andrew Sutton andrew.n.sutton@gmail.com mailto:andrew.n.sutton@gmail.com
Regards liquid
For a short answer: never.
Well, it seemed that sometimes yes.
We'll compromise: sometimes :)
Undoubtedly, above add_vertex function searches vertex by properties and should return descriptor of found vertex. Indeed, it doesn't.
I'm a little bit confused.
I'm a little confused to. The vertex_by_property call will only actually search the vertices if the adjacency_list is using the named_graph framework. If you're not using - and its almost certain that you aren't - the function call evaluates to a no-op. I would say that for the most part - it's just a push_back. Andrew Sutton andrew.n.sutton@gmail.com
participants (2)
-
Andrew Sutton
-
liquid