COIN-OR::LEMON - Graph Library

Changeset 827:580af8cf2f6a in lemon for lemon/hypercube_graph.h


Ignore:
Timestamp:
11/05/09 10:23:16 (10 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
826:c160bf9f18ef (diff), 819:f964a00b9068 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Phase:
public
Message:

Merge #68 (Port static graph implementation)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lemon/hypercube_graph.h

    r784 r827  
    263263    }
    264264
    265     int index(Node node) const {
     265    static int index(Node node) {
    266266      return node._id;
    267267    }
     
    357357    /// Gives back the index of the given node.
    358358    /// The lower bits of the integer describes the node.
    359     int index(Node node) const {
     359    static int index(Node node) {
    360360      return Parent::index(node);
    361361    }
  • lemon/hypercube_graph.h

    r825 r827  
    283283  /// \brief Hypercube graph class
    284284  ///
    285   /// This class implements a special graph type. The nodes of the graph
    286   /// are indiced with integers with at most \c dim binary digits.
     285  /// HypercubeGraph implements a special graph type. The nodes of the
     286  /// graph are indexed with integers having at most \c dim binary digits.
    287287  /// Two nodes are connected in the graph if and only if their indices
    288288  /// differ only on one position in the binary form.
     289  /// This class is completely static and it needs constant memory space.
     290  /// Thus you can neither add nor delete nodes or edges, however
     291  /// the structure can be resized using resize().
     292  ///
     293  /// This type fully conforms to the \ref concepts::Graph "Graph concept".
     294  /// Most of its member functions and nested classes are documented
     295  /// only in the concept class.
    289296  ///
    290297  /// \note The type of the indices is chosen to \c int for efficiency
    291298  /// reasons. Thus the maximum dimension of this implementation is 26
    292299  /// (assuming that the size of \c int is 32 bit).
    293   ///
    294   /// This graph type fully conforms to the \ref concepts::Graph
    295   /// "Graph concept".
    296300  class HypercubeGraph : public ExtendedHypercubeGraphBase {
    297301    typedef ExtendedHypercubeGraphBase Parent;
     
    303307    /// Constructs a hypercube graph with \c dim dimensions.
    304308    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    }
    305324
    306325    /// \brief The number of dimensions.
     
    321340    ///
    322341    /// Gives back the dimension id of the given edge.
    323     /// It is in the [0..dim-1] range.
     342    /// It is in the range <tt>[0..dim-1]</tt>.
    324343    int dimension(Edge edge) const {
    325344      return Parent::dimension(edge);
     
    329348    ///
    330349    /// Gives back the dimension id of the given arc.
    331     /// It is in the [0..dim-1] range.
     350    /// It is in the range <tt>[0..dim-1]</tt>.
    332351    int dimension(Arc arc) const {
    333352      return Parent::dimension(arc);
Note: See TracChangeset for help on using the changeset viewer.