The file src/work/alpar/fullgraph.h renamed and moved to src/hugo/full_graph.h.
authoralpar
Sun, 09 May 2004 16:29:53 +0000
changeset 5925961cce7ec53
parent 591 eb532eef6170
child 593 b83b36ee7f10
The file src/work/alpar/fullgraph.h renamed and moved to src/hugo/full_graph.h.
Compilation tests for FullGraph added to src/test/graph_test.h.
src/hugo/full_graph.h
src/test/graph_test.cc
src/work/alpar/fullgraph.h
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/hugo/full_graph.h	Sun May 09 16:29:53 2004 +0000
     1.3 @@ -0,0 +1,295 @@
     1.4 +// -*- mode:C++ -*-
     1.5 +
     1.6 +#ifndef HUGO_FULL_GRAPH_H
     1.7 +#define HUGO_FULL_GRAPH_H
     1.8 +
     1.9 +///\ingroup graphs
    1.10 +///\file
    1.11 +///\brief FullGraph and SymFullGraph classes.
    1.12 +
    1.13 +#include <vector>
    1.14 +#include <limits.h>
    1.15 +
    1.16 +#include <hugo/invalid.h>
    1.17 +
    1.18 +namespace hugo {
    1.19 +
    1.20 +/// \addtogroup graphs
    1.21 +/// @{
    1.22 +
    1.23 +  ///A full graph class.
    1.24 +
    1.25 +  ///This is a simple and fast directed full graph implementation.
    1.26 +  ///It it completely static, so you can neither add nor delete either
    1.27 +  ///edges or nodes.
    1.28 +  ///Otherwise it conforms to the graph interface documented under
    1.29 +  ///the description of \ref GraphSkeleton.
    1.30 +  ///\sa \ref GraphSkeleton.
    1.31 +  ///\todo Shouldn't we avoid loops?
    1.32 +  ///
    1.33 +  ///\author Alpar Juttner
    1.34 +  class FullGraph {
    1.35 +    int NodeNum;
    1.36 +    int EdgeNum;
    1.37 +  public:
    1.38 +    template <typename T> class EdgeMap;
    1.39 +    template <typename T> class NodeMap;
    1.40 +
    1.41 +    class Node;
    1.42 +    class Edge;
    1.43 +    class NodeIt;
    1.44 +    class EdgeIt;
    1.45 +    class OutEdgeIt;
    1.46 +    class InEdgeIt;
    1.47 +    
    1.48 +    template <typename T> class NodeMap;
    1.49 +    template <typename T> class EdgeMap;
    1.50 +    
    1.51 +  public:
    1.52 +
    1.53 +    ///Creates a full graph with \c n nodes.
    1.54 +    FullGraph(int n) : NodeNum(n), EdgeNum(NodeNum*NodeNum) { }
    1.55 +    ///
    1.56 +    FullGraph(const FullGraph &_g)
    1.57 +      : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { }
    1.58 +    
    1.59 +    int nodeNum() const { return NodeNum; }  //FIXME: What is this?
    1.60 +    int edgeNum() const { return EdgeNum; }  //FIXME: What is this?
    1.61 +
    1.62 +    int maxNodeId() const { return NodeNum; }  //FIXME: What is this?
    1.63 +    int maxEdgeId() const { return EdgeNum; }  //FIXME: What is this?
    1.64 +
    1.65 +    Node tail(Edge e) const { return e.n%NodeNum; }
    1.66 +    Node head(Edge e) const { return e.n/NodeNum; }
    1.67 +
    1.68 +    Node aNode(OutEdgeIt e) const { return tail(e); }
    1.69 +    Node aNode(InEdgeIt e) const { return head(e); }
    1.70 +
    1.71 +    Node bNode(OutEdgeIt e) const { return head(e); }
    1.72 +    Node bNode(InEdgeIt e) const { return tail(e); }
    1.73 +
    1.74 +    NodeIt& first(NodeIt& v) const {
    1.75 +      v=NodeIt(*this); return v; }
    1.76 +    EdgeIt& first(EdgeIt& e) const { 
    1.77 +      e=EdgeIt(*this); return e; }
    1.78 +    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
    1.79 +      e=OutEdgeIt(*this,v); return e; }
    1.80 +    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
    1.81 +      e=InEdgeIt(*this,v); return e; }
    1.82 +
    1.83 +    bool valid(Edge e) const { return e.n!=-1; }
    1.84 +    bool valid(Node n) const { return n.n!=-1; }
    1.85 +    
    1.86 +    template <typename It> It getNext(It it) const
    1.87 +    { It tmp(it); return next(tmp); }
    1.88 +
    1.89 +    NodeIt& next(NodeIt& it) const { 
    1.90 +      it.n=(it.n+2)%(NodeNum+1)-1; 
    1.91 +      return it; 
    1.92 +    }
    1.93 +    OutEdgeIt& next(OutEdgeIt& it) const
    1.94 +    { it.n+=NodeNum; if(it.n>=EdgeNum) it.n=-1; return it; }
    1.95 +    InEdgeIt& next(InEdgeIt& it) const
    1.96 +    { if(!((++it.n)%NodeNum)) it.n=-1; return it; }
    1.97 +    EdgeIt& next(EdgeIt& it) const { --it.n; return it; }
    1.98 +
    1.99 +    int id(Node v) const { return v.n; }
   1.100 +    int id(Edge e) const { return e.n; }
   1.101 +
   1.102 +    class Node {
   1.103 +      friend class FullGraph;
   1.104 +      template <typename T> friend class NodeMap;
   1.105 +
   1.106 +      friend class Edge;
   1.107 +      friend class OutEdgeIt;
   1.108 +      friend class InEdgeIt;
   1.109 +      friend class SymEdge;
   1.110 +
   1.111 +    protected:
   1.112 +      int n;
   1.113 +      friend int FullGraph::id(Node v) const; 
   1.114 +      Node(int nn) {n=nn;}
   1.115 +    public:
   1.116 +      Node() {}
   1.117 +      Node (Invalid) { n=-1; }
   1.118 +      bool operator==(const Node i) const {return n==i.n;}
   1.119 +      bool operator!=(const Node i) const {return n!=i.n;}
   1.120 +      bool operator<(const Node i) const {return n<i.n;}
   1.121 +    };
   1.122 +    
   1.123 +    class NodeIt : public Node {
   1.124 +      friend class FullGraph;
   1.125 +    public:
   1.126 +      NodeIt() : Node() { }
   1.127 +      NodeIt(Invalid i) : Node(i) { }
   1.128 +      NodeIt(const FullGraph& G) : Node(G.NodeNum?0:-1) { }
   1.129 +      ///\todo Undocumented conversion Node -\> NodeIt.
   1.130 +      NodeIt(const FullGraph& G, const Node &n) : Node(n) { }
   1.131 +    };
   1.132 +
   1.133 +    class Edge {
   1.134 +      friend class FullGraph;
   1.135 +      template <typename T> friend class EdgeMap;
   1.136 +      
   1.137 +      friend class Node;
   1.138 +      friend class NodeIt;
   1.139 +    protected:
   1.140 +      int n; //NodeNum*head+tail;
   1.141 +      friend int FullGraph::id(Edge e) const;
   1.142 +
   1.143 +      Edge(int nn) {n=nn;}
   1.144 +    public:
   1.145 +      Edge() { }
   1.146 +      Edge (Invalid) { n=-1; }
   1.147 +      bool operator==(const Edge i) const {return n==i.n;}
   1.148 +      bool operator!=(const Edge i) const {return n!=i.n;}
   1.149 +      bool operator<(const Edge i) const {return n<i.n;}
   1.150 +      ///\bug This is a workaround until somebody tells me how to
   1.151 +      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
   1.152 +      int &idref() {return n;}
   1.153 +      const int &idref() const {return n;}
   1.154 +    };
   1.155 +    
   1.156 +    class EdgeIt : public Edge {
   1.157 +      friend class FullGraph;
   1.158 +    public:
   1.159 +      EdgeIt(const FullGraph& G) : Edge(G.EdgeNum-1) { }
   1.160 +      EdgeIt (Invalid i) : Edge(i) { }
   1.161 +      EdgeIt() : Edge() { }
   1.162 +      ///\bug This is a workaround until somebody tells me how to
   1.163 +      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
   1.164 +      int &idref() {return n;}
   1.165 +    };
   1.166 +    
   1.167 +    class OutEdgeIt : public Edge {
   1.168 +      friend class FullGraph;
   1.169 +    public: 
   1.170 +      OutEdgeIt() : Edge() { }
   1.171 +      OutEdgeIt (Invalid i) : Edge(i) { }
   1.172 +
   1.173 +      OutEdgeIt(const FullGraph& G,const Node v)
   1.174 +	: Edge(v.n) {}
   1.175 +    };
   1.176 +    
   1.177 +    class InEdgeIt : public Edge {
   1.178 +      friend class FullGraph;
   1.179 +    public: 
   1.180 +      InEdgeIt() : Edge() { }
   1.181 +      InEdgeIt (Invalid i) : Edge(i) { }
   1.182 +      InEdgeIt(const FullGraph& G,Node v) :Edge(v.n*G.NodeNum){}
   1.183 +    };
   1.184 +
   1.185 +    template <typename T> class NodeMap
   1.186 +    {
   1.187 +      std::vector<T> container;
   1.188 +
   1.189 +    public:
   1.190 +      typedef T ValueType;
   1.191 +      typedef Node KeyType;
   1.192 +
   1.193 +      NodeMap(const FullGraph &_G) : container(_G.NodeNum) { }
   1.194 +      NodeMap(const FullGraph &_G,const T &t) : container(_G.NodeNum,t) { }
   1.195 +      NodeMap(const NodeMap<T> &m) : container(m.container) { }
   1.196 +
   1.197 +      template<typename TT> friend class NodeMap;
   1.198 +      ///\todo It can copy between different types.
   1.199 +      template<typename TT> NodeMap(const NodeMap<TT> &m)
   1.200 +	: container(m.container.size())
   1.201 +      {
   1.202 +	typename std::vector<TT>::const_iterator i;
   1.203 +	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   1.204 +	    i!=m.container.end();
   1.205 +	    i++)
   1.206 +	  container.push_back(*i);
   1.207 +      }
   1.208 +      void set(Node n, T a) { container[n.n]=a; }
   1.209 +      //'T& operator[](Node n)' would be wrong here
   1.210 +      typename std::vector<T>::reference
   1.211 +      operator[](Node n) { return container[n.n]; }
   1.212 +      //'const T& operator[](Node n)' would be wrong here
   1.213 +      typename std::vector<T>::const_reference 
   1.214 +      operator[](Node n) const { return container[n.n]; }
   1.215 +
   1.216 +      ///\warning There is no safety check at all!
   1.217 +      ///Using operator = between maps attached to different graph may
   1.218 +      ///cause serious problem.
   1.219 +      ///\todo Is this really so?
   1.220 +      ///\todo It can copy between different types.
   1.221 +      const NodeMap<T>& operator=(const NodeMap<T> &m)
   1.222 +      {
   1.223 +	container = m.container;
   1.224 +	return *this;
   1.225 +      }
   1.226 +      template<typename TT>
   1.227 +      const NodeMap<T>& operator=(const NodeMap<TT> &m)
   1.228 +      {
   1.229 +	std::copy(m.container.begin(), m.container.end(), container.begin());
   1.230 +	return *this;
   1.231 +      }
   1.232 +      
   1.233 +      void update() {}    //Useless for Dynamic Maps
   1.234 +      void update(T a) {}  //Useless for Dynamic Maps
   1.235 +    };
   1.236 +    
   1.237 +    template <typename T> class EdgeMap
   1.238 +    {
   1.239 +      std::vector<T> container;
   1.240 +
   1.241 +    public:
   1.242 +      typedef T ValueType;
   1.243 +      typedef Edge KeyType;
   1.244 +
   1.245 +      EdgeMap(const FullGraph &_G) : container(_G.EdgeNum) { }
   1.246 +      EdgeMap(const FullGraph &_G,const T &t) : container(_G.EdgeNum,t) { } 
   1.247 +      EdgeMap(const EdgeMap<T> &m) : container(m.container) { }
   1.248 +
   1.249 +      template<typename TT> friend class EdgeMap;
   1.250 +      ///\todo It can copy between different types. 
   1.251 +      ///\todo We could use 'copy'
   1.252 +      template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
   1.253 +	container(m.container.size())
   1.254 +      {
   1.255 +	typename std::vector<TT>::const_iterator i;
   1.256 +	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   1.257 +	    i!=m.container.end();
   1.258 +	    i++)
   1.259 +	  container.push_back(*i);
   1.260 +      }
   1.261 +      void set(Edge n, T a) { container[n.n]=a; }
   1.262 +      //T get(Edge n) const { return container[n.n]; }
   1.263 +      typename std::vector<T>::reference
   1.264 +      operator[](Edge n) { return container[n.n]; }
   1.265 +      typename std::vector<T>::const_reference
   1.266 +      operator[](Edge n) const { return container[n.n]; }
   1.267 +
   1.268 +      ///\warning There is no safety check at all!
   1.269 +      ///Using operator = between maps attached to different graph may
   1.270 +      ///cause serious problem.
   1.271 +      ///\todo Is this really so?
   1.272 +      ///\todo It can copy between different types.
   1.273 +      const EdgeMap<T>& operator=(const EdgeMap<T> &m)
   1.274 +      {
   1.275 +	container = m.container;
   1.276 +	return *this;
   1.277 +      }
   1.278 +      template<typename TT>
   1.279 +      const EdgeMap<T>& operator=(const EdgeMap<TT> &m)
   1.280 +      {
   1.281 +	std::copy(m.container.begin(), m.container.end(), container.begin());
   1.282 +	return *this;
   1.283 +      }
   1.284 +      
   1.285 +      void update() {}
   1.286 +      void update(T a) {}
   1.287 +    };
   1.288 +
   1.289 +  };
   1.290 +
   1.291 +  /// @}  
   1.292 +
   1.293 +} //namespace hugo
   1.294 +
   1.295 +
   1.296 +
   1.297 +
   1.298 +#endif //HUGO_FULL_GRAPH_H
     2.1 --- a/src/test/graph_test.cc	Sun May 09 16:22:49 2004 +0000
     2.2 +++ b/src/test/graph_test.cc	Sun May 09 16:29:53 2004 +0000
     2.3 @@ -2,6 +2,7 @@
     2.4  #include<hugo/smart_graph.h>
     2.5  #include<hugo/skeletons/graph.h>
     2.6  #include<hugo/list_graph.h>
     2.7 +#include<hugo/full_graph.h>
     2.8  
     2.9  #include"test_tools.h"
    2.10  
    2.11 @@ -10,11 +11,12 @@
    2.12  
    2.13  G.addNode(), G.addEdge(), G.valid(), G.tail(), G.head()
    2.14  
    2.15 +\todo Checks for empty graphs and isolated points.
    2.16  */
    2.17  
    2.18  using namespace hugo;
    2.19  
    2.20 -template<class Graph> void checkCompile(Graph &G) 
    2.21 +template<class Graph> void checkCompileStaticGraph(Graph &G) 
    2.22  {
    2.23    typedef typename Graph::Node Node;
    2.24    typedef typename Graph::NodeIt NodeIt;
    2.25 @@ -79,9 +81,9 @@
    2.26    }
    2.27  
    2.28    Node n,m;
    2.29 -  n=G.addNode();
    2.30 +  n=m=INVALID;
    2.31    Edge e;
    2.32 -  e=G.addEdge(n,m);
    2.33 +  e=INVALID;
    2.34    n=G.tail(e);
    2.35    n=G.head(e);
    2.36  
    2.37 @@ -91,7 +93,7 @@
    2.38    { int i=G.id(n); i=i; }
    2.39    { int i=G.id(e); i=i; }
    2.40    
    2.41 -  G.clear();
    2.42 +  //  G.clear();
    2.43  
    2.44    //NodeMap tests
    2.45    {
    2.46 @@ -160,6 +162,25 @@
    2.47    
    2.48  }
    2.49  
    2.50 +template<class Graph> void checkCompile(Graph &G) 
    2.51 +{
    2.52 +  checkCompileStaticGraph(G);
    2.53 +
    2.54 +  typedef typename Graph::Node Node;
    2.55 +  typedef typename Graph::NodeIt NodeIt;
    2.56 +  typedef typename Graph::Edge Edge;
    2.57 +  typedef typename Graph::EdgeIt EdgeIt;
    2.58 +  typedef typename Graph::InEdgeIt InEdgeIt;
    2.59 +  typedef typename Graph::OutEdgeIt OutEdgeIt;
    2.60 +  
    2.61 +  Node n,m;
    2.62 +  n=G.addNode();
    2.63 +  m=G.addNode();
    2.64 +  
    2.65 +  G.addEdge(n,m);
    2.66 +}
    2.67 +
    2.68 +
    2.69  template<class Graph> void checkNodeList(Graph &G, int nn)
    2.70  {
    2.71    typename Graph::NodeIt n(G);
    2.72 @@ -244,6 +265,7 @@
    2.73  template void checkCompile<SymSmartGraph>(SymSmartGraph &);
    2.74  template void checkCompile<ListGraph>(ListGraph &);
    2.75  template void checkCompile<SymListGraph>(SymListGraph &);
    2.76 +template void checkCompileStaticGraph<FullGraph>(FullGraph &);
    2.77  
    2.78  //Due to some mysterious problems it does not work.
    2.79  template void checkCompile<EdgeSet <ListGraph> >(EdgeSet <ListGraph> &);
     3.1 --- a/src/work/alpar/fullgraph.h	Sun May 09 16:22:49 2004 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,295 +0,0 @@
     3.4 -// -*- mode:C++ -*-
     3.5 -
     3.6 -#ifndef HUGO_FULL_GRAPH_H
     3.7 -#define HUGO_FULL_GRAPH_H
     3.8 -
     3.9 -///\ingroup graphs
    3.10 -///\file
    3.11 -///\brief FullGraph and SymFullGraph classes.
    3.12 -
    3.13 -#include <vector>
    3.14 -#include <limits.h>
    3.15 -
    3.16 -#include <hugo/invalid.h>
    3.17 -
    3.18 -namespace hugo {
    3.19 -
    3.20 -/// \addtogroup graphs
    3.21 -/// @{
    3.22 -
    3.23 -  ///A full graph class.
    3.24 -
    3.25 -  ///This is a simple and fast directed full graph implementation.
    3.26 -  ///It it completely static, so you can neither add nor delete either
    3.27 -  ///edges or nodes.
    3.28 -  ///Otherwise it conforms to the graph interface documented under
    3.29 -  ///the description of \ref GraphSkeleton.
    3.30 -  ///\sa \ref GraphSkeleton.
    3.31 -  ///\todo Shouldn't we avoid loops?
    3.32 -  ///
    3.33 -  ///\author Alpar Juttner
    3.34 -  class FullGraph {
    3.35 -    int NodeNum;
    3.36 -    int EdgeNum;
    3.37 -  public:
    3.38 -    template <typename T> class EdgeMap;
    3.39 -    template <typename T> class NodeMap;
    3.40 -
    3.41 -    class Node;
    3.42 -    class Edge;
    3.43 -    class NodeIt;
    3.44 -    class EdgeIt;
    3.45 -    class OutEdgeIt;
    3.46 -    class InEdgeIt;
    3.47 -    
    3.48 -    template <typename T> class NodeMap;
    3.49 -    template <typename T> class EdgeMap;
    3.50 -    
    3.51 -  public:
    3.52 -
    3.53 -    ///Creates a full graph with \c n nodes.
    3.54 -    FullGraph(int n) : NodeNum(n), EdgeNum(NodeNum*NodeNum) { }
    3.55 -    ///
    3.56 -    FullGraph(const FullGraph &_g)
    3.57 -      : NodeNum(_g.nodeNum()), EdgeNum(NodeNum*NodeNum) { }
    3.58 -    
    3.59 -    int nodeNum() const { return NodeNum; }  //FIXME: What is this?
    3.60 -    int edgeNum() const { return EdgeNum; }  //FIXME: What is this?
    3.61 -
    3.62 -    int maxNodeId() const { return NodeNum; }  //FIXME: What is this?
    3.63 -    int maxEdgeId() const { return EdgeNum; }  //FIXME: What is this?
    3.64 -
    3.65 -    Node tail(Edge e) const { return e.n%NodeNum; }
    3.66 -    Node head(Edge e) const { return e.n/NodeNum; }
    3.67 -
    3.68 -    Node aNode(OutEdgeIt e) const { return tail(e); }
    3.69 -    Node aNode(InEdgeIt e) const { return head(e); }
    3.70 -
    3.71 -    Node bNode(OutEdgeIt e) const { return head(e); }
    3.72 -    Node bNode(InEdgeIt e) const { return tail(e); }
    3.73 -
    3.74 -    NodeIt& first(NodeIt& v) const {
    3.75 -      v=NodeIt(*this); return v; }
    3.76 -    EdgeIt& first(EdgeIt& e) const { 
    3.77 -      e=EdgeIt(*this); return e; }
    3.78 -    OutEdgeIt& first(OutEdgeIt& e, const Node v) const { 
    3.79 -      e=OutEdgeIt(*this,v); return e; }
    3.80 -    InEdgeIt& first(InEdgeIt& e, const Node v) const { 
    3.81 -      e=InEdgeIt(*this,v); return e; }
    3.82 -
    3.83 -    bool valid(Edge e) const { return e.n!=-1; }
    3.84 -    bool valid(Node n) const { return n.n!=-1; }
    3.85 -    
    3.86 -    template <typename It> It getNext(It it) const
    3.87 -    { It tmp(it); return next(tmp); }
    3.88 -
    3.89 -    NodeIt& next(NodeIt& it) const { 
    3.90 -      it.n=(it.n+2)%(NodeNum+1)-1; 
    3.91 -      return it; 
    3.92 -    }
    3.93 -    OutEdgeIt& next(OutEdgeIt& it) const
    3.94 -    { it.n+=NodeNum; if(it.n>=EdgeNum) it.n=-1; return it; }
    3.95 -    InEdgeIt& next(InEdgeIt& it) const
    3.96 -    { if(!((++it.n)%NodeNum)) it.n=-1; return it; }
    3.97 -    EdgeIt& next(EdgeIt& it) const { --it.n; return it; }
    3.98 -
    3.99 -    int id(Node v) const { return v.n; }
   3.100 -    int id(Edge e) const { return e.n; }
   3.101 -
   3.102 -    class Node {
   3.103 -      friend class FullGraph;
   3.104 -      template <typename T> friend class NodeMap;
   3.105 -
   3.106 -      friend class Edge;
   3.107 -      friend class OutEdgeIt;
   3.108 -      friend class InEdgeIt;
   3.109 -      friend class SymEdge;
   3.110 -
   3.111 -    protected:
   3.112 -      int n;
   3.113 -      friend int FullGraph::id(Node v) const; 
   3.114 -      Node(int nn) {n=nn;}
   3.115 -    public:
   3.116 -      Node() {}
   3.117 -      Node (Invalid) { n=-1; }
   3.118 -      bool operator==(const Node i) const {return n==i.n;}
   3.119 -      bool operator!=(const Node i) const {return n!=i.n;}
   3.120 -      bool operator<(const Node i) const {return n<i.n;}
   3.121 -    };
   3.122 -    
   3.123 -    class NodeIt : public Node {
   3.124 -      friend class FullGraph;
   3.125 -    public:
   3.126 -      NodeIt() : Node() { }
   3.127 -      NodeIt(Invalid i) : Node(i) { }
   3.128 -      NodeIt(const FullGraph& G) : Node(G.NodeNum?0:-1) { }
   3.129 -      ///\todo Undocumented conversion Node -\> NodeIt.
   3.130 -      NodeIt(const FullGraph& G, const Node &n) : Node(n) { }
   3.131 -    };
   3.132 -
   3.133 -    class Edge {
   3.134 -      friend class FullGraph;
   3.135 -      template <typename T> friend class EdgeMap;
   3.136 -      
   3.137 -      friend class Node;
   3.138 -      friend class NodeIt;
   3.139 -    protected:
   3.140 -      int n; //NodeNum*head+tail;
   3.141 -      friend int FullGraph::id(Edge e) const;
   3.142 -
   3.143 -      Edge(int nn) {n=nn;}
   3.144 -    public:
   3.145 -      Edge() { }
   3.146 -      Edge (Invalid) { n=-1; }
   3.147 -      bool operator==(const Edge i) const {return n==i.n;}
   3.148 -      bool operator!=(const Edge i) const {return n!=i.n;}
   3.149 -      bool operator<(const Edge i) const {return n<i.n;}
   3.150 -      ///\bug This is a workaround until somebody tells me how to
   3.151 -      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
   3.152 -      int &idref() {return n;}
   3.153 -      const int &idref() const {return n;}
   3.154 -    };
   3.155 -    
   3.156 -    class EdgeIt : public Edge {
   3.157 -      friend class FullGraph;
   3.158 -    public:
   3.159 -      EdgeIt(const FullGraph& G) : Edge(G.EdgeNum-1) { }
   3.160 -      EdgeIt (Invalid i) : Edge(i) { }
   3.161 -      EdgeIt() : Edge() { }
   3.162 -      ///\bug This is a workaround until somebody tells me how to
   3.163 -      ///make class \c SymFullGraph::SymEdgeMap friend of Edge
   3.164 -      int &idref() {return n;}
   3.165 -    };
   3.166 -    
   3.167 -    class OutEdgeIt : public Edge {
   3.168 -      friend class FullGraph;
   3.169 -    public: 
   3.170 -      OutEdgeIt() : Edge() { }
   3.171 -      OutEdgeIt (Invalid i) : Edge(i) { }
   3.172 -
   3.173 -      OutEdgeIt(const FullGraph& G,const Node v)
   3.174 -	: Edge(v.n) {}
   3.175 -    };
   3.176 -    
   3.177 -    class InEdgeIt : public Edge {
   3.178 -      friend class FullGraph;
   3.179 -    public: 
   3.180 -      InEdgeIt() : Edge() { }
   3.181 -      InEdgeIt (Invalid i) : Edge(i) { }
   3.182 -      InEdgeIt(const FullGraph& G,Node v) :Edge(v.n*G.NodeNum){}
   3.183 -    };
   3.184 -
   3.185 -    template <typename T> class NodeMap
   3.186 -    {
   3.187 -      std::vector<T> container;
   3.188 -
   3.189 -    public:
   3.190 -      typedef T ValueType;
   3.191 -      typedef Node KeyType;
   3.192 -
   3.193 -      NodeMap(const FullGraph &_G) : container(_G.NodeNum) { }
   3.194 -      NodeMap(const FullGraph &_G,const T &t) : container(_G.NodeNum,t) { }
   3.195 -      NodeMap(const NodeMap<T> &m) : container(m.container) { }
   3.196 -
   3.197 -      template<typename TT> friend class NodeMap;
   3.198 -      ///\todo It can copy between different types.
   3.199 -      template<typename TT> NodeMap(const NodeMap<TT> &m)
   3.200 -	: container(m.container.size())
   3.201 -      {
   3.202 -	typename std::vector<TT>::const_iterator i;
   3.203 -	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   3.204 -	    i!=m.container.end();
   3.205 -	    i++)
   3.206 -	  container.push_back(*i);
   3.207 -      }
   3.208 -      void set(Node n, T a) { container[n.n]=a; }
   3.209 -      //'T& operator[](Node n)' would be wrong here
   3.210 -      typename std::vector<T>::reference
   3.211 -      operator[](Node n) { return container[n.n]; }
   3.212 -      //'const T& operator[](Node n)' would be wrong here
   3.213 -      typename std::vector<T>::const_reference 
   3.214 -      operator[](Node n) const { return container[n.n]; }
   3.215 -
   3.216 -      ///\warning There is no safety check at all!
   3.217 -      ///Using operator = between maps attached to different graph may
   3.218 -      ///cause serious problem.
   3.219 -      ///\todo Is this really so?
   3.220 -      ///\todo It can copy between different types.
   3.221 -      const NodeMap<T>& operator=(const NodeMap<T> &m)
   3.222 -      {
   3.223 -	container = m.container;
   3.224 -	return *this;
   3.225 -      }
   3.226 -      template<typename TT>
   3.227 -      const NodeMap<T>& operator=(const NodeMap<TT> &m)
   3.228 -      {
   3.229 -	std::copy(m.container.begin(), m.container.end(), container.begin());
   3.230 -	return *this;
   3.231 -      }
   3.232 -      
   3.233 -      void update() {}    //Useless for Dynamic Maps
   3.234 -      void update(T a) {}  //Useless for Dynamic Maps
   3.235 -    };
   3.236 -    
   3.237 -    template <typename T> class EdgeMap
   3.238 -    {
   3.239 -      std::vector<T> container;
   3.240 -
   3.241 -    public:
   3.242 -      typedef T ValueType;
   3.243 -      typedef Edge KeyType;
   3.244 -
   3.245 -      EdgeMap(const FullGraph &_G) : container(_G.EdgeNum) { }
   3.246 -      EdgeMap(const FullGraph &_G,const T &t) : container(_G.EdgeNum,t) { } 
   3.247 -      EdgeMap(const EdgeMap<T> &m) : container(m.container) { }
   3.248 -
   3.249 -      template<typename TT> friend class EdgeMap;
   3.250 -      ///\todo It can copy between different types. 
   3.251 -      ///\todo We could use 'copy'
   3.252 -      template<typename TT> EdgeMap(const EdgeMap<TT> &m) :
   3.253 -	container(m.container.size())
   3.254 -      {
   3.255 -	typename std::vector<TT>::const_iterator i;
   3.256 -	for(typename std::vector<TT>::const_iterator i=m.container.begin();
   3.257 -	    i!=m.container.end();
   3.258 -	    i++)
   3.259 -	  container.push_back(*i);
   3.260 -      }
   3.261 -      void set(Edge n, T a) { container[n.n]=a; }
   3.262 -      //T get(Edge n) const { return container[n.n]; }
   3.263 -      typename std::vector<T>::reference
   3.264 -      operator[](Edge n) { return container[n.n]; }
   3.265 -      typename std::vector<T>::const_reference
   3.266 -      operator[](Edge n) const { return container[n.n]; }
   3.267 -
   3.268 -      ///\warning There is no safety check at all!
   3.269 -      ///Using operator = between maps attached to different graph may
   3.270 -      ///cause serious problem.
   3.271 -      ///\todo Is this really so?
   3.272 -      ///\todo It can copy between different types.
   3.273 -      const EdgeMap<T>& operator=(const EdgeMap<T> &m)
   3.274 -      {
   3.275 -	container = m.container;
   3.276 -	return *this;
   3.277 -      }
   3.278 -      template<typename TT>
   3.279 -      const EdgeMap<T>& operator=(const EdgeMap<TT> &m)
   3.280 -      {
   3.281 -	std::copy(m.container.begin(), m.container.end(), container.begin());
   3.282 -	return *this;
   3.283 -      }
   3.284 -      
   3.285 -      void update() {}
   3.286 -      void update(T a) {}
   3.287 -    };
   3.288 -
   3.289 -  };
   3.290 -
   3.291 -  /// @}  
   3.292 -
   3.293 -} //namespace hugo
   3.294 -
   3.295 -
   3.296 -
   3.297 -
   3.298 -#endif //HUGO_FULL_GRAPH_H