An empty Graph class.
authoralpar
Tue, 03 Feb 2004 12:41:29 +0000
changeset 52a4fc9c5dcee5
parent 51 41133bd4ed94
child 53 cc5eb73a3a93
An empty Graph class.
src/work/alpar/emptygraph.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/work/alpar/emptygraph.h	Tue Feb 03 12:41:29 2004 +0000
     1.3 @@ -0,0 +1,72 @@
     1.4 +// -*-mode: c++; -*-
     1.5 +
     1.6 +template <class N, class E>
     1.7 +class Graph
     1.8 +{
     1.9 +public:
    1.10 +  typedef E EdgeType;
    1.11 +  typedef N NodeType;
    1.12 +  
    1.13 +  class EdgeIt {};
    1.14 +  
    1.15 +  class InEdgeIt : public EdgeIt
    1.16 +  class OutEdgeIt : public EdgeIt {};
    1.17 +  class SymEdgeIt : public EdgeIt {};
    1.18 +  class EachEdgeIt : public EdgeIt {};
    1.19 +
    1.20 +  class NodeIt {};
    1.21 +    
    1.22 +  NodeIt &getFirst(NodeIt &);
    1.23 +  InEdgeIt &getFirst(InEdgeIt &,const NodeIt &);
    1.24 +  OutEdgeIt &getFirst(OutEdgeIt &,const NodeIt &);
    1.25 +  SymEdgeIt &getFirst(SymEdgeIt &,const NodeIt &);
    1.26 +  EachEdgeIt &getFirst(EachEdgeIt &);
    1.27 +
    1.28 +  NodeIt next(const NodeIt &);
    1.29 +  InEdgeIt next(const InEdgeIt &);
    1.30 +  OutEdgeIt next(const OutEdgeIt &);
    1.31 +  SymEdgeIt next(const SymEdgeIt &);
    1.32 +  EachEdgeIt next(const EachEdgeIt &);
    1.33 +
    1.34 +  NodeIt &goNext(const NodeIt &);
    1.35 +  InEdgeIt &goNext(const InEdgeIt &);
    1.36 +  OutEdgeIt &goNext(const OutEdgeIt &);
    1.37 +  SymEdgeIt &goNext(const SymEdgeIt &);
    1.38 +  EachEdgeIt &goNext(const EachEdgeIt &);
    1.39 +
    1.40 +  bool valid(const NodeIt &n);
    1.41 +  bool valid(const EdgeIt &n);
    1.42 +
    1.43 +  void setInvalid(const NodeIt &n);
    1.44 +  void setInvalid(const EdgeIt &n);
    1.45 +  
    1.46 +  NodeIt addNode();
    1.47 +  EdgeIt addEdge(const NodeIt from,const NodeIt to);
    1.48 +    
    1.49 +  void delete(NodeIt n);
    1.50 +  void delete(EdgeIt e);
    1.51 +
    1.52 +  void clean();
    1.53 +
    1.54 +  template<class T> class NodeMap
    1.55 +  {
    1.56 +  public:
    1.57 +    typedef T value_type;
    1.58 +    void set(const NodeIt i, const T &t);
    1.59 +    T get(const NodeIt i) const;
    1.60 +    T operator[](const NodeIt i);
    1.61 +      
    1.62 +    NodeMap(const Graph &G);
    1.63 +  };
    1.64 +
    1.65 +  template<class T> class EdgeMap
    1.66 +  {
    1.67 +  public:
    1.68 +    typedef T value_type;
    1.69 +    void set(const EdgeIt i, const T &t);
    1.70 +    T get(const EdgeIt i) const;
    1.71 +    T operator[](const EdgeIt i);
    1.72 +      
    1.73 +    EdgeMap(const Graph &G);
    1.74 +  };
    1.75 +};