COIN-OR::LEMON - Graph Library

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


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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    ///
Note: See TracChangeset for help on using the changeset viewer.