[Networkit] Graph.shrinkToFit()

Christian Staudt christian.staudt at kit.edu
Tue May 13 00:02:20 CEST 2014


Am 12.05.2014 um 23:36 schrieb Florian Weber <uagws at student.kit.edu>:

>> 
>> So this could be an important improvement. I say
>> „could“ because there is one thing that needs to be checked, namely whether 
>> shrinking significantly increases construction time. 
> 
> construction time of what? Copy-Ctors don't care for the capacity of the
> object they copy.

I mean construction as in the time from when the graph object is initially created to when it is passed to the user to work with.

>> 
>> If it does we need to see 
>> if we want to make the tradeoff.
> 
> I would recommend implementing this with a shrinkToFit-method that is to
> be called by the user (basically exactly the same that std::vector
> does), so that there really wouldn't be a tradeoff.

Yes, I can only imagine this as a method. But if the method exists, then any code which constructs a graph that is meant to be static should call it before returning the graph. This includes file readers and static graph generators. So in practice, both the memory used and the time I have to wait for the finished graph matters. Therefore we need to see how long calling std::vector::shrinkToFit 100 million times takes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20140513/8ca3f85d/attachment.sig>


More information about the NetworKit mailing list