#include #include using namespace boost; struct VIZ : public default_dfs_visitor { template void finish_vertex(V v, const G&) { std::cout << "Finish vertex: " << v << std::endl; } template void finish_edge(E e, const G&) { std::cout << "Finish edge: " << e << std::endl; } }; int main() { adjacency_list g(4); adjacency_list::vertex_descriptor a,b,c,d; a = vertex(0, g); b = vertex(1, g); c = vertex(2, g); d = vertex(3, g); add_edge(a,b,g); add_edge(a,c,g); add_edge(b,d,g); add_edge(c,d,g); depth_first_search(g, visitor(VIZ ())); }