COIN-OR::LEMON - Graph Library

Changeset 986:e997802b855c in lemon-0.x for src/lemon/graph_wrapper.h


Ignore:
Timestamp:
11/13/04 13:53:28 (16 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1376
Message:

Naming changes:

  • head -> target
  • tail -> source
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/graph_wrapper.h

    r970 r986  
    151151    void nextOut(Edge& i) const { graph->nextOut(i); }
    152152
    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))); }
    159159
    160160    int nodeNum() const { return graph->nodeNum(); }
     
    162162 
    163163    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)); }
    166166
    167167    void erase(const Node& i) const { graph->erase(i); }
     
    291291    }
    292292
    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); }
    297297
    298298    //    KEEP_MAPS(Parent, RevGraphWrapper);
     
    626626  readDimacs(std::cin, g, length, s, t);
    627627
    628   cout << "edges with lengths (of form id, tail--length->head): " << endl;
     628  cout << "edges with lengths (of form id, source--length->target): " << endl;
    629629  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;
    632632
    633633  cout << "s: " << g.id(s) << " t: " << g.id(t) << endl;
     
    666666  for(EdgeIt e(g); e!=INVALID; ++e)
    667667    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;
    670670  \endcode
    671671  The program has the following (expected :-)) output:
    672672  \code
    673   edges with lengths (of form id, tail--length->head):
     673  edges with lengths (of form id, source--length->target):
    674674   9, 5--4->6
    675675   8, 4--2->6
     
    757757    OutEdgeIt& next(OutEdgeIt& e) const {
    758758      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);
    760760        this->graph->next(e.out);
    761761        if (!this->graph->valid(e.out)) {
     
    768768
    769769    Node aNode(const OutEdgeIt& e) const {
    770       if (e.out_or_in) return this->graph->tail(e); else
    771         return this->graph->head(e); }
     770      if (e.out_or_in) return this->graph->source(e); else
     771        return this->graph->target(e); }
    772772    Node bNode(const OutEdgeIt& e) const {
    773       if (e.out_or_in) return this->graph->head(e); else
    774         return this->graph->tail(e); }
     773      if (e.out_or_in) return this->graph->target(e); else
     774        return this->graph->source(e); }
    775775
    776776    //    KEEP_MAPS(Parent, UndirGraphWrapper);
     
    938938      OutEdgeIt& operator++() {
    939939        if (!this->backward) {
    940           Node n=gw->tail(*this);
     940          Node n=gw->source(*this);
    941941          *(static_cast<GraphEdge*>(this))=
    942942            ++(typename Graph::OutEdgeIt(*(gw->graph), *this));
     
    995995      InEdgeIt& operator++() {
    996996        if (!this->backward) {
    997           Node n=gw->tail(*this);
     997          Node n=gw->source(*this);
    998998          *(static_cast<GraphEdge*>(this))=
    999999            ++(typename Graph::InEdgeIt(*(gw->graph), *this));
     
    10901090 
    10911091
    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)); }
    10961096
    10971097    /// Gives back the opposite edge.
     
    14141414//     }
    14151415    void erase(const Edge& e) const {
    1416       Node n=tail(e);
     1416      Node n=source(e);
    14171417      typename Graph::OutEdgeIt f(*Parent::graph, n);
    14181418      ++f;
Note: See TracChangeset for help on using the changeset viewer.