#include #include #include #include namespace boost { enum vertex_component_t { vertex_component = 111 }; BOOST_INSTALL_PROPERTY(vertex, component); } using namespace boost; template struct vertexComponent { vertexComponent() {} vertexComponent(ComponentMap component, int f_component) : m_component(component), m_f_component(f_component) {} template bool operator()(const Vertex& v) const { return (get(m_component, v) == m_f_component); } ComponentMap m_component; int m_f_component; }; int main(int argc, char ** argv) { typedef adjacency_list > Graph; typedef property_map::type ComponentMap; typedef filtered_graph > FilteredGraph; graph_traits < Graph >::vertex_iterator vi, vi_end; graph_traits < Graph >::out_edge_iterator oei, oei_end; graph_traits < FilteredGraph >::vertex_iterator fvi, fvi_end; graph_traits < FilteredGraph >::out_edge_iterator foei, foei_end; Graph * g; FilteredGraph * fg; enum { A, B, C, D, E, F, G, H, I, N }; const char* name = "ABCDEFGHI"; g = new Graph(N); add_edge(A, B, *g); add_edge(C, D, *g); add_edge(D, E, *g); add_edge(E, C, *g); add_edge(F, A, *g); add_edge(F, B, *g); add_edge(G, H, *g); add_edge(G, I, *g); add_edge(H, I, *g); std::cout<"< vfilter(get(vertex_component, *g), i); fg = new FilteredGraph(*g, efilter, vfilter); std::cout<<"Filtered graph (component "<"<