Changeset 64:72bd463289a9 in lemon-0.x for src/work/list_graph.hh
- Timestamp:
- 02/05/04 16:06:45 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@79
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/list_graph.hh
r59 r64 41 41 public: 42 42 NodeMap(const ListGraph& _G) : G(_G), container(_G.node_id) { } 43 NodeMap(const ListGraph& _G, constValueType a) :43 NodeMap(const ListGraph& _G, ValueType a) : 44 44 G(_G), container(_G.node_id, a) { } 45 void set( const NodeIt nit, constValueType a) { container[G.id(nit)]=a; }46 ValueType get( constNodeIt nit) const { return container[G.id(nit)]; }45 void set(NodeIt nit, ValueType a) { container[G.id(nit)]=a; } 46 ValueType get(NodeIt nit) const { return container[G.id(nit)]; } 47 47 }; 48 48 … … 53 53 public: 54 54 EdgeMap(const ListGraph& _G) : G(_G), container(_G.edge_id) { } 55 EdgeMap(const ListGraph& _G, constValueType a) :55 EdgeMap(const ListGraph& _G, ValueType a) : 56 56 G(_G), container(_G.edge_id, a) { } 57 void set( const EdgeIt eit, constValueType a) { container[G.id(eit)]=a; }58 ValueType get( constEdgeIt eit) const { return container[G.id(eit)]; }57 void set(EdgeIt eit, ValueType a) { container[G.id(eit)]=a; } 58 ValueType get(EdgeIt eit) const { return container[G.id(eit)]; } 59 59 }; 60 60 … … 227 227 //InEdgeIt firstInEdge(const NodeIt v) const { return InEdgeIt(v); } 228 228 //SymEdgeIt firstSymEdge(const NodeIt v) const { return SymEdgeIt(v); } 229 NodeIt tail( constEdgeIt e) const { return e.tailNode(); }230 NodeIt head( constEdgeIt e) const { return e.headNode(); }229 NodeIt tail(EdgeIt e) const { return e.tailNode(); } 230 NodeIt head(EdgeIt e) const { return e.headNode(); } 231 231 232 232 NodeIt aNode(const OutEdgeIt& e) const { return e.aNode(); } … … 249 249 void getFirst(EachNodeIt& v) const { v=EachNodeIt(*this); } 250 250 void getFirst(EachEdgeIt& e) const { e=EachEdgeIt(*this); } 251 void getFirst(OutEdgeIt& e, const NodeIt&v) const { e=OutEdgeIt(v); }252 void getFirst(InEdgeIt& e, const NodeIt&v) const { e=InEdgeIt(v); }253 void getFirst(SymEdgeIt& e, const NodeIt&v) const { e=SymEdgeIt(v); }254 void getTail(NodeIt& n, const EdgeIt& e) const { n=tail(e); }255 void getHead(NodeIt& n, const EdgeIt& e) const { n=head(e); }256 257 void getANode(NodeIt& n, const OutEdgeIt& e) const { n=e.aNode(); }258 void getANode(NodeIt& n, const InEdgeIt& e) const { n=e.aNode(); }259 void getANode(NodeIt& n, const SymEdgeIt& e) const { n=e.aNode(); }260 void getBNode(NodeIt& n, const OutEdgeIt& e) const { n=e.bNode(); }261 void getBNode(NodeIt& n, const InEdgeIt& e) const { n=e.bNode(); }262 void getBNode(NodeIt& n, const SymEdgeIt& e) const { n=e.bNode(); }251 void getFirst(OutEdgeIt& e, NodeIt v) const { e=OutEdgeIt(v); } 252 void getFirst(InEdgeIt& e, NodeIt v) const { e=InEdgeIt(v); } 253 void getFirst(SymEdgeIt& e, NodeIt v) const { e=SymEdgeIt(v); } 254 //void getTail(NodeIt& n, const EdgeIt& e) const { n=tail(e); } 255 //void getHead(NodeIt& n, const EdgeIt& e) const { n=head(e); } 256 257 //void getANode(NodeIt& n, const OutEdgeIt& e) const { n=e.aNode(); } 258 //void getANode(NodeIt& n, const InEdgeIt& e) const { n=e.aNode(); } 259 //void getANode(NodeIt& n, const SymEdgeIt& e) const { n=e.aNode(); } 260 //void getBNode(NodeIt& n, const OutEdgeIt& e) const { n=e.bNode(); } 261 //void getBNode(NodeIt& n, const InEdgeIt& e) const { n=e.bNode(); } 262 //void getBNode(NodeIt& n, const SymEdgeIt& e) const { n=e.bNode(); } 263 263 //void get_invalid(NodeIt& n) { n=NodeIt(); } 264 264 //void get_invalid(EdgeIt& e) { e=EdgeIt(); } … … 275 275 276 276 template< typename It > 277 It first( constNodeIt v) const {277 It first(NodeIt v) const { 278 278 It e; 279 279 getFirst(e, v); … … 284 284 /* these are important for the implementation of property vectors */ 285 285 286 int id( constNodeIt v) const { return v.node->id; }287 int id( constEdgeIt e) const { return e.edge->id; }286 int id(NodeIt v) const { return v.node->id; } 287 int id(EdgeIt e) const { return e.edge->id; } 288 288 289 289 /* adding nodes and edges */ 290 290 291 291 NodeIt addNode() { return NodeIt(_add_node()); } 292 EdgeIt addEdge( const NodeIt u, constNodeIt v) {292 EdgeIt addEdge(NodeIt u, NodeIt v) { 293 293 return EdgeIt(_add_edge(u.node, v.node)); 294 294 } 295 295 296 void deleteNode( constNodeIt i) {296 void deleteNode(NodeIt i) { 297 297 while (first<OutEdgeIt>(i).valid()) deleteEdge(first<OutEdgeIt>(i)); 298 298 while (first<InEdgeIt>(i).valid()) deleteEdge(first<InEdgeIt>(i)); … … 300 300 } 301 301 302 void deleteEdge( constEdgeIt e) { _delete_edge(e.edge); }303 304 void setTail( const EdgeIt e, constNodeIt tail) {302 void deleteEdge(EdgeIt e) { _delete_edge(e.edge); } 303 304 void setTail(EdgeIt e, NodeIt tail) { 305 305 _set_tail(e.edge, tail.node); 306 306 } 307 307 308 void setHead( const EdgeIt e, constNodeIt head) {308 void setHead(EdgeIt e, NodeIt head) { 309 309 _set_head(e.edge, head.node); 310 310 } … … 329 329 protected: 330 330 node_item* node; 331 friend int ListGraph::id( constNodeIt v) const;331 friend int ListGraph::id(NodeIt v) const; 332 332 public: 333 333 NodeIt() : node(0) { } … … 361 361 protected: 362 362 edge_item* edge; 363 friend int ListGraph::id( constEdgeIt e) const;363 friend int ListGraph::id(EdgeIt e) const; 364 364 public: 365 365 EdgeIt() : edge(0) { } … … 407 407 public: 408 408 OutEdgeIt() : EdgeIt(), v(0) { } 409 OutEdgeIt(const ListGraph& G, constNodeIt _v) : v(_v.node) { edge=v->_first_out_edge; }409 OutEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_out_edge; } 410 410 OutEdgeIt& operator++() { edge=edge->_next_out; return *this; } 411 411 protected: … … 422 422 public: 423 423 InEdgeIt() : EdgeIt(), v(0) { } 424 InEdgeIt(const ListGraph& G, constNodeIt _v) : v(_v.node) { edge=v->_first_in_edge; }424 InEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { edge=v->_first_in_edge; } 425 425 InEdgeIt& operator++() { edge=edge->_next_in; return *this; } 426 426 protected: … … 442 442 public: 443 443 SymEdgeIt() : EdgeIt(), v(0) { } 444 SymEdgeIt(const ListGraph& G, constNodeIt _v) : v(_v.node) {444 SymEdgeIt(const ListGraph& G, NodeIt _v) : v(_v.node) { 445 445 out_or_in=1; 446 446 edge=v->_first_out_edge;
Note: See TracChangeset
for help on using the changeset viewer.