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.
22 /// Also, you will find here the full documentation of a certain graph
23 /// feature, the documentation of a real graph imlementation
24 /// like @ref ListGraph or
25 /// @ref SmartGraph will just refer to this structure.
30 /// The base type of the node iterators.
33 /// @warning The default constructor sets the iterator
34 /// to an undefined value.
36 /// Initialize the iterator to be invalid
38 //Node(const Node &) {}
39 bool operator==(Node n) const { return true; } //FIXME
40 bool operator!=(Node n) const { return true; } //FIXME
43 /// This iterator goes through each node.
44 class NodeIt : public Node {
46 /// @warning The default constructor sets the iterator
47 /// to an undefined value.
49 /// Initialize the iterator to be invalid
51 /// Sets the iterator to the first node of \c G.
52 NodeIt(const EmptyGraph &G) {}
53 NodeIt(const NodeIt &) {} //FIXME
57 /// The base type of the edge iterators.
60 /// @warning The default constructor sets the iterator
61 /// to an undefined value.
63 /// Initialize the iterator to be invalid
65 //Edge(const Edge &) {}
66 bool operator==(Edge n) const { return true; } //FIXME
67 bool operator!=(Edge n) const { return true; } //FIXME
70 /// This iterator goes trought the outgoing edges of a certain graph.
72 class OutEdgeIt : public Edge {
74 /// @warning The default constructor sets the iterator
75 /// to an undefined value.
77 /// Initialize the iterator to be invalid
78 OutEdgeIt(Invalid) {};
79 /// This constructor sets the iterator to first outgoing edge.
81 /// This constructor set the iterator to the first outgoing edge of
85 OutEdgeIt(const EmptyGraph & G, Node n) {}
88 class InEdgeIt : public Edge {
90 /// @warning The default constructor sets the iterator
91 /// to an undefined value.
93 /// Initialize the iterator to be invalid
95 InEdgeIt(const EmptyGraph &, Node) {}
97 // class SymEdgeIt : public Edge {};
98 class EdgeIt : public Edge {
100 /// @warning The default constructor sets the iterator
101 /// to an undefined value.
103 /// Initialize the iterator to be invalid
105 EdgeIt(const EmptyGraph &) {}
108 /// First node of the graph.
110 /// \post \c i and the return value will be the first node.
112 NodeIt &first(NodeIt &i) const { return i;}
114 /// The first outgoing edge.
115 InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
116 /// The first incoming edge.
117 OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
118 // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
119 /// The first edge of the Graph.
120 EdgeIt &first(EdgeIt &i) const { return i;}
122 // Node getNext(Node) const {}
123 // InEdgeIt getNext(InEdgeIt) const {}
124 // OutEdgeIt getNext(OutEdgeIt) const {}
125 // //SymEdgeIt getNext(SymEdgeIt) const {}
126 // EdgeIt getNext(EdgeIt) const {}
128 /// Go to the next node.
129 Node &next(Node &i) const { return i;}
130 /// Go to the next incoming edge.
131 InEdgeIt &next(InEdgeIt &i) const { return i;}
132 /// Go to the next outgoing edge.
133 OutEdgeIt &next(OutEdgeIt &i) const { return i;}
134 //SymEdgeIt &next(SymEdgeIt &) const {}
135 /// Go to the next edge.
136 EdgeIt &next(EdgeIt &i) const { return i;}
138 ///Gives back the head node of an edge.
139 Node head(Edge) const { return INVALID; }
140 ///Gives back the tail node of an edge.
141 Node tail(Edge) const { return INVALID; }
143 // Node aNode(InEdgeIt) const {}
144 // Node aNode(OutEdgeIt) const {}
145 // Node aNode(SymEdgeIt) const {}
147 // Node bNode(InEdgeIt) const {}
148 // Node bNode(OutEdgeIt) const {}
149 // Node bNode(SymEdgeIt) const {}
151 /// Checks if a node iterator is valid
152 bool valid(const Node) const { return true;};
153 /// Checks if an edge iterator is valid
154 bool valid(const Edge) const { return true;};
156 ///Gives back the \e id of a node.
157 int id(const Node) const { return 0;};
158 ///Gives back the \e id of an edge.
159 int id(const Edge) const { return 0;};
161 //void setInvalid(Node &) const {};
162 //void setInvalid(Edge &) const {};
164 Node addNode() { return INVALID;}
165 Edge addEdge(Node tail, Node head) { return INVALID;}
167 void erase(Node n) {}
168 void erase(Edge e) {}
172 int nodeNum() { return 0;}
173 int edgeNum() { return 0;}
176 EmptyGraph(const EmptyGraph &G) {};
180 ///Read/write map from the nodes to type \c T.
181 template<class T> class NodeMap
185 typedef Node KeyType;
187 NodeMap(const EmptyGraph &G) {}
188 NodeMap(const EmptyGraph &G, T t) {}
190 void set(Node i, T t) {}
191 T get(Node i) const {return *(T*)NULL;} //FIXME: Is it necessary
192 T &operator[](Node i) {return *(T*)NULL;}
193 const T &operator[](Node i) const {return *(T*)NULL;}
196 void update(T a) {} //FIXME: Is it necessary
199 ///Read/write map from the edges to type \c T.
200 template<class T> class EdgeMap
204 typedef Edge KeyType;
206 EdgeMap(const EmptyGraph &G) {}
207 EdgeMap(const EmptyGraph &G, T t) {}
209 void set(Edge i, T t) {}
210 T get(Edge i) const {return *(T*)NULL;}
211 T &operator[](Edge i) {return *(T*)NULL;}
214 void update(T a) {} //FIXME: Is it necessary
224 // class EmptyBipGraph : public EmptyGraph
229 // ANode &next(ANode &) {}
230 // BNode &next(BNode &) {}
232 // ANode &getFirst(ANode &) const {}
233 // BNode &getFirst(BNode &) const {}
235 // enum NodeClass { A = 0, B = 1 };
236 // NodeClass getClass(Node n) {}