diff -r 741f3108a90f -r e997802b855c src/lemon/full_graph.h --- a/src/lemon/full_graph.h Sat Nov 13 12:24:01 2004 +0000 +++ b/src/lemon/full_graph.h Sat Nov 13 12:53:28 2004 +0000 @@ -78,8 +78,8 @@ ///\sa id(Edge) int maxId(Edge = INVALID) const { return EdgeNum-1; } - Node tail(Edge e) const { return e.id % NodeNum; } - Node head(Edge e) const { return e.id / NodeNum; } + Node source(Edge e) const { return e.id % NodeNum; } + Node target(Edge e) const { return e.id / NodeNum; } /// Node ID. @@ -136,12 +136,12 @@ friend class FullGraphBase; protected: - int id; // NodeNum * head + tail; + int id; // NodeNum * target + source; Edge(int _id) : id(_id) {} - Edge(const FullGraphBase& _graph, int tail, int head) - : id(_graph.NodeNum * head+tail) {} + Edge(const FullGraphBase& _graph, int source, int target) + : id(_graph.NodeNum * target+source) {} public: Edge() { } Edge (Invalid) { id = -1; } @@ -250,14 +250,14 @@ ///\sa id(Edge) int maxId(Edge = INVALID) const { return EdgeNum-1; } - Node tail(Edge e) const { + Node source(Edge e) const { /// \todo we may do it faster return ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2; } - Node head(Edge e) const { - int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; - return e.id - (tail) * (tail - 1) / 2; + Node target(Edge e) const { + int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; + return e.id - (source) * (source - 1) / 2; } @@ -315,12 +315,12 @@ friend class UndirFullGraphBase; protected: - int id; // NodeNum * head + tail; + int id; // NodeNum * target + source; Edge(int _id) : id(_id) {} - Edge(const UndirFullGraphBase& _graph, int tail, int head) - : id(_graph.NodeNum * head+tail) {} + Edge(const UndirFullGraphBase& _graph, int source, int target) + : id(_graph.NodeNum * target+source) {} public: Edge() { } Edge (Invalid) { id = -1; } @@ -351,10 +351,10 @@ /// \todo with specialized iterators we can make faster iterating void nextOut(Edge& e) const { - int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; - int head = e.id - (tail) * (tail - 1) / 2; - ++head; - e.id = head < tail ? tail * (tail - 1) / 2 + head : -1; + int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; + int target = e.id - (source) * (source - 1) / 2; + ++target; + e.id = target < source ? source * (source - 1) / 2 + target : -1; } void firstIn(Edge& edge, const Node& node) const { @@ -362,10 +362,10 @@ } void nextIn(Edge& e) const { - int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; - int head = e.id - (tail) * (tail - 1) / 2; ++head; - ++tail; - e.id = tail < NodeNum ? tail * (tail - 1) / 2 + head : -1; + int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; + int target = e.id - (source) * (source - 1) / 2; ++target; + ++source; + e.id = source < NodeNum ? source * (source - 1) / 2 + target : -1; } };