Boost logo

Boost Users :

From: Sebastian Weber (sebastian.weber_at_[hidden])
Date: 2004-11-29 09:17:13


Hello there!

First of all thanks a lot for the rapid response of my last question. I
got another question concerning the access of internal graph properties:
To access a bundeled vertice internal properties of a graph one has to
use the following syntax:

struct VertStruct {
   int stuff;
};

typedef adjacency_list<vecS, vecS, undirectedS, VertStruct> graph_t;

graph_t bg;

... setup graph ...

graph_traits<graph_t>::vertex_iterator vi, vend;
tie(vi, vend) = vertices(bg);

bg[*vi].stuff = 4;

This makes it clear, that even though we already have an iterator (vi)
pointing to our vertice of interest, the BGL has to spend again some
time locating the data ascociated with it. A far more direct and much
clearer notion would be:

(*vi).stuff = 4;

With this, one would save a lookup in the data-structures and the
vertice-iterator concept would be far more logic to me, concernig
internal property handling.

I don't know the BGL internals and how this behaviour is optimally
programmed with the BGL. I thought of providing a custom container for
the vertex-container which is composed of a vector of a customary
struct, which glues vertice properties together with every element of
the vertice list and makes the property really internal, allowing a

(*vi).myrealinternalstuff = 4

expression. I hope my point is clear.

Thanks a lot for any help.

Greetings,

Sebastian Weber


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