|
Boost : |
Subject: [boost] [BGL] boost::add_vertex - add unique vertexes to graph
From: Mariusz Kwiczala (mariusz.kwiczala_at_[hidden])
Date: 2009-06-23 07:14:46
Hi,
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?
boost_1_39_0\boost\graph\detail\adjacency_list.hpp contain:
template <class Graph, class Config, class Base>
inline typename Config::vertex_descriptor
add_vertex(const typename Config::vertex_property_type& p,
vec_adj_list_impl<Graph, Config, Base>& g_) {
typedef typename Config::vertex_descriptor vertex_descriptor;
Graph& g = static_cast<Graph&>(g_);
if (optional<vertex_descriptor> v
= g.vertex_by_property(get_property_value(p, vertex_bundle)))
return *v;
typedef typename Config::stored_vertex stored_vertex;
g.m_vertices.push_back(stored_vertex(p));
g.added_vertex(g.m_vertices.size() - 1);
return g.m_vertices.size() - 1;
}
Best regards,
Mariusz
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk