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-25 03:18:03


On Wed, Mar 25, 2009 at 12:01 PM, Phani Deepak <phanidee_at_[hidden]> wrote:

> hi Andrew,
>
> On Wed, Mar 25, 2009 at 6:53 AM, Andrew Sutton <andrew.n.sutton_at_[hidden]>wrote:
>
>>
>>
>> my Graph is :
>>>> *typedef
>>>> boost::adjacency_list<boost::listS,boost::listS,boost::bidirectionalS,
>>>> EdgeProperties *> Graph;
>>>> *
>>>
>>>
>> Your graph doesn't seem to have edge properties. The EdgeProprties* type
>> appears to be substituted for the VertexProperties parameter, not
>> EdgeProperties.
>>
>
> Sorry for the typo,
> The actual declaration was
>
> *typedef
> boost::adjacency_list<boost::listS,boost::listS,boost::bidirectionalS,
> NodeProperties*, EdgeProperties *> Graph;
> *****
>

class NodeProperties {} instead of class Node

> *
> class Node{
> public:
> string id;
> };
> 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) { }
> };
>
> Graph g;
> typedef graphtraits<Graph>::vertex_descriptor Vertex;
> for(boost::tie(iedge_s,iedge_
> * *end) = boost::in_edges(v,g); iedge_s!=iedge_end; ++iedge_s)
> {
> Vertex src = boost::source(*iedge_s,g);
> Vertex target = boost::target(*iedge_s,g);
> cout << g[src]->id << "-->" << g[target]->id << endl;
> EdgeProperties *ep = g[*iedge_s]; // <==== Line 10; g[*iedge_s]
> is returning null
> cout << ep->sourceI << endl; // <==== This is giving
> segmentation fault;
> }
> **
> ***here g[*iedge_s] is returning null**
> is it the problem because iam using (*iedge_s) as (edge_descriptor) or
> the problem somewhere in my code where in i had not properly assigned the
> property object
> to that specific edge.
>
> i just wanted to know whether both of these are same
> *graphtraits<Graph>::in_edge_iterator *iedge_iter;
> graphtraits<Graph>::edge_iterator *edge_iter;
> **(*edge_iter)* -> this becomes edge_descriptor
> *(*iedge_iter) -> ***whether this will also become edge_descriptor**
>
> pardon me if iam really missing any basic concept in here.
>
>
>>
>> Andrew Sutton
>> andrew.n.sutton_at_[hidden]
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>



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