【发布时间】:2009-04-03 18:41:37
【问题描述】:
使用带有捆绑属性的 boost::graph。我希望能够使用各种不同的可能边缘加权方案来运行搜索。如果可能的话,我不想为捆绑的属性创建额外的类,并根据搜索类型传递不同的权重图,而无需创建新图表或修改图表中的所有现有属性。
我可以为 edge_weight_t 手动构建 property_map 吗?到目前为止,这是我所得到的:
typedef boost::property_map<SSPSGraph_t, boost::edge_weight_t>::type WeightMap;
typedef boost::property<boost::edge_weight_t, float> DistanceProperty;
我希望能够做到
WeightMap distances;
edge_descriptor_t e = some_edge_or_another;
float d=some_derived_distance_value;
并将距离[e]分配给适当的值--
distances[e]= ?
或者我是否只需要分解并为捆绑的属性构建一个新结构(我一直试图避免的事情)并从中创建权重图? boost::graph 的新功能;不要假设我在这里没有做完全愚蠢的事情。
【问题讨论】:
标签: c++ boost graph-theory boost-graph