COIN-OR::LEMON - Graph Library

Changeset 2223:590c1b663a27 in lemon-0.x for lemon/hypercube_graph.h


Ignore:
Timestamp:
09/29/06 13:25:27 (13 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2963
Message:

Exporting interface to the Graph class
Some documentation improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/hypercube_graph.h

    r2207 r2223  
    3535namespace lemon {
    3636
    37   /// \brief Base graph for HyperCubeGraph.
    38   ///
    39   /// Base graph for hyper-cube graph. It describes some member functions
    40   /// which can be used in the HyperCubeGraph.
    41   ///
    42   /// \warning Always use the HyperCubeGraph instead of this.
    43   /// \see HyperCubeGraph
    4437  class HyperCubeGraphBase {
    4538
     
    5750  protected:
    5851
    59     /// \brief Creates a hypercube graph with the given size.
    60     ///
    61     /// Creates a hypercube graph with the given size.
    6252    void construct(int dim) {
    6353      _dim = dim;
     
    7161    typedef True EdgeNumTag;
    7262
    73     ///Number of nodes.
    7463    int nodeNum() const { return _nodeNum; }
    75     ///Number of edges.
    7664    int edgeNum() const { return _nodeNum * _dim; }
    7765
    78     /// Maximum node ID.
    79    
    80     /// Maximum node ID.
    81     ///\sa id(Node)
    8266    int maxNodeId() const { return nodeNum() - 1; }
    83     /// Maximum edge ID.
    84    
    85     /// Maximum edge ID.
    86     ///\sa id(Edge)
    8767    int maxEdgeId() const { return edgeNum() - 1; }
    8868
    89     /// \brief Gives back the source node of an edge.
    90     ///   
    91     /// Gives back the source node of an edge.
    9269    Node source(Edge e) const {
    9370      return e.id / _dim;
    9471    }
    9572
    96     /// \brief Gives back the target node of an edge.
    97     ///   
    98     /// Gives back the target node of an edge.
    9973    Node target(Edge e) const {
    10074      return (e.id / _dim) ^ ( 1 << (e.id % _dim));
    10175    }
    10276
    103     /// Node ID.
    104    
    105     /// The ID of a valid Node is a nonnegative integer not greater than
    106     /// \ref maxNodeId(). The range of the ID's is not surely continuous
    107     /// and the greatest node ID can be actually less then \ref maxNodeId().
    108     ///
    109     /// The ID of the \ref INVALID node is -1.
    110     ///\return The ID of the node \c v.
    111 
    11277    static int id(Node v) { return v.id; }
    113     /// Edge ID.
    114    
    115     /// The ID of a valid Edge is a nonnegative integer not greater than
    116     /// \ref maxEdgeId(). The range of the ID's is not surely continuous
    117     /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    118     ///
    119     /// The ID of the \ref INVALID edge is -1.
    120     ///\return The ID of the edge \c e.
    12178    static int id(Edge e) { return e.id; }
    12279
     
    193150    }
    194151
    195     /// \brief Gives back the number of the dimensions.
    196     ///
    197     /// Gives back the number of the dimensions.
    198152    int dimension() const {
    199153      return _dim;
    200154    }
    201155
    202     /// \brief Returns true if the n'th bit of the node is one.
    203     ///
    204     /// Returns true if the n'th bit of the node is one.
    205156    bool projection(Node node, int n) const {
    206157      return (bool)(node.id & (1 << n));
    207158    }
    208159
    209     /// \brief The dimension id of the edge.
    210     ///
    211     /// It returns the dimension id of the edge. It can
    212     /// be in the ${0, 1, dim-1}$ intervall.
    213160    int dimension(Edge edge) const {
    214161      return edge.id % _dim;
    215162    }
    216163
    217     /// \brief Gives back the index of the node.
    218     ///
    219     /// Gives back the index of the node. The lower bits of the
    220     /// integer describe the node.
    221164    int index(Node node) const {
    222165      return node.id;
    223166    }
    224167
    225     /// \brief Gives back the node by its index.
    226     ///
    227     ///  Gives back the node by its index.
    228168    Node operator()(int index) const {
    229169      return Node(index);
     
    253193  /// concept but it does not conform to the \ref concept::UGraph.
    254194  ///
    255   /// \see HyperCubeGraphBase
    256195  /// \author Balazs Dezso
    257196  class HyperCubeGraph : public ExtendedHyperCubeGraphBase {
    258197  public:
    259198
     199    typedef ExtendedHyperCubeGraphBase Parent;
     200
    260201    /// \brief Construct a graph with \c dim dimension.
    261202    ///
    262203    /// Construct a graph with \c dim dimension.
    263204    HyperCubeGraph(int dim) { construct(dim); }
     205
     206    /// \brief Gives back the number of the dimensions.
     207    ///
     208    /// Gives back the number of the dimensions.
     209    int dimension() const {
     210      return Parent::dimension();
     211    }
     212
     213    /// \brief Returns true if the n'th bit of the node is one.
     214    ///
     215    /// Returns true if the n'th bit of the node is one.
     216    bool projection(Node node, int n) const {
     217      return Parent::projection(node, n);
     218    }
     219
     220    /// \brief The dimension id of the edge.
     221    ///
     222    /// It returns the dimension id of the edge. It can
     223    /// be in the \f$ \{0, 1, \dots, dim-1\} \f$ intervall.
     224    int dimension(Edge edge) const {
     225      return Parent::dimension(edge);
     226    }
     227
     228    /// \brief Gives back the index of the node.
     229    ///
     230    /// Gives back the index of the node. The lower bits of the
     231    /// integer describes the node.
     232    int index(Node node) const {
     233      return Parent::index(node);
     234    }
     235
     236    /// \brief Gives back the node by its index.
     237    ///
     238    /// Gives back the node by its index.
     239    Node operator()(int index) const {
     240      return Parent::operator()(index);
     241    }
     242
     243    /// \brief Number of nodes.
     244    int nodeNum() const { return Parent::nodeNum(); }
     245    /// \brief Number of edges.
     246    int edgeNum() const { return Parent::edgeNum(); }
    264247
    265248    /// \brief Linear combination map.
Note: See TracChangeset for help on using the changeset viewer.