1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/stdcpp/tsrc/Boost_test/graph/src/transitive_closure.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,63 @@
1.4 +// Copyright (c) Jeremy Siek 2001
1.5 +//
1.6 +// Distributed under the Boost Software License, Version 1.0. (See
1.7 +// accompanying file LICENSE_1_0.txt or copy at
1.8 +// http://www.boost.org/LICENSE_1_0.txt)
1.9 +
1.10 +// NOTE: this final is generated by libs/graph/doc/transitive_closure.w
1.11 +
1.12 +/*
1.13 + * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.14 +*/
1.15 +
1.16 +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
1.17 +#error The transitive closure algorithm uses partial specialization.
1.18 +#endif
1.19 +
1.20 +#include <boost/graph/transitive_closure.hpp>
1.21 +#include <boost/graph/graphviz.hpp>
1.22 +#include <boost/graph/graph_utility.hpp>
1.23 +
1.24 +#ifdef __SYMBIAN32__
1.25 +#include "std_log_result.h"
1.26 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.27 +#endif
1.28 +
1.29 +int
1.30 +main(int, char *[])
1.31 +{
1.32 + using namespace boost;
1.33 + typedef property < vertex_name_t, char >Name;
1.34 + typedef property < vertex_index_t, std::size_t, Name > Index;
1.35 + typedef adjacency_list < listS, listS, directedS, Index > graph_t;
1.36 + typedef graph_traits < graph_t >::vertex_descriptor vertex_t;
1.37 + graph_t G;
1.38 + std::vector < vertex_t > verts(4);
1.39 + for (int i = 0; i < 4; ++i)
1.40 + verts[i] = add_vertex(Index(i, Name('a' + i)), G);
1.41 + add_edge(verts[1], verts[2], G);
1.42 + add_edge(verts[1], verts[3], G);
1.43 + add_edge(verts[2], verts[1], G);
1.44 + add_edge(verts[3], verts[2], G);
1.45 + add_edge(verts[3], verts[0], G);
1.46 +
1.47 + std::cout << "Graph G:" << std::endl;
1.48 + print_graph(G, get(vertex_name, G));
1.49 +
1.50 + adjacency_list <> TC;
1.51 + transitive_closure(G, TC);
1.52 +
1.53 + std::cout << std::endl << "Graph G+:" << std::endl;
1.54 + char name[] = "abcd";
1.55 + print_graph(TC, name);
1.56 + std::cout << std::endl;
1.57 +
1.58 + std::ofstream out("tc-out.dot");
1.59 + write_graphviz(out, TC, make_label_writer(name));
1.60 + #ifdef __SYMBIAN32__
1.61 + testResultXml("transitive_closure");
1.62 + close_log_file();
1.63 + #endif
1.64 +
1.65 + return 0;
1.66 +}