lemon/smart_graph.h
changeset 2456 717a5134ddeb
parent 2391 14a343be7a5a
child 2498 290e43cddc1a
     1.1 --- a/lemon/smart_graph.h	Fri Jun 15 14:31:14 2007 +0000
     1.2 +++ b/lemon/smart_graph.h	Fri Jun 15 14:32:48 2007 +0000
     1.3 @@ -243,6 +243,28 @@
     1.4        return Parent::addEdge(s, t); 
     1.5      }
     1.6  
     1.7 +    /// \brief Using this it is possible to avoid the superfluous memory
     1.8 +    /// allocation.
     1.9 +
    1.10 +    /// Using this it is possible to avoid the superfluous memory
    1.11 +    /// allocation: if you know that the graph you want to build will
    1.12 +    /// be very large (e.g. it will contain millions of nodes and/or edges)
    1.13 +    /// then it is worth reserving space for this amount before starting
    1.14 +    /// to build the graph.
    1.15 +    /// \sa reserveEdge
    1.16 +    void reserveNode(int n) { nodes.reserve(n); };
    1.17 +
    1.18 +    /// \brief Using this it is possible to avoid the superfluous memory
    1.19 +    /// allocation.
    1.20 +
    1.21 +    /// Using this it is possible to avoid the superfluous memory
    1.22 +    /// allocation: if you know that the graph you want to build will
    1.23 +    /// be very large (e.g. it will contain millions of nodes and/or edges)
    1.24 +    /// then it is worth reserving space for this amount before starting
    1.25 +    /// to build the graph.
    1.26 +    /// \sa reserveNode
    1.27 +    void reserveEdge(int m) { edges.reserve(m); };
    1.28 +
    1.29      ///Clear the graph.
    1.30      
    1.31      ///Erase all the nodes and edges from the graph.