Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78022 - trunk/libs/graph/example
From: jewillco_at_[hidden]
Date: 2012-04-16 13:46:16


Author: jewillco
Date: 2012-04-16 13:46:15 EDT (Mon, 16 Apr 2012)
New Revision: 78022
URL: http://svn.boost.org/trac/boost/changeset/78022

Log:
Fixed SCC example and added it to Jamfile; fixes #6647
Text files modified:
   trunk/libs/graph/example/Jamfile.v2 | 2 ++
   trunk/libs/graph/example/strong_components.cpp | 15 ++++++++-------
   2 files changed, 10 insertions(+), 7 deletions(-)

Modified: trunk/libs/graph/example/Jamfile.v2
==============================================================================
--- trunk/libs/graph/example/Jamfile.v2 (original)
+++ trunk/libs/graph/example/Jamfile.v2 2012-04-16 13:46:15 EDT (Mon, 16 Apr 2012)
@@ -39,3 +39,5 @@
 exe directed_graph : directed_graph.cpp ;
 exe undirected_graph : undirected_graph.cpp ;
 exe two_graphs_common_spanning_trees : two_graphs_common_spanning_trees.cpp ;
+exe strong_components : strong_components.cpp ../build//boost_graph ;
+exe strong-components : strong-components.cpp ;

Modified: trunk/libs/graph/example/strong_components.cpp
==============================================================================
--- trunk/libs/graph/example/strong_components.cpp (original)
+++ trunk/libs/graph/example/strong_components.cpp 2012-04-16 13:46:15 EDT (Mon, 16 Apr 2012)
@@ -46,22 +46,23 @@
   using namespace boost;
   const char* name = "abcdefghij";
 
- GraphvizDigraph G;
- read_graphviz("scc.dot", G);
+ adjacency_list<vecS, vecS, directedS> G;
+ dynamic_properties dp;
+ read_graphviz("scc.dot", G, dp);
 
   std::cout << "A directed graph:" << std::endl;
   print_graph(G, name);
   std::cout << std::endl;
 
- typedef graph_traits<GraphvizGraph>::vertex_descriptor Vertex;
+ typedef graph_traits<adjacency_list<vecS, vecS, directedS> >::vertex_descriptor Vertex;
     
   std::vector<int> component(num_vertices(G)), discover_time(num_vertices(G));
   std::vector<default_color_type> color(num_vertices(G));
   std::vector<Vertex> root(num_vertices(G));
- int num = strong_components(G, &component[0],
- root_map(&root[0]).
- color_map(&color[0]).
- discover_time_map(&discover_time[0]));
+ int num = strong_components(G, make_iterator_property_map(component.begin(), get(vertex_index, G)),
+ root_map(make_iterator_property_map(root.begin(), get(vertex_index, G))).
+ color_map(make_iterator_property_map(color.begin(), get(vertex_index, G))).
+ discover_time_map(make_iterator_property_map(discover_time.begin(), get(vertex_index, G))));
     
   std::cout << "Total number of components: " << num << std::endl;
   std::vector<int>::size_type i;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk