1.1 --- a/src/lemon/list_graph.h Sat Nov 13 12:24:01 2004 +0000
1.2 +++ b/src/lemon/list_graph.h Sat Nov 13 12:53:28 2004 +0000
1.3 @@ -43,7 +43,7 @@
1.4 };
1.5
1.6 struct EdgeT {
1.7 - int head, tail;
1.8 + int target, source;
1.9 int prev_in, prev_out;
1.10 int next_in, next_out;
1.11 };
1.12 @@ -111,8 +111,8 @@
1.13 ///\sa id(Edge)
1.14 int maxId(Edge = INVALID) const { return edges.size()-1; }
1.15
1.16 - Node tail(Edge e) const { return edges[e.id].tail; }
1.17 - Node head(Edge e) const { return edges[e.id].head; }
1.18 + Node source(Edge e) const { return edges[e.id].source; }
1.19 + Node target(Edge e) const { return edges[e.id].target; }
1.20
1.21
1.22 void first(Node& node) const {
1.23 @@ -137,7 +137,7 @@
1.24 edge.id = edges[edge.id].next_in;
1.25 } else {
1.26 int n;
1.27 - for(n = nodes[edges[edge.id].head].next;
1.28 + for(n = nodes[edges[edge.id].target].next;
1.29 n!=-1 && nodes[n].first_in == -1;
1.30 n = nodes[n].next);
1.31 edge.id = (n == -1) ? -1 : nodes[n].first_in;
1.32 @@ -198,8 +198,8 @@
1.33 first_free_edge = edges[n].next_in;
1.34 }
1.35
1.36 - edges[n].tail = u.id;
1.37 - edges[n].head = v.id;
1.38 + edges[n].source = u.id;
1.39 + edges[n].target = v.id;
1.40
1.41 edges[n].next_out = nodes[u.id].first_out;
1.42 if(nodes[u.id].first_out != -1) {
1.43 @@ -246,7 +246,7 @@
1.44 if(edges[n].prev_in!=-1) {
1.45 edges[edges[n].prev_in].next_in = edges[n].next_in;
1.46 } else {
1.47 - nodes[edges[n].head].first_in = edges[n].next_in;
1.48 + nodes[edges[n].target].first_in = edges[n].next_in;
1.49 }
1.50
1.51
1.52 @@ -257,7 +257,7 @@
1.53 if(edges[n].prev_out!=-1) {
1.54 edges[edges[n].prev_out].next_out = edges[n].next_out;
1.55 } else {
1.56 - nodes[edges[n].tail].first_out = edges[n].next_out;
1.57 + nodes[edges[n].source].first_out = edges[n].next_out;
1.58 }
1.59
1.60 edges[n].next_in = first_free_edge;
1.61 @@ -272,26 +272,26 @@
1.62 }
1.63
1.64 protected:
1.65 - void _moveHead(Edge e, Node n)
1.66 + void _moveTarget(Edge e, Node n)
1.67 {
1.68 if(edges[e.id].next_in != -1)
1.69 edges[edges[e.id].next_in].prev_in = edges[e.id].prev_in;
1.70 if(edges[e.id].prev_in != -1)
1.71 edges[edges[e.id].prev_in].next_in = edges[e.id].next_in;
1.72 - else nodes[edges[e.id].head].first_in = edges[e.id].next_in;
1.73 - edges[e.id].head = n.id;
1.74 + else nodes[edges[e.id].target].first_in = edges[e.id].next_in;
1.75 + edges[e.id].target = n.id;
1.76 edges[e.id].prev_in = -1;
1.77 edges[e.id].next_in = nodes[n.id].first_in;
1.78 nodes[n.id].first_in = e.id;
1.79 }
1.80 - void _moveTail(Edge e, Node n)
1.81 + void _moveSource(Edge e, Node n)
1.82 {
1.83 if(edges[e.id].next_out != -1)
1.84 edges[edges[e.id].next_out].prev_out = edges[e.id].prev_out;
1.85 if(edges[e.id].prev_out != -1)
1.86 edges[edges[e.id].prev_out].next_out = edges[e.id].next_out;
1.87 - else nodes[edges[e.id].tail].first_out = edges[e.id].next_out;
1.88 - edges[e.id].tail = n.id;
1.89 + else nodes[edges[e.id].source].first_out = edges[e.id].next_out;
1.90 + edges[e.id].source = n.id;
1.91 edges[e.id].prev_out = -1;
1.92 edges[e.id].next_out = nodes[n.id].first_out;
1.93 nodes[n.id].first_out = e.id;
1.94 @@ -320,16 +320,16 @@
1.95 class ListGraph : public ErasableListGraphBase
1.96 {
1.97 public:
1.98 - /// Moves the head of \c e to \c n
1.99 + /// Moves the target of \c e to \c n
1.100
1.101 - /// Moves the head of \c e to \c n
1.102 + /// Moves the target of \c e to \c n
1.103 ///
1.104 - void moveHead(Edge e, Node n) { _moveHead(e,n); }
1.105 - /// Moves the tail of \c e to \c n
1.106 + void moveTarget(Edge e, Node n) { _moveTarget(e,n); }
1.107 + /// Moves the source of \c e to \c n
1.108
1.109 - /// Moves the tail of \c e to \c n
1.110 + /// Moves the source of \c e to \c n
1.111 ///
1.112 - void moveTail(Edge e, Node n) { _moveTail(e,n); }
1.113 + void moveSource(Edge e, Node n) { _moveSource(e,n); }
1.114
1.115 ///Using this it possible to avoid the superfluous memory allocation.
1.116 ///\todo more docs...