Boost logo

Boost Users :

Subject: [Boost-users] [graph]
From: liquid (kj_at_[hidden])
Date: 2009-04-18 15:14:46


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


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