
18 Apr
2009
18 Apr
'09
1:14 p.m.
I'd like to have unique vertices in a graph based on index of type std::string. I did the following coding. typedef property<edge_weight_t,float> EProperty; typedef property<vertex_index_t,string> VIndex; typedef adjacency_list<setS,listS,directedS,VIndex,EProperty> Graph; typedef property_map<Graph, vertex_index_t>::type VIndexMap; graph_traits<Graph>::vertex_descriptor addv(property_traits<VIndexMap>::value_type v,Graph &g) { graph_traits<Graph>::vertex_descriptor vd; vd = add_vertex(VIndex(v),g); return vd; } Does "add_vertex" check the existence of added vertices of given index? No, it doesn't. Or I do something wrong. Regards liquid