]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph_parallel/test/distributed_st_connected_test.cpp
1 // Copyright (C) 2004-2006 The Trustees of Indiana University.
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)
7 // Authors: Nick Edmonds
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>
23 #include <boost/random.hpp>
24 #include <boost/test/minimal.hpp>
26 #ifdef BOOST_NO_EXCEPTIONS
28 boost::throw_exception(std::exception
const& ex
)
30 std::cout
<< ex
.what() << std::endl
;
35 using namespace boost
;
36 using boost::graph::distributed::mpi_process_group
;
38 // Set up the vertex names
39 enum vertex_id_t
{ u
, v
, w
, x
, y
, z
, N
};
40 char vertex_names
[] = { 'u', 'v', 'w', 'x', 'y', 'z' };
43 test_distributed_st_connected() {
45 typedef adjacency_list
<listS
,
46 distributedS
<mpi_process_group
, vecS
>,
49 property
<vertex_color_t
, default_color_type
> >
52 // Specify the edges in the graph
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
);
59 bool connected
= st_connected(g
, vertex(u
, g
), vertex(z
, g
),
60 get(vertex_color
, g
), get(vertex_owner
, g
));
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
);
71 bool connected
= st_connected(g
, vertex(u
, g
), vertex(z
, g
),
72 get(vertex_color
, g
), get(vertex_owner
, g
));
80 int test_main(int argc
, char* argv
[])
82 mpi::environment
env(argc
, argv
);
83 test_distributed_st_connected();