diff -r 096d83158d41 -r 81b47fc5c444 lemon/full_graph.h --- a/lemon/full_graph.h Fri Mar 02 17:56:22 2007 +0000 +++ b/lemon/full_graph.h Fri Mar 02 18:04:28 2007 +0000 @@ -56,7 +56,7 @@ typedef True NodeNumTag; typedef True EdgeNumTag; - Node operator()(int index) const { return Node(index); } + Node operator()(int ix) const { return Node(ix); } int index(const Node& node) const { return node.id; } Edge edge(const Node& u, const Node& v) const { @@ -129,30 +129,30 @@ --node.id; } - void first(Edge& edge) const { - edge.id = _edgeNum-1; + void first(Edge& e) const { + e.id = _edgeNum-1; } - static void next(Edge& edge) { - --edge.id; + static void next(Edge& e) { + --e.id; } - void firstOut(Edge& edge, const Node& node) const { - edge.id = _edgeNum + node.id - _nodeNum; + void firstOut(Edge& e, const Node& n) const { + e.id = _edgeNum + n.id - _nodeNum; } - void nextOut(Edge& edge) const { - edge.id -= _nodeNum; - if (edge.id < 0) edge.id = -1; + void nextOut(Edge& e) const { + e.id -= _nodeNum; + if (e.id < 0) e.id = -1; } - void firstIn(Edge& edge, const Node& node) const { - edge.id = node.id * _nodeNum; + void firstIn(Edge& e, const Node& n) const { + e.id = n.id * _nodeNum; } - void nextIn(Edge& edge) const { - ++edge.id; - if (edge.id % _nodeNum == 0) edge.id = -1; + void nextIn(Edge& e) const { + ++e.id; + if (e.id % _nodeNum == 0) e.id = -1; } }; @@ -207,7 +207,7 @@ /// 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 Parent::operator()(index); } + Node operator()(int ix) const { return Parent::operator()(ix); } /// \brief Returns the index of the node. /// @@ -250,7 +250,7 @@ public: - Node operator()(int index) const { return Node(index); } + Node operator()(int ix) const { return Node(ix); } int index(const Node& node) const { return node.id; } Edge edge(const Node& u, const Node& v) const { @@ -271,12 +271,12 @@ Node source(Edge e) const { /// \todo we may do it faster - return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2); + return Node((int(sqrt(double(1 + 8 * e.id)) + 1)) / 2); } Node target(Edge e) const { - int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; - return Node(e.id - (source) * (source - 1) / 2); + int s = (int(sqrt(double(1 + 8 * e.id)) + 1)) / 2; + return Node(e.id - s * (s - 1) / 2); } static int id(Node v) { return v.id; } @@ -322,47 +322,47 @@ bool operator<(const Edge edge) const {return id < edge.id;} }; - void first(Node& node) const { - node.id = _nodeNum - 1; + void first(Node& n) const { + n.id = _nodeNum - 1; } - static void next(Node& node) { - --node.id; + static void next(Node& n) { + --n.id; } - void first(Edge& edge) const { - edge.id = _edgeNum - 1; + void first(Edge& e) const { + e.id = _edgeNum - 1; } - static void next(Edge& edge) { - --edge.id; + static void next(Edge& e) { + --e.id; } - void firstOut(Edge& edge, const Node& node) const { - int src = node.id; + void firstOut(Edge& e, const Node& n) const { + int src = n.id; int trg = 0; - edge.id = (trg < src ? src * (src - 1) / 2 + trg : -1); + e.id = (trg < src ? src * (src - 1) / 2 + trg : -1); } /// \todo with specialized iterators we can make faster iterating - void nextOut(Edge& edge) const { - int src = source(edge).id; - int trg = target(edge).id; + void nextOut(Edge& e) const { + int src = source(e).id; + int trg = target(e).id; ++trg; - edge.id = (trg < src ? src * (src - 1) / 2 + trg : -1); + e.id = (trg < src ? src * (src - 1) / 2 + trg : -1); } - void firstIn(Edge& edge, const Node& node) const { - int src = node.id + 1; - int trg = node.id; - edge.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1); + void firstIn(Edge& e, const Node& n) const { + int src = n.id + 1; + int trg = n.id; + e.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1); } - void nextIn(Edge& edge) const { - int src = source(edge).id; - int trg = target(edge).id; + void nextIn(Edge& e) const { + int src = source(e).id; + int trg = target(e).id; ++src; - edge.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1); + e.id = (src < _nodeNum ? src * (src - 1) / 2 + trg : -1); } }; @@ -421,7 +421,7 @@ /// 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 Parent::operator()(index); } + Node operator()(int ix) const { return Parent::operator()(ix); } /// \brief Returns the index of the node. /// @@ -478,10 +478,10 @@ FullBpUGraphBase() {} - void construct(int aNodeNum, int bNodeNum) { - _aNodeNum = aNodeNum; - _bNodeNum = bNodeNum; - _edgeNum = aNodeNum * bNodeNum; + void construct(int ann, int bnn) { + _aNodeNum = ann; + _bNodeNum = bnn; + _edgeNum = ann * bnn; } public: @@ -521,8 +521,8 @@ bool operator<(const UEdge i) const {return id> 1; } int bNodeIndex(const Node& node) const { return node.id >> 1; } @@ -695,8 +695,8 @@ Parent::construct(0, 0); } - FullBpUGraph(int aNodeNum, int bNodeNum) { - Parent::construct(aNodeNum, bNodeNum); + FullBpUGraph(int ann, int bnn) { + Parent::construct(ann, bnn); } /// \brief Resize the graph @@ -737,7 +737,7 @@ /// static size graph the node's of the graph can be indiced /// by the range from 0 to \e aNodeNum()-1 and the index of /// the node can accessed by the \e aNodeIndex() member. - Node aNode(int index) const { return Parent::aNode(index); } + Node aNode(int ix) const { return Parent::aNode(ix); } /// \brief Returns the B-node with the given index. /// @@ -745,7 +745,7 @@ /// static size graph the node's of the graph can be indiced /// by the range from 0 to \e bNodeNum()-1 and the index of /// the node can accessed by the \e bNodeIndex() member. - Node bNode(int index) const { return Parent::bNode(index); } + Node bNode(int ix) const { return Parent::bNode(ix); } /// \brief Returns the index of the A-node. ///