/* Aim - ----- 1) To build a graph with vertices with unique ids - Able to do this 2) To get the vertex containing a specific ids - How do I do this ? */ #include "boost/graph/adjacency_list.hpp" using namespace boost; class VertId { public: typedef boost :: vertex_property_tag kind; }; int main() { typedef property VertIdProp; typedef adjacency_list< vecS, vecS, directedS, VertIdProp > GraphType; GraphType g1; std :: string vp1 = "a100", vp2 = "a200", vp3 = "a300"; add_vertex(vp1, g1); add_vertex(vp2, g1); add_vertex(vp3, g1); property_map :: type propMap1; propMap1 = get(VertId(), g1); graph_traits :: vertex_iterator vertCurrItr, vertEndItr; // search for vertex containing the id a300 for( tie(vertCurrItr, vertEndItr) = vertices(g1); vertCurrItr != vertEndItr; vertCurrItr++ ) { if(propMap1[*vertCurrItr] == "a300") std :: cout << "found it!!\n"; } return (0); }