Changeset 129:1630a5b631c8 in lemon-0.x for src
- Timestamp:
- 02/25/04 16:26:39 (21 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@176
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/work/alpar/smart_graph.h
r116 r129 6 6 #include <iostream> 7 7 #include <vector> 8 #include <limits.h> 8 9 9 10 namespace hugo { … … 11 12 class SmartGraph { 12 13 13 static const int INVALID=-1; 14 static const int INVALID_EDGE=-1; 15 static const int INVALID_NODE=INT_MAX; 14 16 15 17 struct NodeT 16 18 { 17 19 int first_in,first_out; 18 NodeT() : first_in(INVALID ), first_out(INVALID) {}20 NodeT() : first_in(INVALID_EDGE), first_out(INVALID_EDGE) {} 19 21 }; 20 22 struct EdgeT … … 22 24 int head, tail, next_in, next_out; 23 25 //FIXME: is this necessary? 24 EdgeT() : next_in(INVALID ), next_out(INVALID) {}26 EdgeT() : next_in(INVALID_EDGE), next_out(INVALID_EDGE) {} 25 27 }; 26 28 27 29 std::vector<NodeT> nodes; 30 28 31 std::vector<EdgeT> edges; 29 32 … … 124 127 } 125 128 126 bool valid(EdgeIt e) const { return e.n!=INVALID ; }129 bool valid(EdgeIt e) const { return e.n!=INVALID_EDGE; } 127 130 bool valid(EachEdgeIt e) const { return e.n<int(edges.size()); } 128 131 bool valid(NodeIt n) const { return n.n<int(nodes.size()); } 132 133 void setInvalid(EdgeIt &e) { e.n=INVALID_EDGE; } 134 void setInvalid(NodeIt &e) { e.n=INVALID_NODE; } 129 135 130 136 template <typename It> It next(It it) const
Note: See TracChangeset
for help on using the changeset viewer.