]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/graph_parallel/test/distributed_csr_test.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / graph_parallel / test / distributed_csr_test.cpp
CommitLineData
7c673cae
FG
1// Copyright (C) 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: Douglas Gregor
8// Andrew Lumsdaine
9
10// A test of the distributed compressed sparse row graph type
11#include <boost/graph/use_mpi.hpp>
12#include <boost/config.hpp>
13#include <boost/throw_exception.hpp>
14#include <boost/serialization/vector.hpp>
15#include <boost/graph/distributed/compressed_sparse_row_graph.hpp>
16#include <boost/graph/distributed/mpi_process_group.hpp>
17#include <boost/graph/distributed/concepts.hpp>
18#include <boost/graph/erdos_renyi_generator.hpp>
19#include <boost/random/linear_congruential.hpp>
20#include <boost/graph/breadth_first_search.hpp>
21#include <boost/graph/graphviz.hpp>
22#include <boost/property_map/vector_property_map.hpp>
1e59de90 23#include <boost/core/lightweight_test.hpp>
7c673cae
FG
24
25#ifdef BOOST_NO_EXCEPTIONS
26void
27boost::throw_exception(std::exception const& ex)
28{
29 std::cout << ex.what() << std::endl;
30 abort();
31}
32#endif
33
34using namespace boost;
35using boost::graph::distributed::mpi_process_group;
36
37void concept_checks()
38{
39 typedef compressed_sparse_row_graph<directedS, no_property, no_property, no_property,
40 distributedS<mpi_process_group> >
41 Digraph;
42 typedef graph_traits<Digraph>::vertex_descriptor vertex_descriptor;
43 typedef graph_traits<Digraph>::edge_descriptor edge_descriptor;
44
45 function_requires< GraphConcept<Digraph> >();
46 function_requires< IncidenceGraphConcept<Digraph> >();
47 function_requires< AdjacencyGraphConcept<Digraph> >();
48
49 function_requires< DistributedVertexListGraphConcept<Digraph> >();
50 function_requires< DistributedEdgeListGraphConcept<Digraph> >();
51
52 function_requires<
53 ReadablePropertyGraphConcept<Digraph, vertex_descriptor, vertex_global_t>
54 >();
55 function_requires<
56 ReadablePropertyGraphConcept<Digraph, vertex_descriptor, vertex_owner_t>
57 >();
58 function_requires<
59 ReadablePropertyGraphConcept<Digraph, vertex_descriptor, vertex_local_t>
60 >();
61 function_requires<
62 ReadablePropertyGraphConcept<Digraph, vertex_descriptor, vertex_index_t>
63 >();
64
65 function_requires<
66 ReadablePropertyGraphConcept<Digraph, edge_descriptor, edge_global_t>
67 >();
68
69 // DPG TBD: edge_owner, edge_local property maps
70
71 function_requires<
72 ReadablePropertyGraphConcept<Digraph, edge_descriptor, edge_index_t>
73 >();
74
75 // Check default construction
76 Digraph g;
77}
78
1e59de90 79int main(int argc, char* argv[])
7c673cae
FG
80{
81 mpi::environment env(argc, argv);
82
83 concept_checks();
84
85 typedef compressed_sparse_row_graph<directedS, no_property, no_property, no_property,
86 distributedS<mpi_process_group> >
87 Digraph;
88
89 // Build an Erdos-Renyi graph to test with
90 typedef sorted_erdos_renyi_iterator<minstd_rand, Digraph> ERIter;
91
92 int n = 40;
93 double prob = 0.1;
94
95 minstd_rand gen;
96 Digraph g(ERIter(gen, n, prob), ERIter(), n);
97
98 breadth_first_search(g, vertex(0, g), visitor(bfs_visitor<>()));
99
100 std::ofstream out("dcsr.dot");
101 write_graphviz(out, g);
1e59de90 102 return boost::report_errors();
7c673cae 103}