Boost 提供了三种不同的算法来查找有向图中的最大流量:boykov_kolmogorov、edmonds_karp和push_relabel。它们都有命名和非命名参数版本。他们使用的参数集也非常相似。尽管如此,使用相同的参数,这些算法中的一些可以编译,而有些则不能。
push_relabel与命名和非命名版本都可以很好地编译:
using Graph =
boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS,
VertexProperty, EdgeProperty>;
auto props = boost::capacity_map(capacity)
.residual_capacity_map(residual_capacity)
.reverse_edge_map(reverse_edge_map)
.vertex_index_map(vertex_index_map)
.color_map(color_map)
.predecessor_map(predcessor_map)
.distance_map(distance_map);
boost::push_relabel_max_flow(g, s, t, props);
boost::push_relabel_max_flow(g, s, t, capacity, residual_capacity,
reverse_edge_map, vertex_index_map);
boykov_kolmogorov使用非命名版本编译:
boost::boykov_kolmogorov_max_flow(g, capacity, residual_capacity,
reverse_edge_map,
vertex_index_map, s, t);
但命名版本失败:
boost::boykov_kolmogorov_max_flow(g, s, t, props);
/celibs/boost_1_73_0/boost/graph/detail/adjacency_list.hpp:2768:17:错误:形成对 void 的引用
edmonds_karp失败,命名和非命名版本都出现相同的错误:
boost::edmonds_karp_max_flow(g, s, t, props);
boost::edmonds_karp_max_flow(g, s, t, capacity, residual_capacity, reverse_edge_map,
color_map, predcessor_map);
/celibs/boost_1_73_0/boost/concept_check.hpp:147:9:错误:使用已删除的功能
完整示例在这里:https ://godbolt.org/z/dvjfec
我是否以不正确的方式传递参数?如何正确传递它们?
谢谢!