1.1 --- a/src/benchmark/hcube.cc Wed Sep 22 12:42:19 2004 +0000
1.2 +++ b/src/benchmark/hcube.cc Thu Sep 23 14:40:45 2004 +0000
1.3 @@ -66,10 +66,13 @@
1.4 for(int i=0;i<dim*(1<<dim);i++) P();
1.5
1.6 // for(EdgeIt e(G);G.valid(e);G.next(e)) map[e]=P();
1.7 - for(int i=0;i<dim*(1<<dim);i++)
1.8 + Edge te;
1.9 + for(int i=0;i<dim*(1<<dim);i++) {
1.10 + te.setToId(((long long int)(i)*93505)%(dim*(1<<dim)));
1.11 // map[Edge(((long long int)(i)*2987)%(dim*(1<<dim)))]=P();
1.12 - map[Edge(((long long int)(i)*93505)%(dim*(1<<dim)))]=P();
1.13 -
1.14 + map[te]=P();
1.15 + }
1.16 +
1.17 // for(int i=0;i<(1<<dim);i++) {
1.18 // int mul= (1<<(numOfZeros(i,dim)/4));
1.19 // for(OutEdgeIt e(G,nodes[i]);G.valid(e);G.next(e))
2.1 --- a/src/hugo/list_graph.h Wed Sep 22 12:42:19 2004 +0000
2.2 +++ b/src/hugo/list_graph.h Thu Sep 23 14:40:45 2004 +0000
2.3 @@ -76,7 +76,7 @@
2.4
2.5 // Create map registries.
2.6 CREATE_MAP_REGISTRIES;
2.7 - /// Create node and edge maps.
2.8 + // Create node and edge maps.
2.9 CREATE_MAPS(ArrayMap);
2.10
2.11 public:
2.12 @@ -321,8 +321,7 @@
2.13 friend class ListGraph;
2.14 template <typename T> friend class EdgeMap;
2.15
2.16 - //template <typename T> friend class SymListGraph::SymEdgeMap;
2.17 - //friend Edge SymListGraph::opposite(Edge) const;
2.18 + friend class SymListGraph;
2.19
2.20 friend class Node;
2.21 friend class NodeIt;
2.22 @@ -342,10 +341,6 @@
2.23 bool operator==(const Edge i) const {return n==i.n;}
2.24 bool operator!=(const Edge i) const {return n!=i.n;}
2.25 bool operator<(const Edge i) const {return n<i.n;}
2.26 - ///\bug This is a workaround until somebody tells me how to
2.27 - ///make class \c SymListGraph::SymEdgeMap friend of Edge
2.28 - int &idref() {return n;}
2.29 - const int &idref() const {return n;}
2.30 // ///Validity check
2.31 // operator bool() { return n!=-1; }
2.32 };
2.33 @@ -363,9 +358,6 @@
2.34 EdgeIt (Invalid i) : Edge(i) { }
2.35 EdgeIt(const ListGraph& _G, Edge e) : Edge(e), G(&_G) { }
2.36 EdgeIt() : Edge() { }
2.37 - ///\bug This is a workaround until somebody tells me how to
2.38 - ///make class \c SymListGraph::SymEdgeMap friend of Edge
2.39 - int &idref() {return n;}
2.40 EdgeIt &operator++() {
2.41 if(G->edges[n].next_in!=-1) n=G->edges[n].next_in;
2.42 else {
2.43 @@ -465,7 +457,7 @@
2.44 static Edge opposite(Edge e)
2.45 {
2.46 Edge f;
2.47 - f.idref() = e.idref() - 2*(e.idref()%2) + 1;
2.48 + f.n = e.n - 2*(e.n%2) + 1;
2.49 return f;
2.50 }
2.51
2.52 @@ -604,7 +596,7 @@
2.53 ///
2.54 /// The ID of the \ref INVALID node is -1.
2.55 ///\return The ID of the node \c v.
2.56 - int id(Node v) const { return v.n; }
2.57 + static int id(Node v) { return v.n; }
2.58 /// Edge ID.
2.59
2.60 /// The ID of a valid Edge is a nonnegative integer not greater than
2.61 @@ -613,7 +605,7 @@
2.62 ///
2.63 /// The ID of the \ref INVALID edge is -1.
2.64 ///\return The ID of the edge \c e.
2.65 - int id(Edge e) const { return -1; }
2.66 + static int id(Edge e) { return -1; }
2.67
2.68 /// Adds a new node to the graph.
2.69
2.70 @@ -683,7 +675,7 @@
2.71
2.72 protected:
2.73 int n;
2.74 - friend int NodeSet::id(Node v) const;
2.75 + friend int NodeSet::id(Node v);
2.76 Node(int nn) {n=nn;}
2.77 public:
2.78 Node() {}
2.79 @@ -708,39 +700,20 @@
2.80 };
2.81
2.82 class Edge {
2.83 - //friend class NodeSet;
2.84 - //template <typename T> friend class EdgeMap;
2.85 -
2.86 - //template <typename T> friend class SymNodeSet::SymEdgeMap;
2.87 - //friend Edge SymNodeSet::opposite(Edge) const;
2.88 -
2.89 - // friend class Node;
2.90 - // friend class NodeIt;
2.91 - protected:
2.92 - //friend int NodeSet::id(Edge e) const;
2.93 - // Edge(int nn) {}
2.94 public:
2.95 Edge() { }
2.96 Edge (Invalid) { }
2.97 bool operator==(const Edge i) const {return true;}
2.98 bool operator!=(const Edge i) const {return false;}
2.99 bool operator<(const Edge i) const {return false;}
2.100 - ///\bug This is a workaround until somebody tells me how to
2.101 - ///make class \c SymNodeSet::SymEdgeMap friend of Edge
2.102 - // int idref() {return -1;}
2.103 - // int idref() const {return -1;}
2.104 };
2.105
2.106 class EdgeIt : public Edge {
2.107 - //friend class NodeSet;
2.108 public:
2.109 EdgeIt(const NodeSet& G) : Edge() { }
2.110 EdgeIt(const NodeSet&, Edge) : Edge() { }
2.111 EdgeIt (Invalid i) : Edge(i) { }
2.112 EdgeIt() : Edge() { }
2.113 - ///\bug This is a workaround until somebody tells me how to
2.114 - ///make class \c SymNodeSet::SymEdgeMap friend of Edge
2.115 - // int idref() {return -1;}
2.116 EdgeIt operator++() { return INVALID; }
2.117 };
2.118
2.119 @@ -810,7 +783,6 @@
2.120
2.121 class Node : public NodeGraphType::Node {
2.122 friend class EdgeSet;
2.123 - // template <typename T> friend class NodeMap;
2.124
2.125 friend class Edge;
2.126 friend class OutEdgeIt;
2.127 @@ -819,7 +791,6 @@
2.128
2.129 public:
2.130 friend int EdgeSet::id(Node v) const;
2.131 - // Node(int nn) {n=nn;}
2.132 public:
2.133 Node() : NodeGraphType::Node() {}
2.134 Node (Invalid i) : NodeGraphType::Node(i) {}
2.135 @@ -946,7 +917,7 @@
2.136 ///
2.137 /// The ID of the \ref INVALID edge is -1.
2.138 ///\return The ID of the edge \c e.
2.139 - int id(Edge e) const { return e.n; }
2.140 + static int id(Edge e) { return e.n; }
2.141
2.142 /// Adds a new node to the graph.
2.143 Node addNode() { return G.addNode(); }
2.144 @@ -1023,13 +994,6 @@
2.145
2.146 public:
2.147
2.148 -// void erase(Node nn) {
2.149 -// int n=nn.n;
2.150 -// int m;
2.151 -// while((m=nodes[n].first_in)!=-1) eraseEdge(m);
2.152 -// while((m=nodes[n].first_out)!=-1) eraseEdge(m);
2.153 -// }
2.154 -
2.155 void erase(Edge e) { eraseEdge(e.n); }
2.156
2.157 ///Clear all edges. (Doesn't clear the nodes!)
2.158 @@ -1047,11 +1011,8 @@
2.159
2.160 friend class Node;
2.161 friend class NodeIt;
2.162 - public:
2.163 - ///\bug It should be at least protected
2.164 - ///
2.165 + protected:
2.166 int n;
2.167 - protected:
2.168 friend int EdgeSet::id(Edge e) const;
2.169
2.170 Edge(int nn) {n=nn;}
2.171 @@ -1061,10 +1022,6 @@
2.172 bool operator==(const Edge i) const {return n==i.n;}
2.173 bool operator!=(const Edge i) const {return n!=i.n;}
2.174 bool operator<(const Edge i) const {return n<i.n;}
2.175 - ///\bug This is a workaround until somebody tells me how to
2.176 - ///make class \c SymEdgeSet::SymEdgeMap friend of Edge
2.177 - int &idref() {return n;}
2.178 - const int &idref() const {return n;}
2.179 };
2.180
2.181 class EdgeIt : public Edge {
2.182 @@ -1074,7 +1031,6 @@
2.183 const EdgeSet *G;
2.184 public:
2.185 EdgeIt(const EdgeSet& _G) : Edge(), G(&_G) {
2.186 - // typename NodeGraphType::Node m;
2.187 NodeIt m;
2.188 for(G->first(m);
2.189 m!=INVALID && G->nodes[m].first_in == -1; ++m);
2.190 @@ -1091,9 +1047,6 @@
2.191 EdgeIt &operator++() {
2.192 return *this;
2.193 }
2.194 - ///\bug This is a workaround until somebody tells me how to
2.195 - ///make class \c SymEdgeSet::SymEdgeMap friend of Edge
2.196 - int &idref() {return this->n;}
2.197 };
2.198
2.199 class OutEdgeIt : public Edge {
3.1 --- a/src/hugo/smart_graph.h Wed Sep 22 12:42:19 2004 +0000
3.2 +++ b/src/hugo/smart_graph.h Thu Sep 23 14:40:45 2004 +0000
3.3 @@ -217,32 +217,27 @@
3.4 friend class SmartGraph;
3.5 template <typename T> friend class EdgeMap;
3.6
3.7 - //template <typename T> friend class SymSmartGraph::SymEdgeMap;
3.8 - //friend Edge SymSmartGraph::opposite(Edge) const;
3.9 + friend class SymSmartGraph;
3.10
3.11 friend class Node;
3.12 friend class NodeIt;
3.13 protected:
3.14 int n;
3.15 friend int SmartGraph::id(Edge e);
3.16 -
3.17 + Edge(int nn) {n=nn;}
3.18 public:
3.19 /// An Edge with id \c n.
3.20
3.21 - /// \bug It should be
3.22 - /// obtained by a member function of the Graph.
3.23 - Edge(int nn) {n=nn;}
3.24 Edge() { }
3.25 Edge (Invalid) { n=-1; }
3.26 bool operator==(const Edge i) const {return n==i.n;}
3.27 bool operator!=(const Edge i) const {return n!=i.n;}
3.28 bool operator<(const Edge i) const {return n<i.n;}
3.29 - ///\bug This is a workaround until somebody tells me how to
3.30 - ///make class \c SymSmartGraph::SymEdgeMap friend of Edge
3.31 - int &idref() {return n;}
3.32 - const int &idref() const {return n;}
3.33 // ///Validity check
3.34 // operator bool() { return n!=-1; }
3.35 +
3.36 + ///Set the edge to that have ID \c ID.
3.37 + void setToId(int id) { n=id; }
3.38 };
3.39
3.40 class EdgeIt : public Edge {
3.41 @@ -253,9 +248,6 @@
3.42 EdgeIt(const SmartGraph& _G, Edge e) : Edge(e), G(&_G) { }
3.43 EdgeIt (Invalid i) : Edge(i) { }
3.44 EdgeIt() : Edge() { }
3.45 - ///\bug This is a workaround until somebody tells me how to
3.46 - ///make class \c SymSmartGraph::SymEdgeMap friend of Edge
3.47 - int &idref() {return n;}
3.48 EdgeIt &operator++() { --n; return *this; }
3.49 // ///Validity check
3.50 // operator bool() { return Edge::operator bool(); }
3.51 @@ -342,7 +334,7 @@
3.52 static Edge opposite(Edge e)
3.53 {
3.54 Edge f;
3.55 - f.idref() = e.idref() - 2*(e.idref()%2) + 1;
3.56 + f.n = e.n - 2*(e.n%2) + 1;
3.57 return f;
3.58 }
3.59