Changeset 8:cd54905012bc in lemon-0.x for src/include/graph.h
- Timestamp:
- 12/16/03 19:17:51 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@21
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/include/graph.h
r6 r8 76 76 bool operator!=(const NodeIterator &i) const {return n!=i.n;} 77 77 78 int Index() { return n; } //If the nodes are indexable78 int Index() const { return n; } //If the nodes are indexable 79 79 friend class Graph; 80 80 friend class EdgeIterator; … … 120 120 bool operator!=(const EdgeIterator &i) const {return e!=i.e;} 121 121 122 int Index() { return e.index.block*EDGE_BLOCK_SIZE+e.index.index; }122 int Index() const { return e.index.block*EDGE_BLOCK_SIZE+e.index.index; } 123 123 //If the edges are indexable 124 124 … … 402 402 public: 403 403 typedef T value_type; 404 void Set(NodeIterator i, const T &t) {map[i.Index()]=t;}405 T &Get(NodeIterator i){return map[i.Index()];}406 T &operator[](NodeIterator i) {return map[i.Index()];}407 408 void update() { map.resize(G-> OldGraph<N,E>::NodeMax());}409 410 NodeMap( Graph<N,E> &Gr) : map(Gr.OldGraph<N,E>::NodeMax()) { G=&Gr ;}411 404 void Put(const NodeIterator i, const T &t) {map[i.Index()]=t;} 405 T Get(const NodeIterator i) const {return map[i.Index()];} 406 T operator[](NodeIterator i) {return map[i.Index()];} 407 408 void update() { map.resize(G->MaxNode());} 409 410 NodeMap() {} 411 void SetG(Graph<N,E> &Gr) { G=&Gr; update();} 412 412 }; 413 413 … … 419 419 public: 420 420 typedef T value_type; 421 void Set(NodeIterator i, const T &t) {map[i.Index()]=t;}422 T &Get( NodeIterator i) {return map[i.Index()];}421 void Put(const NodeIterator i, const T &t) {map[i.Index()]=t;} 422 T &Get(const NodeIterator i) {return map[i.Index()];} 423 423 T &operator[](NodeIterator i) {return map[i.Index()];} 424 424 425 425 void update() 426 { map.resize(Gr.OldGraph<N,E>::edge_block_num*EDGE_BLOCK_SIZE);} 427 428 EdgeMap(Graph<N,E> &Gr) 429 :map(Gr.OldGraph<N,E>::edge_block_num*EDGE_BLOCK_SIZE) 430 { G=&Gr ;} 431 432 }; 426 { map.resize(G->MaxEdge());} 427 428 EdgeMap() {} 429 void SetG(Graph<N,E> &Gr) 430 { G=&Gr ;update();} 431 432 }; 433 434 435 int MaxNode() { return OldGraph<N,E>::MaxNode();} 436 int MaxEdge() { return ::edge_block_num*EDGE_BLOCK_SIZE;} 433 437 434 438 };
Note: See TracChangeset
for help on using the changeset viewer.