Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-09-14 09:15:09


On Sep 14, 2005, at 6:41 AM, Giulio Veronesi wrote:

> Hi,
>
> Excuse me for the very trivial question, but I'm new with boost and
> I'm looking
> for help. How I can locate a vertex of a graph by the index of the
> vertex?

If your graph is an adjacency_list, you can use vertex(N, g) to get the
Nth vertex in the graph g. Otherwise, you can advance a vertex
iterator:

   vertex_iterator vi = vertices(g).first;
   std::advance(vi, N);
   vertex_descriptor v = *vi; // v is the Nth vertex

        Doug


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