COIN-OR::LEMON - Graph Library

Changeset 801:48638058e188 in lemon-0.x for src


Ignore:
Timestamp:
09/05/04 22:06:08 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1095
Message:
  • Changes in doc
  • Some obsolete features has been removed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/skeletons/graph.h

    r794 r801  
    3636    public:
    3737      /// Defalult constructor.
     38
     39      /// Defalult constructor.
     40      ///
    3841      StaticGraphSkeleton() { }
    3942      ///Copy consructor.
    4043
    41       ///\todo It is not clear, what we expect from a copy constructor.
    42       ///E.g. How to assign the nodes/edges to each other? What about maps?
    43       StaticGraphSkeleton(const StaticGraphSkeleton& g) { }
     44//       ///\todo It is not clear, what we expect from a copy constructor.
     45//       ///E.g. How to assign the nodes/edges to each other? What about maps?
     46//       StaticGraphSkeleton(const StaticGraphSkeleton& g) { }
    4447
    4548      /// The base type of node iterators,
     
    4851      /// This is the base type of each node iterator,
    4952      /// thus each kind of node iterator converts to this.
    50       /// More precisely each kind of node iterator have to be inherited
     53      /// More precisely each kind of node iterator should be inherited
    5154      /// from the trivial node iterator.
    5255      class Node {
    5356      public:
     57        /// Default constructor
     58
    5459        /// @warning The default constructor sets the iterator
    5560        /// to an undefined value.
    5661        Node() { }
    5762        /// Copy constructor.
     63
     64        /// Copy constructor.
     65        ///
    5866        Node(const Node&) { }
     67
    5968        /// Invalid constructor \& conversion.
    6069
     
    6271        /// \sa Invalid for more details.
    6372        Node(Invalid) { }
     73        /// Equality operator
     74
    6475        /// Two iterators are equal if and only if they point to the
    6576        /// same object or both are invalid.
    6677        bool operator==(Node) const { return true; }
    6778
     79        /// Inequality operator
     80       
    6881        /// \sa \ref operator==(Node n)
    6982        ///
    7083        bool operator!=(Node) const { return true; }
    7184
     85        ///Comparison operator.
     86
     87        ///This is a strict ordering between the nodes.
     88        ///
     89        ///This ordering can be different from the order in which NodeIt
     90        ///goes through the nodes.
     91        ///\todo Possibly we don't need it.
    7292        bool operator<(Node) const { return true; }
    7393      };
     
    80100      /// \code
    81101      /// int count=0;
    82       /// for (Graph::NodeIt n(g); g.valid(n); ++n) ++count;
     102      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
    83103      /// \endcode
    84104      class NodeIt : public Node {
    85105      public:
     106        /// Default constructor
     107
    86108        /// @warning The default constructor sets the iterator
    87109        /// to an undefined value.
    88110        NodeIt() { }
    89111        /// Copy constructor.
     112       
     113        /// Copy constructor.
     114        ///
    90115        NodeIt(const NodeIt&) { }
    91116        /// Invalid constructor \& conversion.
     
    94119        /// \sa Invalid for more details.
    95120        NodeIt(Invalid) { }
     121        /// Sets the iterator to the first node.
     122
    96123        /// Sets the iterator to the first node of \c g.
     124        ///
    97125        NodeIt(const StaticGraphSkeleton& g) { }
     126        /// Node -> NodeIt conversion.
     127
    98128        /// Sets the iterator to the node of \c g pointed by the trivial
    99         /// iterator n. This feature necessitates that each time we
    100         /// iterate the node-set, the iteration order is the same.
     129        /// iterator n.
     130        /// This feature necessitates that each time we
     131        /// iterate the edge-set, the iteration order is the same.
    101132        NodeIt(const StaticGraphSkeleton& g, const Node& n) { }
     133        /// Next node.
     134
    102135        /// Assign the iterator to the next node.
     136        ///
    103137        NodeIt& operator++() { return *this; }
    104138      };
     
    106140   
    107141      /// The base type of the edge iterators.
     142
     143      /// The base type of the edge iterators.
     144      ///
    108145      class Edge {
    109146      public:
     147        /// Default constructor
     148
    110149        /// @warning The default constructor sets the iterator
    111150        /// to an undefined value.
    112151        Edge() { }
    113152        /// Copy constructor.
     153
     154        /// Copy constructor.
     155        ///
    114156        Edge(const Edge&) { }
    115157        /// Initialize the iterator to be invalid.
     158
     159        /// Initialize the iterator to be invalid.
     160        ///
    116161        Edge(Invalid) { }
     162        /// Equality operator
     163
    117164        /// Two iterators are equal if and only if they point to the
    118165        /// same object or both are invalid.
    119166        bool operator==(Edge) const { return true; }
     167        /// Inequality operator
     168
     169        /// \sa \ref operator==(Node n)
     170        ///
    120171        bool operator!=(Edge) const { return true; }
    121         bool operator<(Edge) const { return true; }
     172        ///Comparison operator.
     173
     174        ///This is a strict ordering between the nodes.
     175        ///
     176        ///This ordering can be different from the order in which NodeIt
     177        ///goes through the nodes.
     178        ///\todo Possibly we don't need it.
     179        bool operator<(Edge) const { return true; }
    122180      };
    123181   
     
    131189      /// \code
    132190      /// int count=0;
    133       /// for (Graph::OutEdgeIt e(g, n); g.valid(e); ++e) ++count;
     191      /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
    134192      /// \endcode
    135193   
    136194      class OutEdgeIt : public Edge {
    137195      public:
     196        /// Default constructor
     197
    138198        /// @warning The default constructor sets the iterator
    139199        /// to an undefined value.
    140200        OutEdgeIt() { }
    141201        /// Copy constructor.
     202
     203        /// Copy constructor.
     204        ///
    142205        OutEdgeIt(const OutEdgeIt&) { }
    143206        /// Initialize the iterator to be invalid.
     207
     208        /// Initialize the iterator to be invalid.
     209        ///
    144210        OutEdgeIt(Invalid) { }
    145211        /// This constructor sets the iterator to first outgoing edge.
     
    150216        ///@param g the graph
    151217        OutEdgeIt(const StaticGraphSkeleton& g, const Node& n) { }
     218        /// Edge -> OutEdgeIt conversion
     219
    152220        /// Sets the iterator to the value of the trivial iterator \c e.
    153221        /// This feature necessitates that each time we
    154222        /// iterate the edge-set, the iteration order is the same.
    155223        OutEdgeIt(const StaticGraphSkeleton& g, const Edge& e) { }
    156         /// Assign the iterator to the next outedge of the corresponding node.
     224        ///Next outgoing edge
     225       
     226        /// Assign the iterator to the next
     227        /// outgoing edge of the corresponding node.
    157228        OutEdgeIt& operator++() { return *this; }
    158229      };
     
    167238      /// \code
    168239      /// int count=0;
    169       /// for(Graph::InEdgeIt e(g, n); g.valid(e); ++) ++count;
     240      /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
    170241      /// \endcode
    171242
    172243      class InEdgeIt : public Edge {
    173244      public:
     245        /// Default constructor
     246
    174247        /// @warning The default constructor sets the iterator
    175248        /// to an undefined value.
    176249        InEdgeIt() { }
    177250        /// Copy constructor.
     251
     252        /// Copy constructor.
     253        ///
    178254        InEdgeIt(const InEdgeIt&) { }
    179255        /// Initialize the iterator to be invalid.
     256
     257        /// Initialize the iterator to be invalid.
     258        ///
    180259        InEdgeIt(Invalid) { }
    181         /// .
    182         InEdgeIt(const StaticGraphSkeleton&, const Node&) { }
    183         /// .
    184         InEdgeIt(const StaticGraphSkeleton&, const Edge&) { }
     260        /// This constructor sets the iterator to first incoming edge.
     261   
     262        /// This constructor set the iterator to the first incoming edge of
     263        /// node
     264        ///@param n the node
     265        ///@param g the graph
     266        InEdgeIt(const StaticGraphSkeleton& g, const Node& n) { }
     267        /// Edge -> InEdgeIt conversion
     268
     269        /// Sets the iterator to the value of the trivial iterator \c e.
     270        /// This feature necessitates that each time we
     271        /// iterate the edge-set, the iteration order is the same.
     272        InEdgeIt(const StaticGraphSkeleton& g, const Edge& n) { }
     273        /// Next incoming edge
     274
    185275        /// Assign the iterator to the next inedge of the corresponding node.
     276        ///
    186277        InEdgeIt& operator++() { return *this; }
    187278      };
    188       //  class SymEdgeIt : public Edge {};
    189 
    190279      /// This iterator goes through each edge.
    191280
     
    195284      /// \code
    196285      /// int count=0;
    197       /// for(Graph::EdgeIt e(g); g.valid(e); ++e) ++count;
     286      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
    198287      /// \endcode
    199288      class EdgeIt : public Edge {
    200289      public:
     290        /// Default constructor
     291
    201292        /// @warning The default constructor sets the iterator
    202293        /// to an undefined value.
    203294        EdgeIt() { }
    204295        /// Copy constructor.
     296
     297        /// Copy constructor.
     298        ///
    205299        EdgeIt(const EdgeIt&) { }
    206300        /// Initialize the iterator to be invalid.
     301
     302        /// Initialize the iterator to be invalid.
     303        ///
    207304        EdgeIt(Invalid) { }
    208         /// .
    209         EdgeIt(const StaticGraphSkeleton&) { }
    210         /// .
     305        /// This constructor sets the iterator to first edge.
     306   
     307        /// This constructor set the iterator to the first edge of
     308        /// node
     309        ///@param g the graph
     310        EdgeIt(const StaticGraphSkeleton& g) { }
     311        /// Edge -> EdgeIt conversion
     312
     313        /// Sets the iterator to the value of the trivial iterator \c e.
     314        /// This feature necessitates that each time we
     315        /// iterate the edge-set, the iteration order is the same.
    211316        EdgeIt(const StaticGraphSkeleton&, const Edge&) { }
     317        ///Next edge
     318       
     319        /// Assign the iterator to the next
     320        /// edge of the corresponding node.
    212321        EdgeIt& operator++() { return *this; }
    213322      };
     
    221330
    222331      /// The first incoming edge.
     332
     333      /// The first incoming edge.
     334      ///
    223335      InEdgeIt& first(InEdgeIt &i, Node) const { return i; }
    224336      /// The first outgoing edge.
     337
     338      /// The first outgoing edge.
     339      ///
    225340      OutEdgeIt& first(OutEdgeIt& i, Node) const { return i; }
    226       //  SymEdgeIt& first(SymEdgeIt&, Node) const { return i; }
    227341      /// The first edge of the Graph.
     342
     343      /// The first edge of the Graph.
     344      ///
    228345      EdgeIt& first(EdgeIt& i) const { return i; }
    229346
    230       //     Node getNext(Node) const {}
    231       //     InEdgeIt getNext(InEdgeIt) const {}
    232       //     OutEdgeIt getNext(OutEdgeIt) const {}
    233       //     //SymEdgeIt getNext(SymEdgeIt) const {}
    234       //     EdgeIt getNext(EdgeIt) const {}
    235 
    236       /// Go to the next node.
    237       NodeIt& next(NodeIt& i) const { return i; }
    238       /// Go to the next incoming edge.
    239       InEdgeIt& next(InEdgeIt& i) const { return i; }
    240       /// Go to the next outgoing edge.
    241       OutEdgeIt& next(OutEdgeIt& i) const { return i; }
    242       //SymEdgeIt& next(SymEdgeIt&) const { }
    243       /// Go to the next edge.
    244       EdgeIt& next(EdgeIt& i) const { return i; }
    245 
    246347      ///Gives back the head node of an edge.
     348
     349      ///Gives back the head node of an edge.
     350      ///
    247351      Node head(Edge) const { return INVALID; }
    248352      ///Gives back the tail node of an edge.
     353
     354      ///Gives back the tail node of an edge.
     355      ///
    249356      Node tail(Edge) const { return INVALID; }
    250357 
    251       //   Node aNode(InEdgeIt) const {}
    252       //   Node aNode(OutEdgeIt) const {}
    253       //   Node aNode(SymEdgeIt) const {}
    254 
    255       //   Node bNode(InEdgeIt) const {}
    256       //   Node bNode(OutEdgeIt) const {}
    257       //   Node bNode(SymEdgeIt) const {}
    258 
    259       /// Checks if a node iterator is valid
    260 
    261       ///\todo Maybe, it would be better if iterator converted to
    262       ///bool directly, as Jacint prefers.
    263       bool valid(const Node&) const { return true; }
    264       /// Checks if an edge iterator is valid
    265 
    266       ///\todo Maybe, it would be better if iterator converted to
    267       ///bool directly, as Jacint prefers.
    268       bool valid(const Edge&) const { return true; }
    269 
    270358      ///Gives back the \e id of a node.
    271359
    272360      ///\warning Not all graph structures provide this feature.
    273361      ///
     362      ///\todo Should each graph provide \c id?
    274363      int id(const Node&) const { return 0; }
    275364      ///Gives back the \e id of an edge.
     
    277366      ///\warning Not all graph structures provide this feature.
    278367      ///
     368      ///\todo Should each graph provide \c id?
    279369      int id(const Edge&) const { return 0; }
    280370
    281       /// Resets the graph.
    282 
    283       /// This function deletes all edges and nodes of the graph.
    284       /// It also frees the memory allocated to store them.
    285       void clear() { }
    286 
     371      /// .
     372     
     373      ///\todo What is this?
     374      ///
    287375      int nodeNum() const { return 0; }
     376      /// .
     377      ///\todo What is this?
     378      ///
    288379      int edgeNum() const { return 0; }
    289380
     
    294385      /// \sa ReferenceSkeleton
    295386      /// \warning Making maps that can handle bool type (NodeMap<bool>)
    296       /// needs extra attention!
    297 
    298       template<class T> class NodeMap
    299         : public ReferenceMap< Node, T >
     387      /// needs some extra attention!
     388      template<class T> class NodeMap: public ReferenceMap< Node, T >
    300389      {
    301390      public:
    302391
     392        /// .
    303393        NodeMap(const StaticGraphSkeleton&) { }
     394        /// .
    304395        NodeMap(const StaticGraphSkeleton&, T) { }
    305396
     
    316407      /// \sa ReferenceSkeleton
    317408      /// \warning Making maps that can handle bool type (EdgeMap<bool>)
    318       /// needs extra attention!
     409      /// needs some extra attention!
    319410      template<class T> class EdgeMap
    320411        : public ReferenceMap<Edge,T>
    321412      {
    322413      public:
    323         typedef T ValueType;
    324         typedef Edge KeyType;
    325 
     414
     415        /// .
    326416        EdgeMap(const StaticGraphSkeleton&) { }
     417        /// .
    327418        EdgeMap(const StaticGraphSkeleton&, T) { }
    328419   
     
    337428
    338429 
    339     /// An empty graph class.
     430    /// An empty non-static graph class.
    340431
    341432    /// This class provides everything that \c StaticGraphSkeleton
     
    346437    public:
    347438      /// Defalult constructor.
     439
     440      /// Defalult constructor.
     441      ///
    348442      GraphSkeleton() { }
    349       ///Copy consructor.
    350 
    351       ///\todo It is not clear, what we expect from a copy constructor.
    352       ///E.g. How to assign the nodes/edges to each other? What about maps?
    353       GraphSkeleton(const GraphSkeleton&) { }
    354 
    355443      ///Add a new node to the graph.
    356444
     
    380468    {
    381469    public:
     470      /// Defalult constructor.
     471
     472      /// Defalult constructor.
     473      ///
     474      EraseableGraphSkeleton() { }
    382475      /// Deletes a node.
     476
     477      /// Deletes node \c n node.
     478      ///
    383479      void erase(Node n) { }
    384480      /// Deletes an edge.
     481
     482      /// Deletes edge \c e edge.
     483      ///
    385484      void erase(Edge e) { }
    386 
    387       /// Defalult constructor.
    388       EraseableGraphSkeleton() { }
    389       ///Copy consructor.
    390       EraseableGraphSkeleton(const GraphSkeleton&) { }
    391485    };
    392486
    393487    // @}
    394   } //namespace skeleton
    395  
     488  } //namespace skeleton 
    396489} //namespace hugo
    397490
    398491
    399492
    400 // class EmptyBipGraph : public Graph Skeleton
    401 // {
    402 //   class ANode {};
    403 //   class BNode {};
    404 
    405 //   ANode &next(ANode &) {}
    406 //   BNode &next(BNode &) {}
    407 
    408 //   ANode &getFirst(ANode &) const {}
    409 //   BNode &getFirst(BNode &) const {}
    410 
    411 //   enum NodeClass { A = 0, B = 1 };
    412 //   NodeClass getClass(Node n) {}
    413 
    414 // }
    415 
    416493#endif // HUGO_SKELETON_GRAPH_H
Note: See TracChangeset for help on using the changeset viewer.