|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r52994 - trunk/libs/graph/doc
From: jewillco_at_[hidden]
Date: 2009-05-14 10:50:20
Author: jewillco
Date: 2009-05-14 10:50:20 EDT (Thu, 14 May 2009)
New Revision: 52994
URL: http://svn.boost.org/trac/boost/changeset/52994
Log:
Replaced broken example in docs with working version from example directory, fixes #3016
Text files modified:
trunk/libs/graph/doc/kolmogorov_max_flow.html | 62 +++++++++++++++++++++------------------
1 files changed, 33 insertions(+), 29 deletions(-)
Modified: trunk/libs/graph/doc/kolmogorov_max_flow.html
==============================================================================
--- trunk/libs/graph/doc/kolmogorov_max_flow.html (original)
+++ trunk/libs/graph/doc/kolmogorov_max_flow.html 2009-05-14 10:50:20 EDT (Thu, 14 May 2009)
@@ -292,50 +292,54 @@
<PRE>#include <boost/config.hpp>
#include <iostream>
#include <string>
-#include <boost/graph/kolmogorov_map_flow.hpp>
+#include <boost/graph/kolmogorov_max_flow.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/read_dimacs.hpp>
+#include <boost/graph/graph_utility.hpp>
int
main()
{
using namespace boost;
- typedef adjacency_list_traits<vecS, vecS, directedS> Traits;
- typedef adjacency_list<vecS, vecS, directedS,
- property<vertex_name_t, std::string>,
- property<edge_capacity_t, long,
- property<edge_residual_capacity_t, long,
- property<edge_reverse_t, Traits::edge_descriptor> > >
- > Graph;
-
+ typedef adjacency_list_traits < vecS, vecS, directedS > Traits;
+ typedef adjacency_list < vecS, vecS, directedS,
+ property < vertex_name_t, std::string,
+ property < vertex_index_t, long,
+ property < vertex_color_t, boost::default_color_type,
+ property < vertex_distance_t, long,
+ property < vertex_predecessor_t, Traits::edge_descriptor > > > > >,
+
+ property < edge_capacity_t, long,
+ property < edge_residual_capacity_t, long,
+ property < edge_reverse_t, Traits::edge_descriptor > > > > Graph;
+
Graph g;
- long flow;
-
- property_map<Graph, edge_capacity_t>::type
- capacity = get(edge_capacity, g);
- property_map<Graph, edge_reverse_t>::type
- rev = get(edge_reverse, g);
- property_map<Graph, edge_residual_capacity_t>::type
- residual_capacity = get(edge_residual_capacity, g);
-
+ property_map < Graph, edge_capacity_t >::type
+ capacity = get(edge_capacity, g);
+ property_map < Graph, edge_residual_capacity_t >::type
+ residual_capacity = get(edge_residual_capacity, g);
+ property_map < Graph, edge_reverse_t >::type rev = get(edge_reverse, g);
Traits::vertex_descriptor s, t;
read_dimacs_max_flow(g, capacity, rev, s, t);
- flow = kolmogorov_max_flow(g, s, t);
-
- std::cout << "c The total flow:" << std::endl;
- std::cout << "s " << flow << std::endl << std::endl;
-
- std::cout << "c flow values:" << std::endl;
- graph_traits<Graph>::vertex_iterator u_iter, u_end;
- graph_traits<Graph>::out_edge_iterator ei, e_end;
+ std::vector<default_color_type> color(num_vertices(g));
+ std::vector<long> distance(num_vertices(g));
+ long flow = kolmogorov_max_flow(g ,s, t);
+
+ std::cout << "c The total flow:" << std::endl;
+ std::cout << "s " << flow << std::endl << std::endl;
+
+ std::cout << "c flow values:" << std::endl;
+ graph_traits < Graph >::vertex_iterator u_iter, u_end;
+ graph_traits < Graph >::out_edge_iterator ei, e_end;
for (tie(u_iter, u_end) = vertices(g); u_iter != u_end; ++u_iter)
for (tie(ei, e_end) = out_edges(*u_iter, g); ei != e_end; ++ei)
if (capacity[*ei] > 0)
- std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
- << (capacity[*ei] - residual_capacity[*ei]) << std::endl;
- return 0;
+ std::cout << "f " << *u_iter << " " << target(*ei, g) << " "
+ << (capacity[*ei] - residual_capacity[*ei]) << std::endl;
+
+ return EXIT_SUCCESS;
}</PRE><P>
The output is:
</P>
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