]>
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/core/lightweight_test.hpp>
12 using namespace boost
;
17 int main(int, char*[])
19 typedef adjacency_list
< vecS
, vecS
, directedS
, no_property
,
20 property
< edge_weight_t
, int > >
25 (void)add_vertex(graph
);
26 (void)add_vertex(graph
);
27 (void)add_vertex(graph
);
28 (void)add_vertex(graph
);
30 Graph::edge_descriptor e
;
32 e
= add_edge(0, 1, graph
).first
;
33 put(edge_weight
, graph
, e
, 1);
35 e
= add_edge(1, 2, graph
).first
;
36 put(edge_weight
, graph
, e
, 1);
38 e
= add_edge(3, 1, graph
).first
;
39 put(edge_weight
, graph
, e
, 5);
41 vector_property_map
< int > distance
;
43 dag_shortest_paths(graph
, 0,
44 distance_map(distance
)
45 .distance_compare(std::greater
< int >())
46 .distance_inf((std::numeric_limits
< int >::min
)())
49 cout
<< distance
[2] << "\n";
51 BOOST_TEST(distance
[2] == 2);
53 return boost::report_errors();