
On Thu, 1 Apr 2010, Gábor Szuromi wrote:
Hi!
The edge_index internal property map is not created by default, so you have to define it explicitly:
typedef adjacency_list
> MyGraph; typedef property_map ::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;
Note that you need to fill in the edge indices; they are not created automatically for the graph type you have.
The vertex descriptor is an integer value so it works with operator[], but edge descriptor is an std::pair<>, so you have to convert it to an integer with the appropriate edge index map. This leaves only one question: how do you use bundled edge properties along with edge index map?
You don't need an edge index map for bundled edge properties. Your graph doesn't currently have (from what is listed above) bundled edge properties; if it did, you could do just g[e].whatever where "whatever" is a member of your bundled edge property class. -- Jeremiah Willcock