[Lemon-commits] [lemon_svn] alpar: r1095 - hugo/trunk/src/hugo/skeletons

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:43:13 CET 2006


Author: alpar
Date: Sun Sep  5 22:06:08 2004
New Revision: 1095

Modified:
   hugo/trunk/src/hugo/skeletons/graph.h

Log:
- Changes in doc
- Some obsolete features has been removed.

Modified: hugo/trunk/src/hugo/skeletons/graph.h
==============================================================================
--- hugo/trunk/src/hugo/skeletons/graph.h	(original)
+++ hugo/trunk/src/hugo/skeletons/graph.h	Sun Sep  5 22:06:08 2004
@@ -35,40 +35,60 @@
     {
     public:
       /// Defalult constructor.
+
+      /// Defalult constructor.
+      ///
       StaticGraphSkeleton() { }
       ///Copy consructor.
 
-      ///\todo It is not clear, what we expect from a copy constructor.
-      ///E.g. How to assign the nodes/edges to each other? What about maps?
-      StaticGraphSkeleton(const StaticGraphSkeleton& g) { }
+//       ///\todo It is not clear, what we expect from a copy constructor.
+//       ///E.g. How to assign the nodes/edges to each other? What about maps?
+//       StaticGraphSkeleton(const StaticGraphSkeleton& g) { }
 
       /// The base type of node iterators, 
       /// or in other words, the trivial node iterator.
 
       /// This is the base type of each node iterator,
       /// thus each kind of node iterator converts to this.
-      /// More precisely each kind of node iterator have to be inherited 
+      /// More precisely each kind of node iterator should be inherited 
       /// from the trivial node iterator.
       class Node {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	Node() { }
 	/// Copy constructor.
+
+	/// Copy constructor.
+	///
 	Node(const Node&) { }
+
 	/// Invalid constructor \& conversion.
 
 	/// This constructor initializes the iterator to be invalid.
 	/// \sa Invalid for more details.
 	Node(Invalid) { }
+	/// Equality operator
+
 	/// Two iterators are equal if and only if they point to the
 	/// same object or both are invalid.
 	bool operator==(Node) const { return true; }
 
+	/// Inequality operator
+	
 	/// \sa \ref operator==(Node n)
 	///
 	bool operator!=(Node) const { return true; }
 
+ 	///Comparison operator.
+
+	///This is a strict ordering between the nodes.
+	///
+	///This ordering can be different from the order in which NodeIt
+	///goes through the nodes.
+	///\todo Possibly we don't need it.
 	bool operator<(Node) const { return true; }
       };
     
@@ -79,46 +99,84 @@
       /// of nodes in graph \c g of type \c Graph like this:
       /// \code
       /// int count=0;
-      /// for (Graph::NodeIt n(g); g.valid(n); ++n) ++count;
+      /// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count;
       /// \endcode
       class NodeIt : public Node {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	NodeIt() { }
 	/// Copy constructor.
+	
+	/// Copy constructor.
+	///
 	NodeIt(const NodeIt&) { }
 	/// Invalid constructor \& conversion.
 
 	/// Initialize the iterator to be invalid.
 	/// \sa Invalid for more details.
 	NodeIt(Invalid) { }
+	/// Sets the iterator to the first node.
+
 	/// Sets the iterator to the first node of \c g.
+	///
 	NodeIt(const StaticGraphSkeleton& g) { }
+	/// Node -> NodeIt conversion.
+
 	/// Sets the iterator to the node of \c g pointed by the trivial 
-	/// iterator n. This feature necessitates that each time we 
-	/// iterate the node-set, the iteration order is the same.
+	/// iterator n.
+	/// This feature necessitates that each time we 
+	/// iterate the edge-set, the iteration order is the same.
 	NodeIt(const StaticGraphSkeleton& g, const Node& n) { }
+	/// Next node.
+
 	/// Assign the iterator to the next node.
+	///
 	NodeIt& operator++() { return *this; }
       };
     
     
       /// The base type of the edge iterators.
+
+      /// The base type of the edge iterators.
+      ///
       class Edge {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	Edge() { }
 	/// Copy constructor.
+
+	/// Copy constructor.
+	///
 	Edge(const Edge&) { }
 	/// Initialize the iterator to be invalid.
+
+	/// Initialize the iterator to be invalid.
+	///
 	Edge(Invalid) { }
+	/// Equality operator
+
 	/// Two iterators are equal if and only if they point to the
 	/// same object or both are invalid.
 	bool operator==(Edge) const { return true; }
+	/// Inequality operator
+
+	/// \sa \ref operator==(Node n)
+	///
 	bool operator!=(Edge) const { return true; }
-	bool operator<(Edge) const { return true; }
+ 	///Comparison operator.
+
+	///This is a strict ordering between the nodes.
+	///
+	///This ordering can be different from the order in which NodeIt
+	///goes through the nodes.
+	///\todo Possibly we don't need it.
+ 	bool operator<(Edge) const { return true; }
       };
     
       /// This iterator goes trough the outgoing edges of a node.
@@ -130,17 +188,25 @@
       /// in graph \c g of type \c Graph as follows.
       /// \code
       /// int count=0;
-      /// for (Graph::OutEdgeIt e(g, n); g.valid(e); ++e) ++count;
+      /// for (Graph::OutEdgeIt e(g, n); e!=INVALID; ++e) ++count;
       /// \endcode
     
       class OutEdgeIt : public Edge {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	OutEdgeIt() { }
 	/// Copy constructor.
+
+	/// Copy constructor.
+	///
 	OutEdgeIt(const OutEdgeIt&) { }
 	/// Initialize the iterator to be invalid.
+
+	/// Initialize the iterator to be invalid.
+	///
 	OutEdgeIt(Invalid) { }
 	/// This constructor sets the iterator to first outgoing edge.
     
@@ -149,11 +215,16 @@
 	///@param n the node
 	///@param g the graph
 	OutEdgeIt(const StaticGraphSkeleton& g, const Node& n) { }
+	/// Edge -> OutEdgeIt conversion
+
 	/// Sets the iterator to the value of the trivial iterator \c e.
 	/// This feature necessitates that each time we 
 	/// iterate the edge-set, the iteration order is the same.
 	OutEdgeIt(const StaticGraphSkeleton& g, const Edge& e) { }
-	/// Assign the iterator to the next outedge of the corresponding node.
+	///Next outgoing edge
+	
+	/// Assign the iterator to the next 
+	/// outgoing edge of the corresponding node.
 	OutEdgeIt& operator++() { return *this; }
       };
 
@@ -166,27 +237,45 @@
       /// in graph \c g of type \c Graph as follows.
       /// \code
       /// int count=0;
-      /// for(Graph::InEdgeIt e(g, n); g.valid(e); ++) ++count;
+      /// for(Graph::InEdgeIt e(g, n); e!=INVALID; ++e) ++count;
       /// \endcode
 
       class InEdgeIt : public Edge {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	InEdgeIt() { }
 	/// Copy constructor.
+
+	/// Copy constructor.
+	///
 	InEdgeIt(const InEdgeIt&) { }
 	/// Initialize the iterator to be invalid.
+
+	/// Initialize the iterator to be invalid.
+	///
 	InEdgeIt(Invalid) { }
-	/// .
-	InEdgeIt(const StaticGraphSkeleton&, const Node&) { }
-	/// .
-	InEdgeIt(const StaticGraphSkeleton&, const Edge&) { }
+	/// This constructor sets the iterator to first incoming edge.
+    
+	/// This constructor set the iterator to the first incoming edge of
+	/// node
+	///@param n the node
+	///@param g the graph
+	InEdgeIt(const StaticGraphSkeleton& g, const Node& n) { }
+	/// Edge -> InEdgeIt conversion
+
+	/// Sets the iterator to the value of the trivial iterator \c e.
+	/// This feature necessitates that each time we 
+	/// iterate the edge-set, the iteration order is the same.
+	InEdgeIt(const StaticGraphSkeleton& g, const Edge& n) { }
+	/// Next incoming edge
+
 	/// Assign the iterator to the next inedge of the corresponding node.
+	///
 	InEdgeIt& operator++() { return *this; }
       };
-      //  class SymEdgeIt : public Edge {};
-
       /// This iterator goes through each edge.
 
       /// This iterator goes through each edge of a graph.
@@ -194,21 +283,41 @@
       /// of edges in a graph \c g of type \c Graph as follows:
       /// \code
       /// int count=0;
-      /// for(Graph::EdgeIt e(g); g.valid(e); ++e) ++count;
+      /// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count;
       /// \endcode
       class EdgeIt : public Edge {
       public:
+	/// Default constructor
+
 	/// @warning The default constructor sets the iterator
 	/// to an undefined value.
 	EdgeIt() { }
 	/// Copy constructor.
+
+	/// Copy constructor.
+	///
 	EdgeIt(const EdgeIt&) { }
 	/// Initialize the iterator to be invalid.
+
+	/// Initialize the iterator to be invalid.
+	///
 	EdgeIt(Invalid) { }
-	/// .
-	EdgeIt(const StaticGraphSkeleton&) { }
-	/// .
+	/// This constructor sets the iterator to first edge.
+    
+	/// This constructor set the iterator to the first edge of
+	/// node
+	///@param g the graph
+	EdgeIt(const StaticGraphSkeleton& g) { }
+	/// Edge -> EdgeIt conversion
+
+	/// Sets the iterator to the value of the trivial iterator \c e.
+	/// This feature necessitates that each time we 
+	/// iterate the edge-set, the iteration order is the same.
 	EdgeIt(const StaticGraphSkeleton&, const Edge&) { } 
+    	///Next edge
+	
+	/// Assign the iterator to the next 
+	/// edge of the corresponding node.
 	EdgeIt& operator++() { return *this; }
       };
 
@@ -220,71 +329,53 @@
       NodeIt& first(NodeIt& i) const { return i; }
 
       /// The first incoming edge.
+
+      /// The first incoming edge.
+      ///
       InEdgeIt& first(InEdgeIt &i, Node) const { return i; }
       /// The first outgoing edge.
+
+      /// The first outgoing edge.
+      ///
       OutEdgeIt& first(OutEdgeIt& i, Node) const { return i; }
-      //  SymEdgeIt& first(SymEdgeIt&, Node) const { return i; }
       /// The first edge of the Graph.
+
+      /// 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.
-      NodeIt& next(NodeIt& 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.
 
       ///Gives back the head node of an edge.
+      ///
       Node head(Edge) const { return INVALID; }
       ///Gives back the tail node of an edge.
+
+      ///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
-
-      ///\todo Maybe, it would be better if iterator converted to
-      ///bool directly, as Jacint prefers.
-      bool valid(const Node&) const { return true; }
-      /// Checks if an edge iterator is valid
-
-      ///\todo Maybe, it would be better if iterator converted to
-      ///bool directly, as Jacint prefers.
-      bool valid(const Edge&) const { return true; }
-
       ///Gives back the \e id of a node.
 
       ///\warning Not all graph structures provide this feature.
       ///
+      ///\todo Should each graph provide \c id?
       int id(const Node&) const { return 0; }
       ///Gives back the \e id of an edge.
 
       ///\warning Not all graph structures provide this feature.
       ///
+      ///\todo Should each graph provide \c id?
       int id(const Edge&) const { return 0; }
 
-      /// Resets the graph.
-
-      /// This function deletes all edges and nodes of the graph.
-      /// It also frees the memory allocated to store them.
-      void clear() { }
-
+      /// .
+      
+      ///\todo What is this?
+      ///
       int nodeNum() const { return 0; }
+      /// .
+      ///\todo What is this?
+      ///
       int edgeNum() const { return 0; }
 
 
@@ -293,14 +384,14 @@
       ///Reference map of the nodes to type \c T.
       /// \sa ReferenceSkeleton
       /// \warning Making maps that can handle bool type (NodeMap<bool>)
-      /// needs extra attention!
-
-      template<class T> class NodeMap
-	: public ReferenceMap< Node, T >
+      /// needs some extra attention!
+      template<class T> class NodeMap: public ReferenceMap< Node, T >
       {
       public:
 
+	/// .
 	NodeMap(const StaticGraphSkeleton&) { }
+	/// .
 	NodeMap(const StaticGraphSkeleton&, T) { }
 
 	///Copy constructor
@@ -315,15 +406,15 @@
       ///Reference map of the edges to type \c T.
       /// \sa ReferenceSkeleton
       /// \warning Making maps that can handle bool type (EdgeMap<bool>)
-      /// needs extra attention!
+      /// needs some extra attention!
       template<class T> class EdgeMap
 	: public ReferenceMap<Edge,T>
       {
       public:
-	typedef T ValueType;
-	typedef Edge KeyType;
 
+	/// .
 	EdgeMap(const StaticGraphSkeleton&) { }
+	/// .
 	EdgeMap(const StaticGraphSkeleton&, T) { }
     
 	///Copy constructor
@@ -336,7 +427,7 @@
 
 
   
-    /// An empty graph class.
+    /// An empty non-static graph class.
 
     /// This class provides everything that \c StaticGraphSkeleton
     /// with additional functionality which enables to build a
@@ -345,13 +436,10 @@
     {
     public:
       /// Defalult constructor.
-      GraphSkeleton() { }
-      ///Copy consructor.
-
-      ///\todo It is not clear, what we expect from a copy constructor.
-      ///E.g. How to assign the nodes/edges to each other? What about maps?
-      GraphSkeleton(const GraphSkeleton&) { }
 
+      /// Defalult constructor.
+      ///
+      GraphSkeleton() { }
       ///Add a new node to the graph.
 
       /// \return the new node.
@@ -379,38 +467,27 @@
     class EraseableGraphSkeleton : public GraphSkeleton
     {
     public:
+      /// Defalult constructor.
+
+      /// Defalult constructor.
+      ///
+      EraseableGraphSkeleton() { }
       /// Deletes a node.
+
+      /// Deletes node \c n node.
+      ///
       void erase(Node n) { }
       /// Deletes an edge.
-      void erase(Edge e) { }
 
-      /// Defalult constructor.
-      EraseableGraphSkeleton() { }
-      ///Copy consructor.
-      EraseableGraphSkeleton(const GraphSkeleton&) { }
+      /// Deletes edge \c e edge.
+      ///
+      void erase(Edge e) { }
     };
 
     // @}
-  } //namespace skeleton
-  
+  } //namespace skeleton  
 } //namespace hugo
 
 
 
-// class EmptyBipGraph : public Graph Skeleton
-// {
-//   class ANode {};
-//   class BNode {};
-
-//   ANode &next(ANode &) {}
-//   BNode &next(BNode &) {}
-
-//   ANode &getFirst(ANode &) const {}
-//   BNode &getFirst(BNode &) const {}
-
-//   enum NodeClass { A = 0, B = 1 };
-//   NodeClass getClass(Node n) {}
-
-// }
-
 #endif // HUGO_SKELETON_GRAPH_H



More information about the Lemon-commits mailing list