COIN-OR::LEMON - Graph Library

Changeset 182:c59e450712d8 in lemon-0.x for src/work/alpar


Ignore:
Timestamp:
03/13/04 23:40:36 (21 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@258
Message:

More comments, bug fixes, and copy constructors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/alpar/emptygraph.h

    r179 r182  
    88namespace hugo {
    99
    10   // @defgroup empty_graph The EmptyGraph class
     10  // @defgroup empty_graph The GraphSkeleton class
    1111  // @{
    1212
     
    2626  /// like @ref ListGraph or
    2727  /// @ref SmartGraph will just refer to this structure.
    28   class EmptyGraph
     28  class GraphSkeleton
    2929  {
    3030  public:
    3131   
    3232    /// The base type of the node iterators.
     33
     34    /// This \c Node is the base type of each node iterators,
     35    /// thus each kind of node iterator will convert to this.
    3336    class Node {
    3437    public:
     
    3639      /// to an undefined value.
    3740      Node() {}   //FIXME
    38       /// Initialize the iterator to be invalid
     41      /// Invalid constructor \& conversion.
     42
     43      /// This constructor initializes the iterator to be invalid.
     44      /// \sa Invalid for more details.
     45
    3946      Node(Invalid) {}
    40       //Node(const Node &) {}
    41       bool operator==(Node n) const { return true; } //FIXME
    42       bool operator!=(Node n) const { return true; } //FIXME
     47      //Node(const Node &) {}
     48
     49      /// Two iterators are equal if and only if they point to the
     50      /// same object or both are invalid.
     51      bool operator==(Node n) const { return true; }
     52
     53      /// \sa \ref operator==(Node n)
     54      ///
     55      bool operator!=(Node n) const { return true; }
     56
     57      bool operator<(Node n) const { return true; }
    4358    };
    4459   
     
    4964      /// to an undefined value.
    5065      NodeIt() {} //FIXME
    51       /// Initialize the iterator to be invalid
     66      /// Invalid constructor \& conversion.
     67
     68      /// Initialize the iterator to be invalid
     69      /// \sa Invalid for more details.
    5270      NodeIt(Invalid) {}
    5371      /// Sets the iterator to the first node of \c G.
    54       NodeIt(const EmptyGraph &G) {}
    55       NodeIt(const NodeIt &) {} //FIXME
     72      NodeIt(const GraphSkeleton &G) {}
     73      /// @warning The default constructor sets the iterator
     74      /// to an undefined value.
     75      NodeIt(const NodeIt &) {}
    5676    };
    5777   
     
    6585      /// Initialize the iterator to be invalid
    6686      Edge(Invalid) {}
    67       //Edge(const Edge &) {}
    68       bool operator==(Edge n) const { return true; } //FIXME
    69       bool operator!=(Edge n) const { return true; } //FIXME   
     87      /// Two iterators are equal if and only if they point to the
     88      /// same object or both are invalid.
     89      bool operator==(Edge n) const { return true; }
     90      bool operator!=(Edge n) const { return true; }
     91      bool operator<(Edge n) const { return true; }
    7092    };
    7193   
     
    85107      ///@param n the node
    86108      ///@param G the graph
    87       OutEdgeIt(const EmptyGraph & G, Node n) {}
     109      OutEdgeIt(const GraphSkeleton & G, Node n) {}
    88110    };
    89111
     
    95117      /// Initialize the iterator to be invalid
    96118      InEdgeIt(Invalid) {}
    97       InEdgeIt(const EmptyGraph &, Node) {}   
     119      InEdgeIt(const GraphSkeleton &, Node) {}   
    98120    };
    99121    //  class SymEdgeIt : public Edge {};
     
    105127      /// Initialize the iterator to be invalid
    106128      EdgeIt(Invalid) {}
    107       EdgeIt(const EmptyGraph &) {}
     129      EdgeIt(const GraphSkeleton &) {}
    108130    };
    109131
     
    157179
    158180    ///Gives back the \e id of a node.
     181
     182    ///\warning Not all graph structure provide this feature.
     183    ///
    159184    int id(const Node) const { return 0;}
    160185    ///Gives back the \e id of an edge.
     186
     187    ///\warning Not all graph structure provide this feature.
     188    ///
    161189    int id(const Edge) const { return 0;}
    162190
     
    164192    //void setInvalid(Edge &) const {};
    165193 
     194    ///Add a new node to the graph.
     195
     196    /// \return the new node.
    166197    Node addNode() { return INVALID;}
     198    ///Add a new edge to the graph.
     199
     200    ///Add a new edge to the graph with tail node \c tail
     201    ///and head node \c head.
     202    ///\return the new edge.
    167203    Edge addEdge(Node tail, Node head) { return INVALID;}
    168204   
     205    /// Deletes a node.
     206   
     207    ///\warning Not all graph structure provide this feature.
     208    ///
    169209    void erase(Node n) {}
     210    /// Deletes an edge.
     211
     212    ///\warning Not all graph structure provide this feature.
     213    ///
    170214    void erase(Edge e) {}
    171215
     216    /// Reset the graph.
     217
     218    /// This function deletes all edges and nodes of the graph.
     219    /// It also frees the memory allocated to store them.
    172220    void clear() {}
    173221
     
    175223    int edgeNum() const { return 0;}
    176224
    177     EmptyGraph() {}
    178     EmptyGraph(const EmptyGraph &G) {}
    179  
    180  
    181 
    182     ///Read/write map from the nodes to type \c T.
     225    GraphSkeleton() {}
     226    GraphSkeleton(const GraphSkeleton &G) {}
     227 
     228 
     229
     230    ///Read/write map of the nodes to type \c T.
     231
     232    /// \todo We may need copy constructor
     233    /// \todo We may need conversion from other nodetype
     234    /// \todo We may need operator=
     235
    183236    template<class T> class NodeMap
    184237    {
     
    187240      typedef Node KeyType;
    188241
    189       NodeMap(const EmptyGraph &G) {}
    190       NodeMap(const EmptyGraph &G, T t) {}
    191 
     242      NodeMap(const GraphSkeleton &G) {}
     243      NodeMap(const GraphSkeleton &G, T t) {}
     244
     245      template<typename TT> NodeMap(const NodeMap<TT> &m) {}
     246
     247      /// Sets the value of a node.
     248
     249      /// Sets the value associated with node \c i to the value \c t.
     250      ///
    192251      void set(Node i, T t) {}
    193       T get(Node i) const {return *(T*)NULL;}  //FIXME: Is it necessary
    194       T &operator[](Node i) {return *(T*)NULL;}
    195       const T &operator[](Node i) const {return *(T*)NULL;}
    196 
     252      /// Gets the value of a node.
     253      T get(Node i) const {return *(T*)0;}  //FIXME: Is it necessary
     254      T &operator[](Node i) {return *(T*)0;}
     255      const T &operator[](Node i) const {return *(T*)0;}
     256
     257      /// Updates the map if the graph has been changed
     258
     259      /// \todo Do we need this?
     260      ///
    197261      void update() {}
    198262      void update(T a) {}   //FIXME: Is it necessary
    199263    };
    200264
    201     ///Read/write map from the edges to type \c T.
     265    ///Read/write map of the edges to type \c T.
     266
     267    ///Read/write map of the edges to type \c T.
     268    ///It behaves exactly the same way as \ref NodeMap.
    202269    template<class T> class EdgeMap
    203270    {
     
    206273      typedef Edge KeyType;
    207274
    208       EdgeMap(const EmptyGraph &G) {}
    209       EdgeMap(const EmptyGraph &G, T t) {}
     275      EdgeMap(const GraphSkeleton &G) {}
     276      EdgeMap(const GraphSkeleton &G, T t) {}
    210277   
    211278      void set(Edge i, T t) {}
    212       T get(Edge i) const {return *(T*)NULL;}
    213       T &operator[](Edge i) {return *(T*)NULL;}
     279      T get(Edge i) const {return *(T*)0;}
     280      T &operator[](Edge i) {return *(T*)0;}
    214281   
    215282      void update() {}
     
    224291
    225292
    226 // class EmptyBipGraph : public EmptyGraph
     293// class EmptyBipGraph : public Graph Skeleton
    227294// {
    228295//   class ANode {};
Note: See TracChangeset for help on using the changeset viewer.