COIN-OR::LEMON - Graph Library

Changeset 737:9d6c3e8b2421 in lemon-1.2 for lemon


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

Add a resize() function to HypercubeGraph? (#311)
just like the similar functions in other static graph structures,
and extend the test files to check these functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/hypercube_graph.h

    r735 r737  
    288288  /// differ only on one position in the binary form.
    289289  /// This class is completely static and it needs constant memory space.
    290   /// Thus you can neither add nor delete nodes or edges.
     290  /// Thus you can neither add nor delete nodes or edges, however
     291  /// the structure can be resized using resize().
    291292  ///
    292293  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
     
    306307    /// Constructs a hypercube graph with \c dim dimensions.
    307308    HypercubeGraph(int dim) { construct(dim); }
     309
     310    /// \brief Resizes the graph
     311    ///
     312    /// This function resizes the graph. It fully destroys and
     313    /// rebuilds the structure, therefore the maps of the graph will be
     314    /// reallocated automatically and the previous values will be lost.
     315    void resize(int dim) {
     316      Parent::notifier(Arc()).clear();
     317      Parent::notifier(Edge()).clear();
     318      Parent::notifier(Node()).clear();
     319      construct(dim);
     320      Parent::notifier(Node()).build();
     321      Parent::notifier(Edge()).build();
     322      Parent::notifier(Arc()).build();
     323    }
    308324
    309325    /// \brief The number of dimensions.
Note: See TracChangeset for help on using the changeset viewer.