1.1 --- a/lemon/smart_graph.h Sun Aug 23 11:09:22 2009 +0200
1.2 +++ b/lemon/smart_graph.h Sun Aug 23 11:10:40 2009 +0200
1.3 @@ -691,6 +691,26 @@
1.4 Parent::clear();
1.5 }
1.6
1.7 + /// Reserve memory for nodes.
1.8 +
1.9 + /// Using this function, it is possible to avoid superfluous memory
1.10 + /// allocation: if you know that the graph you want to build will
1.11 + /// be large (e.g. it will contain millions of nodes and/or edges),
1.12 + /// then it is worth reserving space for this amount before starting
1.13 + /// to build the graph.
1.14 + /// \sa reserveEdge()
1.15 + void reserveNode(int n) { nodes.reserve(n); };
1.16 +
1.17 + /// Reserve memory for edges.
1.18 +
1.19 + /// Using this function, it is possible to avoid superfluous memory
1.20 + /// allocation: if you know that the graph you want to build will
1.21 + /// be large (e.g. it will contain millions of nodes and/or edges),
1.22 + /// then it is worth reserving space for this amount before starting
1.23 + /// to build the graph.
1.24 + /// \sa reserveNode()
1.25 + void reserveEdge(int m) { arcs.reserve(2 * m); };
1.26 +
1.27 public:
1.28
1.29 class Snapshot;