Boost logo

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 &lt;boost/config.hpp&gt;
 #include &lt;iostream&gt;
 #include &lt;string&gt;
-#include &lt;boost/graph/kolmogorov_map_flow.hpp&gt;
+#include &lt;boost/graph/kolmogorov_max_flow.hpp&gt;
 #include &lt;boost/graph/adjacency_list.hpp&gt;
 #include &lt;boost/graph/read_dimacs.hpp&gt;
+#include &lt;boost/graph/graph_utility.hpp&gt;
 
 int
 main()
 {
   using namespace boost;
 
- typedef adjacency_list_traits&lt;vecS, vecS, directedS&gt; Traits;
- typedef adjacency_list&lt;vecS, vecS, directedS,
- property&lt;vertex_name_t, std::string&gt;,
- property&lt;edge_capacity_t, long,
- property&lt;edge_residual_capacity_t, long,
- property&lt;edge_reverse_t, Traits::edge_descriptor&gt; &gt; &gt;
- &gt; Graph;
-
+ typedef adjacency_list_traits &lt; vecS, vecS, directedS &gt; Traits;
+ typedef adjacency_list &lt; vecS, vecS, directedS,
+ property &lt; vertex_name_t, std::string,
+ property &lt; vertex_index_t, long,
+ property &lt; vertex_color_t, boost::default_color_type,
+ property &lt; vertex_distance_t, long,
+ property &lt; vertex_predecessor_t, Traits::edge_descriptor &gt; &gt; &gt; &gt; &gt;,
+
+ property &lt; edge_capacity_t, long,
+ property &lt; edge_residual_capacity_t, long,
+ property &lt; edge_reverse_t, Traits::edge_descriptor &gt; &gt; &gt; &gt; Graph;
+
   Graph g;
- long flow;
-
- property_map&lt;Graph, edge_capacity_t&gt;::type
- capacity = get(edge_capacity, g);
- property_map&lt;Graph, edge_reverse_t&gt;::type
- rev = get(edge_reverse, g);
- property_map&lt;Graph, edge_residual_capacity_t&gt;::type
- residual_capacity = get(edge_residual_capacity, g);
-
+ property_map &lt; Graph, edge_capacity_t &gt;::type
+ capacity = get(edge_capacity, g);
+ property_map &lt; Graph, edge_residual_capacity_t &gt;::type
+ residual_capacity = get(edge_residual_capacity, g);
+ property_map &lt; Graph, edge_reverse_t &gt;::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 &lt;&lt; &quot;c The total flow:&quot; &lt;&lt; std::endl;
- std::cout &lt;&lt; &quot;s &quot; &lt;&lt; flow &lt;&lt; std::endl &lt;&lt; std::endl;
-
- std::cout &lt;&lt; &quot;c flow values:&quot; &lt;&lt; std::endl;
- graph_traits&lt;Graph&gt;::vertex_iterator u_iter, u_end;
- graph_traits&lt;Graph&gt;::out_edge_iterator ei, e_end;
+ std::vector&lt;default_color_type&gt; color(num_vertices(g));
+ std::vector&lt;long&gt; distance(num_vertices(g));
+ long flow = kolmogorov_max_flow(g ,s, t);
+
+ std::cout &lt;&lt; "c The total flow:" &lt;&lt; std::endl;
+ std::cout &lt;&lt; "s " &lt;&lt; flow &lt;&lt; std::endl &lt;&lt; std::endl;
+
+ std::cout &lt;&lt; "c flow values:" &lt;&lt; std::endl;
+ graph_traits &lt; Graph &gt;::vertex_iterator u_iter, u_end;
+ graph_traits &lt; Graph &gt;::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] &gt; 0)
- std::cout &lt;&lt; &quot;f &quot; &lt;&lt; *u_iter &lt;&lt; &quot; &quot; &lt;&lt; target(*ei, g) &lt;&lt; &quot; &quot;
- &lt;&lt; (capacity[*ei] - residual_capacity[*ei]) &lt;&lt; std::endl;
- return 0;
+ std::cout &lt;&lt; "f " &lt;&lt; *u_iter &lt;&lt; " " &lt;&lt; target(*ei, g) &lt;&lt; " "
+ &lt;&lt; (capacity[*ei] - residual_capacity[*ei]) &lt;&lt; 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