[Lemon-commits] [lemon_svn] alpar: r1329 - hugo/trunk/src/lemon
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:44:38 CET 2006
Author: alpar
Date: Sat Oct 30 20:30:29 2004
New Revision: 1329
Modified:
hugo/trunk/src/lemon/list_graph.h
Log:
ListGraph compilation bug fixed.
Modified: hugo/trunk/src/lemon/list_graph.h
==============================================================================
--- hugo/trunk/src/lemon/list_graph.h (original)
+++ hugo/trunk/src/lemon/list_graph.h Sat Oct 30 20:30:29 2004
@@ -38,6 +38,7 @@
class ListGraphBase {
+ protected:
struct NodeT {
int first_in,first_out;
int prev, next;
@@ -100,11 +101,6 @@
first_free_node(-1), edges(), first_free_edge(-1) {}
- ///Using this it possible to avoid the superfluous memory allocation.
- ///\todo more docs...
- ///\todo It should be defined in ListGraph.
- void reserveEdge(int n) { edges.reserve(n); };
-
/// Maximum node ID.
/// Maximum node ID.
@@ -277,6 +273,32 @@
first_node = first_free_node = first_free_edge = -1;
}
+ protected:
+ void _moveHead(Edge e, Node n)
+ {
+ if(edges[e.id].next_in != -1)
+ edges[edges[e.id].next_in].prev_in = edges[e.id].prev_in;
+ if(edges[e.id].prev_in != -1)
+ edges[edges[e.id].prev_in].next_in = edges[e.id].next_in;
+ else nodes[edges[e.id].head].first_in = edges[e.id].next_in;
+ edges[e.id].head = n.id;
+ edges[e.id].prev_in = -1;
+ edges[e.id].next_in = nodes[n.id].first_in;
+ nodes[n.id].first_in = e.id;
+ }
+ void _moveTail(Edge e, Node n)
+ {
+ if(edges[e.id].next_out != -1)
+ edges[edges[e.id].next_out].prev_out = edges[e.id].prev_out;
+ if(edges[e.id].prev_out != -1)
+ edges[edges[e.id].prev_out].next_out = edges[e.id].next_out;
+ else nodes[edges[e.id].tail].first_out = edges[e.id].next_out;
+ edges[e.id].tail = n.id;
+ edges[e.id].prev_out = -1;
+ edges[e.id].next_out = nodes[n.id].first_out;
+ nodes[n.id].first_out = e.id;
+ }
+
};
typedef AlterableGraphExtender<ListGraphBase> AlterableListGraphBase;
@@ -305,35 +327,19 @@
/// Moves the head of \c e to \c n
///
- void moveHead(Edge e, Node n)
- {
- if(edges[e.n].next_in != -1)
- edges[edges[e.n].next_in].prev_in = edges[e.n].prev_in;
- if(edges[e.n].prev_in != -1)
- edges[edges[e.n].prev_in].next_in = edges[e.n].next_in;
- else nodes[edges[e.n].head].first_in = edges[e.n].next_in;
- edges[e.n].head = n.n;
- edges[e.n].prev_in = -1;
- edges[e.n].next_in = nodes[n.n].first_in;
- nodes[n.n].first_in = e.n;
- }
+ void moveHead(Edge e, Node n) { _moveHead(e,n); }
/// Moves the tail of \c e to \c n
/// Moves the tail of \c e to \c n
///
- void moveTail(Edge e, Node n)
- {
- if(edges[e.n].next_out != -1)
- edges[edges[e.n].next_out].prev_out = edges[e.n].prev_out;
- if(edges[e.n].prev_out != -1)
- edges[edges[e.n].prev_out].next_out = edges[e.n].next_out;
- else nodes[edges[e.n].tail].first_out = edges[e.n].next_out;
- edges[e.n].tail = n.n;
- edges[e.n].prev_out = -1;
- edges[e.n].next_out = nodes[n.n].first_out;
- nodes[n.n].first_out = e.n;
- }
- }
+ void moveTail(Edge e, Node n) { _moveTail(e,n); }
+
+ ///Using this it possible to avoid the superfluous memory allocation.
+ ///\todo more docs...
+ void reserveEdge(int n) { edges.reserve(n); };
+
+ };
+
/// @}
} //namespace lemon
More information about the Lemon-commits
mailing list