COIN-OR::LEMON - Graph Library

Changeset 786:32baeb8e5c8f in lemon


Ignore:
Timestamp:
09/28/09 12:48:44 (9 years ago)
Author:
Peter Kovacs <kpeter@…>
Branch:
default
Phase:
public
Message:

Modify the implementation of ListDigraph::ArcIt? (#311)

The new implementation is based on out-arc iteration (like
ListGraph::ArcIt?) instead of in-arc iteration to make it
consistent with the documentation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lemon/list_graph.h

    r664 r786  
    117117      int n;
    118118      for(n = first_node;
    119           n!=-1 && nodes[n].first_in == -1;
     119          n != -1 && nodes[n].first_out == -1;
    120120          n = nodes[n].next) {}
    121       arc.id = (n == -1) ? -1 : nodes[n].first_in;
     121      arc.id = (n == -1) ? -1 : nodes[n].first_out;
    122122    }
    123123
    124124    void next(Arc& arc) const {
    125       if (arcs[arc.id].next_in != -1) {
    126         arc.id = arcs[arc.id].next_in;
     125      if (arcs[arc.id].next_out != -1) {
     126        arc.id = arcs[arc.id].next_out;
    127127      } else {
    128128        int n;
    129         for(n = nodes[arcs[arc.id].target].next;
    130             n!=-1 && nodes[n].first_in == -1;
     129        for(n = nodes[arcs[arc.id].source].next;
     130            n != -1 && nodes[n].first_out == -1;
    131131            n = nodes[n].next) {}
    132         arc.id = (n == -1) ? -1 : nodes[n].first_in;
     132        arc.id = (n == -1) ? -1 : nodes[n].first_out;
    133133      }
    134134    }
Note: See TracChangeset for help on using the changeset viewer.