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

时间:2011-12-14 12:36:48

标签: c++ boost-graph

我正在使用类型的增强图:

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;

现在我必须为图形的每个边缘添加刺痛类型的边缘标签,我还可以在我的程序中使用它们来区分不同类型的边缘。

请提前感谢您的想法。

1 个答案:

答案 0 :(得分:1)

您可以将新标签属性添加到边缘属性列表中(删除名称空间):

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