【发布时间】:2016-06-02 22:25:04
【问题描述】:
我想使用来自 Boost.Graph 库的push_relabel_max_flow。
我已经生成了我的图表,这是我目前的代码:
struct EdgeProps {
double capacity;
double residual_capacity;
Traits::edge_descriptor reverse;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::directedS, boost::no_property, EdgeProps > DirectedGraph;
DirectedGraph g;
std::vector<DirectedGraph::vertex_descriptor> vertices;
/* Filling the Graph with vertices and edges and saving the vertex-descriptors in "vertices" */
//...
//...
double flow = boost::push_relabel_max_flow(g,vertices[0],vertices[1],
vertex_index_map(boost::get(boost::vertex_index, g)).
residual_capacity_map(boost::get(&EdgeProps::residual_capacity, g)).
reverse_edge_map(boost::get(&EdgeProps::reverse, g)).
capacity_map(boost::get(&EdgeProps::capacity, g))
);
我在传递参数时遇到问题。我得到“形成对 void 的引用”-错误:
/usr/local/include/boost/graph/detail/adjacency_list.hpp:2696: error: forming reference to void
typedef value_type& reference;
^
/usr/local/include/boost/graph/detail/adjacency_list.hpp:2697: error: forming reference to void
typedef const value_type& const_reference;
^
/usr/local/include/boost/graph/detail/adjacency_list.hpp:2701: error: forming reference to void
typename Graph::vertex_descriptor,Property,Tag> type;
^
这些不是全部,只是其中三个。如果您需要查看每一个,请发表评论,我会添加它们。 有谁知道我必须如何将参数传递给函数而不产生“Reference to void”-错误?
【问题讨论】:
标签: c++ boost boost-graph