lemon/bits/base_extender.h
changeset 274 2a33883915bb
parent 220 a5d8c039f218
child 280 e7f8647ce760
equal deleted inserted replaced
3:6bae9659a203 4:439e04626ef4
    57         Edge(ue), forward(_forward) {}
    57         Edge(ue), forward(_forward) {}
    58 
    58 
    59     public:
    59     public:
    60       Arc() {}
    60       Arc() {}
    61 
    61 
    62       /// Invalid arc constructor
    62       // Invalid arc constructor
    63       Arc(Invalid i) : Edge(i), forward(true) {}
    63       Arc(Invalid i) : Edge(i), forward(true) {}
    64 
    64 
    65       bool operator==(const Arc &that) const {
    65       bool operator==(const Arc &that) const {
    66         return forward==that.forward && Edge(*this)==Edge(that);
    66         return forward==that.forward && Edge(*this)==Edge(that);
    67       }
    67       }
    72         return forward<that.forward ||
    72         return forward<that.forward ||
    73           (!(that.forward<forward) && Edge(*this)<Edge(that));
    73           (!(that.forward<forward) && Edge(*this)<Edge(that));
    74       }
    74       }
    75     };
    75     };
    76 
    76 
    77 
    77     /// First node of the edge
    78 
    78     Node u(const Edge &e) const {
    79     using Parent::source;
    79       return Parent::source(e);
    80 
    80     }
    81     /// Source of the given Arc.
    81 
       
    82     /// Source of the given arc
    82     Node source(const Arc &e) const {
    83     Node source(const Arc &e) const {
    83       return e.forward ? Parent::source(e) : Parent::target(e);
    84       return e.forward ? Parent::source(e) : Parent::target(e);
    84     }
    85     }
    85 
    86 
    86     using Parent::target;
    87     /// Second node of the edge
    87 
    88     Node v(const Edge &e) const {
    88     /// Target of the given Arc.
    89       return Parent::target(e);
       
    90     }
       
    91 
       
    92     /// Target of the given arc
    89     Node target(const Arc &e) const {
    93     Node target(const Arc &e) const {
    90       return e.forward ? Parent::target(e) : Parent::source(e);
    94       return e.forward ? Parent::target(e) : Parent::source(e);
    91     }
    95     }
    92 
    96 
    93     /// \brief Directed arc from an edge.
    97     /// \brief Directed arc from an edge.
    94     ///
    98     ///
    95     /// Returns a directed arc corresponding to the specified Edge.
    99     /// Returns a directed arc corresponding to the specified edge.
    96     /// If the given bool is true the given edge and the
   100     /// If the given bool is true, the first node of the given edge and
    97     /// returned arc have the same source node.
   101     /// the source node of the returned arc are the same.
    98     static Arc direct(const Edge &ue, bool d) {
   102     static Arc direct(const Edge &e, bool d) {
    99       return Arc(ue, d);
   103       return Arc(e, d);
   100     }
   104     }
   101 
   105 
   102     /// Returns whether the given directed arc is same orientation as the
   106     /// Returns whether the given directed arc has the same orientation
   103     /// corresponding edge.
   107     /// as the corresponding edge.
   104     ///
   108     ///
   105     /// \todo reference to the corresponding point of the undirected digraph
   109     /// \todo reference to the corresponding point of the undirected digraph
   106     /// concept. "What does the direction of an edge mean?"
   110     /// concept. "What does the direction of an edge mean?"
   107     static bool direction(const Arc &e) { return e.forward; }
   111     static bool direction(const Arc &a) { return a.forward; }
   108 
       
   109 
   112 
   110     using Parent::first;
   113     using Parent::first;
   111     using Parent::next;
   114     using Parent::next;
   112 
   115 
   113     void first(Arc &e) const {
   116     void first(Arc &e) const {
   226     }
   229     }
   227 
   230 
   228     int maxEdgeId() const {
   231     int maxEdgeId() const {
   229       return Parent::maxArcId();
   232       return Parent::maxArcId();
   230     }
   233     }
   231 
       
   232 
   234 
   233     int arcNum() const {
   235     int arcNum() const {
   234       return 2 * Parent::arcNum();
   236       return 2 * Parent::arcNum();
   235     }
   237     }
   236 
   238