dfs_cc.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //=======================================================================
  2. // Copyright 2002 Indiana University.
  3. // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //=======================================================================
  9. #include <boost/concept_archetype.hpp>
  10. #include <boost/graph/depth_first_search.hpp>
  11. #include <boost/graph/graph_archetypes.hpp>
  12. int main()
  13. {
  14. using namespace boost;
  15. typedef default_constructible_archetype<
  16. sgi_assignable_archetype<
  17. equality_comparable_archetype<> > > vertex_t;
  18. {
  19. typedef incidence_graph_archetype<vertex_t, directed_tag,
  20. allow_parallel_edge_tag> IncidenceGraph;
  21. typedef vertex_list_graph_archetype<vertex_t, directed_tag,
  22. allow_parallel_edge_tag, IncidenceGraph> graph_t;
  23. graph_t& g = static_object<graph_t>::get();
  24. read_write_property_map_archetype<vertex_t, color_value_archetype> color;
  25. depth_first_search(g, color_map(color));
  26. }
  27. {
  28. typedef incidence_graph_archetype<vertex_t, directed_tag,
  29. allow_parallel_edge_tag> IncidenceGraph;
  30. typedef vertex_list_graph_archetype<vertex_t, directed_tag,
  31. allow_parallel_edge_tag, IncidenceGraph> graph_t;
  32. graph_t& g = static_object<graph_t>::get();
  33. readable_property_map_archetype<vertex_t, std::size_t> v_index;
  34. depth_first_search(g, vertex_index_map(v_index));
  35. }
  36. {
  37. typedef incidence_graph_archetype<vertex_t, undirected_tag,
  38. allow_parallel_edge_tag> IncidenceGraph;
  39. typedef vertex_list_graph_archetype<vertex_t, undirected_tag,
  40. allow_parallel_edge_tag, IncidenceGraph> Graph;
  41. typedef property_graph_archetype<Graph, vertex_index_t, std::size_t>
  42. graph_t;
  43. graph_t& g = static_object<graph_t>::get();
  44. dfs_visitor<> v;
  45. depth_first_search(g, visitor(v));
  46. }
  47. return 0;
  48. }