os/ossrv/stdcpp/tsrc/Boost_test/graph/src/bfs_cc.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 
    10 #include <boost/concept_archetype.hpp>
    11 #include <boost/graph/breadth_first_search.hpp>
    12 #include <boost/graph/graph_archetypes.hpp>
    13 
    14 int main()
    15 {
    16   using namespace boost;
    17   typedef default_constructible_archetype<
    18     sgi_assignable_archetype<
    19     equality_comparable_archetype<> > > vertex_t;
    20   {
    21     typedef incidence_graph_archetype<vertex_t, directed_tag,
    22       allow_parallel_edge_tag> IncidenceGraph;
    23     typedef vertex_list_graph_archetype<vertex_t, directed_tag,
    24       allow_parallel_edge_tag, IncidenceGraph> graph_t;
    25     graph_t& g = static_object<graph_t>::get();
    26     vertex_t s;
    27     read_write_property_map_archetype<vertex_t, color_value_archetype> color;
    28     breadth_first_search(g, s, color_map(color));
    29   }
    30   {
    31     typedef incidence_graph_archetype<vertex_t, directed_tag,
    32       allow_parallel_edge_tag> IncidenceGraph;
    33     typedef vertex_list_graph_archetype<vertex_t, directed_tag,
    34       allow_parallel_edge_tag, IncidenceGraph> graph_t;
    35     graph_t& g = static_object<graph_t>::get();
    36     vertex_t s;
    37     readable_property_map_archetype<vertex_t, std::size_t> v_index;
    38     breadth_first_search(g, s, vertex_index_map(v_index));
    39   }
    40   {
    41     typedef incidence_graph_archetype<vertex_t, undirected_tag,
    42       allow_parallel_edge_tag> IncidenceGraph;
    43     typedef vertex_list_graph_archetype<vertex_t, undirected_tag,
    44       allow_parallel_edge_tag, IncidenceGraph> Graph;
    45     typedef property_graph_archetype<Graph, vertex_index_t, std::size_t>
    46       graph_t;
    47     graph_t& g = static_object<graph_t>::get();
    48     vertex_t s;
    49     bfs_visitor<> v;
    50     buffer_archetype<vertex_t> b;
    51     breadth_first_search(g, s, visitor(v).buffer(b));
    52   }
    53   return 0;
    54 }