mirror of
https://github.com/boostorg/graph.git
synced 2025-05-11 13:24:01 +00:00
Fixes #416
Fixed spelling of Jack Edmonds name and renamed files where necessary. Updated the documentation as well. Tested changes by building/running tests in libs/graph/test. [SVN r42984]
This commit is contained in:
parent
341a685ff1
commit
40af610e8f
@ -7,7 +7,7 @@
|
||||
-- http://www.boost.org/LICENSE_1_0.txt)
|
||||
-->
|
||||
<Head>
|
||||
<Title>Boost Graph Library: Edmunds-Karp Maximum Flow</Title>
|
||||
<Title>Boost Graph Library: Edmonds-Karp Maximum Flow</Title>
|
||||
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
|
||||
ALINK="#ff0000">
|
||||
<IMG SRC="../../../boost.png"
|
||||
@ -15,15 +15,15 @@
|
||||
|
||||
<BR Clear>
|
||||
|
||||
<H1><A NAME="sec:edmunds_karp_max_flow">
|
||||
<TT>edmunds_karp_max_flow</TT>
|
||||
<H1><A NAME="sec:edmonds_karp_max_flow">
|
||||
<TT>edmonds_karp_max_flow</TT>
|
||||
</H1>
|
||||
|
||||
<PRE>
|
||||
<i>// named paramter version</i>
|
||||
template <class <a href="./Graph.html">Graph</a>, class P, class T, class R>
|
||||
typename detail::edge_capacity_value<Graph, P, T, R>::value_type
|
||||
edmunds_karp_max_flow(Graph& g,
|
||||
edmonds_karp_max_flow(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink,
|
||||
const bgl_named_params<P, T, R>& params = <i>all defaults</i>)
|
||||
@ -33,7 +33,7 @@ template <class <a href="./Graph.html">Graph</a>,
|
||||
class CapacityEdgeMap, class ResidualCapacityEdgeMap,
|
||||
class ReverseEdgeMap, class ColorMap, class PredEdgeMap>
|
||||
typename property_traits<CapacityEdgeMap>::value_type
|
||||
edmunds_karp_max_flow(Graph& g,
|
||||
edmonds_karp_max_flow(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink,
|
||||
CapacityEdgeMap cap, ResidualCapacityEdgeMap res, ReverseEdgeMap rev,
|
||||
@ -41,7 +41,7 @@ edmunds_karp_max_flow(Graph& g,
|
||||
</PRE>
|
||||
|
||||
<P>
|
||||
The <tt>edmunds_karp_max_flow()</tt> function calculates the maximum flow
|
||||
The <tt>edmonds_karp_max_flow()</tt> function calculates the maximum flow
|
||||
of a network. See Section <a
|
||||
href="./graph_theory_review.html#sec:network-flow-algorithms">Network
|
||||
Flow Algorithms</a> for a description of maximum flow. The calculated
|
||||
@ -93,7 +93,7 @@ algorithm.
|
||||
<H3>Where Defined</H3>
|
||||
|
||||
<P>
|
||||
<a href="../../../boost/graph/edmunds_karp_max_flow.hpp"><TT>boost/graph/edmunds_karp_max_flow.hpp</TT></a>
|
||||
<a href="../../../boost/graph/edmonds_karp_max_flow.hpp"><TT>boost/graph/edmonds_karp_max_flow.hpp</TT></a>
|
||||
|
||||
<P>
|
||||
|
||||
@ -209,7 +209,7 @@ some constant <i>U</i>.
|
||||
<h3>Example</h3>
|
||||
|
||||
The program in <a
|
||||
href="../example/edmunds-karp-eg.cpp"><tt>example/edmunds-karp-eg.cpp</tt></a>
|
||||
href="../example/edmonds-karp-eg.cpp"><tt>example/edmonds-karp-eg.cpp</tt></a>
|
||||
reads an example maximum flow problem (a graph with edge capacities)
|
||||
from a file in the DIMACS format and computes the maximum flow.
|
||||
|
||||
@ -229,9 +229,9 @@ from a file in the DIMACS format and computes the maximum flow.
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
||||
<!-- LocalWords: HTML Siek Edmunds BGCOLOR ffffff ee VLINK ALINK ff IMG SRC
|
||||
<!-- LocalWords: HTML Siek Edmonds BGCOLOR ffffff ee VLINK ALINK ff IMG SRC
|
||||
-->
|
||||
<!-- LocalWords: gif ALT BR sec edmunds karp TT DIV CELLPADDING TR TD PRE lt
|
||||
<!-- LocalWords: gif ALT BR sec edmonds karp TT DIV CELLPADDING TR TD PRE lt
|
||||
-->
|
||||
<!-- LocalWords: typename VertexListGraph CapacityEdgeMap ReverseEdgeMap gt
|
||||
-->
|
@ -364,7 +364,7 @@ f 6 4 0
|
||||
f 7 6 0
|
||||
f 7 5 0</PRE><H3>
|
||||
See Also</H3>
|
||||
<P STYLE="margin-bottom: 0cm"><TT><A HREF="edmunds_karp_max_flow.html">edmunds_karp_max_flow()</A></TT>,<BR><TT><A HREF="push_relabel_max_flow.html">push_relabel_max_flow()</A></TT>.
|
||||
<P STYLE="margin-bottom: 0cm"><TT><A HREF="edmonds_karp_max_flow.html">edmonds_karp_max_flow()</A></TT>,<BR><TT><A HREF="push_relabel_max_flow.html">push_relabel_max_flow()</A></TT>.
|
||||
</P>
|
||||
<HR>
|
||||
<TABLE CELLPADDING=2 CELLSPACING=2>
|
||||
|
@ -225,7 +225,7 @@ f 6 7 1
|
||||
|
||||
<h3>See Also</h3>
|
||||
|
||||
<a href="./edmunds_karp_max_flow.html"><tt>edmunds_karp_max_flow()</tt></a><br>
|
||||
<a href="./edmonds_karp_max_flow.html"><tt>edmonds_karp_max_flow()</tt></a><br>
|
||||
<a href="./kolmogorov_max_flow.html"><tt>kolmogorov_max_flow()</tt></a>.
|
||||
|
||||
<br>
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <boost/graph/edmunds_karp_max_flow.hpp>
|
||||
#include <boost/graph/edmonds_karp_max_flow.hpp>
|
||||
#include <boost/graph/push_relabel_max_flow.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/graphviz.hpp>
|
||||
@ -110,7 +110,7 @@ namespace boost
|
||||
|
||||
while (!nonneighbor_S.empty()) {
|
||||
k = nonneighbor_S.front();
|
||||
alpha_S_k = edmunds_karp_max_flow
|
||||
alpha_S_k = edmonds_karp_max_flow
|
||||
(flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]);
|
||||
if (alpha_S_k < alpha_star) {
|
||||
alpha_star = alpha_S_k;
|
||||
|
@ -8,13 +8,13 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <boost/graph/edmunds_karp_max_flow.hpp>
|
||||
#include <boost/graph/edmonds_karp_max_flow.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/read_dimacs.hpp>
|
||||
#include <boost/graph/graph_utility.hpp>
|
||||
|
||||
// Use a DIMACS network flow file as stdin.
|
||||
// edmunds-karp-eg < max_flow.dat
|
||||
// edmonds-karp-eg < max_flow.dat
|
||||
//
|
||||
// Sample output:
|
||||
// c The total flow:
|
||||
@ -68,10 +68,10 @@ main()
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
std::vector<default_color_type> color(num_vertices(g));
|
||||
std::vector<Traits::edge_descriptor> pred(num_vertices(g));
|
||||
long flow = edmunds_karp_max_flow
|
||||
long flow = edmonds_karp_max_flow
|
||||
(g, s, t, capacity, residual_capacity, rev, &color[0], &pred[0]);
|
||||
#else
|
||||
long flow = edmunds_karp_max_flow(g, s, t);
|
||||
long flow = edmonds_karp_max_flow(g, s, t);
|
||||
#endif
|
||||
|
||||
std::cout << "c The total flow:" << std::endl;
|
@ -44,7 +44,7 @@ compile libs/graph/example/edge_basics.cpp
|
||||
compile libs/graph/example/edge_connectivity.cpp
|
||||
compile libs/graph/example/edge_iterator_constructor.cpp
|
||||
compile libs/graph/example/edge_property.cpp
|
||||
compile libs/graph/example/edmunds-karp-eg.cpp
|
||||
compile libs/graph/example/edmonds-karp-eg.cpp
|
||||
compile libs/graph/example/exterior_properties.cpp
|
||||
compile libs/graph/example/exterior_property_map.cpp
|
||||
compile libs/graph/example/family-tree-eg.cpp
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
#include <boost/graph/edmunds_karp_max_flow.hpp>
|
||||
#include <boost/graph/edmonds_karp_max_flow.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@ -139,7 +139,7 @@ namespace boost {
|
||||
while (!non_neighbor_S.empty()) { // at most n - 1 times
|
||||
k = non_neighbor_S.front();
|
||||
|
||||
alpha_S_k = edmunds_karp_max_flow
|
||||
alpha_S_k = edmonds_karp_max_flow
|
||||
(flow_g, p, k, cap, res_cap, rev_edge, &color[0], &pred[0]);
|
||||
|
||||
if (alpha_S_k < alpha_star) {
|
||||
|
@ -7,8 +7,8 @@
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//=======================================================================
|
||||
|
||||
#ifndef EDMUNDS_KARP_MAX_FLOW_HPP
|
||||
#define EDMUNDS_KARP_MAX_FLOW_HPP
|
||||
#ifndef EDMONDS_KARP_MAX_FLOW_HPP
|
||||
#define EDMONDS_KARP_MAX_FLOW_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <vector>
|
||||
@ -25,7 +25,7 @@ namespace boost {
|
||||
|
||||
// The "labeling" algorithm from "Network Flows" by Ahuja, Magnanti,
|
||||
// Orlin. I think this is the same as or very similar to the original
|
||||
// Edmunds-Karp algorithm. This solves the maximum flow problem.
|
||||
// Edmonds-Karp algorithm. This solves the maximum flow problem.
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -76,7 +76,7 @@ namespace boost {
|
||||
class CapacityEdgeMap, class ResidualCapacityEdgeMap,
|
||||
class ReverseEdgeMap, class ColorMap, class PredEdgeMap>
|
||||
typename property_traits<CapacityEdgeMap>::value_type
|
||||
edmunds_karp_max_flow
|
||||
edmonds_karp_max_flow
|
||||
(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink,
|
||||
@ -111,7 +111,7 @@ namespace boost {
|
||||
for (tie(ei, e_end) = out_edges(src, g); ei != e_end; ++ei)
|
||||
flow += (cap[*ei] - res[*ei]);
|
||||
return flow;
|
||||
} // edmunds_karp_max_flow()
|
||||
} // edmonds_karp_max_flow()
|
||||
|
||||
namespace detail {
|
||||
//-------------------------------------------------------------------------
|
||||
@ -119,7 +119,7 @@ namespace boost {
|
||||
|
||||
// use of class here is a VC++ workaround
|
||||
template <class ColorMap>
|
||||
struct edmunds_karp_dispatch2 {
|
||||
struct edmonds_karp_dispatch2 {
|
||||
template <class Graph, class PredMap, class P, class T, class R>
|
||||
static typename edge_capacity_value<Graph, P, T, R>::type
|
||||
apply
|
||||
@ -130,7 +130,7 @@ namespace boost {
|
||||
const bgl_named_params<P, T, R>& params,
|
||||
ColorMap color)
|
||||
{
|
||||
return edmunds_karp_max_flow
|
||||
return edmonds_karp_max_flow
|
||||
(g, src, sink,
|
||||
choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity),
|
||||
choose_pmap(get_param(params, edge_residual_capacity),
|
||||
@ -140,7 +140,7 @@ namespace boost {
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct edmunds_karp_dispatch2<detail::error_property_not_found> {
|
||||
struct edmonds_karp_dispatch2<detail::error_property_not_found> {
|
||||
template <class Graph, class PredMap, class P, class T, class R>
|
||||
static typename edge_capacity_value<Graph, P, T, R>::type
|
||||
apply
|
||||
@ -156,7 +156,7 @@ namespace boost {
|
||||
size_type n = is_default_param(get_param(params, vertex_color)) ?
|
||||
num_vertices(g) : 1;
|
||||
std::vector<default_color_type> color_vec(n);
|
||||
return edmunds_karp_max_flow
|
||||
return edmonds_karp_max_flow
|
||||
(g, src, sink,
|
||||
choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity),
|
||||
choose_pmap(get_param(params, edge_residual_capacity),
|
||||
@ -174,7 +174,7 @@ namespace boost {
|
||||
|
||||
// use of class here is a VC++ workaround
|
||||
template <class PredMap>
|
||||
struct edmunds_karp_dispatch1 {
|
||||
struct edmonds_karp_dispatch1 {
|
||||
template <class Graph, class P, class T, class R>
|
||||
static typename edge_capacity_value<Graph, P, T, R>::type
|
||||
apply(Graph& g,
|
||||
@ -184,12 +184,12 @@ namespace boost {
|
||||
PredMap pred)
|
||||
{
|
||||
typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C;
|
||||
return edmunds_karp_dispatch2<C>::apply
|
||||
return edmonds_karp_dispatch2<C>::apply
|
||||
(g, src, sink, pred, params, get_param(params, vertex_color));
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct edmunds_karp_dispatch1<detail::error_property_not_found> {
|
||||
struct edmonds_karp_dispatch1<detail::error_property_not_found> {
|
||||
|
||||
template <class Graph, class P, class T, class R>
|
||||
static typename edge_capacity_value<Graph, P, T, R>::type
|
||||
@ -207,7 +207,7 @@ namespace boost {
|
||||
std::vector<edge_descriptor> pred_vec(n);
|
||||
|
||||
typedef typename property_value< bgl_named_params<P,T,R>, vertex_color_t>::type C;
|
||||
return edmunds_karp_dispatch2<C>::apply
|
||||
return edmonds_karp_dispatch2<C>::apply
|
||||
(g, src, sink,
|
||||
make_iterator_property_map(pred_vec.begin(), choose_const_pmap
|
||||
(get_param(params, vertex_index),
|
||||
@ -221,14 +221,14 @@ namespace boost {
|
||||
|
||||
template <class Graph, class P, class T, class R>
|
||||
typename detail::edge_capacity_value<Graph, P, T, R>::type
|
||||
edmunds_karp_max_flow
|
||||
edmonds_karp_max_flow
|
||||
(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink,
|
||||
const bgl_named_params<P, T, R>& params)
|
||||
{
|
||||
typedef typename property_value< bgl_named_params<P,T,R>, vertex_predecessor_t>::type Pred;
|
||||
return detail::edmunds_karp_dispatch1<Pred>::apply
|
||||
return detail::edmonds_karp_dispatch1<Pred>::apply
|
||||
(g, src, sink, params, get_param(params, vertex_predecessor));
|
||||
}
|
||||
|
||||
@ -236,15 +236,15 @@ namespace boost {
|
||||
typename property_traits<
|
||||
typename property_map<Graph, edge_capacity_t>::const_type
|
||||
>::value_type
|
||||
edmunds_karp_max_flow
|
||||
edmonds_karp_max_flow
|
||||
(Graph& g,
|
||||
typename graph_traits<Graph>::vertex_descriptor src,
|
||||
typename graph_traits<Graph>::vertex_descriptor sink)
|
||||
{
|
||||
bgl_named_params<int, buffer_param_t> params(0);
|
||||
return edmunds_karp_max_flow(g, src, sink, params);
|
||||
return edmonds_karp_max_flow(g, src, sink, params);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // EDMUNDS_KARP_MAX_FLOW_HPP
|
||||
#endif // EDMONDS_KARP_MAX_FLOW_HPP
|
@ -39,7 +39,7 @@
|
||||
//three max_flows we test here
|
||||
#include <boost/graph/kolmogorov_max_flow.hpp>
|
||||
#include <boost/graph/push_relabel_max_flow.hpp>
|
||||
#include <boost/graph/edmunds_karp_max_flow.hpp>
|
||||
#include <boost/graph/edmonds_karp_max_flow.hpp>
|
||||
//boost utilities we use
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <boost/graph/random.hpp>
|
||||
@ -127,10 +127,10 @@ int test_main(int argc, char* argv[])
|
||||
|
||||
tEdgeVal kolmo = kolmogorov_max_flow(g,source_vertex,sink_vertex);
|
||||
tEdgeVal push_relabel = push_relabel_max_flow(g,source_vertex,sink_vertex);
|
||||
tEdgeVal edmunds_karp = edmunds_karp_max_flow(g,source_vertex,sink_vertex);
|
||||
tEdgeVal edmonds_karp = edmonds_karp_max_flow(g,source_vertex,sink_vertex);
|
||||
|
||||
BOOST_REQUIRE( kolmo == push_relabel );
|
||||
BOOST_REQUIRE( push_relabel == edmunds_karp );
|
||||
BOOST_REQUIRE( push_relabel == edmonds_karp );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user