1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/include/oldgraph.h Sat Dec 06 19:32:27 2003 +0000
1.3 @@ -0,0 +1,551 @@
1.4 +// -*-mode: c++; -*-
1.5 +#ifndef __OLDGRAPH_H_
1.6 +#define __OLDGRAPH_H_
1.7 +
1.8 +#include <stdio.h>
1.9 +
1.10 +//#include <new>
1.11 +
1.12 +#define INVALID -1
1.13 +#define FREE_NODE INVALID
1.14 +
1.15 +#define EDGE_BLOCK_SIZE 100
1.16 +#define INIT_NODES_SIZE 10
1.17 +#define INIT_EDGES_BLOCK_MAX 10
1.18 +
1.19 +#define foreachNode(n,G) for((n)=(G).FirstNode();(n)!=INVALID;(n)=(G).NextNode(n))
1.20 +#define foreachIn(e,G,n) for((e)=(G).FirstIn(n) ;(e);(e)=(G).NextIn(e) )
1.21 +#define foreachOut(e,G,n) for((e)=(G).FirstOut(n);(e);(e)=(G).NextOut(e))
1.22 +#define foreachEdge(e,G,n) for((e)=(G).FirstEdge(n);(e);(e)=(G).NextEdge((n),(e)))
1.23 +
1.24 +struct EdgeIndex { int block,index; };
1.25 +
1.26 +extern EdgeIndex InvalidIndex;
1.27 +
1.28 +class EdgeCorp;
1.29 +typedef EdgeCorp *EdgePoint;
1.30 +
1.31 +class EdgeCorp {
1.32 + public:
1.33 + int from,to; //from==INVALID <=> this is a free edge.
1.34 + EdgePoint previn,nextin,prevout,nextout;
1.35 + EdgeIndex index;
1.36 +
1.37 + int From() { return from; }
1.38 + int To() { return to; }
1.39 + EdgePoint NextIn() { return nextin; }
1.40 + EdgePoint NextOut() { return nextout; }
1.41 +};
1.42 +
1.43 +inline int From(EdgePoint e) { return e->from; }
1.44 +inline int To(EdgePoint e) { return e->to; }
1.45 +inline EdgePoint NextIn(EdgePoint e) { return e->nextin; }
1.46 +inline EdgePoint NextOut(EdgePoint e) { return e->nextout; }
1.47 +
1.48 +
1.49 +//////////////////////////////////////////////////////////////////////
1.50 +// OLDGRAPH TEMPLATE
1.51 +//////////////////////////////////////////////////////////////////////
1.52 +// Copy Constructor should be provided for N
1.53 +
1.54 +//class Graph;
1.55 +//class Graph::NodeIterator; //Nem megy. Disznosag!
1.56 +template <class N, class E> class OldGraph
1.57 +{
1.58 +
1.59 + // friend class NEGRO::Graph::NodeIterator; //Nem megy. Disznosag!
1.60 +
1.61 +
1.62 + class nodes_t;
1.63 + friend class OldGraph::nodes_t;
1.64 + class edge_block;
1.65 + friend class OldGraph::edge_block;
1.66 +
1.67 + class edge_t : public EdgeCorp {
1.68 + public:
1.69 + //edge_t *previn,*nextin,*prevout,*nextout;
1.70 + union {
1.71 + int _align;
1.72 + char data[sizeof(E)];
1.73 + };
1.74 + };
1.75 +
1.76 + class nodes_t {
1.77 + public:
1.78 + union {
1.79 + int _align;
1.80 + char data[sizeof(N)];
1.81 + };
1.82 + int indeg,outdeg; // indeg==FREE_NODE <=> this node is free.
1.83 + EdgePoint firstin, firstout;
1.84 + int prev,next;
1.85 +
1.86 + void Copy(nodes_t &n)
1.87 + {
1.88 + indeg = n.indeg; outdeg = n.outdeg;
1.89 + firstin = n.firstin; firstout = n.firstout;
1.90 + prev = n.prev; next = n.next;
1.91 + if(n.indeg!=FREE_NODE) new(data) N(*(N*)(n.data));
1.92 + // if(n.indeg!=FREE_NODE) {
1.93 + // new(data) N;
1.94 + // (*(N*)(data))=(*(N*)(n.data));
1.95 + // }
1.96 + }
1.97 +
1.98 + } *nodes;
1.99 + int nodenum, nodes_size;
1.100 + int firstnode, freenodes;
1.101 + class edge_block {
1.102 + public:
1.103 + //edge_block *next;
1.104 + // char fields[sizeof(edge_t)*EDGE_BLOCK_SIZE];
1.105 + edge_t fields[EDGE_BLOCK_SIZE];
1.106 + } **edges;
1.107 + int edge_block_num,edge_block_max;
1.108 + EdgePoint freeedges;
1.109 +
1.110 + void setup(int nosi = INIT_NODES_SIZE);
1.111 + void destroy();
1.112 + void inc_nodes_size(int n);
1.113 +
1.114 + public:
1.115 + int NodeNum() {return nodenum;};
1.116 + int EdgeNum();
1.117 + int MaxNode() {return nodes_size;};
1.118 + int FirstNode() {return firstnode;};
1.119 + int NextNode(int n) {return nodes[n].next;};
1.120 + int PrevNode(int n) {return nodes[n].prev;};
1.121 + N& operator()(int n) {return *(N*)(nodes[n].data);};
1.122 + N& Data (int n) {return *(N*)(nodes[n].data);};
1.123 + int AddNode();
1.124 + void AddNodeBlock(int n) {for(int i=0;i<n;i++) AddNode();}
1.125 + int AddNode(int n);
1.126 + void Delete(int n);
1.127 + int isaNode(int n) {return n>=0&&n<nodes_size&&nodes[n].indeg!=FREE_NODE;};
1.128 +
1.129 + int InDeg(int n) {return nodes[n].indeg;};
1.130 + int OutDeg(int n) {return nodes[n].outdeg;};
1.131 + EdgePoint FirstIn(int n) {return nodes[n].firstin;};
1.132 + EdgePoint FirstOut(int n) {return nodes[n].firstout;};
1.133 +
1.134 + E& operator()(EdgePoint e) {return *(E*)(((edge_t*)e)->data);};
1.135 + E& Data (EdgePoint e) {return *(E*)(((edge_t*)e)->data);};
1.136 + int From(EdgePoint e) {return e->from;};
1.137 + int To(EdgePoint e) {return e->to;};
1.138 + EdgePoint NextIn(EdgePoint e)
1.139 + {return e->nextin;};
1.140 + EdgePoint NextOut(EdgePoint e)
1.141 + {return e->nextout;};
1.142 + EdgePoint AddEdge(int f, int t);
1.143 + void Delete(EdgePoint e);
1.144 + EdgePoint Edge(int f,int t);
1.145 + // EdgePoint Edge(E &d)
1.146 + // {return (EdgePoint)(((char*)&d)-(char*)&(((edge_t*)NULL)->data));};
1.147 + E& operator()(int f, int t) {return *(E*)(((edge_t*)Edge(f,t))->data);};
1.148 + E& Data(int f, int t) {return *(E*)(((edge_t*)Edge(f,t))->data);};
1.149 + void Delete(int f, int t) {Delete(Edge(f,t));};
1.150 + void Reverse(EdgePoint e);
1.151 +
1.152 + // Functions for EdgeIndex
1.153 +
1.154 + EdgePoint Edge(EdgeIndex i)
1.155 + { return (EdgePoint)(edges[i.block]->fields+i.index);};
1.156 + EdgeIndex Index(EdgePoint e) { return e->index;};
1.157 + EdgeIndex Index(int f, int t) { EdgePoint e; return Edge(f,t)->index; }
1.158 + void Delete(EdgeIndex i) { Delete(Edge(i));};
1.159 + E& operator()(EdgeIndex i)
1.160 + {return *(E*)(edges[i.block]->fields[i.index].data);};
1.161 + E& Data(EdgeIndex i)
1.162 + {return *(E*)(edges[i.block]->fields[i.index].data);};
1.163 + EdgePoint AddEdge(int f, int t,EdgeIndex in);
1.164 +
1.165 +
1.166 +
1.167 + // Operators for symmetric graphs:
1.168 +
1.169 + EdgePoint FirstEdge(int n)
1.170 + { return (EdgePoint)(FirstIn(n)?FirstIn(n):FirstOut(n));};
1.171 + EdgePoint NextEdge(int n,EdgePoint e)
1.172 + { return From(e)==n?NextOut(e):(NextIn(e)?NextIn(e):FirstOut(n)); };
1.173 + int Opposite(EdgePoint e,int n)
1.174 + { return From(e)+To(e)-n; };
1.175 +
1.176 + // Initializers, destructors
1.177 +
1.178 + OldGraph() {setup();};
1.179 + OldGraph(int nosi) {setup(nosi);};
1.180 + OldGraph(OldGraph<N,E> &H) {setup();operator=(H);};
1.181 + ~OldGraph() {destroy();};
1.182 + void Clean(int nosi = INIT_NODES_SIZE) {destroy();setup(nosi);};
1.183 + void Clear(int nosi = INIT_NODES_SIZE) {destroy();setup(nosi);};
1.184 +
1.185 + void DeleteEdges();
1.186 +
1.187 + OldGraph<N,E> &operator=(OldGraph<N,E> &H);
1.188 +};
1.189 +
1.190 +//////////////////////////////////////////////////////////////////////
1.191 +// Template Definitions
1.192 +//////////////////////////////////////////////////////////////////////
1.193 +
1.194 +//#include <stdio.h>
1.195 +
1.196 +//**********************************************************************
1.197 +// OldGraph definitions
1.198 +//**********************************************************************
1.199 +
1.200 +template<class N, class E> void OldGraph<N,E>::setup(int nosi) {
1.201 + int i;
1.202 +
1.203 + //Set up nodes
1.204 + nodenum = 0;
1.205 + nodes_size = nosi;
1.206 + // nodes = (nodes_t*) new char[sizeof(nodes_t)*nodes_size];
1.207 + nodes = (nodes_t*) new nodes_t [nodes_size];
1.208 + for(i=0;i<nodes_size;i++)
1.209 + {
1.210 + nodes[i].prev=i-1;
1.211 + nodes[i].next=i+1;
1.212 + nodes[i].indeg=FREE_NODE;
1.213 + nodes[i].outdeg=0;
1.214 + nodes[i].firstin=nodes[i].firstout=NULL;
1.215 + }
1.216 + firstnode=nodes[0].prev=nodes[nodes_size-1].next=INVALID;
1.217 + freenodes=0;
1.218 + //Set up edge-list_template_type;
1.219 + freeedges = NULL;
1.220 +
1.221 + edges = new edge_block* [edge_block_max=INIT_EDGES_BLOCK_MAX];
1.222 + edge_block_num = 0;
1.223 +
1.224 +}
1.225 +
1.226 +template<class N, class E> void OldGraph<N,E>::destroy()
1.227 +{
1.228 + edge_block *oe;
1.229 + int i;
1.230 +
1.231 + while(firstnode!=INVALID) Delete(firstnode);
1.232 + delete [] nodes;
1.233 + for(i=0;i<edge_block_num;i++) delete edges[i];
1.234 + delete [] edges;
1.235 +}
1.236 +
1.237 +template<class N, class E> void OldGraph<N,E>::inc_nodes_size(int n)
1.238 +{
1.239 + int i;
1.240 + if(n<=nodenum) return;
1.241 +
1.242 + nodes_t *nn;
1.243 +// nn = (nodes_t*) new char [sizeof(nodes_t)*n];
1.244 + nn = (nodes_t*) new nodes_t [n];
1.245 + for(i=0;i<nodes_size;i++)
1.246 + {
1.247 + nn[i].Copy(nodes[i]);
1.248 + if(nodes[i].indeg!=FREE_NODE) ((N*)(nodes[i].data))->~N();
1.249 + }
1.250 +
1.251 + delete [] nodes;
1.252 + nodes = nn;
1.253 + for(i=nodes_size;i<n;i++)
1.254 + {
1.255 + nodes[i].prev=i-1;
1.256 + nodes[i].next=i+1;
1.257 + nodes[i].indeg=FREE_NODE;
1.258 + nodes[i].outdeg=0;
1.259 + nodes[i].firstin=nodes[i].firstout=NULL;
1.260 + }
1.261 + nodes[nodes_size].prev=INVALID;
1.262 + nodes[n-1].next=freenodes;
1.263 + if(freenodes!=INVALID) nodes[freenodes].prev=n-1;
1.264 + freenodes=nodes_size;
1.265 + nodes_size=n;
1.266 +}
1.267 +
1.268 +template<class N, class E> OldGraph<N,E> &OldGraph<N,E>::operator=(OldGraph<N,E> &H)
1.269 +{
1.270 + Clean();
1.271 +
1.272 + int i;
1.273 + EdgePoint e;
1.274 +
1.275 + for(i=H.FirstNode();i!=INVALID;i=H.NextNode(i))
1.276 + {
1.277 + AddNode(i);
1.278 + operator()(i)=H(i);
1.279 + }
1.280 + for(i=H.FirstNode();i!=INVALID;i=H.NextNode(i))
1.281 + for(e=H.FirstOut(i);e;e=H.NextOut(e))
1.282 + operator()(AddEdge(i,H.To(e),H.Index(e)))=H(e);
1.283 +
1.284 + return *this;
1.285 +}
1.286 +
1.287 +template<class N, class E> int OldGraph<N,E>::EdgeNum()
1.288 +{
1.289 + int n=firstnode, m=0;
1.290 + EdgePoint e;
1.291 + while(n != INVALID)
1.292 + {
1.293 + e=FirstOut(n);
1.294 + while (e != NULL)
1.295 + {
1.296 + m++;
1.297 + e=NextOut(e);
1.298 + }
1.299 + n=nodes[n].next;
1.300 + }
1.301 + return m;
1.302 +}
1.303 +
1.304 +template<class N, class E> int OldGraph<N,E>::AddNode()
1.305 +{
1.306 + int i;
1.307 +
1.308 + if(freenodes==INVALID) inc_nodes_size(2*nodes_size);
1.309 +
1.310 + i=freenodes;
1.311 + if(firstnode!=INVALID) nodes[firstnode].prev=i;
1.312 + freenodes=nodes[i].next;
1.313 + new(nodes[i].data) N; //Explicit constructor call
1.314 + nodes[i].next=firstnode;
1.315 + nodes[i].prev=INVALID;
1.316 + nodes[i].indeg=0;
1.317 + firstnode=i;
1.318 + if(freenodes!=INVALID) nodes[freenodes].prev=INVALID;
1.319 + nodenum++;
1.320 + return i;
1.321 +}
1.322 +
1.323 +template<class N, class E> int OldGraph<N,E>::AddNode(int n)
1.324 +{
1.325 + int i;
1.326 +
1.327 + if(n>=nodes_size)
1.328 + {
1.329 + for(i=INIT_NODES_SIZE;i<=n;i*=2) ;
1.330 + inc_nodes_size(i);
1.331 + }
1.332 +
1.333 + if(nodes[n].indeg==FREE_NODE)
1.334 + {
1.335 + new(nodes[n].data) N; //Explicit constructor call
1.336 + if(nodes[n].next!=INVALID) nodes[nodes[n].next].prev = nodes[n].prev;
1.337 + if(nodes[n].prev!=INVALID) nodes[nodes[n].prev].next = nodes[n].next;
1.338 + else freenodes = nodes[n].next;
1.339 +
1.340 + nodes[n].prev = INVALID;
1.341 + if((nodes[n].next = firstnode)!=INVALID) nodes[firstnode].prev=n;
1.342 + firstnode = n;
1.343 + nodenum++;
1.344 + nodes[n].indeg=0;
1.345 + }
1.346 + return n;
1.347 +}
1.348 +
1.349 +template<class N, class E> void OldGraph<N,E>::Delete(int n)
1.350 +{
1.351 + if(n==INVALID||nodes[n].indeg==FREE_NODE) return;
1.352 +
1.353 + EdgePoint e;
1.354 +
1.355 + while(e=FirstIn(n)) Delete(e);
1.356 + while(e=FirstOut(n)) Delete(e);
1.357 +
1.358 + if(n==firstnode) firstnode=nodes[n].next;
1.359 + if(nodes[n].prev!=INVALID) nodes[nodes[n].prev].next=nodes[n].next;
1.360 + if(nodes[n].next!=INVALID) nodes[nodes[n].next].prev=nodes[n].prev;
1.361 + if(freenodes!=INVALID) nodes[freenodes].prev=n;
1.362 + nodes[n].next=freenodes;
1.363 + nodes[n].prev=INVALID;
1.364 + nodes[n].indeg=FREE_NODE;
1.365 + ((N*)(nodes[n].data))->~N(); //Explicit destructor call
1.366 + freenodes=n;
1.367 +
1.368 + nodenum--;
1.369 +}
1.370 +
1.371 +template<class N, class E> EdgePoint OldGraph<N,E>::AddEdge(int f, int t)
1.372 +{
1.373 + int i;
1.374 + edge_block *peb;
1.375 + edge_block **ppeb;
1.376 + edge_t *e;
1.377 +
1.378 + if(!freeedges)
1.379 + {
1.380 + if(edge_block_num>=edge_block_max)
1.381 + {
1.382 + ppeb = new edge_block* [edge_block_max*=2];
1.383 + for(i=0;i<edge_block_num;i++) ppeb[i]=edges[i];
1.384 + delete [] edges;
1.385 + edges = ppeb;
1.386 + }
1.387 + peb = new edge_block;
1.388 + edges[edge_block_num] = peb;
1.389 +
1.390 + for(i=0;i<EDGE_BLOCK_SIZE;i++)
1.391 + {
1.392 + ((edge_t*)peb->fields)[i].nextin=((edge_t*)peb->fields)+(i+1);
1.393 + ((edge_t*)peb->fields)[i].previn=((edge_t*)peb->fields)+(i-1);
1.394 + ((edge_t*)peb->fields)[i].index.block = edge_block_num;
1.395 + ((edge_t*)peb->fields)[i].index.index = i;
1.396 + ((edge_t*)peb->fields)[i].from = INVALID;
1.397 + }
1.398 + ((edge_t*)peb->fields)[0].previn=
1.399 + ((edge_t*)peb->fields)[EDGE_BLOCK_SIZE-1].nextin=NULL;
1.400 + freeedges = (edge_t*)peb->fields;
1.401 + edge_block_num++;
1.402 + }
1.403 +
1.404 + e=(edge_t *)freeedges;
1.405 + new (e->data) E; //Explicit constructor call
1.406 + freeedges=e->nextin;
1.407 + if(freeedges) freeedges->previn=NULL;
1.408 +
1.409 + e->from=f; e->to=t;
1.410 + e->previn=e->prevout=NULL;
1.411 + e->nextin=nodes[t].firstin;
1.412 + e->nextout=nodes[f].firstout;
1.413 + if(nodes[t].firstin) nodes[t].firstin->previn=e;
1.414 + if(nodes[f].firstout) nodes[f].firstout->prevout=e;
1.415 + nodes[t].firstin=nodes[f].firstout=e;
1.416 + nodes[t].indeg++; nodes[f].outdeg++;
1.417 +
1.418 + return (EdgePoint)e;
1.419 +
1.420 +}
1.421 +
1.422 +template<class N, class E>
1.423 +EdgePoint OldGraph<N,E>::AddEdge(int f, int t, EdgeIndex in)
1.424 +{
1.425 + int i;
1.426 + edge_block *peb;
1.427 + edge_block **ppeb;
1.428 + edge_t *e;
1.429 +
1.430 + while(edge_block_num<=in.block)
1.431 + {
1.432 + if(edge_block_num>=edge_block_max)
1.433 + {
1.434 + ppeb = new edge_block* [edge_block_max*=2];
1.435 + for(i=0;i<edge_block_num;i++) ppeb[i]=edges[i];
1.436 + delete [] edges;
1.437 + edges = ppeb;
1.438 + }
1.439 + peb = new edge_block;
1.440 + edges[edge_block_num] = peb;
1.441 +
1.442 + for(i=0;i<EDGE_BLOCK_SIZE;i++)
1.443 + {
1.444 + ((edge_t*)peb->fields)[i].nextin=((edge_t*)peb->fields)+(i+1);
1.445 + ((edge_t*)peb->fields)[i].previn=((edge_t*)peb->fields)+(i-1);
1.446 + ((edge_t*)peb->fields)[i].index.block = edge_block_num;
1.447 + ((edge_t*)peb->fields)[i].index.index = i;
1.448 + ((edge_t*)peb->fields)[i].from = INVALID;
1.449 + }
1.450 + ((edge_t*)peb->fields)[0].previn=NULL;
1.451 + ((edge_t*)peb->fields)[EDGE_BLOCK_SIZE-1].nextin=freeedges;
1.452 + if(freeedges)
1.453 + freeedges->previn = ((edge_t*)peb->fields) + (EDGE_BLOCK_SIZE-1);
1.454 + freeedges = (edge_t*)peb->fields;
1.455 + edge_block_num++;
1.456 + }
1.457 +
1.458 +
1.459 + e=((edge_t*)(edges[in.block]->fields))+in.index;
1.460 + if(e->from==INVALID)
1.461 + {
1.462 + if(e->previn) e->previn->nextin = e->nextin;
1.463 + else freeedges = e->nextin;
1.464 + if(e->nextin) e->nextin->previn = e->previn;
1.465 +
1.466 + new (e->data) E; //Explicit constructor call
1.467 +
1.468 + e->from=f; e->to=t;
1.469 + e->previn=e->prevout=NULL;
1.470 + e->nextin=nodes[t].firstin;
1.471 + e->nextout=nodes[f].firstout;
1.472 + if(nodes[t].firstin) nodes[t].firstin->previn=e;
1.473 + if(nodes[f].firstout) nodes[f].firstout->prevout=e;
1.474 + nodes[t].firstin=nodes[f].firstout=e;
1.475 + nodes[t].indeg++; nodes[f].outdeg++;
1.476 + }
1.477 + return (EdgePoint)e;
1.478 +}
1.479 +
1.480 +template<class N, class E> void OldGraph<N,E>::Delete(EdgePoint e)
1.481 +{
1.482 + if(!e||e->from==INVALID) return;
1.483 +
1.484 + ((E*)(((edge_t*)e)->data))->~E(); //Explicit destructor call
1.485 +
1.486 + nodes[e->from].outdeg--; nodes[e->to].indeg--;
1.487 +
1.488 +
1.489 + if(e->previn)
1.490 + e->previn->nextin=e->nextin;
1.491 + else nodes[e->to].firstin=e->nextin;
1.492 + if(e->prevout)
1.493 + e->prevout->nextout=e->nextout;
1.494 + else nodes[e->from].firstout=e->nextout;
1.495 + if(e->nextin)
1.496 + e->nextin->previn=e->previn;
1.497 + if(e->nextout)
1.498 + e->nextout->prevout=e->prevout;
1.499 +
1.500 + if(freeedges) freeedges->previn=e;
1.501 + e->previn=NULL; e->nextin=freeedges;
1.502 +
1.503 + e->from = INVALID;
1.504 + freeedges=e;
1.505 +}
1.506 +
1.507 +template<class N, class E> EdgePoint OldGraph<N,E>::Edge(int f, int t)
1.508 +{
1.509 + EdgePoint e;
1.510 +
1.511 + for(e=nodes[f].firstout;e&&e->to!=t;e=e->nextout) ;
1.512 +
1.513 + return (EdgePoint) e;
1.514 +}
1.515 +
1.516 +template<class N, class E> void OldGraph<N,E>::Reverse(EdgePoint e)
1.517 +{
1.518 + if(!e) return;
1.519 +
1.520 + nodes[e->from].outdeg--; nodes[e->to].indeg--;
1.521 +
1.522 + if(e->previn)
1.523 + e->previn->nextin=e->nextin;
1.524 + else nodes[e->to].firstin=e->nextin;
1.525 + if(e->prevout)
1.526 + e->prevout->nextout=e->nextout;
1.527 + else nodes[e->from].firstout=e->nextout;
1.528 + if(e->nextin)
1.529 + e->nextin->previn=e->previn;
1.530 + if(e->nextout)
1.531 + e->nextout->prevout=e->prevout;
1.532 +
1.533 + int t,f;
1.534 + f=e->to;e->to=t=e->from;
1.535 + e->from=f;
1.536 +
1.537 + e->previn=e->prevout=NULL;
1.538 + e->nextin=nodes[t].firstin;
1.539 + e->nextout=nodes[f].firstout;
1.540 + if(nodes[t].firstin) nodes[t].firstin->previn=e;
1.541 + if(nodes[f].firstout) nodes[f].firstout->prevout=e;
1.542 + nodes[t].firstin=nodes[f].firstout=e;
1.543 + nodes[t].indeg++; nodes[f].outdeg++;
1.544 +
1.545 +}
1.546 +
1.547 +template<class N, class E> void OldGraph<N,E>::DeleteEdges()
1.548 +{
1.549 + int n;
1.550 + for(n=FirstNode();n!=INVALID;n=NextNode(n))
1.551 + while(FirstOut(n)) Delete(FirstOut(n));
1.552 +}
1.553 +
1.554 +#endif