diff -r 8782ff6fd98a -r 9b56cca61e2e lemon/full_graph.h --- a/lemon/full_graph.h Mon Feb 27 10:17:33 2006 +0000 +++ b/lemon/full_graph.h Mon Feb 27 10:36:01 2006 +0000 @@ -36,6 +36,9 @@ namespace lemon { + /// \brief Base of the FullGrpah. + /// + /// Base of the FullGrpah. class FullGraphBase { int _nodeNum; int _edgeNum; @@ -53,13 +56,26 @@ ///Creates a full graph with \c n nodes. void construct(int n) { _nodeNum = n; _edgeNum = n * n; } - /// - // FullGraphBase(const FullGraphBase &_g) - // : _nodeNum(_g.nodeNum()), _edgeNum(_nodeNum*_nodeNum) { } typedef True NodeNumTag; typedef True EdgeNumTag; + /// \brief Returns the node with the given index. + /// + /// Returns the node with the given index. Because it is a + /// static size graph the node's of the graph can be indiced + /// by the range from 0 to \e nodeNum()-1 and the index of + /// the node can accessed by the \e index() member. + Node operator()(int index) const { return Node(index); } + + /// \brief Returns the index of the node. + /// + /// Returns the index of the node. Because it is a + /// static size graph the node's of the graph can be indiced + /// by the range from 0 to \e nodeNum()-1 and the index of + /// the node can accessed by the \e index() member. + int index(const Node& node) const { return node.id; } + ///Number of nodes. int nodeNum() const { return _nodeNum; } ///Number of edges. @@ -202,6 +218,9 @@ /// the \ref concept::StaticGraph "StaticGraph" concept /// \sa concept::StaticGraph. /// + /// \sa FullGraphBase + /// \sa FullUGraph + /// /// \author Alpar Juttner class FullGraph : public ExtendedFullGraphBase { public: @@ -214,6 +233,9 @@ /// \brief Resize the graph /// + /// Resize the graph. The function will fully destroy and build the graph. + /// This cause that the maps of the graph will reallocated + /// automatically and the previous values will be lost. void resize(int n) { Parent::getNotifier(Edge()).clear(); Parent::getNotifier(Node()).clear(); @@ -224,6 +246,9 @@ }; + /// \brief Base of the FullUGrpah. + /// + /// Base of the FullUGrpah. class FullUGraphBase { int _nodeNum; int _edgeNum; @@ -241,10 +266,23 @@ ///Creates a full graph with \c n nodes. void construct(int n) { _nodeNum = n; _edgeNum = n * (n - 1) / 2; } + + /// \brief Returns the node with the given index. /// - // FullGraphBase(const FullGraphBase &_g) - // : _nodeNum(_g.nodeNum()), _edgeNum(_nodeNum*_nodeNum) { } - + /// Returns the node with the given index. Because it is a + /// static size graph the node's of the graph can be indiced + /// by the range from 0 to \e nodeNum()-1 and the index of + /// the node can accessed by the \e index() member. + Node operator()(int index) const { return Node(index); } + + /// \brief Returns the index of the node. + /// + /// Returns the index of the node. Because it is a + /// static size graph the node's of the graph can be indiced + /// by the range from 0 to \e nodeNum()-1 and the index of + /// the node can accessed by the \e index() member. + int index(const Node& node) const { return node.id; } + typedef True NodeNumTag; typedef True EdgeNumTag; @@ -275,18 +313,19 @@ } - /// Node ID. - + /// \brief Node ID. + /// /// The ID of a valid Node is a nonnegative integer not greater than /// \ref maxNodeId(). The range of the ID's is not surely continuous /// and the greatest node ID can be actually less then \ref maxNodeId(). /// /// The ID of the \ref INVALID node is -1. - ///\return The ID of the node \c v. + /// \return The ID of the node \c v. static int id(Node v) { return v.id; } - /// Edge ID. - + + /// \brief Edge ID. + /// /// The ID of a valid Edge is a nonnegative integer not greater than /// \ref maxEdgeId(). The range of the ID's is not surely continuous /// and the greatest edge ID can be actually less then \ref maxEdgeId(). @@ -295,8 +334,8 @@ ///\return The ID of the edge \c e. static int id(Edge e) { return e.id; } - /// Finds an edge between two nodes. - + /// \brief Finds an edge between two nodes. + /// /// Finds an edge from node \c u to node \c v. /// /// If \c prev is \ref INVALID (this is the default value), then @@ -304,7 +343,7 @@ /// the next edge from \c u to \c v after \c prev. /// \return The found edge or INVALID if there is no such an edge. Edge findEdge(Node u, Node v, Edge prev = INVALID) const { - if (prev.id != -1 || u.id <= v.id) return -1; + if (prev.id != -1 || u.id <= v.id) return Edge(-1); return Edge(u.id * (u.id - 1) / 2 + v.id); } @@ -403,6 +442,7 @@ /// is that this class conforms to the undirected graph concept and /// it does not contain the loop edges. /// + /// \sa FullUGraphBase /// \sa FullGraph /// /// \author Balazs Dezso @@ -416,6 +456,9 @@ /// \brief Resize the graph /// + /// Resize the graph. The function will fully destroy and build the graph. + /// This cause that the maps of the graph will reallocated + /// automatically and the previous values will be lost. void resize(int n) { Parent::getNotifier(Edge()).clear(); Parent::getNotifier(UEdge()).clear(); @@ -612,6 +655,7 @@ /// It is completely static, so you can neither add nor delete either /// edges or nodes. /// + /// \sa FullUGraphBase /// \sa FullGraph /// /// \author Balazs Dezso