COIN-OR::LEMON - Graph Library

Changeset 1060:7a24bb2e7480 in lemon-0.x for src/lemon


Ignore:
Timestamp:
01/07/05 19:53:02 (19 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1456
Message:

Nasty bug in undir_graph_extender.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/undir_graph_extender.h

    r1054 r1060  
    141141    template <typename E>
    142142    void _dirFirstOut(E &e, const Node &n) const {
     143      Parent::firstIn(e,n);
     144      if( UndirEdge(e) != INVALID ) {
     145        e.forward = false;
     146      }
     147      else {
     148        Parent::firstOut(e,n);
     149        e.forward = true;
     150      }
     151    }
     152    template <typename E>
     153    void _dirFirstIn(E &e, const Node &n) const {
    143154      Parent::firstOut(e,n);
    144155      if( UndirEdge(e) != INVALID ) {
     156        e.forward = false;
     157      }
     158      else {
     159        Parent::firstIn(e,n);
    145160        e.forward = true;
    146161      }
    147       else {
    148         Parent::firstIn(e,n);
    149         e.forward = false;
    150       }
    151     }
    152     template <typename E>
    153     void _dirFirstIn(E &e, const Node &n) const {
    154       Parent::firstIn(e,n);
    155       if( UndirEdge(e) != INVALID ) {
    156         e.forward = true;
    157       }
    158       else {
    159         Parent::firstOut(e,n);
    160         e.forward = false;
    161       }
    162162    }
    163163
    164164    template <typename E>
    165165    void _dirNextOut(E &e) const {
    166       if( e.forward ) {
     166      if( ! e.forward ) {
     167        Node n = Parent::target(e);
     168        Parent::nextIn(e);
     169        if( UndirEdge(e) == INVALID ) {
     170          Parent::firstOut(e, n);
     171          e.forward = true;
     172        }
     173      }
     174      else {
     175        Parent::nextOut(e);
     176      }
     177    }
     178    template <typename E>
     179    void _dirNextIn(E &e) const {
     180      if( ! e.forward ) {
     181        Node n = Parent::source(e);
    167182        Parent::nextOut(e);
    168183        if( UndirEdge(e) == INVALID ) {
    169           Parent::firstIn(e, Parent::source(e));
    170           e.forward = false;
     184          Parent::firstIn(e, n);
     185          e.forward = true;
    171186        }
    172187      }
    173188      else {
    174189        Parent::nextIn(e);
    175       }
    176     }
    177     template <typename E>
    178     void _dirNextIn(E &e) const {
    179       if( e.forward ) {
    180         Parent::nextIn(e);
    181         if( UndirEdge(e) == INVALID ) {
    182           Parent::firstOut(e, Parent::target(e));
    183           e.forward = false;
    184         }
    185       }
    186       else {
    187         Parent::nextOut(e);
    188190      }
    189191    }
     
    227229
    228230
    229     int maxId(Node n) const {
     231    int maxId(Node) const {
    230232      return Parent::maxId(Node());
    231233    }
Note: See TracChangeset for help on using the changeset viewer.