Boost logo

Boost Users :

From: Doug Gregor (dgregor_at_[hidden])
Date: 2004-08-01 09:46:13


On Jul 31, 2004, at 9:38 PM, Jeffrey Holle wrote:

> HI,
>
> I'm starting a project that uses boost.graph and I'm trying to decide
> if I should use internal or external properties.
> My code that implements external properties is like, for example:
> typedef boost::graph_traits <GraphT>::vertex_descriptor Vertex;
> typedef std::map<Vertex,Vertex_Datum,ltDescriptor<Vertex> >
> VertexData;
>
> My question is:
>
> Given my use of Vertex as a key of a std::map, it needs to be unique.
> Is this uniqueness quality maintained across different graphs?

No, it is not guaranteed that vertex descriptors from different graphs
are distinct. In fact, they will very often be the same: when using
adjacency_list with VertexListS = vecS, vertex descriptors are always
integers between 0 and num_vertices(g).

> That is, can I instanciate 2 GraphT objects and populate both, but
> maintain only one VertexData container?

Not unless you want to make the key type std::pair<GraphT*, Vertex>.

        Doug


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