如何在boost图中添加自定义边缘标签



我使用的boost图形类型:

namespace boost {
      struct computable_object_t
  {
    typedef vertex_property_tag kind;
  };
}
typedef boost::property<boost::vertex_index_t, unsigned int,
                        boost::property<boost::computable_object_t,
                                        plComputableObject*> > slVertexProperty;
typedef boost::property<boost::edge_weight_t, slScoreValueType> slEdgeProperty;
typedef boost::adjacency_list<boost::vecS, boost::listS, boost::bidirectionalS,
                              slVertexProperty, slEdgeProperty> slGraph;

现在我必须为图的每条边添加sting类型的边标签,进一步我可以在我的程序中使用它们来区分不同类型的边。

请分享你的想法,提前感谢

你可以把新的label属性添加到边缘属性列表中(删除名称空间):

typedef property<edge_weight_t, slScoreValueType,
          property<edge_name_t, string> >
        slEdgeProperty;

最新更新