【发布时间】:2014-02-08 10:44:32
【问题描述】:
我正在为某个项目使用 Boost Graph 库,并且我想找出一条边在图中重复的次数。例如,
typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, Node_Info, Edge_Info > Graph_t;
//node_info and Edge_info are external node and edge properties (structures)
假设我有两个节点,node1 和 node2,并且它们之间有一条边(node1,node2)。每个边缘的边缘属性包含一个时间戳开始,结束......并且图中可以有许多具有不同时间戳的此类边缘。例如。
edge1 = (node1, node2) with start = 100, end = 200.
edge2 = (node1, node2) with start = 250, end = 400.
我知道在 boost 图中,给定两个顶点,我们可以使用以下方法找出图中是否存在边。
std::pair < edge_t, bool > p = boost::edge( node1, node2, myGraph );
if(p.second == 1) cout << "edge exists!" << endl;
else cout << " does not exist " << endl;
但这可能意味着即使存在具有不同边缘属性的多条边,它也只会返回任何一条边 --> 问题
谁能提出一个想法,如何在两个给定节点之间获得如此多的边?谢谢!
【问题讨论】:
标签: c++ boost graph boost-graph