]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/graph_parallel/test/distributed_st_connected_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / graph_parallel / test / distributed_st_connected_test.cpp
CommitLineData
7c673cae
FG
1// Copyright (C) 2004-2006 The Trustees of Indiana University.
2
3// Use, modification and distribution is subject to the Boost Software
4// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5// http://www.boost.org/LICENSE_1_0.txt)
6
7// Authors: Nick Edmonds
8// Andrew Lumsdaine
9
10#include <boost/graph/use_mpi.hpp>
11#include <boost/config.hpp>
12#include <boost/throw_exception.hpp>
13#include <boost/graph/distributed/adjacency_list.hpp>
14#include <boost/graph/random.hpp>
15#include <boost/property_map/parallel/distributed_property_map.hpp>
16#include <boost/graph/distributed/mpi_process_group.hpp>
17#include <boost/graph/distributed/st_connected.hpp>
18#include <boost/graph/parallel/distribution.hpp>
19#include <boost/graph/small_world_generator.hpp>
20#include <iostream>
21#include <cstdlib>
22#include <iomanip>
23#include <boost/random.hpp>
1e59de90 24#include <boost/core/lightweight_test.hpp>
7c673cae
FG
25
26#ifdef BOOST_NO_EXCEPTIONS
27void
28boost::throw_exception(std::exception const& ex)
29{
30 std::cout << ex.what() << std::endl;
31 abort();
32}
33#endif
34
35using namespace boost;
36using boost::graph::distributed::mpi_process_group;
37
38// Set up the vertex names
39enum vertex_id_t { u, v, w, x, y, z, N };
40char vertex_names[] = { 'u', 'v', 'w', 'x', 'y', 'z' };
41
42void
43test_distributed_st_connected() {
44
45 typedef adjacency_list<listS,
46 distributedS<mpi_process_group, vecS>,
47 undirectedS,
48 // Vertex properties
49 property<vertex_color_t, default_color_type> >
50 Graph;
51
52 // Specify the edges in the graph
53 {
54 typedef std::pair<int, int> E;
55 E edge_array[] = { E(u, u), E(u, v), E(u, w), E(v, w), E(x, y),
56 E(x, z), E(z, y), E(z, z) };
57 Graph g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N);
58
59 bool connected = st_connected(g, vertex(u, g), vertex(z, g),
60 get(vertex_color, g), get(vertex_owner, g));
61
62 assert(!connected);
63 }
64
65 {
66 typedef std::pair<int, int> E;
67 E edge_array[] = { E(u, v), E(u, w), E(u, x), E(x, v), E(y, x),
68 E(v, y), E(w, y), E(w, z), E(z, z) };
69 Graph g(edge_array, edge_array + sizeof(edge_array) / sizeof(E), N);
70
71 bool connected = st_connected(g, vertex(u, g), vertex(z, g),
72 get(vertex_color, g), get(vertex_owner, g));
73
74 assert(connected);
75 }
76
77
78}
79
1e59de90 80int main(int argc, char* argv[])
7c673cae
FG
81{
82 mpi::environment env(argc, argv);
83 test_distributed_st_connected();
1e59de90 84 return boost::report_errors();
7c673cae 85}