7 /// The namespace of HugoLib
10 // @defgroup empty_graph The GraphSkeleton class
13 /// An empty graph class.
15 /// This class provides all the common features of a grapf structure,
16 /// however completely without implementations or real data structures
17 /// behind the interface.
18 /// All graph algorithms should compile with this class, but it will not
19 /// run properly, of course.
21 /// It can be used for checking the interface compatibility,
22 /// or it can serve as a skeleton of a new graph structure.
24 /// Also, you will find here the full documentation of a certain graph
25 /// feature, the documentation of a real graph imlementation
26 /// like @ref ListGraph or
27 /// @ref SmartGraph will just refer to this structure.
32 /// The base type of the node iterators.
34 /// This \c Node is the base type of each node iterators,
35 /// thus each kind of node iterator will convert to this.
38 /// @warning The default constructor sets the iterator
39 /// to an undefined value.
41 /// Invalid constructor \& conversion.
43 /// This constructor initializes the iterator to be invalid.
44 /// \sa Invalid for more details.
47 //Node(const Node &) {}
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; }
53 /// \sa \ref operator==(Node n)
55 bool operator!=(Node n) const { return true; }
57 bool operator<(Node n) const { return true; }
60 /// This iterator goes through each node.
61 class NodeIt : public Node {
63 /// @warning The default constructor sets the iterator
64 /// to an undefined value.
66 /// Invalid constructor \& conversion.
68 /// Initialize the iterator to be invalid
69 /// \sa Invalid for more details.
71 /// Sets the iterator to the first node of \c G.
72 NodeIt(const GraphSkeleton &G) {}
73 /// @warning The default constructor sets the iterator
74 /// to an undefined value.
75 NodeIt(const NodeIt &) {}
79 /// The base type of the edge iterators.
82 /// @warning The default constructor sets the iterator
83 /// to an undefined value.
85 /// Initialize the iterator to be invalid
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; }
94 /// This iterator goes trought the outgoing edges of a certain graph.
96 class OutEdgeIt : public Edge {
98 /// @warning The default constructor sets the iterator
99 /// to an undefined value.
101 /// Initialize the iterator to be invalid
102 OutEdgeIt(Invalid) {}
103 /// This constructor sets the iterator to first outgoing edge.
105 /// This constructor set the iterator to the first outgoing edge of
108 ///@param G the graph
109 OutEdgeIt(const GraphSkeleton & G, Node n) {}
112 class InEdgeIt : public Edge {
114 /// @warning The default constructor sets the iterator
115 /// to an undefined value.
117 /// Initialize the iterator to be invalid
119 InEdgeIt(const GraphSkeleton &, Node) {}
121 // class SymEdgeIt : public Edge {};
122 class EdgeIt : public Edge {
124 /// @warning The default constructor sets the iterator
125 /// to an undefined value.
127 /// Initialize the iterator to be invalid
129 EdgeIt(const GraphSkeleton &) {}
132 /// First node of the graph.
134 /// \post \c i and the return value will be the first node.
136 NodeIt &first(NodeIt &i) const { return i;}
138 /// The first outgoing edge.
139 InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
140 /// The first incoming edge.
141 OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
142 // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
143 /// The first edge of the Graph.
144 EdgeIt &first(EdgeIt &i) const { return i;}
146 // Node getNext(Node) const {}
147 // InEdgeIt getNext(InEdgeIt) const {}
148 // OutEdgeIt getNext(OutEdgeIt) const {}
149 // //SymEdgeIt getNext(SymEdgeIt) const {}
150 // EdgeIt getNext(EdgeIt) const {}
152 /// Go to the next node.
153 NodeIt &next(NodeIt &i) const { return i;}
154 /// Go to the next incoming edge.
155 InEdgeIt &next(InEdgeIt &i) const { return i;}
156 /// Go to the next outgoing edge.
157 OutEdgeIt &next(OutEdgeIt &i) const { return i;}
158 //SymEdgeIt &next(SymEdgeIt &) const {}
159 /// Go to the next edge.
160 EdgeIt &next(EdgeIt &i) const { return i;}
162 ///Gives back the head node of an edge.
163 Node head(Edge) const { return INVALID; }
164 ///Gives back the tail node of an edge.
165 Node tail(Edge) const { return INVALID; }
167 // Node aNode(InEdgeIt) const {}
168 // Node aNode(OutEdgeIt) const {}
169 // Node aNode(SymEdgeIt) const {}
171 // Node bNode(InEdgeIt) const {}
172 // Node bNode(OutEdgeIt) const {}
173 // Node bNode(SymEdgeIt) const {}
175 /// Checks if a node iterator is valid
176 bool valid(const Node) const { return true;}
177 /// Checks if an edge iterator is valid
178 bool valid(const Edge) const { return true;}
180 ///Gives back the \e id of a node.
182 ///\warning Not all graph structure provide this feature.
184 int id(const Node) const { return 0;}
185 ///Gives back the \e id of an edge.
187 ///\warning Not all graph structure provide this feature.
189 int id(const Edge) const { return 0;}
191 //void setInvalid(Node &) const {};
192 //void setInvalid(Edge &) const {};
194 ///Add a new node to the graph.
196 /// \return the new node.
197 Node addNode() { return INVALID;}
198 ///Add a new edge to the graph.
200 ///Add a new edge to the graph with tail node \c tail
201 ///and head node \c head.
202 ///\return the new edge.
203 Edge addEdge(Node tail, Node head) { return INVALID;}
207 ///\warning Not all graph structure provide this feature.
209 void erase(Node n) {}
212 ///\warning Not all graph structure provide this feature.
214 void erase(Edge e) {}
218 /// This function deletes all edges and nodes of the graph.
219 /// It also frees the memory allocated to store them.
222 int nodeNum() const { return 0;}
223 int edgeNum() const { return 0;}
226 GraphSkeleton(const GraphSkeleton &G) {}
230 ///Read/write map of the nodes to type \c T.
232 /// \todo We may need copy constructor
233 /// \todo We may need conversion from other nodetype
234 /// \todo We may need operator=
236 template<class T> class NodeMap
240 typedef Node KeyType;
242 NodeMap(const GraphSkeleton &G) {}
243 NodeMap(const GraphSkeleton &G, T t) {}
245 template<typename TT> NodeMap(const NodeMap<TT> &m) {}
247 /// Sets the value of a node.
249 /// Sets the value associated with node \c i to the value \c t.
251 void set(Node i, T t) {}
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;}
257 /// Updates the map if the graph has been changed
259 /// \todo Do we need this?
262 void update(T a) {} //FIXME: Is it necessary
265 ///Read/write map of the edges to type \c T.
267 ///Read/write map of the edges to type \c T.
268 ///It behaves exactly the same way as \ref NodeMap.
269 template<class T> class EdgeMap
273 typedef Edge KeyType;
275 EdgeMap(const GraphSkeleton &G) {}
276 EdgeMap(const GraphSkeleton &G, T t) {}
278 void set(Edge i, T t) {}
279 T get(Edge i) const {return *(T*)0;}
280 T &operator[](Edge i) {return *(T*)0;}
283 void update(T a) {} //FIXME: Is it necessary
293 // class EmptyBipGraph : public Graph Skeleton
298 // ANode &next(ANode &) {}
299 // BNode &next(BNode &) {}
301 // ANode &getFirst(ANode &) const {}
302 // BNode &getFirst(BNode &) const {}
304 // enum NodeClass { A = 0, B = 1 };
305 // NodeClass getClass(Node n) {}
309 #endif // EMPTYGRAPH_H