Boost logo

Boost Users :

Subject: Re: [Boost-users] How to convert graphtraits<Graph>::in_edge to graphtraits<Graph>::edge
From: Phani Deepak (phanidee_at_[hidden])
Date: 2009-03-24 14:12:57


The same code is working fine if i use

              boost::target(*iedge_s,g) or boost::source(*iedge_s,g);

i mean that source and target of the edge that it is returning are the right
ones.
here i think iam able to use *in_edge_descriptor* as *edge_descriptor*

-
Phani.

On Tue, Mar 24, 2009 at 11:35 PM, Phani Deepak <phanidee_at_[hidden]> wrote:

> hi,
> i have stored some bundled properties for an edge.
> *
> class EdgeProperties {
> public:
> int targetI;// Terminal No. interms of target node
> int sourceI;// Terminal No. interms of source node
> EdgeProperties(int s,int t):sourceI(s-1),targetI(t-1) { }
> };*
>
> my Graph is :
> *typedef
> boost::adjacency_list<boost::listS,boost::listS,boost::bidirectionalS,
> EdgeProperties *> Graph;
> Graph g;
> *
> Now iam iterating through in_edges of some vertex v;
> *graphtraits<Graph>::in_edge_iterator iedge_s,iedge_end;
> for(boost::tie(iedge_s,iedge_end) = boost::in_edges(v,g);
> iedge_s!=iedge_end; ++iedge_s){
> EdgeProperties *ep = g[*iedge_s]; // <==== **Line 10**
> cout << ep->sourceI << endl; // <==== **This is
> giving segmentation fault;**
> }
> *
> I checked the *ep* pointer. it is coming out as null in line 10;
>
> is there any problem while using *in_edge_descriptor* as *edge_descriptor*
> *( for g[edge_descriptor]* ) in *Line 10* ??
> *
> *please help.
>
> -
> Phani.
> *
> *



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