我的图表有以下声明
struct vertex_info
{
std::string name;
std::string label;
unsigned int type;
bool isND;
};
struct edge_info
{
std::string name;
long capacity;
long residualCapacity;
long rev;
};
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::bidirectionalS
, vertex_info, edge_info > expr_graph_t;
我已经构建了一个图(流网络)
flowG
,其中包括source
节点和sink
节点。现在我想使用boost graph库中提供的push_relabel
方法来计算最大流。我将如下调用该函数。 push_relabel_max_flow(flowG, source, sink
, get(&edge_info::capacity, flowG)
, get(&edge_info::residualCapacity, flowG)
, get(&edge_info::rev, flowG)
, get(boost::vertex_index, flowG)
);
编译器(g++)生成了很长的错误消息(pasted here)。我怀疑我没有能够正确地将映射的正确类型传递给函数。函数签名可在这里的boost-doc中找到。
文档中给出了许多示例,但它们使用的图形与我的不同。我无法更改图形声明,否则会破坏很多代码。我不习惯于使用boost的
property_map
概念。
reverse_edge_map
需要一个带有key_type=edge_descriptor和value_type=edge_descriptor的属性映射,而您使用的那个是value_type=long。您可以使用adjacency_list_traits<vecS,vecS,bidirectionalS>::edge_descriptor
来声明您的rev
。如果您添加一个简单的示例图,我可以尝试使其正常工作。 - user1252091