lemon/hypercube_graph.h
changeset 737 9d6c3e8b2421
parent 735 853fcddcf282
child 780 580af8cf2f6a
child 786 e20173729589
     1.1 --- a/lemon/hypercube_graph.h	Sun Aug 23 11:10:40 2009 +0200
     1.2 +++ b/lemon/hypercube_graph.h	Sun Aug 23 11:11:49 2009 +0200
     1.3 @@ -287,7 +287,8 @@
     1.4    /// Two nodes are connected in the graph if and only if their indices
     1.5    /// differ only on one position in the binary form.
     1.6    /// This class is completely static and it needs constant memory space.
     1.7 -  /// Thus you can neither add nor delete nodes or edges.
     1.8 +  /// Thus you can neither add nor delete nodes or edges, however 
     1.9 +  /// the structure can be resized using resize().
    1.10    ///
    1.11    /// This type fully conforms to the \ref concepts::Graph "Graph concept".
    1.12    /// Most of its member functions and nested classes are documented
    1.13 @@ -306,6 +307,21 @@
    1.14      /// Constructs a hypercube graph with \c dim dimensions.
    1.15      HypercubeGraph(int dim) { construct(dim); }
    1.16  
    1.17 +    /// \brief Resizes the graph
    1.18 +    ///
    1.19 +    /// This function resizes the graph. It fully destroys and
    1.20 +    /// rebuilds the structure, therefore the maps of the graph will be
    1.21 +    /// reallocated automatically and the previous values will be lost.
    1.22 +    void resize(int dim) {
    1.23 +      Parent::notifier(Arc()).clear();
    1.24 +      Parent::notifier(Edge()).clear();
    1.25 +      Parent::notifier(Node()).clear();
    1.26 +      construct(dim);
    1.27 +      Parent::notifier(Node()).build();
    1.28 +      Parent::notifier(Edge()).build();
    1.29 +      Parent::notifier(Arc()).build();
    1.30 +    }
    1.31 +
    1.32      /// \brief The number of dimensions.
    1.33      ///
    1.34      /// Gives back the number of dimensions.