Marci's changes accepted.
7 /// The namespace of HugoLib
10 // @defgroup empty_graph The EmptyGraph 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.
35 /// @warning The default constructor sets the iterator
36 /// to an undefined value.
38 /// Initialize the iterator to be invalid
40 //Node(const Node &) {}
41 bool operator==(Node n) const { return true; } //FIXME
42 bool operator!=(Node n) const { return true; } //FIXME
45 /// This iterator goes through each node.
46 class NodeIt : public Node {
48 /// @warning The default constructor sets the iterator
49 /// to an undefined value.
51 /// Initialize the iterator to be invalid
53 /// Sets the iterator to the first node of \c G.
54 NodeIt(const EmptyGraph &G) {}
55 NodeIt(const NodeIt &) {} //FIXME
59 /// The base type of the edge iterators.
62 /// @warning The default constructor sets the iterator
63 /// to an undefined value.
65 /// Initialize the iterator to be invalid
67 //Edge(const Edge &) {}
68 bool operator==(Edge n) const { return true; } //FIXME
69 bool operator!=(Edge n) const { return true; } //FIXME
72 /// This iterator goes trought the outgoing edges of a certain graph.
74 class OutEdgeIt : public Edge {
76 /// @warning The default constructor sets the iterator
77 /// to an undefined value.
79 /// Initialize the iterator to be invalid
81 /// This constructor sets the iterator to first outgoing edge.
83 /// This constructor set the iterator to the first outgoing edge of
87 OutEdgeIt(const EmptyGraph & G, Node n) {}
90 class InEdgeIt : public Edge {
92 /// @warning The default constructor sets the iterator
93 /// to an undefined value.
95 /// Initialize the iterator to be invalid
97 InEdgeIt(const EmptyGraph &, Node) {}
99 // class SymEdgeIt : public Edge {};
100 class EdgeIt : public Edge {
102 /// @warning The default constructor sets the iterator
103 /// to an undefined value.
105 /// Initialize the iterator to be invalid
107 EdgeIt(const EmptyGraph &) {}
110 /// First node of the graph.
112 /// \post \c i and the return value will be the first node.
114 NodeIt &first(NodeIt &i) const { return i;}
116 /// The first outgoing edge.
117 InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
118 /// The first incoming edge.
119 OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
120 // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
121 /// The first edge of the Graph.
122 EdgeIt &first(EdgeIt &i) const { return i;}
124 // Node getNext(Node) const {}
125 // InEdgeIt getNext(InEdgeIt) const {}
126 // OutEdgeIt getNext(OutEdgeIt) const {}
127 // //SymEdgeIt getNext(SymEdgeIt) const {}
128 // EdgeIt getNext(EdgeIt) const {}
130 /// Go to the next node.
131 Node &next(Node &i) const { return i;}
132 /// Go to the next incoming edge.
133 InEdgeIt &next(InEdgeIt &i) const { return i;}
134 /// Go to the next outgoing edge.
135 OutEdgeIt &next(OutEdgeIt &i) const { return i;}
136 //SymEdgeIt &next(SymEdgeIt &) const {}
137 /// Go to the next edge.
138 EdgeIt &next(EdgeIt &i) const { return i;}
140 ///Gives back the head node of an edge.
141 Node head(Edge) const { return INVALID; }
142 ///Gives back the tail node of an edge.
143 Node tail(Edge) const { return INVALID; }
145 // Node aNode(InEdgeIt) const {}
146 // Node aNode(OutEdgeIt) const {}
147 // Node aNode(SymEdgeIt) const {}
149 // Node bNode(InEdgeIt) const {}
150 // Node bNode(OutEdgeIt) const {}
151 // Node bNode(SymEdgeIt) const {}
153 /// Checks if a node iterator is valid
154 bool valid(const Node) const { return true;}
155 /// Checks if an edge iterator is valid
156 bool valid(const Edge) const { return true;}
158 ///Gives back the \e id of a node.
159 int id(const Node) const { return 0;}
160 ///Gives back the \e id of an edge.
161 int id(const Edge) const { return 0;}
163 //void setInvalid(Node &) const {};
164 //void setInvalid(Edge &) const {};
166 Node addNode() { return INVALID;}
167 Edge addEdge(Node tail, Node head) { return INVALID;}
169 void erase(Node n) {}
170 void erase(Edge e) {}
174 int nodeNum() { return 0;}
175 int edgeNum() { return 0;}
178 EmptyGraph(const EmptyGraph &G) {}
182 ///Read/write map from the nodes to type \c T.
183 template<class T> class NodeMap
187 typedef Node KeyType;
189 NodeMap(const EmptyGraph &G) {}
190 NodeMap(const EmptyGraph &G, T t) {}
192 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;}
198 void update(T a) {} //FIXME: Is it necessary
201 ///Read/write map from the edges to type \c T.
202 template<class T> class EdgeMap
206 typedef Edge KeyType;
208 EdgeMap(const EmptyGraph &G) {}
209 EdgeMap(const EmptyGraph &G, T t) {}
211 void set(Edge i, T t) {}
212 T get(Edge i) const {return *(T*)NULL;}
213 T &operator[](Edge i) {return *(T*)NULL;}
216 void update(T a) {} //FIXME: Is it necessary
226 // class EmptyBipGraph : public EmptyGraph
231 // ANode &next(ANode &) {}
232 // BNode &next(BNode &) {}
234 // ANode &getFirst(ANode &) const {}
235 // BNode &getFirst(BNode &) const {}
237 // enum NodeClass { A = 0, B = 1 };
238 // NodeClass getClass(Node n) {}
242 #endif // EMPTYGRAPH_H