1.1 --- a/lemon/hypercube_graph.h Mon Jan 12 23:11:39 2009 +0100
1.2 +++ b/lemon/hypercube_graph.h Thu Nov 05 15:48:01 2009 +0100
1.3 @@ -262,7 +262,7 @@
1.4 return arc._id >> _dim;
1.5 }
1.6
1.7 - int index(Node node) const {
1.8 + static int index(Node node) {
1.9 return node._id;
1.10 }
1.11
1.12 @@ -282,29 +282,46 @@
1.13 ///
1.14 /// \brief Hypercube graph class
1.15 ///
1.16 - /// This class implements a special graph type. The nodes of the graph
1.17 - /// are indiced with integers with at most \c dim binary digits.
1.18 + /// HypercubeGraph implements a special graph type. The nodes of the
1.19 + /// graph are indexed with integers having at most \c dim binary digits.
1.20 /// Two nodes are connected in the graph if and only if their indices
1.21 /// differ only on one position in the binary form.
1.22 + /// This class is completely static and it needs constant memory space.
1.23 + /// Thus you can neither add nor delete nodes or edges, however
1.24 + /// the structure can be resized using resize().
1.25 + ///
1.26 + /// This type fully conforms to the \ref concepts::Graph "Graph concept".
1.27 + /// Most of its member functions and nested classes are documented
1.28 + /// only in the concept class.
1.29 ///
1.30 /// \note The type of the indices is chosen to \c int for efficiency
1.31 /// reasons. Thus the maximum dimension of this implementation is 26
1.32 /// (assuming that the size of \c int is 32 bit).
1.33 - ///
1.34 - /// This graph type is fully conform to the \ref concepts::Graph
1.35 - /// "Graph" concept, and it also has an important extra feature
1.36 - /// that its maps are real \ref concepts::ReferenceMap
1.37 - /// "reference map"s.
1.38 class HypercubeGraph : public ExtendedHypercubeGraphBase {
1.39 + typedef ExtendedHypercubeGraphBase Parent;
1.40 +
1.41 public:
1.42
1.43 - typedef ExtendedHypercubeGraphBase Parent;
1.44 -
1.45 /// \brief Constructs a hypercube graph with \c dim dimensions.
1.46 ///
1.47 /// Constructs a hypercube graph with \c dim dimensions.
1.48 HypercubeGraph(int dim) { construct(dim); }
1.49
1.50 + /// \brief Resizes the graph
1.51 + ///
1.52 + /// This function resizes the graph. It fully destroys and
1.53 + /// rebuilds the structure, therefore the maps of the graph will be
1.54 + /// reallocated automatically and the previous values will be lost.
1.55 + void resize(int dim) {
1.56 + Parent::notifier(Arc()).clear();
1.57 + Parent::notifier(Edge()).clear();
1.58 + Parent::notifier(Node()).clear();
1.59 + construct(dim);
1.60 + Parent::notifier(Node()).build();
1.61 + Parent::notifier(Edge()).build();
1.62 + Parent::notifier(Arc()).build();
1.63 + }
1.64 +
1.65 /// \brief The number of dimensions.
1.66 ///
1.67 /// Gives back the number of dimensions.
1.68 @@ -322,7 +339,7 @@
1.69 /// \brief The dimension id of an edge.
1.70 ///
1.71 /// Gives back the dimension id of the given edge.
1.72 - /// It is in the [0..dim-1] range.
1.73 + /// It is in the range <tt>[0..dim-1]</tt>.
1.74 int dimension(Edge edge) const {
1.75 return Parent::dimension(edge);
1.76 }
1.77 @@ -330,7 +347,7 @@
1.78 /// \brief The dimension id of an arc.
1.79 ///
1.80 /// Gives back the dimension id of the given arc.
1.81 - /// It is in the [0..dim-1] range.
1.82 + /// It is in the range <tt>[0..dim-1]</tt>.
1.83 int dimension(Arc arc) const {
1.84 return Parent::dimension(arc);
1.85 }
1.86 @@ -339,7 +356,7 @@
1.87 ///
1.88 /// Gives back the index of the given node.
1.89 /// The lower bits of the integer describes the node.
1.90 - int index(Node node) const {
1.91 + static int index(Node node) {
1.92 return Parent::index(node);
1.93 }
1.94