Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost Graph Library: edge retrieval using edge descriptor between square brackets fails
From: Nicholas Mario Wardhana (mario.wardhana_at_[hidden])
Date: 2011-01-12 05:07:04


On 12 January 2011 16:36, Cedric Laczny <cedric.laczny_at_[hidden]> wrote:
> Hi,
>
> it seems to me, that you are very well adding an edge, but forgetting to
> insert its properties, that you want to retrieve.
>
> Please s. code below.

Hi Cedric,

Thank you for your quick reply.

>
> You do add an edge, but this in the same as for vertices, it is only an edge
> descriptor. There is no additional information (as the properties) associated
> with it, yet.
>
> This information has not yet been set! I would expect the same as in AddNode()
> here:
> m_graph[edgeDescriptor] = pEdge;
> Retrieving this information when first adding an edge is counter-intuitive.
> Of course you need to pass pEdge as an argument to AddEdge().
>

My bad! Now I realise that I forget to assign pEdge to the edge
descriptor. So at the beginning of the function I add this line, which
basically calls the parent class' AddEdge function to retrieve the
corresponding Edge information:

Edge<NodeData, EdgeData>* pEdge = Graph<NodeData,
EdgeData>::AddEdge(pNode1, pNode2);

and in Step 3 of BoostGraphWrapper::AddEdge(), I add:

m_graph[edgeDescriptor] = pEdge;

This solves the problem. Thank you for your suggestion.

>
> Hope that helps.
> BTW, have you already thought about using vecS for the VertexList (instead of
> listS)? It has the advantage of automatically creating vertex indices which
> are crucial to most BGL algorithms.
>

I think I am clueless about this issue. After searching around, I
found about that in

http://www.systomath.com/include/Boost-1_36/libs/graph/doc/quick_tour.html

I am a new BGL user, and haven't noticed how automatically created
vertex indices can be useful. Could you please give some information?
Currently I choose listS over vecS because in some operations, listS
is faster than vecS, as written in:

http://www.boost.org/doc/libs/1_44_0/libs/graph/doc/using_adjacency_list.html

Thank you for bringing that up.

>
> Best,
>
> Cedric
>

Best regards,
Nicholas Mario Wardhana


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