COIN-OR::LEMON - Graph Library

Changeset 2223:590c1b663a27 in lemon-0.x


Ignore:
Timestamp:
09/29/06 13:25:27 (18 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

Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • lemon/full_graph.h

    r2162 r2223  
    3636namespace lemon {
    3737
    38   /// \brief Base of the FullGrpah.
    39   ///
    40   /// Base of the FullGrpah.
    4138  class FullGraphBase {
    4239    int _nodeNum;
     
    4946    class Edge;
    5047
     48  protected:
     49
     50    FullGraphBase() {}
     51
     52    void construct(int n) { _nodeNum = n; _edgeNum = n * n; }
     53
    5154  public:
    52 
    53     FullGraphBase() {}
    54 
    55 
    56     ///Creates a full graph with \c n nodes.
    57     void construct(int n) { _nodeNum = n; _edgeNum = n * n; }
    5855   
    5956    typedef True NodeNumTag;
    6057    typedef True EdgeNumTag;
    6158
    62     /// \brief Returns the node with the given index.
    63     ///
    64     /// Returns the node with the given index. Because it is a
    65     /// static size graph the node's of the graph can be indiced
    66     /// by the range from 0 to \e nodeNum()-1 and the index of
    67     /// the node can accessed by the \e index() member.
    6859    Node operator()(int index) const { return Node(index); }
    69 
    70     /// \brief Returns the index of the node.
    71     ///
    72     /// Returns the index of the node. Because it is a
    73     /// static size graph the node's of the graph can be indiced
    74     /// by the range from 0 to \e nodeNum()-1 and the index of
    75     /// the node can accessed by the \e index() member.
    7660    int index(const Node& node) const { return node.id; }
    7761
    78     ///Number of nodes.
     62    Edge edge(const Node& u, const Node& v) const {
     63      return Edge(*this, u.id, v.id);
     64    }
     65
    7966    int nodeNum() const { return _nodeNum; }
    80     ///Number of edges.
    8167    int edgeNum() const { return _edgeNum; }
    8268
    83     /// Maximum node ID.
    84    
    85     /// Maximum node ID.
    86     ///\sa id(Node)
    8769    int maxNodeId() const { return _nodeNum-1; }
    88     /// Maximum edge ID.
    89    
    90     /// Maximum edge ID.
    91     ///\sa id(Edge)
    9270    int maxEdgeId() const { return _edgeNum-1; }
    9371
     
    9674
    9775
    98     /// Node ID.
    99    
    100     /// The ID of a valid Node is a nonnegative integer not greater than
    101     /// \ref maxNodeId(). The range of the ID's is not surely continuous
    102     /// and the greatest node ID can be actually less then \ref maxNodeId().
    103     ///
    104     /// The ID of the \ref INVALID node is -1.
    105     ///\return The ID of the node \c v.
    106 
    10776    static int id(Node v) { return v.id; }
    108     /// Edge ID.
    109    
    110     /// The ID of a valid Edge is a nonnegative integer not greater than
    111     /// \ref maxEdgeId(). The range of the ID's is not surely continuous
    112     /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    113     ///
    114     /// The ID of the \ref INVALID edge is -1.
    115     ///\return The ID of the edge \c e.
    11677    static int id(Edge e) { return e.id; }
    11778
     
    12283    typedef True FindEdgeTag;
    12384
    124     /// Finds an edge between two nodes.
    125    
    126     /// Finds an edge from node \c u to node \c v.
    127     ///
    128     /// If \c prev is \ref INVALID (this is the default value), then
    129     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    130     /// the next edge from \c u to \c v after \c prev.
    131     /// \return The found edge or INVALID if there is no such an edge.
    13285    Edge findEdge(Node u,Node v, Edge prev = INVALID) const {
    13386      return prev.id == -1 ? Edge(*this, u.id, v.id) : INVALID;
     
    218171  /// \sa concept::Graph.
    219172  ///
    220   /// \sa FullGraphBase
    221173  /// \sa FullUGraph
    222174  ///
     
    246198      Parent::getNotifier(Edge()).build();
    247199    }
     200
     201    /// \brief Returns the node with the given index.
     202    ///
     203    /// Returns the node with the given index. Because it is a
     204    /// static size graph the node's of the graph can be indiced
     205    /// by the range from 0 to \e nodeNum()-1 and the index of
     206    /// the node can accessed by the \e index() member.
     207    Node operator()(int index) const { return Parent::operator()(index); }
     208
     209    /// \brief Returns the index of the node.
     210    ///
     211    /// Returns the index of the node. Because it is a
     212    /// static size graph the node's of the graph can be indiced
     213    /// by the range from 0 to \e nodeNum()-1 and the index of
     214    /// the node can accessed by the \e index() member.
     215    int index(const Node& node) const { return Parent::index(node); }
     216
     217    /// \brief Returns the edge connects the given nodes.
     218    ///
     219    /// Returns the edge connects the given nodes.
     220    Edge edge(const Node& u, const Node& v) const {
     221      return Parent::edge(u, v);
     222    }
     223
     224    /// \brief Number of nodes.
     225    int nodeNum() const { return Parent::nodeNum(); }
     226    /// \brief Number of edges.
     227    int edgeNum() const { return Parent::edgeNum(); }
    248228  };
    249229
    250230
    251   /// \brief Base of the FullUGrpah.
    252   ///
    253   /// Base of the FullUGrpah.
    254231  class FullUGraphBase {
    255232    int _nodeNum;
     
    262239    class Edge;
    263240
     241  protected:
     242
     243    FullUGraphBase() {}
     244
     245    void construct(int n) { _nodeNum = n; _edgeNum = n * (n - 1) / 2; }
     246
    264247  public:
    265248
    266     FullUGraphBase() {}
    267 
    268 
    269     ///Creates a full graph with \c n nodes.
    270     void construct(int n) { _nodeNum = n; _edgeNum = n * (n - 1) / 2; }
    271 
    272     /// \brief Returns the node with the given index.
    273     ///
    274     /// Returns the node with the given index. Because it is a
    275     /// static size graph the node's of the graph can be indiced
    276     /// by the range from 0 to \e nodeNum()-1 and the index of
    277     /// the node can accessed by the \e index() member.
     249
    278250    Node operator()(int index) const { return Node(index); }
    279 
    280     /// \brief Returns the index of the node.
    281     ///
    282     /// Returns the index of the node. Because it is a
    283     /// static size graph the node's of the graph can be indiced
    284     /// by the range from 0 to \e nodeNum()-1 and the index of
    285     /// the node can accessed by the \e index() member.
    286251    int index(const Node& node) const { return node.id; }
     252
     253    Edge edge(const Node& u, const Node& v) const {
     254      return Edge(u.id * (u.id - 1) / 2 + v.id);
     255    }
    287256
    288257    typedef True NodeNumTag;
    289258    typedef True EdgeNumTag;
    290259
    291     ///Number of nodes.
    292260    int nodeNum() const { return _nodeNum; }
    293     ///Number of edges.
    294261    int edgeNum() const { return _edgeNum; }
    295262
    296     /// Maximum node ID.
    297    
    298     /// Maximum node ID.
    299     ///\sa id(Node)
    300263    int maxNodeId() const { return _nodeNum-1; }
    301     /// Maximum edge ID.
    302    
    303     /// Maximum edge ID.
    304     ///\sa id(Edge)
    305264    int maxEdgeId() const { return _edgeNum-1; }
    306265
    307     /// \brief Returns the node from its \c id.
    308     ///
    309     /// Returns the node from its \c id. If there is not node
    310     /// with the given id the effect of the function is undefinied.
    311266    static Node nodeFromId(int id) { return Node(id);}
    312 
    313     /// \brief Returns the edge from its \c id.
    314     ///
    315     /// Returns the edge from its \c id. If there is not edge
    316     /// with the given id the effect of the function is undefinied.
    317267    static Edge edgeFromId(int id) { return Edge(id);}
    318268
     
    327277    }
    328278
    329 
    330     /// \brief Node ID.
    331     ///
    332     /// The ID of a valid Node is a nonnegative integer not greater than
    333     /// \ref maxNodeId(). The range of the ID's is not surely continuous
    334     /// and the greatest node ID can be actually less then \ref maxNodeId().
    335     ///
    336     /// The ID of the \ref INVALID node is -1.
    337     /// \return The ID of the node \c v.
    338 
    339279    static int id(Node v) { return v.id; }
    340 
    341     /// \brief Edge ID.
    342     ///
    343     /// The ID of a valid Edge is a nonnegative integer not greater than
    344     /// \ref maxEdgeId(). The range of the ID's is not surely continuous
    345     /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    346     ///
    347     /// The ID of the \ref INVALID edge is -1.
    348     ///\return The ID of the edge \c e.
    349280    static int id(Edge e) { return e.id; }
    350281
    351     /// \brief Finds an edge between two nodes.
    352     ///
    353     /// Finds an edge from node \c u to node \c v.
    354     ///
    355     /// If \c prev is \ref INVALID (this is the default value), then
    356     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    357     /// the next edge from \c u to \c v after \c prev.
    358     /// \return The found edge or INVALID if there is no such an edge.
    359282    Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
    360283      if (prev.id != -1 || u.id <= v.id) return Edge(-1);
     
    457380  /// it does not contain the loop edges.
    458381  ///
    459   /// \sa FullUGraphBase
    460382  /// \sa FullGraph
    461383  ///
     
    486408      Parent::getNotifier(Edge()).build();
    487409    }
     410
     411    /// \brief Returns the node with the given index.
     412    ///
     413    /// Returns the node with the given index. Because it is a
     414    /// static size graph the node's of the graph can be indiced
     415    /// by the range from 0 to \e nodeNum()-1 and the index of
     416    /// the node can accessed by the \e index() member.
     417    Node operator()(int index) const { return Parent::operator()(index); }
     418
     419    /// \brief Returns the index of the node.
     420    ///
     421    /// Returns the index of the node. Because it is a
     422    /// static size graph the node's of the graph can be indiced
     423    /// by the range from 0 to \e nodeNum()-1 and the index of
     424    /// the node can accessed by the \e index() member.
     425    int index(const Node& node) const { return Parent::index(node); }
     426
     427    /// \brief Number of nodes.
     428    int nodeNum() const { return Parent::nodeNum(); }
     429    /// \brief Number of edges.
     430    int edgeNum() const { return Parent::edgeNum(); }
     431    /// \brief Number of undirected edges.
     432    int uEdgeNum() const { return Parent::uEdgeNum(); }
     433
     434    /// \brief Returns the edge connects the given nodes.
     435    ///
     436    /// Returns the edge connects the given nodes.
     437    Edge edge(const Node& u, const Node& v) const {
     438      if (Parent::index(u) > Parent::index(v)) {
     439        return Parent::direct(Parent::edge(u, v), true);
     440      } else if (Parent::index(u) == Parent::index(v)) {
     441        return INVALID;
     442      } else {
     443        return Parent::direct(Parent::edge(v, u), false);
     444      }
     445    }
     446
     447    /// \brief Returns the undirected edge connects the given nodes.
     448    ///
     449    /// Returns the undirected edge connects the given nodes.
     450    UEdge uEdge(const Node& u, const Node& v) const {
     451      if (Parent::index(u) > Parent::index(v)) {
     452        return Parent::edge(u, v);
     453      } else if (Parent::index(u) == Parent::index(v)) {
     454        return INVALID;
     455      } else {
     456        return Parent::edge(v, u);
     457      }
     458    }
    488459  };
    489460
     
    496467
    497468    int _edgeNum;
     469
     470  protected:
     471
     472    FullBpUGraphBase() {}
     473
     474    void construct(int aNodeNum, int bNodeNum) {
     475      _aNodeNum = aNodeNum;
     476      _bNodeNum = bNodeNum;
     477      _edgeNum = aNodeNum * bNodeNum;
     478    }
    498479
    499480  public:
     
    534515    };
    535516
    536     void construct(int aNodeNum, int bNodeNum) {
    537       _aNodeNum = aNodeNum;
    538       _bNodeNum = bNodeNum;
    539       _edgeNum = aNodeNum * bNodeNum;
     517    Node aNode(int index) const { return Node(index << 1); }
     518    Node bNode(int index) const { return Node((index << 1) + 1); }
     519
     520    int aNodeIndex(const Node& node) const { return node.id >> 1; }
     521    int bNodeIndex(const Node& node) const { return node.id >> 1; }
     522
     523    UEdge uEdge(const Node& u, const Node& v) const {
     524      if (((u.id ^ v.id) & 1) != 1) {
     525        return UEdge(-1);
     526      } else if ((u.id & 1) == 0) {
     527        return UEdge((u.id >> 1) * _bNodeNum + (v.id >> 1));
     528      } else {
     529        return UEdge((v.id >> 1) * _bNodeNum + (u.id >> 1));
     530      }
    540531    }
    541532
     
    651642    }
    652643
    653     static Node aNode(int index) {
    654       return Node(index << 1);
    655     }
    656 
    657     static Node bNode(int index) {
    658       return Node((index << 1) + 1);
    659     }
    660644
    661645    typedef True NodeNumTag;
     
    667651    int uEdgeNum() const { return _edgeNum; }
    668652
     653
     654    typedef True FindEdgeTag;
     655    UEdge findUEdge(Node u, Node v, UEdge prev = INVALID) const {
     656      if (prev.id != -1 || ((u.id ^ v.id) & 1) != 1) {
     657        return UEdge(-1);
     658      } else if ((u.id & 1) == 0) {
     659        return UEdge((u.id >> 1) * _bNodeNum + (v.id >> 1));
     660      } else {
     661        return UEdge((v.id >> 1) * _bNodeNum + (u.id >> 1));
     662      }
     663    }
     664
    669665  };
    670666
     
    680676  /// It is completely static, so you can neither add nor delete either
    681677  /// edges or nodes.
    682   ///
    683   /// \sa FullUGraphBase
    684   /// \sa FullGraph
    685678  ///
    686679  /// \author Balazs Dezso
     
    701694    /// \brief Resize the graph
    702695    ///
     696    /// Resize the graph
    703697    void resize(int n, int m) {
    704698      Parent::getNotifier(Edge()).clear();
     
    714708      Parent::getNotifier(Edge()).build();
    715709    }
     710
     711    /// \brief Number of nodes.
     712    int nodeNum() const { return Parent::nodeNum(); }
     713    /// \brief Number of A-nodes.
     714    int aNodeNum() const { return Parent::aNodeNum(); }
     715    /// \brief Number of B-nodes.
     716    int bNodeNum() const { return Parent::bNodeNum(); }
     717    /// \brief Number of edges.
     718    int edgeNum() const { return Parent::edgeNum(); }
     719    /// \brief Number of undirected edges.
     720    int uEdgeNum() const { return Parent::uEdgeNum(); }
     721
     722
     723    using Parent::aNode;
     724    using Parent::bNode;
     725
     726    /// \brief Returns the A-node with the given index.
     727    ///
     728    /// Returns the A-node with the given index. Because it is a
     729    /// static size graph the node's of the graph can be indiced
     730    /// by the range from 0 to \e aNodeNum()-1 and the index of
     731    /// the node can accessed by the \e aNodeIndex() member.
     732    Node aNode(int index) const { return Parent::aNode(index); }
     733
     734    /// \brief Returns the B-node with the given index.
     735    ///
     736    /// Returns the B-node with the given index. Because it is a
     737    /// static size graph the node's of the graph can be indiced
     738    /// by the range from 0 to \e bNodeNum()-1 and the index of
     739    /// the node can accessed by the \e bNodeIndex() member.
     740    Node bNode(int index) const { return Parent::bNode(index); }
     741
     742    /// \brief Returns the index of the A-node.
     743    ///
     744    /// Returns the index of the A-node. Because it is a
     745    /// static size graph the node's of the graph can be indiced
     746    /// by the range from 0 to \e aNodeNum()-1 and the index of
     747    /// the node can accessed by the \e aNodeIndex() member.
     748    int aNodeIndex(const Node& node) const { return Parent::aNodeIndex(node); }
     749
     750    /// \brief Returns the index of the B-node.
     751    ///
     752    /// Returns the index of the B-node. Because it is a
     753    /// static size graph the node's of the graph can be indiced
     754    /// by the range from 0 to \e bNodeNum()-1 and the index of
     755    /// the node can accessed by the \e bNodeIndex() member.
     756    int bNodeIndex(const Node& node) const { return Parent::bNodeIndex(node); }
     757
     758    /// \brief Returns the edge connects the given nodes.
     759    ///
     760    /// Returns the edge connects the given nodes.
     761    Edge edge(const Node& u, const Node& v) const {
     762      UEdge uedge = Parent::uEdge(u, v);
     763      if (uedge != INVALID) {
     764        return Parent::direct(uedge, Parent::aNode(u));
     765      } else {
     766        return INVALID;
     767      }
     768    }
     769
     770    /// \brief Returns the undirected edge connects the given nodes.
     771    ///
     772    /// Returns the undirected edge connects the given nodes.
     773    UEdge uEdge(const Node& u, const Node& v) const {
     774      return Parent::uEdge(u, v);
     775    }
    716776  };
    717777
  • lemon/grid_ugraph.h

    r2207 r2223  
    3535namespace lemon {
    3636
    37   /// \brief Base graph for GridUGraph.
    38   ///
    39   /// Base graph for grid graph. It describes some member functions
    40   /// which can be used in the GridUGraph.
    41   ///
    42   /// \warning Always use the GridUGraph instead of this.
    43   /// \see GridUGraph
    4437  class GridUGraphBase {
    4538
     
    5750  protected:
    5851
    59     /// \brief Creates a grid graph with the given size.
    60     ///
    61     /// Creates a grid graph with the given size.
    6252    void construct(int width, int height) {
    6353      _height = height; _width = width;
     
    6656    }
    6757
    68     /// \brief Gives back the edge goes down from the node.
    69     ///
    70     /// Gives back the edge goes down from the node. If there is not
    71     /// outgoing edge then it gives back INVALID.
    7258    Edge _down(Node n) const {
    7359      if (n.id < _nodeNum - _width) {
     
    7864    }
    7965
    80     /// \brief Gives back the edge comes from up into the node.
    81     ///
    82     /// Gives back the edge comes from up into the node. If there is not
    83     /// incoming edge then it gives back INVALID.
    8466    Edge _up(Node n) const {
    8567      if (n.id >= _width) {
     
    9072    }
    9173
    92     /// \brief Gives back the edge goes right from the node.
    93     ///
    94     /// Gives back the edge goes right from the node. If there is not
    95     /// outgoing edge then it gives back INVALID.
    9674    Edge _right(Node n) const {
    9775      if (n.id % _width < _width - 1) {
     
    10280    }
    10381
    104     /// \brief Gives back the edge comes from left into the node.
    105     ///
    106     /// Gives back the edge comes left up into the node. If there is not
    107     /// incoming edge then it gives back INVALID.
    10882    Edge _left(Node n) const {
    10983      if (n.id % _width > 0) {
     
    12498
    12599   
    126     /// \brief The node on the given position.
    127     ///
    128     /// Gives back the node on the given position.
    129100    Node operator()(int i, int j) const {
    130101      LEMON_ASSERT(0 <= i && i < width() && 0 <= j  &&
     
    133104    }
    134105
    135     /// \brief Gives back the row index of the node.
    136     ///
    137     /// Gives back the row index of the node.
    138106    int row(Node n) const {
    139107      return n.id / _width;
    140108    }
    141109   
    142     /// \brief Gives back the coloumn index of the node.
    143     ///
    144     /// Gives back the coloumn index of the node.
    145110    int col(Node n) const {
    146111      return n.id % _width;   
    147112    }
    148113
    149     /// \brief Gives back the width of the graph.
    150     ///
    151     /// Gives back the width of the graph.
    152114    int width() const {
    153115      return _width;
    154116    }
    155117
    156     /// \brief Gives back the height of the graph.
    157     ///
    158     /// Gives back the height of the graph.
    159118    int height() const {
    160119      return _height;
     
    164123    typedef True EdgeNumTag;
    165124
    166     ///Number of nodes.
    167125    int nodeNum() const { return _nodeNum; }
    168     ///Number of edges.
    169126    int edgeNum() const { return _edgeNum; }
    170127
    171     /// Maximum node ID.
    172    
    173     /// Maximum node ID.
    174     ///\sa id(Node)
    175128    int maxNodeId() const { return nodeNum() - 1; }
    176     /// Maximum edge ID.
    177    
    178     /// Maximum edge ID.
    179     ///\sa id(Edge)
    180129    int maxEdgeId() const { return edgeNum() - 1; }
    181130
    182     /// \brief Gives back the source node of an edge.
    183     ///   
    184     /// Gives back the source node of an edge.
    185131    Node source(Edge e) const {
    186132      if (e.id < _edgeLimit) {
     
    192138    }
    193139
    194     /// \brief Gives back the target node of an edge.
    195     ///   
    196     /// Gives back the target node of an edge.
    197140    Node target(Edge e) const {
    198141      if (e.id < _edgeLimit) {
     
    204147    }
    205148
    206     /// Node ID.
    207    
    208     /// The ID of a valid Node is a nonnegative integer not greater than
    209     /// \ref maxNodeId(). The range of the ID's is not surely continuous
    210     /// and the greatest node ID can be actually less then \ref maxNodeId().
    211     ///
    212     /// The ID of the \ref INVALID node is -1.
    213     ///\return The ID of the node \c v.
    214 
    215149    static int id(Node v) { return v.id; }
    216     /// Edge ID.
    217    
    218     /// The ID of a valid Edge is a nonnegative integer not greater than
    219     /// \ref maxEdgeId(). The range of the ID's is not surely continuous
    220     /// and the greatest edge ID can be actually less then \ref maxEdgeId().
    221     ///
    222     /// The ID of the \ref INVALID edge is -1.
    223     ///\return The ID of the edge \c e.
    224150    static int id(Edge e) { return e.id; }
    225151
     
    230156    typedef True FindEdgeTag;
    231157
    232     /// Finds an edge between two nodes.
    233    
    234     /// Finds an edge from node \c u to node \c v.
    235     ///
    236     /// If \c prev is \ref INVALID (this is the default value), then
    237     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    238     /// the next edge from \c u to \c v after \c prev.
    239     /// \return The found edge or INVALID if there is no such an edge.
    240158    Edge findEdge(Node u, Node v, Edge prev = INVALID) const {
    241159      if (prev != INVALID) return INVALID;
     
    360278  /// Two nodes are connected in the graph if the indices differ only
    361279  /// on one position and only one is the difference.
     280  ///
     281  /// \image html grid_ugraph.png
     282  /// \image latex grid_ugraph.eps "Grid graph" width=\textwidth
    362283  ///
    363284  /// The graph can be indiced in the following way:
     
    376297  ///
    377298  /// \author Balazs Dezso
    378   /// \see GridUGraphBase
    379299  class GridUGraph : public ExtendedGridUGraphBase {
    380300  public:
     
    477397    }
    478398   
     399    /// \brief The node on the given position.
     400    ///
     401    /// Gives back the node on the given position.
     402    Node operator()(int i, int j) const {
     403      return Parent::operator()(i, j);
     404    }
     405
     406    /// \brief Gives back the row index of the node.
     407    ///
     408    /// Gives back the row index of the node.
     409    int row(Node n) const {
     410      return Parent::row(n);
     411    }
     412   
     413    /// \brief Gives back the coloumn index of the node.
     414    ///
     415    /// Gives back the coloumn index of the node.
     416    int col(Node n) const {
     417      return Parent::col(n);
     418    }
     419
     420    /// \brief Gives back the width of the graph.
     421    ///
     422    /// Gives back the width of the graph.
     423    int width() const {
     424      return Parent::width();
     425    }
     426
     427    /// \brief Gives back the height of the graph.
     428    ///
     429    /// Gives back the height of the graph.
     430    int height() const {
     431      return Parent::height();
     432    }
     433
    479434    /// \brief Gives back the edge goes down from the node.
    480435    ///
  • 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.