#include // for std::cout #include // for std::pair #include // for std::for_each #include #include #include #include #include #include using namespace boost; int main(int,char*[]) { // create a typedef for the Graph type typedef adjacency_list Graph; // Make convenient labels for the vertices enum { A, B, C, D, E, N }; const int num_vertices = N; const char* name = "ABCDE"; // declare a graph object Graph g(num_vertices); // get the property map for vertex indices typedef property_map::type IndexMap; IndexMap index = get(vertex_index, g); std::cout << "vertices(g) = "; typedef graph_traits::vertex_iterator vertex_iter; std::pair vp; for (vp = vertices(g); vp.first != vp.second; ++vp.first) std::cout << index[*vp.first] << " "; std::cout << std::endl; clear_vertex(C, g); remove_vertex(C, g); std::cout << "vertices(g) = "; IndexMap index_2 = get(vertex_index, g); for (vp = vertices(g); vp.first != vp.second; ++vp.first) std::cout << index_2[*vp.first] << " "; std::cout << std::endl; return 0; }