COIN-OR::LEMON - Graph Library

Changeset 783:2e20aad15754 in lemon for lemon/smart_graph.h


Ignore:
Timestamp:
08/23/09 11:10:40 (10 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/smart_graph.h

    r782 r783  
    692692    }
    693693
     694    /// Reserve memory for nodes.
     695
     696    /// Using this function, it is possible to avoid superfluous memory
     697    /// allocation: if you know that the graph you want to build will
     698    /// be large (e.g. it will contain millions of nodes and/or edges),
     699    /// then it is worth reserving space for this amount before starting
     700    /// to build the graph.
     701    /// \sa reserveEdge()
     702    void reserveNode(int n) { nodes.reserve(n); };
     703
     704    /// Reserve memory for edges.
     705
     706    /// Using this function, it is possible to avoid superfluous memory
     707    /// allocation: if you know that the graph you want to build will
     708    /// be large (e.g. it will contain millions of nodes and/or edges),
     709    /// then it is worth reserving space for this amount before starting
     710    /// to build the graph.
     711    /// \sa reserveNode()
     712    void reserveEdge(int m) { arcs.reserve(2 * m); };
     713
    694714  public:
    695715
Note: See TracChangeset for help on using the changeset viewer.