sl@0
|
1 |
// Copyright (c) Jeremy Siek 2001
|
sl@0
|
2 |
//
|
sl@0
|
3 |
// Distributed under the Boost Software License, Version 1.0. (See
|
sl@0
|
4 |
// accompanying file LICENSE_1_0.txt or copy at
|
sl@0
|
5 |
// http://www.boost.org/LICENSE_1_0.txt)
|
sl@0
|
6 |
|
sl@0
|
7 |
// NOTE: this final is generated by libs/graph/doc/transitive_closure.w
|
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 |
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
sl@0
|
14 |
#error The transitive closure algorithm uses partial specialization.
|
sl@0
|
15 |
#endif
|
sl@0
|
16 |
|
sl@0
|
17 |
#include <boost/graph/transitive_closure.hpp>
|
sl@0
|
18 |
#include <boost/graph/graphviz.hpp>
|
sl@0
|
19 |
#include <boost/graph/graph_utility.hpp>
|
sl@0
|
20 |
|
sl@0
|
21 |
#ifdef __SYMBIAN32__
|
sl@0
|
22 |
#include "std_log_result.h"
|
sl@0
|
23 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
sl@0
|
24 |
#endif
|
sl@0
|
25 |
|
sl@0
|
26 |
int
|
sl@0
|
27 |
main(int, char *[])
|
sl@0
|
28 |
{
|
sl@0
|
29 |
using namespace boost;
|
sl@0
|
30 |
typedef property < vertex_name_t, char >Name;
|
sl@0
|
31 |
typedef property < vertex_index_t, std::size_t, Name > Index;
|
sl@0
|
32 |
typedef adjacency_list < listS, listS, directedS, Index > graph_t;
|
sl@0
|
33 |
typedef graph_traits < graph_t >::vertex_descriptor vertex_t;
|
sl@0
|
34 |
graph_t G;
|
sl@0
|
35 |
std::vector < vertex_t > verts(4);
|
sl@0
|
36 |
for (int i = 0; i < 4; ++i)
|
sl@0
|
37 |
verts[i] = add_vertex(Index(i, Name('a' + i)), G);
|
sl@0
|
38 |
add_edge(verts[1], verts[2], G);
|
sl@0
|
39 |
add_edge(verts[1], verts[3], G);
|
sl@0
|
40 |
add_edge(verts[2], verts[1], G);
|
sl@0
|
41 |
add_edge(verts[3], verts[2], G);
|
sl@0
|
42 |
add_edge(verts[3], verts[0], G);
|
sl@0
|
43 |
|
sl@0
|
44 |
std::cout << "Graph G:" << std::endl;
|
sl@0
|
45 |
print_graph(G, get(vertex_name, G));
|
sl@0
|
46 |
|
sl@0
|
47 |
adjacency_list <> TC;
|
sl@0
|
48 |
transitive_closure(G, TC);
|
sl@0
|
49 |
|
sl@0
|
50 |
std::cout << std::endl << "Graph G+:" << std::endl;
|
sl@0
|
51 |
char name[] = "abcd";
|
sl@0
|
52 |
print_graph(TC, name);
|
sl@0
|
53 |
std::cout << std::endl;
|
sl@0
|
54 |
|
sl@0
|
55 |
std::ofstream out("tc-out.dot");
|
sl@0
|
56 |
write_graphviz(out, TC, make_label_writer(name));
|
sl@0
|
57 |
#ifdef __SYMBIAN32__
|
sl@0
|
58 |
testResultXml("transitive_closure");
|
sl@0
|
59 |
close_log_file();
|
sl@0
|
60 |
#endif
|
sl@0
|
61 |
|
sl@0
|
62 |
return 0;
|
sl@0
|
63 |
}
|