Boost logo

Boost :

Subject: Re: [boost] [BGL] boost::add_vertex - add unique vertexes to graph
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-06-23 08:18:41


>
>
> Currently I externally check if vertex exist in graph.
> But it is look like boost::add_vertex can check internally if vertexes
> are unique.
> if (optional<vertex_descriptor> v
> = g.vertex_by_property(get_property_value(p, vertex_bundle)))
> return *v;
>
> Could you send me any example where boost::add_vertex just return
> already created vertex (line: "return *v") instead of create new one?
>

In 1.39, there is a class called named_graph allows you to do something like
this, but it's completely undocumented and I'm not sure how to use it.

In trunk, there is a graph adaptor called labeled_graph (also undocumented),
that can be used to maintain a mapping of elements to vertices, but it
doesn't work with interior or bundled vertex properties yet.

Otherwise, your best bet is to simply keep passing around a map of property
to vertex.

Andrew Sutton
andrew.n.sutton_at_[hidden]


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk