]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/dag_longest_paths.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / graph / test / dag_longest_paths.cpp
1 // Copyright (C) 2002 Trustees of Indiana University
2
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
6
7 #include <boost/graph/adjacency_list.hpp>
8 #include <boost/graph/dag_shortest_paths.hpp>
9 #include <boost/property_map/vector_property_map.hpp>
10 #include <boost/core/lightweight_test.hpp>
11
12 using namespace boost;
13
14 #include <iostream>
15 using namespace std;
16
17 int main(int, char*[])
18 {
19 typedef adjacency_list< vecS, vecS, directedS, no_property,
20 property< edge_weight_t, int > >
21 Graph;
22
23 Graph graph;
24
25 (void)add_vertex(graph);
26 (void)add_vertex(graph);
27 (void)add_vertex(graph);
28 (void)add_vertex(graph);
29
30 Graph::edge_descriptor e;
31
32 e = add_edge(0, 1, graph).first;
33 put(edge_weight, graph, e, 1);
34
35 e = add_edge(1, 2, graph).first;
36 put(edge_weight, graph, e, 1);
37
38 e = add_edge(3, 1, graph).first;
39 put(edge_weight, graph, e, 5);
40
41 vector_property_map< int > distance;
42
43 dag_shortest_paths(graph, 0,
44 distance_map(distance)
45 .distance_compare(std::greater< int >())
46 .distance_inf((std::numeric_limits< int >::min)())
47 .distance_zero(0));
48
49 cout << distance[2] << "\n";
50
51 BOOST_TEST(distance[2] == 2);
52
53 return boost::report_errors();
54 }