COIN-OR::LEMON - Graph Library

Changeset 129:1630a5b631c8 in lemon-0.x


Ignore:
Timestamp:
02/25/04 16:26:39 (20 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@176
Message:

setInvalid() functions added.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/work/alpar/smart_graph.h

    r116 r129  
    66#include <iostream>
    77#include <vector>
     8#include <limits.h>
    89
    910namespace hugo {
     
    1112  class SmartGraph {
    1213
    13     static const int INVALID=-1;
     14    static const int INVALID_EDGE=-1;
     15    static const int INVALID_NODE=INT_MAX;
    1416
    1517    struct NodeT
    1618    {
    1719      int first_in,first_out;     
    18       NodeT() : first_in(INVALID), first_out(INVALID) {}
     20      NodeT() : first_in(INVALID_EDGE), first_out(INVALID_EDGE) {}
    1921    };
    2022    struct EdgeT
     
    2224      int head, tail, next_in, next_out;     
    2325      //FIXME: is this necessary?
    24       EdgeT() : next_in(INVALID), next_out(INVALID) {} 
     26      EdgeT() : next_in(INVALID_EDGE), next_out(INVALID_EDGE) {} 
    2527    };
    2628
    2729    std::vector<NodeT> nodes;
     30
    2831    std::vector<EdgeT> edges;
    2932   
     
    124127    }
    125128
    126     bool valid(EdgeIt e) const { return e.n!=INVALID; }
     129    bool valid(EdgeIt e) const { return e.n!=INVALID_EDGE; }
    127130    bool valid(EachEdgeIt e) const { return e.n<int(edges.size()); }
    128131    bool valid(NodeIt n) const { return n.n<int(nodes.size()); }
     132   
     133    void setInvalid(EdgeIt &e) { e.n=INVALID_EDGE; }
     134    void setInvalid(NodeIt &e) { e.n=INVALID_NODE; }
    129135   
    130136    template <typename It> It next(It it) const
Note: See TracChangeset for help on using the changeset viewer.