Changeset 1643:9285f3777553 in lemon-0.x for lemon/full_graph.h
- Timestamp:
- 08/18/05 15:33:49 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2156
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/full_graph.h
r1566 r1643 126 126 protected: 127 127 int id; 128 Node(int _id) { id = _id;}128 Node(int _id) : id(_id) {} 129 129 public: 130 130 Node() {} 131 Node (Invalid) { id = -1;}131 Node (Invalid) : id(-1) {} 132 132 bool operator==(const Node node) const {return id == node.id;} 133 133 bool operator!=(const Node node) const {return id != node.id;} … … 261 261 Node source(Edge e) const { 262 262 /// \todo we may do it faster 263 return ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;263 return Node(((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2); 264 264 } 265 265 266 266 Node target(Edge e) const { 267 267 int source = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; 268 return e.id - (source) * (source - 1) / 2;268 return Node(e.id - (source) * (source - 1) / 2); 269 269 } 270 270
Note: See TracChangeset
for help on using the changeset viewer.