简体   繁体   English

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

[英]How to add custom edge label in boost graph?

I am using boost graph of type: 我正在使用类型的提升图:

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;

Now i have to add sting type edge label for each edge of the graph, further i could use them in my program to distinguish different kind of edges. 现在,我必须为图形的每个边缘添加字符串类型的边缘标签,此外,我可以在程序中使用它们来区分不同类型的边缘。

Please share you idea, thanks in advance. 请分享您的想法,谢谢。

You can just add that new label property to the list of edge properties (namespaces removed): 您可以仅将新的label属性添加到edge属性列表中(删除命名空间):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM