|
Boost Users : |
Subject: Re: [Boost-users] [BGL] resize/reserve on graph?
From: Anil Ramapanicker (anilpanicker_at_[hidden])
Date: 2011-08-09 19:54:17
Okay, I think I got what you are saying.You may have to content with
iteratively adding those vertices.
On Tue, Aug 9, 2011 at 6:59 PM, Geoff Hilton <geoff.hilton_at_[hidden]>wrote:
> On Tue, Aug 9, 2011 at 3:13 PM, Geoff Hilton
>> <geoff.hilton_at_[hidden] <mailto:geoff.hilton_at_t-**optlogic.com<geoff.hilton_at_[hidden]>>>
>> 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?
>>
>> Thank you,
>> Geoff
>>
>
> > On 09/08/2011 6:12 PM, Anil Ramapanicker wrote:
> > I think you are asking about implicit graph where vertices and edges are
> > unknown at the begining and they are added during the execution of an
> > algorithm. You can do it in two ways
> > a) If you are using internal properties then
> > add_vertex( vertex_whatever,g) will work
> > b) If you are using exterior property map then use vector_property_map
> > since the size is unknown
> > http://www.boost.org/doc/libs/**1_47_0/libs/property_map/doc/**
> vector_property_map.html<http://www.boost.org/doc/libs/1_47_0/libs/property_map/doc/vector_property_map.html>
> > Anil
>
> That's exactly what I'm already doing. I'm asking because true, at first I
> do invariably have to use add_vertex(..), but later on I know exactly how
> many vertices by which to grow the graph at a time due to the algorithm I'm
> implementing and I wish to add them in as few memory allocations as possible
> (preferably one) to the existing graph. Thus, something like std::vector's
> resize/reserve or an equivalent would be useful.
>
>
> Thank you,
> Geoff
>
> ______________________________**_________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/**mailman/listinfo.cgi/boost-**users
>
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