Changeset 986:e997802b855c in lemon0.x for src/lemon/graph_wrapper.h
 Timestamp:
 11/13/04 13:53:28 (19 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1376
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/graph_wrapper.h
r970 r986 151 151 void nextOut(Edge& i) const { graph>nextOut(i); } 152 152 153 Node tail(const Edge& e) const { return graph>tail(e); }154 Node head(const Edge& e) const { return graph>head(e); }155 // Node tail(const Edge& e) const {156 // return Node(graph> tail(static_cast<typename Graph::Edge>(e))); }157 // Node head(const Edge& e) const {158 // return Node(graph> head(static_cast<typename Graph::Edge>(e))); }153 Node source(const Edge& e) const { return graph>source(e); } 154 Node target(const Edge& e) const { return graph>target(e); } 155 // Node source(const Edge& e) const { 156 // return Node(graph>source(static_cast<typename Graph::Edge>(e))); } 157 // Node target(const Edge& e) const { 158 // return Node(graph>target(static_cast<typename Graph::Edge>(e))); } 159 159 160 160 int nodeNum() const { return graph>nodeNum(); } … … 162 162 163 163 Node addNode() const { return Node(graph>addNode()); } 164 Edge addEdge(const Node& tail, const Node& head) const {165 return Edge(graph>addEdge( tail, head)); }164 Edge addEdge(const Node& source, const Node& target) const { 165 return Edge(graph>addEdge(source, target)); } 166 166 167 167 void erase(const Node& i) const { graph>erase(i); } … … 291 291 } 292 292 293 Node tail(const Edge& e) const {294 return GraphWrapper<Graph>:: head(e); }295 Node head(const Edge& e) const {296 return GraphWrapper<Graph>:: tail(e); }293 Node source(const Edge& e) const { 294 return GraphWrapper<Graph>::target(e); } 295 Node target(const Edge& e) const { 296 return GraphWrapper<Graph>::source(e); } 297 297 298 298 // KEEP_MAPS(Parent, RevGraphWrapper); … … 626 626 readDimacs(std::cin, g, length, s, t); 627 627 628 cout << "edges with lengths (of form id, taillength>head): " << endl;628 cout << "edges with lengths (of form id, sourcelength>target): " << endl; 629 629 for(EdgeIt e(g); e!=INVALID; ++e) 630 cout << g.id(e) << ", " << g.id(g. tail(e)) << ""631 << length[e] << ">" << g.id(g. head(e)) << endl;630 cout << g.id(e) << ", " << g.id(g.source(e)) << "" 631 << length[e] << ">" << g.id(g.target(e)) << endl; 632 632 633 633 cout << "s: " << g.id(s) << " t: " << g.id(t) << endl; … … 666 666 for(EdgeIt e(g); e!=INVALID; ++e) 667 667 if (flow[e]) 668 cout << " " << g.id(g. tail(e)) << ""669 << length[e] << ">" << g.id(g. head(e)) << endl;668 cout << " " << g.id(g.source(e)) << "" 669 << length[e] << ">" << g.id(g.target(e)) << endl; 670 670 \endcode 671 671 The program has the following (expected :)) output: 672 672 \code 673 edges with lengths (of form id, taillength>head):673 edges with lengths (of form id, sourcelength>target): 674 674 9, 54>6 675 675 8, 42>6 … … 757 757 OutEdgeIt& next(OutEdgeIt& e) const { 758 758 if (e.out_or_in) { 759 typename Graph::Node n=this>graph> tail(e.out);759 typename Graph::Node n=this>graph>source(e.out); 760 760 this>graph>next(e.out); 761 761 if (!this>graph>valid(e.out)) { … … 768 768 769 769 Node aNode(const OutEdgeIt& e) const { 770 if (e.out_or_in) return this>graph> tail(e); else771 return this>graph> head(e); }770 if (e.out_or_in) return this>graph>source(e); else 771 return this>graph>target(e); } 772 772 Node bNode(const OutEdgeIt& e) const { 773 if (e.out_or_in) return this>graph> head(e); else774 return this>graph> tail(e); }773 if (e.out_or_in) return this>graph>target(e); else 774 return this>graph>source(e); } 775 775 776 776 // KEEP_MAPS(Parent, UndirGraphWrapper); … … 938 938 OutEdgeIt& operator++() { 939 939 if (!this>backward) { 940 Node n=gw> tail(*this);940 Node n=gw>source(*this); 941 941 *(static_cast<GraphEdge*>(this))= 942 942 ++(typename Graph::OutEdgeIt(*(gw>graph), *this)); … … 995 995 InEdgeIt& operator++() { 996 996 if (!this>backward) { 997 Node n=gw> tail(*this);997 Node n=gw>source(*this); 998 998 *(static_cast<GraphEdge*>(this))= 999 999 ++(typename Graph::InEdgeIt(*(gw>graph), *this)); … … 1090 1090 1091 1091 1092 Node tail(Edge e) const {1093 return ((!e.backward) ? this>graph> tail(e) : this>graph>head(e)); }1094 Node head(Edge e) const {1095 return ((!e.backward) ? this>graph> head(e) : this>graph>tail(e)); }1092 Node source(Edge e) const { 1093 return ((!e.backward) ? this>graph>source(e) : this>graph>target(e)); } 1094 Node target(Edge e) const { 1095 return ((!e.backward) ? this>graph>target(e) : this>graph>source(e)); } 1096 1096 1097 1097 /// Gives back the opposite edge. … … 1414 1414 // } 1415 1415 void erase(const Edge& e) const { 1416 Node n= tail(e);1416 Node n=source(e); 1417 1417 typename Graph::OutEdgeIt f(*Parent::graph, n); 1418 1418 ++f;
Note: See TracChangeset
for help on using the changeset viewer.