|
Boost Users : |
Subject: Re: [Boost-users] Error in accessing label of an edge, urgently need help.
From: Amanullah Yasin (amanyasin_at_[hidden])
Date: 2011-12-14 11:49:52
Thanks it works
On Wed, Dec 14, 2011 at 5:35 PM, Jeremiah Willcock <jewillco_at_[hidden]>wrote:
> On Wed, 14 Dec 2011, Amanullah Yasin wrote:
>
> Hello,
>>
>> I want to put edge label but facing an error. Please share any better
>> idea.
>> Thanks in advance.
>>
>
> BTW, you shouldn't add things to the boost namespace; property names don't
> need to be in that namespace. Anyway, the code worked for me with GCC 4.6.
> Here's the full test program I used:
>
> #include <boost/graph/properties.hpp>
> #include <boost/graph/adjacency_list.**hpp>
> #include <string>
> #include <iostream>
>
> struct plComputableObject;
> struct slScoreValueType {};
>
> 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,
> boost::property<boost::edge_**name_t, std::string> >
> slEdgeProperty;
>
>
> typedef boost::adjacency_list<boost::**vecS, boost::listS,
> boost::bidirectionalS,
> slVertexProperty, slEdgeProperty> slGraph;
>
>
> int main(int, char**) {
> using namespace boost;
> slGraph graph;
>
>
> //Now i want to add edge name
> boost::property_map<slGraph, edge_name_t>::type labelmap = get(edge_name,
> graph);
>
> boost::graph_traits<slGraph>::**edge_iterator ei, ei_end;
>
> for(tie(ei, ei_end) = edges(graph); ei != ei_end; ++ei){
>
> std::string label = "unknown";
> put(labelmap, *ei, label);
> std::cout<<"\nUndirected s: "<<source(*ei, graph) <<" T: "<<target(*ei,
> graph)<<" LABEL: "<< get(labelmap,*ei);
> }
> }
>
> -- Jeremiah Willcock
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net