COIN-OR::LEMON - Graph Library

Changeset 916:c0734a8c282c in lemon-0.x


Ignore:
Timestamp:
09/28/04 18:40:55 (16 years ago)
Author:
Balazs Dezso
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1227
Message:

Fix InEdgeIt? and OutEdgeIt? in the symmetric graphs.

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/hugo/list_graph.h

    r911 r916  
    103103        first_free_edge(_g.first_free_edge) {}
    104104   
     105    /// \bug In the vector can be hole if a node is erased from the graph.
    105106    ///Number of nodes.
    106107    int nodeNum() const { return nodes.size(); }
     
    580581      OutEdgeIt() {}
    581582      OutEdgeIt(const SymListGraph& g, Edge e) {
    582         if (e.id & 1 == 0) {   
     583        if ((e.id & 1) == 0) { 
    583584          out = Parent::OutEdgeIt(g, SymEdge(e));
    584585          in = Parent::InEdgeIt(g, g.tail(e));
     
    617618      InEdgeIt() {}
    618619      InEdgeIt(const SymListGraph& g, Edge e) {
    619         if (e.id & 1 == 0) {   
     620        if ((e.id & 1) == 0) { 
    620621          out = Parent::OutEdgeIt(g, SymEdge(e));
    621622          in = Parent::InEdgeIt(g, g.tail(e));
     
    733734
    734735    Node tail(Edge e) const {
    735       return e.id & 1 == 0 ?
     736      return (e.id & 1) == 0 ?
    736737        Parent::tail(SymEdge(e)) : Parent::head(SymEdge(e));
    737738    }
    738739
    739740    Node head(Edge e) const {
    740       return e.id & 1 == 0 ?
     741      return (e.id & 1) == 0 ?
    741742        Parent::head(SymEdge(e)) : Parent::tail(SymEdge(e));
    742743    }
     
    823824    }
    824825
    825     /// Finds an symmetric edge between two nodes.
    826 
    827     /// Finds an symmetric edge from node \c u to node \c v.
    828     ///
    829     /// If \c prev is \ref INVALID (this is the default value), then
    830     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    831     /// the next edge from \c u to \c v after \c prev.
    832     /// \return The found edge or INVALID if there is no such an edge.
     826//     /// Finds an symmetric edge between two nodes.
     827
     828//     /// Finds an symmetric edge from node \c u to node \c v.
     829//     ///
     830//     /// If \c prev is \ref INVALID (this is the default value), then
     831//     /// It finds the first edge from \c u to \c v. Otherwise it looks for
     832//     /// the next edge from \c u to \c v after \c prev.
     833//     /// \return The found edge or INVALID if there is no such an edge.
    833834
    834835//     SymEdge findEdge(Node u, Node v, SymEdge prev = INVALID)
     
    874875
    875876    static Edge backward(SymEdge e) {
    876       return Edge((id(e) << 1) & 1);
     877      return Edge((id(e) << 1) | 1);
    877878    }
    878879
  • src/hugo/smart_graph.h

    r909 r916  
    395395      OutEdgeIt() {}
    396396      OutEdgeIt(const SymSmartGraph& g, Edge e) {
    397         if (e.id & 1 == 0) {   
     397        if ((e.id & 1) == 0) { 
    398398          out = Parent::OutEdgeIt(g, SymEdge(e));
    399399          in = Parent::InEdgeIt(g, g.tail(e));
     
    432432      InEdgeIt() {}
    433433      InEdgeIt(const SymSmartGraph& g, Edge e) {
    434         if (e.id & 1 == 0) {   
     434        if ((e.id & 1) == 0) { 
    435435          out = Parent::OutEdgeIt(g, SymEdge(e));
    436436          in = Parent::InEdgeIt(g, g.tail(e));
     
    541541
    542542    Node tail(Edge e) const {
    543       return e.id & 1 == 0 ?
     543      return (e.id & 1) == 0 ?
    544544        Parent::tail(SymEdge(e)) : Parent::head(SymEdge(e));
    545545    }
    546546
    547547    Node head(Edge e) const {
    548       return e.id & 1 == 0 ?
     548      return (e.id & 1) == 0 ?
    549549        Parent::head(SymEdge(e)) : Parent::tail(SymEdge(e));
    550550    }
     
    631631    }
    632632
    633     /// Finds an symmetric edge between two nodes.
    634 
    635     /// Finds an symmetric edge from node \c u to node \c v.
    636     ///
    637     /// If \c prev is \ref INVALID (this is the default value), then
    638     /// It finds the first edge from \c u to \c v. Otherwise it looks for
    639     /// the next edge from \c u to \c v after \c prev.
    640     /// \return The found edge or INVALID if there is no such an edge.
     633//     /// Finds an symmetric edge between two nodes.
     634
     635//     /// Finds an symmetric edge from node \c u to node \c v.
     636//     ///
     637//     /// If \c prev is \ref INVALID (this is the default value), then
     638//     /// It finds the first edge from \c u to \c v. Otherwise it looks for
     639//     /// the next edge from \c u to \c v after \c prev.
     640//     /// \return The found edge or INVALID if there is no such an edge.
    641641
    642642//     SymEdge findEdge(Node u, Node v, SymEdge prev = INVALID)
     
    668668
    669669    static Edge backward(SymEdge e) {
    670       return Edge((id(e) << 1) & 1);
     670      return Edge((id(e) << 1) | 1);
    671671    }
    672672
  • src/test/graph_test.h

    r906 r916  
    299299      for(int i=0;i<nn;i++) {
    300300        check(e!=INVALID,"Wrong OutEdge list linking.");
     301        check(n==G.tail(e), "Wrong OutEdge list linking.");
    301302        ++e;
    302303      }
     
    311312      for(int i=0;i<nn;i++) {
    312313        check(e!=INVALID,"Wrong InEdge list linking.");
     314        check(n==G.head(e), "Wrong InEdge list linking.");
    313315        ++e;
    314316      }
Note: See TracChangeset for help on using the changeset viewer.