[Lemon-commits] [lemon_svn] alpar: r1375 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:44:55 CET 2006
Author: alpar
Date: Sat Nov 13 13:24:01 2004
New Revision: 1375
Modified:
hugo/trunk/src/lemon/full_graph.h
Log:
Bugfixes in UndirFullGraphBase
Modified: hugo/trunk/src/lemon/full_graph.h
==============================================================================
--- hugo/trunk/src/lemon/full_graph.h (original)
+++ hugo/trunk/src/lemon/full_graph.h Sat Nov 13 13:24:01 2004
@@ -296,7 +296,7 @@
class Node {
- friend class FullGraphBase;
+ friend class UndirFullGraphBase;
protected:
int id;
@@ -312,14 +312,14 @@
class Edge {
- friend class FullGraphBase;
+ friend class UndirFullGraphBase;
protected:
int id; // NodeNum * head + tail;
Edge(int _id) : id(_id) {}
- Edge(const FullGraphBase& _graph, int tail, int head)
+ Edge(const UndirFullGraphBase& _graph, int tail, int head)
: id(_graph.NodeNum * head+tail) {}
public:
Edge() { }
@@ -350,22 +350,22 @@
}
/// \todo with specialized iterators we can make faster iterating
- void nextOut(Edge& edge) const {
+ 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;
- return head < tail ? tail * (tail - 1) / 2 + head : -1;
+ e.id = head < tail ? tail * (tail - 1) / 2 + head : -1;
}
void firstIn(Edge& edge, const Node& node) const {
edge.id = node.id * (node.id + 1) / 2 - 1;
}
- void nextIn(Edge& edge) const {
+ 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;
- return tail < nodeNum ? tail * (tail - 1) / 2 + head : -1;
+ e.id = tail < NodeNum ? tail * (tail - 1) / 2 + head : -1;
}
};
More information about the Lemon-commits
mailing list