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