5 /// The namespace of HugoLib
8 // @defgroup empty_graph The EmptyGraph class
11 /// An empty graph class.
13 /// This class provides all the common features of a grapf structure,
14 /// however completely without implementations or real data structures
15 /// behind the interface.
16 /// All graph algorithms should compile with this class, but it will not
17 /// run properly, of course.
19 /// It can be used for checking the interface compatibility,
20 /// or it can serve as a skeleton of a new graph structure.
26 /// The base type of the node iterators.
29 /// @warning The default constructor sets the iterator
30 /// to an undefined value.
32 /// Initialize the iterator to be invalid
34 //Node(const Node &) {}
35 bool operator==(Node n) const { return true; } //FIXME
36 bool operator!=(Node n) const { return true; } //FIXME
39 /// This iterator goes through each node.
40 class NodeIt : public Node {
42 /// @warning The default constructor sets the iterator
43 /// to an undefined value.
45 /// Initialize the iterator to be invalid
47 /// Sets the iterator to the first node of \c G.
48 NodeIt(const EmptyGraph &G) {}
49 NodeIt(const NodeIt &) {} //FIXME
53 /// The base type of the edge iterators.
56 /// @warning The default constructor sets the iterator
57 /// to an undefined value.
59 /// Initialize the iterator to be invalid
61 //Edge(const Edge &) {}
62 bool operator==(Edge n) const { return true; } //FIXME
63 bool operator!=(Edge n) const { return true; } //FIXME
66 /// This iterator goes trought the outgoing edges of a certain graph.
68 class OutEdgeIt : public Edge {
70 /// @warning The default constructor sets the iterator
71 /// to an undefined value.
73 /// Initialize the iterator to be invalid
74 OutEdgeIt(Invalid) {};
75 /// This constructor sets the iterator to first outgoing edge.
77 /// This constructor set the iterator to the first outgoing edge of
81 OutEdgeIt(const EmptyGraph & G, Node n) {}
84 class InEdgeIt : public Edge {
86 /// @warning The default constructor sets the iterator
87 /// to an undefined value.
89 /// Initialize the iterator to be invalid
91 InEdgeIt(const EmptyGraph &, Node) {}
93 // class SymEdgeIt : public Edge {};
94 class EdgeIt : public Edge {
96 /// @warning The default constructor sets the iterator
97 /// to an undefined value.
99 /// Initialize the iterator to be invalid
101 EdgeIt(const EmptyGraph &) {}
104 /// First node of the graph.
106 /// \post \c i and the return value will be the first node.
108 NodeIt &first(NodeIt &i) const { return i;}
110 /// The first outgoing edge.
111 InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
112 /// The first incoming edge.
113 OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
114 // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
115 /// The first edge of the Graph.
116 EdgeIt &first(EdgeIt &i) const { return i;}
118 // Node getNext(Node) const {}
119 // InEdgeIt getNext(InEdgeIt) const {}
120 // OutEdgeIt getNext(OutEdgeIt) const {}
121 // //SymEdgeIt getNext(SymEdgeIt) const {}
122 // EdgeIt getNext(EdgeIt) const {}
124 /// Go to the next node.
125 Node &next(Node &i) const { return i;}
126 /// Go to the next incoming edge.
127 InEdgeIt &next(InEdgeIt &i) const { return i;}
128 /// Go to the next outgoing edge.
129 OutEdgeIt &next(OutEdgeIt &i) const { return i;}
130 //SymEdgeIt &next(SymEdgeIt &) const {}
131 /// Go to the next edge.
132 EdgeIt &next(EdgeIt &i) const { return i;}
134 ///Gives back the head node of an edge.
135 Node head(Edge) const { return INVALID; }
136 ///Gives back the tail node of an edge.
137 Node tail(Edge) const { return INVALID; }
139 // Node aNode(InEdgeIt) const {}
140 // Node aNode(OutEdgeIt) const {}
141 // Node aNode(SymEdgeIt) const {}
143 // Node bNode(InEdgeIt) const {}
144 // Node bNode(OutEdgeIt) const {}
145 // Node bNode(SymEdgeIt) const {}
147 /// Checks if a node iterator is valid
148 bool valid(const Node) const { return true;};
149 /// Checks if an edge iterator is valid
150 bool valid(const Edge) const { return true;};
152 ///Gives back the \e id of a node.
153 int id(const Node) const { return 0;};
154 ///Gives back the \e id of an edge.
155 int id(const Edge) const { return 0;};
157 //void setInvalid(Node &) const {};
158 //void setInvalid(Edge &) const {};
160 Node addNode() { return INVALID;}
161 Edge addEdge(Node tail, Node head) { return INVALID;}
163 void erase(Node n) {}
164 void erase(Edge e) {}
168 int nodeNum() { return 0;}
169 int edgeNum() { return 0;}
172 EmptyGraph(const EmptyGraph &G) {};
176 ///Read/write map from the nodes to type \c T.
177 template<class T> class NodeMap
181 typedef Node KeyType;
183 NodeMap(const EmptyGraph &G) {}
184 NodeMap(const EmptyGraph &G, T t) {}
186 void set(Node i, T t) {}
187 T get(Node i) const {return *(T*)NULL;} //FIXME: Is it necessary
188 T &operator[](Node i) {return *(T*)NULL;}
189 const T &operator[](Node i) const {return *(T*)NULL;}
192 void update(T a) {} //FIXME: Is it necessary
195 ///Read/write map from the edges to type \c T.
196 template<class T> class EdgeMap
200 typedef Edge KeyType;
202 EdgeMap(const EmptyGraph &G) {}
203 EdgeMap(const EmptyGraph &G, T t) {}
205 void set(Edge i, T t) {}
206 T get(Edge i) const {return *(T*)NULL;}
207 T &operator[](Edge i) {return *(T*)NULL;}
210 void update(T a) {} //FIXME: Is it necessary
220 // class EmptyBipGraph : public EmptyGraph
225 // ANode &next(ANode &) {}
226 // BNode &next(BNode &) {}
228 // ANode &getFirst(ANode &) const {}
229 // BNode &getFirst(BNode &) const {}
231 // enum NodeClass { A = 0, B = 1 };
232 // NodeClass getClass(Node n) {}