]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/test/dag_longest_paths.cpp
1 // Copyright (C) 2002 Trustees of Indiana University
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)
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/test/minimal.hpp>
12 using namespace boost
;
17 int test_main(int, char*[])
19 typedef adjacency_list
<vecS
, vecS
, directedS
, no_property
,
20 property
<edge_weight_t
, int> > Graph
;
24 (void)add_vertex(graph
);
25 (void)add_vertex(graph
);
26 (void)add_vertex(graph
);
27 (void)add_vertex(graph
);
29 Graph::edge_descriptor e
;
31 e
= add_edge(0, 1, graph
).first
;
32 put(edge_weight
, graph
, e
, 1);
34 e
= add_edge(1, 2, graph
).first
;
35 put(edge_weight
, graph
, e
, 1);
37 e
= add_edge(3, 1, graph
).first
;
38 put(edge_weight
, graph
, e
, 5);
40 vector_property_map
<int> distance
;
42 dag_shortest_paths(graph
, 0,
43 distance_map(distance
)
44 .distance_compare(std::greater
<int>())
45 .distance_inf((std::numeric_limits
<int>::min
)())
48 cout
<< distance
[2] << "\n";
50 BOOST_CHECK(distance
[2] == 2);