简体   繁体   中英

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):

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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