Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] resize/reserve on graph?
From: Alex Hagen-Zanker (ahh34_at_[hidden])
Date: 2011-08-10 07:04:10


On 09/08/2011 20:13, Geoff Hilton wrote:
> If I know that during the execution of the algorithm the graph size
> must be grown by X number of vertices in one go, is there a way this
> can be done to avoid multiple allocations such as when using
> std::vector's reserve(..) or resize(..) member functions without
> subverting the BGL's documented interface? Currently I use a for loop
> which iterates over add_vertex(vertex_property, graph). Can a reserve
> and/or resize equivalent otherwise please be added somewhere?
>
I suppose it subverts the documented interface, but the following
works: mygraph.m_vertices.reserve(n)
See also: http://lists.boost.org/boost-users/2008/11/42425.php


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