]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/graph/example/cc-internet.cpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / graph / example / cc-internet.cpp
1 //=======================================================================
2 // Copyright 2001 Jeremy G. Siek, Andrew Lumsdaine, Lie-Quan Lee,
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //=======================================================================
8
9 /*
10 IMPORTANT!!!
11 ~~~~~~~~~~~~
12 This example uses interfaces that have been deprecated and removed from
13 Boost.Grpah. Someone needs to update it, as it does NOT compile.
14 */
15
16 #include <boost/config.hpp>
17 #include <fstream>
18 #include <vector>
19 #include <string>
20 #include <boost/graph/connected_components.hpp>
21 #include <boost/graph/graphviz.hpp>
22
23 int main()
24 {
25 using namespace boost;
26 GraphvizGraph g;
27 read_graphviz("figs/cc-internet.dot", g);
28
29 std::vector< int > component(num_vertices(g));
30
31 connected_components(g,
32 make_iterator_property_map(
33 component.begin(), get(vertex_index, g), component[0]));
34
35 property_map< GraphvizGraph, vertex_attribute_t >::type vertex_attr_map
36 = get(vertex_attribute, g);
37 std::string color[] = { "white", "gray", "black", "lightgray" };
38 graph_traits< GraphvizGraph >::vertex_iterator vi, vi_end;
39 for (boost::tie(vi, vi_end) = vertices(g); vi != vi_end; ++vi)
40 {
41 vertex_attr_map[*vi]["color"] = color[component[*vi]];
42 vertex_attr_map[*vi]["style"] = "filled";
43 if (vertex_attr_map[*vi]["color"] == "black")
44 vertex_attr_map[*vi]["fontcolor"] = "white";
45 }
46 write_graphviz("figs/cc-internet-out.dot", g);
47 }