Hello list members, I've a little question: Is it possible and if so, how is it possible, to randomly access a vertex or edge by its id (according to vertex_index or edge_index proprty map)?, i.e. calling 'vertices(graph)[id]'. My problem is that I wan't to access a vertex or edge in an unique and graph lifespan-wide manner without iterate over all vertices or edges. With vertex_descriptor/edge_discriptor it's possible but only if I don't change the graph structur (not lifespan-wide). Kind regrads, Manuel -- GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! Jetzt dabei sein: http://www.shortview.de/wasistshortview.php?mc=sv_ext_mf@gmx
Very good question. I do iterate but if there is something better... template <typename Graph> void remove_vtx_from_id(const int id, Graph& g) { typename boost::graph_traits<Graph>::vertex_iterator vi, vi_end; boost::tie(vi, vi_end) = boost::vertices(g); for (; vi != vi_end; ++vi) { if (get(boost::vertex_index_t(), g, *vi) == id) { clear_vertex(*vi, g); remove_vertex(*vi, g); break; } } } Am 09.07.2008 um 12:56 schrieb M. Siebeneicher:
Hello list members,
I've a little question:
Is it possible and if so, how is it possible, to randomly access a vertex or edge by its id (according to vertex_index or edge_index proprty map)?, i.e. calling 'vertices(graph)[id]'.
My problem is that I wan't to access a vertex or edge in an unique and graph lifespan-wide manner without iterate over all vertices or edges. With vertex_descriptor/edge_discriptor it's possible but only if I don't change the graph structur (not lifespan-wide).
Kind regrads, Manuel -- GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! Jetzt dabei sein: http://www.shortview.de/wasistshortview.php? mc=sv_ext_mf@gmx _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
M. Siebeneicher
-
Torsten Sadowski