Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-10-10 09:26:11


On Oct 9, 2005, at 9:56 AM, Giulio Veronesi wrote:
> How do I access the vertex_index property of a vertex? Is it necessary
> to use the get function? More precisaly, let us consider the following:
>
> typedef adjacency_list<vecS, vecS, bidirectionalS,
> no_property, property<edge_weight_t, int> > TGraph;
>
> typedef graph_traits<TGraph>::vertex_descriptor TNode;
>
> Suppose that 'vertex' is a TNode. Is it correct to do
>
> int idx = vertex;
>
> to get in idx the vertex_index of vertex?

It is correct for adjacency_list when vertex_listS = vecS. In the more
general case, one would write:

        graph_traits<TGraph>::vertices_size_type idx = get(vertex_index,
graph, 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