New graph interface
authoralpar
Wed, 10 Mar 2004 17:47:54 +0000
changeset 164970b265696b0
parent 163 c5fbd2c1d75f
child 165 9b078bc3ce13
New graph interface
src/work/alpar/smart_graph.h
src/work/alpar/smart_graph_demo.cc
     1.1 --- a/src/work/alpar/smart_graph.h	Wed Mar 10 16:46:17 2004 +0000
     1.2 +++ b/src/work/alpar/smart_graph.h	Wed Mar 10 17:47:54 2004 +0000
     1.3 @@ -6,7 +6,7 @@
     1.4  #include <vector>
     1.5  #include <limits.h>
     1.6  
     1.7 -struct _Invalid {} Invalid;
     1.8 +#include <invalid.h>
     1.9  
    1.10  namespace hugo {
    1.11  
    1.12 @@ -46,27 +46,27 @@
    1.13      template <typename T> class DynEdgeMap;
    1.14      template <typename T> class DynEdgeMap;
    1.15  
    1.16 -    class NodeIt;
    1.17 -    class EdgeIt;
    1.18 +    class Node;
    1.19 +    class Edge;
    1.20  
    1.21    protected:
    1.22 -    mutable std::vector<DynMapBase<NodeIt> * > dyn_node_maps;
    1.23 -    mutable std::vector<DynMapBase<EdgeIt> * > dyn_edge_maps;
    1.24 +    mutable std::vector<DynMapBase<Node> * > dyn_node_maps;
    1.25 +    mutable std::vector<DynMapBase<Edge> * > dyn_edge_maps;
    1.26      
    1.27    public:
    1.28  
    1.29 -    class EachNodeIt;
    1.30 -    class EachEdgeIt;
    1.31 +    class NodeIt;
    1.32 +    class EdgeIt;
    1.33      class OutEdgeIt;
    1.34      class InEdgeIt;
    1.35      
    1.36 -    //     class NodeIt { int n; };
    1.37 -    //     class EachNodeIt : public NodeIt { };
    1.38 -    //     class EdgeIt { int n; };
    1.39 -    //     class EachEdgeIt : public EdgeIt {};
    1.40 -    //     class OutEdgeIt : public EdgeIt {};
    1.41 -    //     class InEdgeIt : public EdgeIt {};
    1.42 -    //     class SymEdgeIt;
    1.43 +    //     class Node { int n; };
    1.44 +    //     class NodeIt : public Node { };
    1.45 +    //     class Edge { int n; };
    1.46 +    //     class EdgeIt : public Edge {};
    1.47 +    //     class OutEdgeIt : public Edge {};
    1.48 +    //     class InEdgeIt : public Edge {};
    1.49 +    //     class SymEdge;
    1.50      
    1.51      template <typename T> class NodeMap;
    1.52      template <typename T> class EdgeMap;
    1.53 @@ -80,9 +80,9 @@
    1.54      
    1.55      ~SmartGraph()
    1.56      {
    1.57 -      for(std::vector<DynMapBase<NodeIt> * >::iterator i=dyn_node_maps.begin();
    1.58 +      for(std::vector<DynMapBase<Node> * >::iterator i=dyn_node_maps.begin();
    1.59  	  i!=dyn_node_maps.end(); ++i) (**i).G=NULL;
    1.60 -      for(std::vector<DynMapBase<EdgeIt> * >::iterator i=dyn_edge_maps.begin();
    1.61 +      for(std::vector<DynMapBase<Edge> * >::iterator i=dyn_edge_maps.begin();
    1.62  	  i!=dyn_edge_maps.end(); ++i) (**i).G=NULL;
    1.63      }
    1.64  
    1.65 @@ -93,24 +93,24 @@
    1.66      int maxEdgeId() const { return edges.size(); }  //FIXME: What is this?
    1.67  
    1.68      
    1.69 -    NodeIt tail(EdgeIt e) const { return edges[e.n].tail; }
    1.70 -    NodeIt head(EdgeIt e) const { return edges[e.n].head; }
    1.71 +    Node tail(Edge e) const { return edges[e.n].tail; }
    1.72 +    Node head(Edge e) const { return edges[e.n].head; }
    1.73  
    1.74 -//     NodeIt aNode(const OutEdgeIt& e) const { return tail(e); }
    1.75 -//     NodeIt aNode(const InEdgeIt& e) const { return head(e); }
    1.76 -//     //NodeIt aNode(const SymEdgeIt& e) const { return e.aNode(); }
    1.77 +//     Node aNode(const OutEdgeIt& e) const { return tail(e); }
    1.78 +//     Node aNode(const InEdgeIt& e) const { return head(e); }
    1.79 +//     //Node aNode(const SymEdge& e) const { return e.aNode(); }
    1.80  
    1.81 -//     NodeIt bNode(const OutEdgeIt& e) const { return head(e); }
    1.82 -//     NodeIt bNode(const InEdgeIt& e) const { return tail(e); }
    1.83 -//     //NodeIt bNode(const SymEdgeIt& e) const { return e.bNode(); }
    1.84 +//     Node bNode(const OutEdgeIt& e) const { return head(e); }
    1.85 +//     Node bNode(const InEdgeIt& e) const { return tail(e); }
    1.86 +//     //Node bNode(const SymEdge& e) const { return e.bNode(); }
    1.87  
    1.88 -    EachNodeIt& getFirst(EachNodeIt& v) const { 
    1.89 -      v=EachNodeIt(*this); return v; }
    1.90 -    EachEdgeIt& getFirst(EachEdgeIt& e) const { 
    1.91 -      e=EachEdgeIt(*this); return e; }
    1.92 -    OutEdgeIt& getFirst(OutEdgeIt& e, const NodeIt v) const { 
    1.93 +    NodeIt& first(NodeIt& v) const { 
    1.94 +      v=NodeIt(*this); return v; }
    1.95 +    EdgeIt& first(EdgeIt& e) const { 
    1.96 +      e=EdgeIt(*this); return e; }
    1.97 +    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
    1.98        e=OutEdgeIt(*this,v); return e; }
    1.99 -    InEdgeIt& getFirst(InEdgeIt& e, const NodeIt v) const { 
   1.100 +    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
   1.101        e=InEdgeIt(*this,v); return e; }
   1.102  
   1.103      template< typename It >
   1.104 @@ -121,51 +121,51 @@
   1.105      }
   1.106  
   1.107      template< typename It >
   1.108 -    It first(NodeIt v) const { 
   1.109 +    It first(Node v) const { 
   1.110        It e;
   1.111        getFirst(e, v);
   1.112        return e; 
   1.113      }
   1.114  
   1.115 -    bool valid(EdgeIt e) const { return e.n!=-1; }
   1.116 -    //    bool valid(EachEdgeIt e) const { return e.n<int(edges.size()); }
   1.117 -    bool valid(NodeIt n) const { return n.n!=-1; }
   1.118 +    bool valid(Edge e) const { return e.n!=-1; }
   1.119 +    //    bool valid(EdgeIt e) const { return e.n<int(edges.size()); }
   1.120 +    bool valid(Node n) const { return n.n!=-1; }
   1.121      
   1.122 -    void setInvalid(EdgeIt &e) { e.n=-1; }
   1.123 -    void setInvalid(NodeIt &n) { n.n=-1; }
   1.124 +    void setInvalid(Edge &e) { e.n=-1; }
   1.125 +    void setInvalid(Node &n) { n.n=-1; }
   1.126      
   1.127      template <typename It> It getNext(It it) const
   1.128      { It tmp(it); return next(tmp); }
   1.129      //{ It tmp; tmp.n=it.n+1; return tmp; }
   1.130  
   1.131 -    NodeIt& next(NodeIt& it) const { it.n=(it.n+2)%nodes.size()-1; return it; }
   1.132 +    Node& next(Node& it) const { it.n=(it.n+2)%nodes.size()-1; return it; }
   1.133      OutEdgeIt& next(OutEdgeIt& it) const
   1.134      { it.n=edges[it.n].next_out; return it; }
   1.135      InEdgeIt& next(InEdgeIt& it) const
   1.136      { it.n=edges[it.n].next_in; return it; }
   1.137 -    EachEdgeIt& next(EachEdgeIt& it) const { --it.n; return it; }
   1.138 +    EdgeIt& next(EdgeIt& it) const { --it.n; return it; }
   1.139  
   1.140 -    int id(NodeIt v) const { return v.n; }
   1.141 -    int id(EdgeIt e) const { return e.n; }
   1.142 +    int id(Node v) const { return v.n; }
   1.143 +    int id(Edge e) const { return e.n; }
   1.144  
   1.145 -    NodeIt addNode() {
   1.146 -      NodeIt n; n.n=nodes.size();
   1.147 +    Node addNode() {
   1.148 +      Node n; n.n=nodes.size();
   1.149        nodes.push_back(NodeT()); //FIXME: Hmmm...
   1.150  
   1.151 -      for(std::vector<DynMapBase<NodeIt> * >::iterator i=dyn_node_maps.begin();
   1.152 +      for(std::vector<DynMapBase<Node> * >::iterator i=dyn_node_maps.begin();
   1.153  	  i!=dyn_node_maps.end(); ++i) (**i).add(n.n);
   1.154  
   1.155        return n;
   1.156      }
   1.157      
   1.158 -    EdgeIt addEdge(NodeIt u, NodeIt v) {
   1.159 -      EdgeIt e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm...
   1.160 +    Edge addEdge(Node u, Node v) {
   1.161 +      Edge e; e.n=edges.size(); edges.push_back(EdgeT()); //FIXME: Hmmm...
   1.162        edges[e.n].tail=u.n; edges[e.n].head=v.n;
   1.163        edges[e.n].next_out=nodes[u.n].first_out;
   1.164        edges[e.n].next_in=nodes[v.n].first_in;
   1.165        nodes[u.n].first_out=nodes[v.n].first_in=e.n;
   1.166  
   1.167 -      for(std::vector<DynMapBase<EdgeIt> * >::iterator i=dyn_edge_maps.begin();
   1.168 +      for(std::vector<DynMapBase<Edge> * >::iterator i=dyn_edge_maps.begin();
   1.169  	  i!=dyn_edge_maps.end(); ++i) (**i).add(e);
   1.170  
   1.171        return e;
   1.172 @@ -173,79 +173,79 @@
   1.173  
   1.174      void clear() {nodes.clear();edges.clear();}
   1.175  
   1.176 -    class NodeIt {
   1.177 +    class Node {
   1.178        friend class SmartGraph;
   1.179        template <typename T> friend class NodeMap;
   1.180        template <typename T> friend class DynNodeMap;
   1.181        
   1.182 -      friend class EdgeIt;
   1.183 +      friend class Edge;
   1.184        friend class OutEdgeIt;
   1.185        friend class InEdgeIt;
   1.186 -      friend class SymEdgeIt;
   1.187 +      friend class SymEdge;
   1.188  
   1.189      protected:
   1.190        int n;
   1.191 -      friend int SmartGraph::id(NodeIt v) const; 
   1.192 -      NodeIt(int nn) {n=nn;}
   1.193 +      friend int SmartGraph::id(Node v) const; 
   1.194 +      Node(int nn) {n=nn;}
   1.195      public:
   1.196 -      NodeIt() {}
   1.197 -      NodeIt (_Invalid i) { n=-1; }
   1.198 -      bool operator==(const NodeIt i) const {return n==i.n;}
   1.199 -      bool operator!=(const NodeIt i) const {return n!=i.n;}
   1.200 -      bool operator<(const NodeIt i) const {return n<i.n;}
   1.201 +      Node() {}
   1.202 +      Node (Invalid i) { n=-1; }
   1.203 +      bool operator==(const Node i) const {return n==i.n;}
   1.204 +      bool operator!=(const Node i) const {return n!=i.n;}
   1.205 +      bool operator<(const Node i) const {return n<i.n;}
   1.206      };
   1.207      
   1.208 -    class EachNodeIt : public NodeIt {
   1.209 +    class NodeIt : public Node {
   1.210        friend class SmartGraph;
   1.211      public:
   1.212 -      EachNodeIt(const SmartGraph& G) : NodeIt(G.nodes.size()?0:-1) { }
   1.213 -      EachNodeIt() : NodeIt() { }
   1.214 +      NodeIt(const SmartGraph& G) : Node(G.nodes.size()?0:-1) { }
   1.215 +      NodeIt() : Node() { }
   1.216      };
   1.217  
   1.218 -    class EdgeIt {
   1.219 +    class Edge {
   1.220        friend class SmartGraph;
   1.221        template <typename T> friend class EdgeMap;
   1.222        template <typename T> friend class DynEdgeMap;
   1.223        
   1.224 +      friend class Node;
   1.225        friend class NodeIt;
   1.226 -      friend class EachNodeIt;
   1.227      protected:
   1.228        int n;
   1.229 -      friend int SmartGraph::id(EdgeIt e) const;
   1.230 +      friend int SmartGraph::id(Edge e) const;
   1.231  
   1.232 -      EdgeIt(int nn) {n=nn;}
   1.233 +      Edge(int nn) {n=nn;}
   1.234      public:
   1.235 -      EdgeIt() { }
   1.236 -      EdgeIt (_Invalid i) { n=-1; }
   1.237 -      bool operator==(const EdgeIt i) const {return n==i.n;}
   1.238 -      bool operator!=(const EdgeIt i) const {return n!=i.n;}
   1.239 -      bool operator<(const EdgeIt i) const {return n<i.n;}
   1.240 +      Edge() { }
   1.241 +      Edge (Invalid i) { n=-1; }
   1.242 +      bool operator==(const Edge i) const {return n==i.n;}
   1.243 +      bool operator!=(const Edge i) const {return n!=i.n;}
   1.244 +      bool operator<(const Edge i) const {return n<i.n;}
   1.245      };
   1.246      
   1.247 -    class EachEdgeIt : public EdgeIt {
   1.248 +    class EdgeIt : public Edge {
   1.249        friend class SmartGraph;
   1.250      public:
   1.251 -      EachEdgeIt(const SmartGraph& G) : EdgeIt(G.edges.size()-1) { }
   1.252 -      EachEdgeIt (_Invalid i) : EdgeIt(i) { }
   1.253 -      EachEdgeIt() : EdgeIt() { }
   1.254 +      EdgeIt(const SmartGraph& G) : Edge(G.edges.size()-1) { }
   1.255 +      EdgeIt (Invalid i) : Edge(i) { }
   1.256 +      EdgeIt() : Edge() { }
   1.257      };
   1.258      
   1.259 -    class OutEdgeIt : public EdgeIt {
   1.260 +    class OutEdgeIt : public Edge {
   1.261        friend class SmartGraph;
   1.262      public: 
   1.263 -      OutEdgeIt() : EdgeIt() { }
   1.264 -      OutEdgeIt (_Invalid i) : EdgeIt(i) { }
   1.265 +      OutEdgeIt() : Edge() { }
   1.266 +      OutEdgeIt (Invalid i) : Edge(i) { }
   1.267  
   1.268 -      OutEdgeIt(const SmartGraph& G,const NodeIt v)
   1.269 -	: EdgeIt(G.nodes[v.n].first_out) {}
   1.270 +      OutEdgeIt(const SmartGraph& G,const Node v)
   1.271 +	: Edge(G.nodes[v.n].first_out) {}
   1.272      };
   1.273      
   1.274 -    class InEdgeIt : public EdgeIt {
   1.275 +    class InEdgeIt : public Edge {
   1.276        friend class SmartGraph;
   1.277      public: 
   1.278 -      InEdgeIt() : EdgeIt() { }
   1.279 -      InEdgeIt (_Invalid i) : EdgeIt(i) { }
   1.280 -      InEdgeIt(const SmartGraph& G,NodeIt v) :EdgeIt(G.nodes[v.n].first_in){}
   1.281 +      InEdgeIt() : Edge() { }
   1.282 +      InEdgeIt (Invalid i) : Edge(i) { }
   1.283 +      InEdgeIt(const SmartGraph& G,Node v) :Edge(G.nodes[v.n].first_in){}
   1.284      };
   1.285  
   1.286      // Map types
   1.287 @@ -256,14 +256,14 @@
   1.288        std::vector<T> container;
   1.289      public:
   1.290        typedef T ValueType;
   1.291 -      typedef NodeIt KeyType;
   1.292 +      typedef Node KeyType;
   1.293        NodeMap(const SmartGraph& _G) : G(_G), container(G.maxNodeId()) { }
   1.294        NodeMap(const SmartGraph& _G, T a) : 
   1.295  	G(_G), container(G.maxNodeId(), a) { }
   1.296 -      void set(NodeIt n, T a) { container[n.n]=a; }
   1.297 -      T get(NodeIt n) const { return container[n.n]; }
   1.298 -      T& operator[](NodeIt n) { return container[n.n]; }
   1.299 -      const T& operator[](NodeIt n) const { return container[n.n]; }
   1.300 +      void set(Node n, T a) { container[n.n]=a; }
   1.301 +      T get(Node n) const { return container[n.n]; }
   1.302 +      T& operator[](Node n) { return container[n.n]; }
   1.303 +      const T& operator[](Node n) const { return container[n.n]; }
   1.304        void update() { container.resize(G.maxNodeId()); }
   1.305        void update(T a) { container.resize(G.maxNodeId(), a); }
   1.306      };
   1.307 @@ -274,28 +274,28 @@
   1.308        std::vector<T> container;
   1.309      public:
   1.310        typedef T ValueType;
   1.311 -      typedef EdgeIt KeyType;
   1.312 +      typedef Edge KeyType;
   1.313        EdgeMap(const SmartGraph& _G) : G(_G), container(G.maxEdgeId()) { }
   1.314        EdgeMap(const SmartGraph& _G, T a) : 
   1.315  	G(_G), container(G.maxEdgeId(), a) { }
   1.316 -      void set(EdgeIt e, T a) { container[e.n]=a; }
   1.317 -      T get(EdgeIt e) const { return container[e.n]; }
   1.318 -      T& operator[](EdgeIt e) { return container[e.n]; } 
   1.319 -      const T& operator[](EdgeIt e) const { return container[e.n]; } 
   1.320 +      void set(Edge e, T a) { container[e.n]=a; }
   1.321 +      T get(Edge e) const { return container[e.n]; }
   1.322 +      T& operator[](Edge e) { return container[e.n]; } 
   1.323 +      const T& operator[](Edge e) const { return container[e.n]; } 
   1.324        void update() { container.resize(G.maxEdgeId()); }
   1.325        void update(T a) { container.resize(G.maxEdgeId(), a); }
   1.326      };
   1.327  
   1.328 -    template <typename T> class DynNodeMap : public DynMapBase<NodeIt>
   1.329 +    template <typename T> class DynNodeMap : public DynMapBase<Node>
   1.330      {
   1.331        std::vector<T> container;
   1.332  
   1.333      public:
   1.334        typedef T ValueType;
   1.335 -      typedef NodeIt KeyType;
   1.336 +      typedef Node KeyType;
   1.337  
   1.338        DynNodeMap(const SmartGraph &_G) :
   1.339 -	DynMapBase<NodeIt>(_G), container(_G.maxNodeId())
   1.340 +	DynMapBase<Node>(_G), container(_G.maxNodeId())
   1.341        {
   1.342  	//FIXME: What if there are empty Id's?
   1.343  	//FIXME: Can I use 'this' in a constructor?
   1.344 @@ -304,7 +304,7 @@
   1.345        ~DynNodeMap()
   1.346        {
   1.347  	if(G) {
   1.348 -	  std::vector<DynMapBase<NodeIt>* >::iterator i;
   1.349 +	  std::vector<DynMapBase<Node>* >::iterator i;
   1.350  	  for(i=G->dyn_node_maps.begin();
   1.351  	      i!=G->dyn_node_maps.end() && *i!=this; ++i) ;
   1.352  	  //if(*i==this) G->dyn_node_maps.erase(i); //FIXME: Way too slow...
   1.353 @@ -316,38 +316,38 @@
   1.354  	}
   1.355        }
   1.356  
   1.357 -      void add(const NodeIt k) 
   1.358 +      void add(const Node k) 
   1.359        {
   1.360  	if(k.n>=container.size()) container.resize(k.n+1);
   1.361        }
   1.362 -//       void erase(const NodeIt k)
   1.363 +//       void erase(const Node k)
   1.364  //       {
   1.365  // 	//FIXME: Please implement me.
   1.366  //       }
   1.367 -//       void erase(const EdgeIt k)
   1.368 +//       void erase(const Edge k)
   1.369  //       {
   1.370  // 	//FIXME: Please implement me.
   1.371  //       }
   1.372        
   1.373 -      void set(NodeIt n, T a) { container[n.n]=a; }
   1.374 -      T get(NodeIt n) const { return container[n.n]; }
   1.375 -      T& operator[](NodeIt n) { return container[n.n]; }
   1.376 -      const T& operator[](NodeIt n) const { return container[n.n]; }
   1.377 +      void set(Node n, T a) { container[n.n]=a; }
   1.378 +      T get(Node n) const { return container[n.n]; }
   1.379 +      T& operator[](Node n) { return container[n.n]; }
   1.380 +      const T& operator[](Node n) const { return container[n.n]; }
   1.381  
   1.382        void update() {}    //Useless for DynMaps
   1.383        void update(T a) {}  //Useless for DynMaps
   1.384      };
   1.385      
   1.386 -    template <typename T> class DynEdgeMap : public DynMapBase<EdgeIt>
   1.387 +    template <typename T> class DynEdgeMap : public DynMapBase<Edge>
   1.388      {
   1.389        std::vector<T> container;
   1.390  
   1.391      public:
   1.392        typedef T ValueType;
   1.393 -      typedef EdgeIt KeyType;
   1.394 +      typedef Edge KeyType;
   1.395  
   1.396        DynEdgeMap(const SmartGraph &_G) :
   1.397 -	DynMapBase<EdgeIt>(_G), container(_G.maxEdgeId())
   1.398 +	DynMapBase<Edge>(_G), container(_G.maxEdgeId())
   1.399        {
   1.400  	//FIXME: What if there are empty Id's?
   1.401  	//FIXME: Can I use 'this' in a constructor?
   1.402 @@ -356,7 +356,7 @@
   1.403        ~DynEdgeMap()
   1.404        {
   1.405  	if(G) {
   1.406 -	  std::vector<DynMapBase<EdgeIt>* >::iterator i;
   1.407 +	  std::vector<DynMapBase<Edge>* >::iterator i;
   1.408  	  for(i=G->dyn_edge_maps.begin();
   1.409  	      i!=G->dyn_edge_maps.end() && *i!=this; ++i) ;
   1.410  	  //if(*i==this) G->dyn_edge_maps.erase(i); //Way too slow...
   1.411 @@ -368,19 +368,19 @@
   1.412  	}
   1.413        }
   1.414        
   1.415 -      void add(const EdgeIt k) 
   1.416 +      void add(const Edge k) 
   1.417        {
   1.418  	if(k.n>=int(container.size())) container.resize(k.n+1);
   1.419        }
   1.420 -      void erase(const EdgeIt k)
   1.421 +      void erase(const Edge k)
   1.422        {
   1.423  	//FIXME: Please implement me.
   1.424        }
   1.425        
   1.426 -      void set(EdgeIt n, T a) { container[n.n]=a; }
   1.427 -      T get(EdgeIt n) const { return container[n.n]; }
   1.428 -      T& operator[](EdgeIt n) { return container[n.n]; }
   1.429 -      const T& operator[](EdgeIt n) const { return container[n.n]; }
   1.430 +      void set(Edge n, T a) { container[n.n]=a; }
   1.431 +      T get(Edge n) const { return container[n.n]; }
   1.432 +      T& operator[](Edge n) { return container[n.n]; }
   1.433 +      const T& operator[](Edge n) const { return container[n.n]; }
   1.434  
   1.435        void update() {}    //Useless for DynMaps
   1.436        void update(T a) {}  //Useless for DynMaps
     2.1 --- a/src/work/alpar/smart_graph_demo.cc	Wed Mar 10 16:46:17 2004 +0000
     2.2 +++ b/src/work/alpar/smart_graph_demo.cc	Wed Mar 10 17:47:54 2004 +0000
     2.3 @@ -1,36 +1,67 @@
     2.4  #include<smart_graph.h>
     2.5 +#include<emptygraph.h>
     2.6  
     2.7  #include <iostream>
     2.8 +#include <vector>
     2.9  
    2.10  using namespace hugo;
    2.11  
    2.12 -SmartGraph::OutEdgeIt safeFirstOut(const SmartGraph &G, SmartGraph::NodeIt n)
    2.13 +//typedef SmartGraph Graph;
    2.14 +typedef EmptyGraph Graph;
    2.15 +
    2.16 +
    2.17 +Graph::OutEdgeIt safeFirstOut(const Graph &G, Graph::Node n)
    2.18  {
    2.19 -  return G.valid(n) ? SmartGraph::OutEdgeIt(G,n):Invalid;
    2.20 +  return G.valid(n) ? Graph::OutEdgeIt(G,n):INVALID;
    2.21  }
    2.22  
    2.23  int main()
    2.24  {
    2.25  
    2.26 -  typedef SmartGraph::EdgeIt EdgeIt;
    2.27 -  typedef SmartGraph::InEdgeIt InEdgeIt;
    2.28 -  typedef SmartGraph::OutEdgeIt OutEdgeIt;
    2.29 -  typedef SmartGraph::EachEdgeIt EachEdgeIt;
    2.30 -  typedef SmartGraph::NodeIt NodeIt;
    2.31 -  typedef SmartGraph::EachNodeIt EachNodeIt;
    2.32 +  typedef Graph::Edge Edge;
    2.33 +  typedef Graph::InEdgeIt InEdgeIt;
    2.34 +  typedef Graph::OutEdgeIt OutEdgeIt;
    2.35 +  typedef Graph::EdgeIt EdgeIt;
    2.36 +  typedef Graph::Node Node;
    2.37 +  typedef Graph::NodeIt NodeIt;
    2.38    
    2.39 -  SmartGraph G;
    2.40 -  EachNodeIt n;
    2.41 +  Graph G;
    2.42 +  NodeIt n;
    2.43  
    2.44  
    2.45 -  //  std::cout.form("%s: %d\n","Sztring",15);
    2.46 -
    2.47    for(int i=0;i<10;i++) G.addNode();
    2.48 -  for(G.getFirst(n);G.valid(n);G.next(n)) 
    2.49 -    for(EachNodeIt m(G);m!=Invalid;G.next(m)) 
    2.50 +  for(G.first(n);G.valid(n);G.next(n)) 
    2.51 +    for(NodeIt m(G);m!=INVALID;G.next(m)) 
    2.52        if(n!=m) G.addEdge(n,m);
    2.53  
    2.54    OutEdgeIt e = safeFirstOut(G,n);
    2.55 -  OutEdgeIt f = safeFirstOut(G,EachNodeIt(G));
    2.56 +  OutEdgeIt f = safeFirstOut(G,NodeIt(G));
    2.57 +  
    2.58 +
    2.59 +  InEdgeIt i(INVALID), j;
    2.60 +  InEdgeIt ii(i);
    2.61 +  ii=G.first(i,n);
    2.62 +  ii=G.next(i);
    2.63 +  
    2.64 +  OutEdgeIt o(INVALID), oo;
    2.65 +  OutEdgeIt ooo(oo);
    2.66 +  oo=G.first(o,n);
    2.67 +  oo=G.next(o);
    2.68 +  
    2.69 +  EdgeIt ei(INVALID), eie;
    2.70 +  EdgeIt eiee(ei);
    2.71 +  eie=G.first(ei);
    2.72 +  eie=G.next(ei);
    2.73 +
    2.74 +  Edge eee(i);
    2.75 +  eee=o;
    2.76 +  eee=eie;
    2.77 +  
    2.78 +  
    2.79 +  bool tm;
    2.80 +  tm = G.valid(n) && G.valid(i) && G.valid(o) && G.valid(ei);
    2.81 +
    2.82 +  std::vector<InEdgeIt> v(10);
    2.83 +  std::vector<InEdgeIt> w(10,INVALID);
    2.84    
    2.85  }