Changeset 182:c59e450712d8 in lemon-0.x for src/work/alpar
- Timestamp:
- 03/13/04 23:40:36 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@258
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/alpar/emptygraph.h
r179 r182 8 8 namespace hugo { 9 9 10 // @defgroup empty_graph The EmptyGraphclass10 // @defgroup empty_graph The GraphSkeleton class 11 11 // @{ 12 12 … … 26 26 /// like @ref ListGraph or 27 27 /// @ref SmartGraph will just refer to this structure. 28 class EmptyGraph28 class GraphSkeleton 29 29 { 30 30 public: 31 31 32 32 /// 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. 33 36 class Node { 34 37 public: … … 36 39 /// to an undefined value. 37 40 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 39 46 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; } 43 58 }; 44 59 … … 49 64 /// to an undefined value. 50 65 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. 52 70 NodeIt(Invalid) {} 53 71 /// 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 &) {} 56 76 }; 57 77 … … 65 85 /// Initialize the iterator to be invalid 66 86 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; } 70 92 }; 71 93 … … 85 107 ///@param n the node 86 108 ///@param G the graph 87 OutEdgeIt(const EmptyGraph& G, Node n) {}109 OutEdgeIt(const GraphSkeleton & G, Node n) {} 88 110 }; 89 111 … … 95 117 /// Initialize the iterator to be invalid 96 118 InEdgeIt(Invalid) {} 97 InEdgeIt(const EmptyGraph&, Node) {}119 InEdgeIt(const GraphSkeleton &, Node) {} 98 120 }; 99 121 // class SymEdgeIt : public Edge {}; … … 105 127 /// Initialize the iterator to be invalid 106 128 EdgeIt(Invalid) {} 107 EdgeIt(const EmptyGraph&) {}129 EdgeIt(const GraphSkeleton &) {} 108 130 }; 109 131 … … 157 179 158 180 ///Gives back the \e id of a node. 181 182 ///\warning Not all graph structure provide this feature. 183 /// 159 184 int id(const Node) const { return 0;} 160 185 ///Gives back the \e id of an edge. 186 187 ///\warning Not all graph structure provide this feature. 188 /// 161 189 int id(const Edge) const { return 0;} 162 190 … … 164 192 //void setInvalid(Edge &) const {}; 165 193 194 ///Add a new node to the graph. 195 196 /// \return the new node. 166 197 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. 167 203 Edge addEdge(Node tail, Node head) { return INVALID;} 168 204 205 /// Deletes a node. 206 207 ///\warning Not all graph structure provide this feature. 208 /// 169 209 void erase(Node n) {} 210 /// Deletes an edge. 211 212 ///\warning Not all graph structure provide this feature. 213 /// 170 214 void erase(Edge e) {} 171 215 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. 172 220 void clear() {} 173 221 … … 175 223 int edgeNum() const { return 0;} 176 224 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 183 236 template<class T> class NodeMap 184 237 { … … 187 240 typedef Node KeyType; 188 241 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 /// 192 251 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 /// 197 261 void update() {} 198 262 void update(T a) {} //FIXME: Is it necessary 199 263 }; 200 264 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. 202 269 template<class T> class EdgeMap 203 270 { … … 206 273 typedef Edge KeyType; 207 274 208 EdgeMap(const EmptyGraph&G) {}209 EdgeMap(const EmptyGraph&G, T t) {}275 EdgeMap(const GraphSkeleton &G) {} 276 EdgeMap(const GraphSkeleton &G, T t) {} 210 277 211 278 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;} 214 281 215 282 void update() {} … … 224 291 225 292 226 // class EmptyBipGraph : public EmptyGraph293 // class EmptyBipGraph : public Graph Skeleton 227 294 // { 228 295 // class ANode {};
Note: See TracChangeset
for help on using the changeset viewer.