sl@0
|
1 |
//=======================================================================
|
sl@0
|
2 |
// Copyright 2002 Indiana University.
|
sl@0
|
3 |
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
|
sl@0
|
4 |
//
|
sl@0
|
5 |
// Distributed under the Boost Software License, Version 1.0. (See
|
sl@0
|
6 |
// accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
7 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
8 |
//=======================================================================
|
sl@0
|
9 |
/*
|
sl@0
|
10 |
* © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
|
sl@0
|
11 |
*/
|
sl@0
|
12 |
|
sl@0
|
13 |
#include <boost/config.hpp>
|
sl@0
|
14 |
#include <boost/concept_archetype.hpp>
|
sl@0
|
15 |
#include <boost/graph/dijkstra_shortest_paths.hpp>
|
sl@0
|
16 |
#include <boost/graph/graph_archetypes.hpp>
|
sl@0
|
17 |
#ifdef __SYMBIAN32__
|
sl@0
|
18 |
#include "std_log_result.h"
|
sl@0
|
19 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
sl@0
|
20 |
#endif
|
sl@0
|
21 |
typedef boost::default_constructible_archetype<
|
sl@0
|
22 |
boost::sgi_assignable_archetype<> > dist_value;
|
sl@0
|
23 |
|
sl@0
|
24 |
// So generate_infinity works...
|
sl@0
|
25 |
namespace std {
|
sl@0
|
26 |
template <>
|
sl@0
|
27 |
class numeric_limits<dist_value> {
|
sl@0
|
28 |
public:
|
sl@0
|
29 |
static dist_value max BOOST_PREVENT_MACRO_SUBSTITUTION () {
|
sl@0
|
30 |
return boost::static_object<dist_value>::get();
|
sl@0
|
31 |
}
|
sl@0
|
32 |
};
|
sl@0
|
33 |
}
|
sl@0
|
34 |
|
sl@0
|
35 |
dist_value abs(const dist_value& x) { return x; }
|
sl@0
|
36 |
std::size_t abs(std::size_t x) { return x; }
|
sl@0
|
37 |
|
sl@0
|
38 |
int main()
|
sl@0
|
39 |
{
|
sl@0
|
40 |
using namespace boost;
|
sl@0
|
41 |
typedef default_constructible_archetype<
|
sl@0
|
42 |
sgi_assignable_archetype<
|
sl@0
|
43 |
equality_comparable_archetype<> > > vertex_t;
|
sl@0
|
44 |
{
|
sl@0
|
45 |
typedef incidence_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
46 |
allow_parallel_edge_tag> IncidenceGraph;
|
sl@0
|
47 |
typedef vertex_list_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
48 |
allow_parallel_edge_tag, IncidenceGraph> graph_t;
|
sl@0
|
49 |
graph_t& g = static_object<graph_t>::get();
|
sl@0
|
50 |
vertex_t s;
|
sl@0
|
51 |
typedef graph_traits<graph_t>::edge_descriptor edge_t;
|
sl@0
|
52 |
readable_property_map_archetype<edge_t, std::size_t> weight;
|
sl@0
|
53 |
readable_property_map_archetype<vertex_t, int> index;
|
sl@0
|
54 |
read_write_property_map_archetype<vertex_t, std::size_t> distance;
|
sl@0
|
55 |
dijkstra_shortest_paths(g, s,
|
sl@0
|
56 |
vertex_index_map(index).
|
sl@0
|
57 |
weight_map(weight).
|
sl@0
|
58 |
distance_map(distance));
|
sl@0
|
59 |
}
|
sl@0
|
60 |
{
|
sl@0
|
61 |
typedef incidence_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
62 |
allow_parallel_edge_tag> IncidenceGraph;
|
sl@0
|
63 |
typedef vertex_list_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
64 |
allow_parallel_edge_tag, IncidenceGraph> Graph;
|
sl@0
|
65 |
vertex_t s;
|
sl@0
|
66 |
typedef graph_traits<Graph>::edge_descriptor edge_t;
|
sl@0
|
67 |
readable_property_map_archetype<edge_t, std::size_t> weight;
|
sl@0
|
68 |
typedef property_graph_archetype<Graph, vertex_index_t, std::size_t>
|
sl@0
|
69 |
graph_t;
|
sl@0
|
70 |
graph_t& g = static_object<graph_t>::get();
|
sl@0
|
71 |
read_write_property_map_archetype<vertex_t, vertex_t> pred;
|
sl@0
|
72 |
dijkstra_shortest_paths(g, s,
|
sl@0
|
73 |
predecessor_map(pred).
|
sl@0
|
74 |
weight_map(weight));
|
sl@0
|
75 |
}
|
sl@0
|
76 |
{
|
sl@0
|
77 |
typedef incidence_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
78 |
allow_parallel_edge_tag> IncidenceGraph;
|
sl@0
|
79 |
typedef vertex_list_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
80 |
allow_parallel_edge_tag, IncidenceGraph> Graph;
|
sl@0
|
81 |
vertex_t s;
|
sl@0
|
82 |
typedef property_graph_archetype<Graph, edge_weight_t, std::size_t>
|
sl@0
|
83 |
graph_t;
|
sl@0
|
84 |
graph_t& g = static_object<graph_t>::get();
|
sl@0
|
85 |
read_write_property_map_archetype<vertex_t, vertex_t> pred;
|
sl@0
|
86 |
readable_property_map_archetype<vertex_t, int> index;
|
sl@0
|
87 |
dijkstra_shortest_paths(g, s,
|
sl@0
|
88 |
predecessor_map(pred).
|
sl@0
|
89 |
vertex_index_map(index));
|
sl@0
|
90 |
}
|
sl@0
|
91 |
{
|
sl@0
|
92 |
typedef incidence_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
93 |
allow_parallel_edge_tag> IncidenceGraph;
|
sl@0
|
94 |
typedef vertex_list_graph_archetype<vertex_t, directed_tag,
|
sl@0
|
95 |
allow_parallel_edge_tag, IncidenceGraph> graph_t;
|
sl@0
|
96 |
graph_t& g = static_object<graph_t>::get();
|
sl@0
|
97 |
vertex_t s;
|
sl@0
|
98 |
typedef graph_traits<graph_t>::edge_descriptor edge_t;
|
sl@0
|
99 |
readable_property_map_archetype<edge_t, dist_value> weight;
|
sl@0
|
100 |
readable_property_map_archetype<vertex_t, int> index;
|
sl@0
|
101 |
read_write_property_map_archetype<vertex_t, color_value_archetype> color;
|
sl@0
|
102 |
read_write_property_map_archetype<vertex_t, dist_value> distance;
|
sl@0
|
103 |
typedef binary_function_archetype<dist_value, dist_value, dist_value>
|
sl@0
|
104 |
Combine;
|
sl@0
|
105 |
Combine combine = static_object<Combine>::get();
|
sl@0
|
106 |
typedef binary_predicate_archetype<dist_value, dist_value>
|
sl@0
|
107 |
Compare;
|
sl@0
|
108 |
Compare compare = static_object<Compare>::get();
|
sl@0
|
109 |
dijkstra_visitor<> vis;
|
sl@0
|
110 |
|
sl@0
|
111 |
dijkstra_shortest_paths(g, s, color_map(color).
|
sl@0
|
112 |
vertex_index_map(index).
|
sl@0
|
113 |
weight_map(weight).
|
sl@0
|
114 |
distance_map(distance).
|
sl@0
|
115 |
distance_combine(combine).
|
sl@0
|
116 |
distance_compare(compare).
|
sl@0
|
117 |
visitor(vis));
|
sl@0
|
118 |
}
|
sl@0
|
119 |
#ifdef __SYMBIAN32__
|
sl@0
|
120 |
std_log(LOG_FILENAME_LINE,"[End Test Case ]");
|
sl@0
|
121 |
|
sl@0
|
122 |
testResultXml("dijkstra_cc");
|
sl@0
|
123 |
close_log_file();
|
sl@0
|
124 |
#endif
|
sl@0
|
125 |
return 0;
|
sl@0
|
126 |
}
|