|
Boost Users : |
From: Torsten Sadowski (tsadowski_at_[hidden])
Date: 2008-07-09 09:54:45
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_at_gmx
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
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