Hi,
In the Boost Graph library, vertices have an index (vertex_index_t),
and I was under the impression that edges have one, too. At least,
there's a predefined type called edge_index_t. However, I can't figure
out how to access an edge's index. For example, consider a graph
defined like:
typedef adjacency_list MyGraph;
typedef graph_traits<MyGraph>::vertex_descriptor Vertex;
typedef graph_traits<MyGraph>::edge_descriptor Edge;
And let's say I've got a vertex descriptor called "u". I can iterate
over u's outgoing edges like this:
typedef graph_traits<MyGraph>::out_edge_iterator out_iter;
std::pair outp;
for (outp = out_edges(u, g); outp.first != outp.second; ++outp.first) {
Edge e = *outp.first;
Vertex v = target(e, g);
cout << index[v] << std::endl; // Works fine
cout << index[e] << std::endl; // Compiler error
}
In this example, index[v] works as expected, but index[e] gives me a
compiler error: "no match for ‘operator[]’ in ‘index[e]".
Perhaps my graph typedef needs to be changed so that its edges have a
property map for edge_index_t, although I'm not sure how to do that.
(And anyway I wouldn't expect vertices to have indices by default but
edges not...)
Thanks for any help,
Trevor