Ignore:
Timestamp:
08/23/09 11:10:40 (10 years ago)
Branch:
default
Phase:
public
Message:

Add reserve functions to ListGraph? and SmartGraph? (#311)
ListDigraph? and SmartDigraph? already have such functions.

Files:
4 edited

Unmodified
Removed
• ## lemon/list_graph.h

 r735 } /// Reserve memory for nodes. /// Using this function, it is possible to avoid superfluous memory /// allocation: if you know that the graph you want to build will /// be large (e.g. it will contain millions of nodes and/or edges), /// then it is worth reserving space for this amount before starting /// to build the graph. /// \sa reserveEdge() void reserveNode(int n) { nodes.reserve(n); }; /// Reserve memory for edges. /// Using this function, it is possible to avoid superfluous memory /// allocation: if you know that the graph you want to build will /// be large (e.g. it will contain millions of nodes and/or edges), /// then it is worth reserving space for this amount before starting /// to build the graph. /// \sa reserveNode() void reserveEdge(int m) { arcs.reserve(2 * m); }; /// \brief Class to make a snapshot of the graph and restore /// it later.
• ## lemon/smart_graph.h

 r735 } /// Reserve memory for nodes. /// Using this function, it is possible to avoid superfluous memory /// allocation: if you know that the graph you want to build will /// be large (e.g. it will contain millions of nodes and/or edges), /// then it is worth reserving space for this amount before starting /// to build the graph. /// \sa reserveEdge() void reserveNode(int n) { nodes.reserve(n); }; /// Reserve memory for edges. /// Using this function, it is possible to avoid superfluous memory /// allocation: if you know that the graph you want to build will /// be large (e.g. it will contain millions of nodes and/or edges), /// then it is worth reserving space for this amount before starting /// to build the graph. /// \sa reserveNode() void reserveEdge(int m) { arcs.reserve(2 * m); }; public:
• ## test/digraph_test.cc

 r440 checkGraphArcList(G, 0); G.reserveNode(3); G.reserveArc(4); Node n1 = G.addNode(),
• ## test/graph_test.cc

 r440 checkGraphArcList(G, 0); G.reserveNode(3); G.reserveEdge(3); Node n1 = G.addNode(),
Note: See TracChangeset for help on using the changeset viewer.