]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/min_degree_empty.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / graph / test / min_degree_empty.cpp
1 //=======================================================================
2 // Copyright 2017 Felix Salfelder
3 //
4 // Distributed under the Boost Software License, Version 1.0.
5 // (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
8
9 #include <boost/graph/minimum_degree_ordering.hpp>
10 #include <boost/graph/adjacency_list.hpp>
11 #include <boost/property_map/property_map.hpp>
12 #include <boost/test/minimal.hpp>
13 #include <boost/typeof/typeof.hpp>
14 #include <vector>
15 #include <map>
16
17 typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS> G;
18
19 int test_main(int argc, char** argv)
20 {
21 size_t n = 10;
22 G g(n);
23
24 std::vector<int> inverse_perm(n, 0);
25 std::vector<int> supernode_sizes(n, 1);
26 BOOST_AUTO(id, boost::get(boost::vertex_index, g));
27 std::vector<int> degree(n, 0);
28 std::map<int,int> io;
29 std::map<int,int> o;
30
31 boost::minimum_degree_ordering(
32 g
33 , boost::make_iterator_property_map(degree.begin(), id, degree[0])
34 , boost::make_assoc_property_map(io)
35 , boost::make_assoc_property_map(o)
36 , boost::make_iterator_property_map(
37 supernode_sizes.begin()
38 , id
39 , supernode_sizes[0]
40 )
41 , 0
42 , id
43 );
44
45 for (int k = 0; k < n; ++k)
46 {
47 BOOST_CHECK(o[io[k]] == k);
48 }
49
50 return 0;
51 }