lemon/hypercube_graph.h
changeset 770 432c54cec63c
parent 735 853fcddcf282
child 780 580af8cf2f6a
child 786 e20173729589
     1.1 --- a/lemon/hypercube_graph.h	Tue Aug 18 10:08:28 2009 +0200
     1.2 +++ b/lemon/hypercube_graph.h	Thu Nov 05 08:39:49 2009 +0100
     1.3 @@ -282,17 +282,21 @@
     1.4    ///
     1.5    /// \brief Hypercube graph class
     1.6    ///
     1.7 -  /// This class implements a special graph type. The nodes of the graph
     1.8 -  /// are indiced with integers with at most \c dim binary digits.
     1.9 +  /// HypercubeGraph implements a special graph type. The nodes of the
    1.10 +  /// graph are indexed with integers having at most \c dim binary digits.
    1.11    /// Two nodes are connected in the graph if and only if their indices
    1.12    /// differ only on one position in the binary form.
    1.13 +  /// This class is completely static and it needs constant memory space.
    1.14 +  /// Thus you can neither add nor delete nodes or edges, however 
    1.15 +  /// the structure can be resized using resize().
    1.16 +  ///
    1.17 +  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
    1.18 +  /// Most of its member functions and nested classes are documented
    1.19 +  /// only in the concept class.
    1.20    ///
    1.21    /// \note The type of the indices is chosen to \c int for efficiency
    1.22    /// reasons. Thus the maximum dimension of this implementation is 26
    1.23    /// (assuming that the size of \c int is 32 bit).
    1.24 -  ///
    1.25 -  /// This graph type fully conforms to the \ref concepts::Graph
    1.26 -  /// "Graph concept".
    1.27    class HypercubeGraph : public ExtendedHypercubeGraphBase {
    1.28      typedef ExtendedHypercubeGraphBase Parent;
    1.29  
    1.30 @@ -303,6 +307,21 @@
    1.31      /// Constructs a hypercube graph with \c dim dimensions.
    1.32      HypercubeGraph(int dim) { construct(dim); }
    1.33  
    1.34 +    /// \brief Resizes the graph
    1.35 +    ///
    1.36 +    /// This function resizes the graph. It fully destroys and
    1.37 +    /// rebuilds the structure, therefore the maps of the graph will be
    1.38 +    /// reallocated automatically and the previous values will be lost.
    1.39 +    void resize(int dim) {
    1.40 +      Parent::notifier(Arc()).clear();
    1.41 +      Parent::notifier(Edge()).clear();
    1.42 +      Parent::notifier(Node()).clear();
    1.43 +      construct(dim);
    1.44 +      Parent::notifier(Node()).build();
    1.45 +      Parent::notifier(Edge()).build();
    1.46 +      Parent::notifier(Arc()).build();
    1.47 +    }
    1.48 +
    1.49      /// \brief The number of dimensions.
    1.50      ///
    1.51      /// Gives back the number of dimensions.
    1.52 @@ -320,7 +339,7 @@
    1.53      /// \brief The dimension id of an edge.
    1.54      ///
    1.55      /// Gives back the dimension id of the given edge.
    1.56 -    /// It is in the [0..dim-1] range.
    1.57 +    /// It is in the range <tt>[0..dim-1]</tt>.
    1.58      int dimension(Edge edge) const {
    1.59        return Parent::dimension(edge);
    1.60      }
    1.61 @@ -328,7 +347,7 @@
    1.62      /// \brief The dimension id of an arc.
    1.63      ///
    1.64      /// Gives back the dimension id of the given arc.
    1.65 -    /// It is in the [0..dim-1] range.
    1.66 +    /// It is in the range <tt>[0..dim-1]</tt>.
    1.67      int dimension(Arc arc) const {
    1.68        return Parent::dimension(arc);
    1.69      }