diff -r 259540358bbf -r 47cd1716870e src/work/alpar/emptygraph.h --- a/src/work/alpar/emptygraph.h Sat Mar 13 22:53:07 2004 +0000 +++ b/src/work/alpar/emptygraph.h Mon Mar 15 16:30:20 2004 +0000 @@ -12,8 +12,8 @@ /// An empty graph class. - /// This class provides all the common features of a grapf structure, - /// however completely without implementations or real data structures + /// This class provides all the common features of a graph structure, + /// however completely without implementations and real data structures /// behind the interface. /// All graph algorithms should compile with this class, but it will not /// run properly, of course. @@ -31,7 +31,7 @@ /// The base type of the node iterators. - /// This \c Node is the base type of each node iterators, + /// This is the base type of each node iterators, /// thus each kind of node iterator will convert to this. class Node { public: @@ -58,6 +58,14 @@ }; /// This iterator goes through each node. + + /// This iterator goes through each node. + /// Its usage is quite simple, for example you can count the number + /// of nodes in graph \c G of type \c Graph like this: + /// \code + ///int count=0; + ///for(Graph::NodeIt n(G);G.valid(n);G.next(n)) count++; + /// \endcode class NodeIt : public Node { public: /// @warning The default constructor sets the iterator @@ -91,7 +99,17 @@ bool operator<(Edge n) const { return true; } }; - /// This iterator goes trought the outgoing edges of a certain graph. + /// This iterator goes trought the outgoing edges of a node. + + /// This iterator goes trought the \e outgoing edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c G of type \c Graph as follows. + /// \code + ///int count=0; + ///for(Graph::OutEdgeIt e(G,n);G.valid(e);G.next(e)) count++; + /// \endcode class OutEdgeIt : public Edge { public: @@ -109,6 +127,18 @@ OutEdgeIt(const GraphSkeleton & G, Node n) {} }; + /// This iterator goes trought the incoming edges of a node. + + /// This iterator goes trought the \e incoming edges of a certain node + /// of a graph. + /// Its usage is quite simple, for example you can count the number + /// of outgoing edges of a node \c n + /// in graph \c G of type \c Graph as follows. + /// \code + ///int count=0; + ///for(Graph::InEdgeIt e(G,n);G.valid(e);G.next(e)) count++; + /// \endcode + class InEdgeIt : public Edge { public: /// @warning The default constructor sets the iterator @@ -119,6 +149,16 @@ InEdgeIt(const GraphSkeleton &, Node) {} }; // class SymEdgeIt : public Edge {}; + + /// This iterator goes through each edge. + + /// This iterator goes through each edge of a graph. + /// Its usage is quite simple, for example you can count the number + /// 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);G.next(e)) count++; + /// \endcode class EdgeIt : public Edge { public: /// @warning The default constructor sets the iterator @@ -173,8 +213,14 @@ // 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. @@ -194,6 +240,7 @@ ///Add a new node to the graph. /// \return the new node. + /// Node addNode() { return INVALID;} ///Add a new edge to the graph. @@ -227,8 +274,10 @@ - ///Read/write map of the nodes to type \c T. + ///Read/write/reference map of the nodes to type \c T. + ///Read/write/reference map of the nodes to type \c T. + /// \sa MemoryMapSkeleton /// \todo We may need copy constructor /// \todo We may need conversion from other nodetype /// \todo We may need operator= @@ -262,10 +311,15 @@ void update(T a) {} //FIXME: Is it necessary }; - ///Read/write map of the edges to type \c T. + ///Read/write/reference map of the edges to type \c T. - ///Read/write map of the edges to type \c T. - ///It behaves exactly the same way as \ref NodeMap. + ///Read/write/reference map of the edges to type \c T. + ///It behaves exactly in the same way as \ref NodeMap. + /// \sa NodeMap + /// \sa MemoryMapSkeleton + /// \todo We may need copy constructor + /// \todo We may need conversion from other edgetype + /// \todo We may need operator= template class EdgeMap { public: