COIN-OR::LEMON - Graph Library

Changeset 985:741f3108a90f in lemon-0.x


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

Bugfixes in UndirFullGraphBase?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lemon/full_graph.h

    r984 r985  
    297297     
    298298    class Node {
    299       friend class FullGraphBase;
     299      friend class UndirFullGraphBase;
    300300
    301301    protected:
     
    313313
    314314    class Edge {
    315       friend class FullGraphBase;
     315      friend class UndirFullGraphBase;
    316316     
    317317    protected:
     
    320320      Edge(int _id) : id(_id) {}
    321321
    322       Edge(const FullGraphBase& _graph, int tail, int head)
     322      Edge(const UndirFullGraphBase& _graph, int tail, int head)
    323323        : id(_graph.NodeNum * head+tail) {}
    324324    public:
     
    351351
    352352    /// \todo with specialized iterators we can make faster iterating
    353     void nextOut(Edge& edge) const {
     353    void nextOut(Edge& e) const {
    354354      int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;;
    355355      int head = e.id - (tail) * (tail - 1) / 2;
    356356      ++head;
    357       return head < tail ? tail * (tail - 1) / 2 + head : -1;
     357      e.id = head < tail ? tail * (tail - 1) / 2 + head : -1;
    358358    }
    359359
     
    362362    }
    363363   
    364     void nextIn(Edge& edge) const {
     364    void nextIn(Edge& e) const {
    365365      int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;;
    366366      int head = e.id - (tail) * (tail - 1) / 2; ++head;
    367367      ++tail;
    368       return tail < nodeNum ? tail * (tail - 1) / 2 + head : -1;
     368      e.id = tail < NodeNum ? tail * (tail - 1) / 2 + head : -1;
    369369    }
    370370
Note: See TracChangeset for help on using the changeset viewer.