Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Graph: edge indices
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-04-01 17:19:58


On Thu, 1 Apr 2010, Trevor Harmon wrote:

> On Apr 1, 2010, at 5:31 AM, Gábor Szuromi wrote:
>
>> The edge_index internal property map is not created by default, so you
>> have to define it explicitly:
>
> Any particular reason why vertex indices are created (and updated) by default
> but edge indices are not? Perhaps it was just decided that the former is
> often needed while the latter not so often...

Vertex indices are an accident of using a vector as the vertex container
-- see another email I posted today about that.

>> typedef adjacency_list<vecS, vecS, directedS, Foo*,
>> property<edge_index_t, std::size_t> > MyGraph;
>> typedef property_map<MyGraph, edge_index_t>::type MyEdgeIndexMap;
>> ...
>> // Retrieve the edge index map associated with the graph
>> MyEdgeIndexMap emap = get(edge_index, g);
>> ...
>> // Convert the edge descriptor to an integer value
>> cout << index[ get(emap, e, g) ] << endl;
>
> Thanks for the tip. However, I think that last line is wrong. It should be:
>
> cout << index[ get(emap, e) ] << endl;

Yes, you can do either get(emap, e) or get(edge_index, g, e).

-- Jeremiah Willcock


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