[Lemon-commits] [lemon_svn] alpar: r230 - hugo/trunk/src/work/alpar
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:38:15 CET 2006
Author: alpar
Date: Wed Mar 10 17:46:17 2004
New Revision: 230
Modified:
hugo/trunk/src/work/alpar/emptygraph.h
Log:
Emtygraph with the new interface
Modified: hugo/trunk/src/work/alpar/emptygraph.h
==============================================================================
--- hugo/trunk/src/work/alpar/emptygraph.h (original)
+++ hugo/trunk/src/work/alpar/emptygraph.h Wed Mar 10 17:46:17 2004
@@ -1,144 +1,234 @@
// -*-mode: c++; -*-
-class EmptyGraph
-{
-public:
+#include <invalid.h>
- class NodeIt {
- public:
- NodeIt() {} //FIXME
- //NodeIt(const NodeIt &) {}
- bool operator==(NodeIt n) const {} //FIXME
- bool operator!=(NodeIt n) const {} //FIXME
- };
-
- class EachNodeIt : public NodeIt {
- public:
- EachNodeIt() {} //FIXME
- EachNodeIt(const EmptyGraph &) const {}
- EachNodeIt(const EachNodeIt &) const {} //FIXME
- };
-
- class EdgeIt {
- EdgeIt() {} //FIXME
- //EdgeIt(const EdgeIt &) {}
- bool operator==(EdgeIt n) const {} //FIXME
- bool operator!=(EdgeIt n) const {} //FIXME
- };
-
- class OutEdgeIt : public EdgeIt {
- OutEdgeIt() {}
- OutEdgeIt(const EmptyGraph &, NodeIt) {}
- };
+/// The namespace of HugoLib
+namespace hugo {
- class InEdgeIt : public EdgeIt {
- InEdgeIt() {}
- InEdgeIt(const EmptyGraph &, NodeIt) {}
- };
- // class SymEdgeIt : public EdgeIt {};
- class EachEdgeIt : public EdgeIt {
- EachEdgeIt() {}
- EachEdgeIt(const EmptyGraph &) {}
- };
-
- EachNodeIt &getFirst(EachNodeIt &) const {}
- InEdgeIt &getFirst(InEdgeIt &, NodeIt) const {}
- OutEdgeIt &getFirst(OutEdgeIt &, NodeIt) const {}
- // SymEdgeIt &getFirst(SymEdgeIt &, NodeIt) const {}
- EachEdgeIt &getFirst(EachEdgeIt &) const {}
-
- NodeIt getNext(NodeIt) const {}
- InEdgeIt getNext(InEdgeIt) const {}
- OutEdgeIt getNext(OutEdgeIt) const {}
- //SymEdgeIt getNext(SymEdgeIt) const {}
- EachEdgeIt getNext(EachEdgeIt) const {}
-
- NodeIt &next(NodeIt &) const {}
- InEdgeIt &next(InEdgeIt &) const {}
- OutEdgeIt &next(OutEdgeIt &) const {}
- //SymEdgeIt &next(SymEdgeIt &) const {}
- EachEdgeIt &next(EachEdgeIt &) const {}
+ // @defgroup empty_graph The EmptyGraph class
+ // @{
- NodeIt head(EdgeIt) const {}
- NodeIt tail(EdgeIt) const {}
+ /// An empty graph class.
-// NodeIt aNode(InEdgeIt) const {}
-// NodeIt aNode(OutEdgeIt) const {}
-// NodeIt aNode(SymEdgeIt) const {}
-
-// NodeIt bNode(InEdgeIt) const {}
-// NodeIt bNode(OutEdgeIt) const {}
-// NodeIt bNode(SymEdgeIt) const {}
+ /// This class provides all the common features of a grapf structure,
+ /// however completely without implementations or real data structures
+ /// behind the interface.
+ /// All graph algorithms should compile with this class, but it will not
+ /// run properly, of course.
+ ///
+ /// It can be used for checking the interface compatibility,
+ /// or it can serve as a skeleton of a new graph structure.
- bool valid(const NodeIt) const {};
- bool valid(const EdgeIt) const {};
-
- int id(const NodeIt) const {};
- int id(const EdgeIt) const {};
+ class EmptyGraph
+ {
+ public:
+
+ /// The base type of the node iterators.
+ class Node {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Node() {} //FIXME
+ /// Initialize the iterator to be invalid
+ Node(Invalid) {};
+ //Node(const Node &) {}
+ bool operator==(Node n) const { return true; } //FIXME
+ bool operator!=(Node n) const { return true; } //FIXME
+ };
+
+ /// This iterator goes through each node.
+ class NodeIt : public Node {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ NodeIt() {} //FIXME
+ /// Initialize the iterator to be invalid
+ NodeIt(Invalid) {};
+ /// Sets the iterator to the first node of \c G.
+ NodeIt(const EmptyGraph &G) {}
+ NodeIt(const NodeIt &) {} //FIXME
+ };
+
+
+ /// The base type of the edge iterators.
+ class Edge {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ Edge() {} //FIXME
+ /// Initialize the iterator to be invalid
+ Edge(Invalid) {};
+ //Edge(const Edge &) {}
+ bool operator==(Edge n) const { return true; } //FIXME
+ bool operator!=(Edge n) const { return true; } //FIXME
+ };
+
+ /// This iterator goes trought the outgoing edges of a certain graph.
+
+ class OutEdgeIt : public Edge {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ OutEdgeIt() {}
+ /// Initialize the iterator to be invalid
+ OutEdgeIt(Invalid) {};
+ /// This constructor sets the iterator to first outgoing edge.
+
+ /// This constructor set the iterator to the first outgoing edge of
+ /// node
+ ///@param n the node
+ ///@param G the graph
+ OutEdgeIt(const EmptyGraph & G, Node n) {}
+ };
+
+ class InEdgeIt : public Edge {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ InEdgeIt() {}
+ /// Initialize the iterator to be invalid
+ InEdgeIt(Invalid) {};
+ InEdgeIt(const EmptyGraph &, Node) {}
+ };
+ // class SymEdgeIt : public Edge {};
+ class EdgeIt : public Edge {
+ public:
+ /// @warning The default constructor sets the iterator
+ /// to an undefined value.
+ EdgeIt() {}
+ /// Initialize the iterator to be invalid
+ EdgeIt(Invalid) {};
+ EdgeIt(const EmptyGraph &) {}
+ };
+
+ /// First node of the graph.
+
+ /// \post \c i and the return value will be the first node.
+ ///
+ NodeIt &first(NodeIt &i) const { return i;}
+
+ /// The first outgoing edge.
+ InEdgeIt &first(InEdgeIt &i, Node n) const { return i;}
+ /// The first incoming edge.
+ OutEdgeIt &first(OutEdgeIt &i, Node n) const { return i;}
+ // SymEdgeIt &first(SymEdgeIt &, Node) const { return i;}
+ /// The first edge of the Graph.
+ EdgeIt &first(EdgeIt &i) const { return i;}
+
+// Node getNext(Node) const {}
+// InEdgeIt getNext(InEdgeIt) const {}
+// OutEdgeIt getNext(OutEdgeIt) const {}
+// //SymEdgeIt getNext(SymEdgeIt) const {}
+// EdgeIt getNext(EdgeIt) const {}
+
+ /// Go to the next node.
+ Node &next(Node &i) const { return i;}
+ /// Go to the next incoming edge.
+ InEdgeIt &next(InEdgeIt &i) const { return i;}
+ /// Go to the next outgoing edge.
+ OutEdgeIt &next(OutEdgeIt &i) const { return i;}
+ //SymEdgeIt &next(SymEdgeIt &) const {}
+ /// Go to the next edge.
+ EdgeIt &next(EdgeIt &i) const { return i;}
+
+ ///Gives back the head node of an edge.
+ Node head(Edge) const { return INVALID; }
+ ///Gives back the tail node of an edge.
+ Node tail(Edge) const { return INVALID; }
+
+ // Node aNode(InEdgeIt) const {}
+ // Node aNode(OutEdgeIt) const {}
+ // Node aNode(SymEdgeIt) const {}
+
+ // Node bNode(InEdgeIt) const {}
+ // Node bNode(OutEdgeIt) const {}
+ // Node bNode(SymEdgeIt) const {}
+
+ /// Checks if a node iterator is valid
+ bool valid(const Node) const { return true;};
+ /// Checks if an edge iterator is valid
+ bool valid(const Edge) const { return true;};
+
+ ///Gives back the \e id of a node.
+ int id(const Node) const { return 0;};
+ ///Gives back the \e id of an edge.
+ int id(const Edge) const { return 0;};
- //void setInvalid(NodeIt &) const {};
- //void setInvalid(EdgeIt &) const {};
+ //void setInvalid(Node &) const {};
+ //void setInvalid(Edge &) const {};
- NodeIt addNode() {}
- EdgeIt addEdge(NodeIt tail, NodeIt head) {}
+ Node addNode() { return INVALID;}
+ Edge addEdge(Node tail, Node head) { return INVALID;}
- void erase(NodeIt n) {}
- void erase(EdgeIt e) {}
-
- void clear() {}
-
- int nodeNum() {}
- int edgeNum() {}
-
- template<class T> class NodeMap
- {
- public:
- typedef T ValueType;
- typedef NodeIt KeyType;
+ void erase(Node n) {}
+ void erase(Edge e) {}
- NodeMap(const Graph &G) {}
- NodeMap(const Graph &G, T t) {}
+ void clear() {}
- void set(NodeIt i, T t) {}
- T get(NodeIt i) const {} //FIXME: Is it necessary
- T &operator[](NodeIt i) {}
- const T &operator[](NodeIt i) const {}
+ int nodeNum() { return 0;}
+ int edgeNum() { return 0;}
- update() {}
- update(T a) {} //FIXME: Is it necessary
- };
+ EmptyGraph() {};
+ EmptyGraph(const EmptyGraph &G) {};
+
+
- template<class T> class EdgeMap
- {
- public:
- typedef T ValueType;
- typedef EdgeIt KeyType;
+ ///Read/write map from the nodes to type \c T.
+ template<class T> class NodeMap
+ {
+ public:
+ typedef T ValueType;
+ typedef Node KeyType;
+
+ NodeMap(const EmptyGraph &G) {}
+ NodeMap(const EmptyGraph &G, T t) {}
+
+ void set(Node i, T t) {}
+ T get(Node i) const {return *(T*)NULL;} //FIXME: Is it necessary
+ T &operator[](Node i) {return *(T*)NULL;}
+ const T &operator[](Node i) const {return *(T*)NULL;}
+
+ void update() {}
+ void update(T a) {} //FIXME: Is it necessary
+ };
+
+ ///Read/write map from the edges to type \c T.
+ template<class T> class EdgeMap
+ {
+ public:
+ typedef T ValueType;
+ typedef Edge KeyType;
- EdgeMap(const Graph &G) {}
- EdgeMap(const Graph &G, T t) {}
+ EdgeMap(const EmptyGraph &G) {}
+ EdgeMap(const EmptyGraph &G, T t) {}
- void set(EdgeIt i, T t) {}
- T get(EdgeIt i) const {}
- T &operator[](EdgeIt i) {}
+ void set(Edge i, T t) {}
+ T get(Edge i) const {return *(T*)NULL;}
+ T &operator[](Edge i) {return *(T*)NULL;}
- update() {}
- update(T a) {} //FIXME: Is it necessary
+ void update() {}
+ void update(T a) {} //FIXME: Is it necessary
+ };
};
+
+ // @}
+
};
+
// class EmptyBipGraph : public EmptyGraph
// {
-// class ANodeIt {};
-// class BNodeIt {};
+// class ANode {};
+// class BNode {};
-// ANodeIt &next(ANodeIt &) {}
-// BNodeIt &next(BNodeIt &) {}
+// ANode &next(ANode &) {}
+// BNode &next(BNode &) {}
-// ANodeIt &getFirst(ANodeIt &) const {}
-// BNodeIt &getFirst(BNodeIt &) const {}
+// ANode &getFirst(ANode &) const {}
+// BNode &getFirst(BNode &) const {}
// enum NodeClass { A = 0, B = 1 };
-// NodeClass getClass(NodeIt n) {}
+// NodeClass getClass(Node n) {}
// }
More information about the Lemon-commits
mailing list