|
Boost Users : |
From: Anthony Labarre (alabarre_at_[hidden])
Date: 2008-07-13 18:53:17
X-No-Archive: yes
Hi all,
I'm interested in adding edges to a graph whose vertices are labelled, and I would like to do this using the vertex NAMES instead of their indices (or "descriptors"). I know that add_edge uses vertex_descriptor, so I probably won't be able to achieve what I want directly, but I thought property maps would allow to easily recover the vertex_descriptor corresponding to a given label. Unfortunately, although I have spent a lot of time looking for that in the documentation, I didn't succeed in achieving my goal.
My graph is declared as follows:
typedef adjacency_list< vecS, vecS, undirectedS, property< vertex_name_t, std::string > > Graph;
Graph G(0);
I hoped that
boost::property_map<Graph, vertex_name_t>::type vertex_names = get(vertex_name, G);
would be exactly what I needed, but it seems that vertex_names can only be accessed using vertex descriptors and returns strings, which is exactly the opposite of what I need. If anyone has ideas, I'd love to hear them.
Thank you so much,
Anthony
-- http://homepages.ulb.ac.be/~alabarre/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net