
Hi Lodewijk,
I tried to get an unique identifier for a node and an edge. The node is possible e.g.:
However, the same idee does not work for an edge:
std::pair<adjacency_list<>::edge_iterator,adjacency_list<>::edge_iterator> pe; property_map< adjacency_list<> , edge_index_t>::type inedge; inedge = get(edge_index_t(), processGraph); for (pe = edges(someGraph); pe.first != pe.second; ++pe.first) { cout << *pe.first << " "; cout << "index: " << inedge[*pe.first] << " \n"; }
I can not figure out how to get an unique id for an edge and I can not understand how the property maps works from the documentation nor I can find how such a edge_index_t property is defined. Can somebody provide some help.
The reason is that vertex_index_t property is automatically defined for adjacency_list<>. It's not the case for edge_vertex_t. You'd have to: adjacency_list<vecS, vecS, directedS, no_property, property<edge_index_t, unsigned> > g; unsigned index(0); ...edge_iterator i, e; for(tie(i, e) = edges(i, e); i != e; ++i, ++index) put(edge_index, process_graph, *i, index); In other words, you have initialize and maintain edge_index property yourself. HTH, Volodya