lemon/smart_graph.h
changeset 2468 16615642ac7b
parent 2391 14a343be7a5a
child 2498 290e43cddc1a
equal deleted inserted replaced
43:1be9ff805671 44:18d699f6fb40
   240     ///and target node \c t.
   240     ///and target node \c t.
   241     ///\return the new edge.
   241     ///\return the new edge.
   242     Edge addEdge(const Node& s, const Node& t) { 
   242     Edge addEdge(const Node& s, const Node& t) { 
   243       return Parent::addEdge(s, t); 
   243       return Parent::addEdge(s, t); 
   244     }
   244     }
       
   245 
       
   246     /// \brief Using this it is possible to avoid the superfluous memory
       
   247     /// allocation.
       
   248 
       
   249     /// Using this it is possible to avoid the superfluous memory
       
   250     /// allocation: if you know that the graph you want to build will
       
   251     /// be very large (e.g. it will contain millions of nodes and/or edges)
       
   252     /// then it is worth reserving space for this amount before starting
       
   253     /// to build the graph.
       
   254     /// \sa reserveEdge
       
   255     void reserveNode(int n) { nodes.reserve(n); };
       
   256 
       
   257     /// \brief Using this it is possible to avoid the superfluous memory
       
   258     /// allocation.
       
   259 
       
   260     /// Using this it is possible to avoid the superfluous memory
       
   261     /// allocation: if you know that the graph you want to build will
       
   262     /// be very large (e.g. it will contain millions of nodes and/or edges)
       
   263     /// then it is worth reserving space for this amount before starting
       
   264     /// to build the graph.
       
   265     /// \sa reserveNode
       
   266     void reserveEdge(int m) { edges.reserve(m); };
   245 
   267 
   246     ///Clear the graph.
   268     ///Clear the graph.
   247     
   269     
   248     ///Erase all the nodes and edges from the graph.
   270     ///Erase all the nodes and edges from the graph.
   249     ///
   271     ///