1.1 --- a/src/lemon/graph_wrapper.h Sat Nov 13 12:24:01 2004 +0000
1.2 +++ b/src/lemon/graph_wrapper.h Sat Nov 13 12:53:28 2004 +0000
1.3 @@ -150,19 +150,19 @@
1.4 void nextIn(Edge& i) const { graph->nextIn(i); }
1.5 void nextOut(Edge& i) const { graph->nextOut(i); }
1.6
1.7 - Node tail(const Edge& e) const { return graph->tail(e); }
1.8 - Node head(const Edge& e) const { return graph->head(e); }
1.9 -// Node tail(const Edge& e) const {
1.10 -// return Node(graph->tail(static_cast<typename Graph::Edge>(e))); }
1.11 -// Node head(const Edge& e) const {
1.12 -// return Node(graph->head(static_cast<typename Graph::Edge>(e))); }
1.13 + Node source(const Edge& e) const { return graph->source(e); }
1.14 + Node target(const Edge& e) const { return graph->target(e); }
1.15 +// Node source(const Edge& e) const {
1.16 +// return Node(graph->source(static_cast<typename Graph::Edge>(e))); }
1.17 +// Node target(const Edge& e) const {
1.18 +// return Node(graph->target(static_cast<typename Graph::Edge>(e))); }
1.19
1.20 int nodeNum() const { return graph->nodeNum(); }
1.21 int edgeNum() const { return graph->edgeNum(); }
1.22
1.23 Node addNode() const { return Node(graph->addNode()); }
1.24 - Edge addEdge(const Node& tail, const Node& head) const {
1.25 - return Edge(graph->addEdge(tail, head)); }
1.26 + Edge addEdge(const Node& source, const Node& target) const {
1.27 + return Edge(graph->addEdge(source, target)); }
1.28
1.29 void erase(const Node& i) const { graph->erase(i); }
1.30 void erase(const Edge& i) const { graph->erase(i); }
1.31 @@ -290,10 +290,10 @@
1.32 i=InEdgeIt(*this, p); return i;
1.33 }
1.34
1.35 - Node tail(const Edge& e) const {
1.36 - return GraphWrapper<Graph>::head(e); }
1.37 - Node head(const Edge& e) const {
1.38 - return GraphWrapper<Graph>::tail(e); }
1.39 + Node source(const Edge& e) const {
1.40 + return GraphWrapper<Graph>::target(e); }
1.41 + Node target(const Edge& e) const {
1.42 + return GraphWrapper<Graph>::source(e); }
1.43
1.44 // KEEP_MAPS(Parent, RevGraphWrapper);
1.45
1.46 @@ -625,10 +625,10 @@
1.47
1.48 readDimacs(std::cin, g, length, s, t);
1.49
1.50 - cout << "edges with lengths (of form id, tail--length->head): " << endl;
1.51 + cout << "edges with lengths (of form id, source--length->target): " << endl;
1.52 for(EdgeIt e(g); e!=INVALID; ++e)
1.53 - cout << g.id(e) << ", " << g.id(g.tail(e)) << "--"
1.54 - << length[e] << "->" << g.id(g.head(e)) << endl;
1.55 + cout << g.id(e) << ", " << g.id(g.source(e)) << "--"
1.56 + << length[e] << "->" << g.id(g.target(e)) << endl;
1.57
1.58 cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
1.59 \endcode
1.60 @@ -665,12 +665,12 @@
1.61 << endl;
1.62 for(EdgeIt e(g); e!=INVALID; ++e)
1.63 if (flow[e])
1.64 - cout << " " << g.id(g.tail(e)) << "--"
1.65 - << length[e] << "->" << g.id(g.head(e)) << endl;
1.66 + cout << " " << g.id(g.source(e)) << "--"
1.67 + << length[e] << "->" << g.id(g.target(e)) << endl;
1.68 \endcode
1.69 The program has the following (expected :-)) output:
1.70 \code
1.71 - edges with lengths (of form id, tail--length->head):
1.72 + edges with lengths (of form id, source--length->target):
1.73 9, 5--4->6
1.74 8, 4--2->6
1.75 7, 3--1->5
1.76 @@ -756,7 +756,7 @@
1.77
1.78 OutEdgeIt& next(OutEdgeIt& e) const {
1.79 if (e.out_or_in) {
1.80 - typename Graph::Node n=this->graph->tail(e.out);
1.81 + typename Graph::Node n=this->graph->source(e.out);
1.82 this->graph->next(e.out);
1.83 if (!this->graph->valid(e.out)) {
1.84 e.out_or_in=false; this->graph->first(e.in, n); }
1.85 @@ -767,11 +767,11 @@
1.86 }
1.87
1.88 Node aNode(const OutEdgeIt& e) const {
1.89 - if (e.out_or_in) return this->graph->tail(e); else
1.90 - return this->graph->head(e); }
1.91 + if (e.out_or_in) return this->graph->source(e); else
1.92 + return this->graph->target(e); }
1.93 Node bNode(const OutEdgeIt& e) const {
1.94 - if (e.out_or_in) return this->graph->head(e); else
1.95 - return this->graph->tail(e); }
1.96 + if (e.out_or_in) return this->graph->target(e); else
1.97 + return this->graph->source(e); }
1.98
1.99 // KEEP_MAPS(Parent, UndirGraphWrapper);
1.100
1.101 @@ -937,7 +937,7 @@
1.102 Edge(e), gw(&_gw) { }
1.103 OutEdgeIt& operator++() {
1.104 if (!this->backward) {
1.105 - Node n=gw->tail(*this);
1.106 + Node n=gw->source(*this);
1.107 *(static_cast<GraphEdge*>(this))=
1.108 ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
1.109 while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.110 @@ -994,7 +994,7 @@
1.111 Edge(e), gw(&_gw) { }
1.112 InEdgeIt& operator++() {
1.113 if (!this->backward) {
1.114 - Node n=gw->tail(*this);
1.115 + Node n=gw->source(*this);
1.116 *(static_cast<GraphEdge*>(this))=
1.117 ++(typename Graph::InEdgeIt(*(gw->graph), *this));
1.118 while (*static_cast<GraphEdge*>(this)!=INVALID &&
1.119 @@ -1089,10 +1089,10 @@
1.120 // }
1.121
1.122
1.123 - Node tail(Edge e) const {
1.124 - return ((!e.backward) ? this->graph->tail(e) : this->graph->head(e)); }
1.125 - Node head(Edge e) const {
1.126 - return ((!e.backward) ? this->graph->head(e) : this->graph->tail(e)); }
1.127 + Node source(Edge e) const {
1.128 + return ((!e.backward) ? this->graph->source(e) : this->graph->target(e)); }
1.129 + Node target(Edge e) const {
1.130 + return ((!e.backward) ? this->graph->target(e) : this->graph->source(e)); }
1.131
1.132 /// Gives back the opposite edge.
1.133 Edge opposite(const Edge& e) const {
1.134 @@ -1413,7 +1413,7 @@
1.135 // i=OutEdgeIt(*this, p); return i;
1.136 // }
1.137 void erase(const Edge& e) const {
1.138 - Node n=tail(e);
1.139 + Node n=source(e);
1.140 typename Graph::OutEdgeIt f(*Parent::graph, n);
1.141 ++f;
1.142 first_out_edges->set(n, f);