Changeset 985:741f3108a90f in lemon-0.x for src/lemon
- Timestamp:
- 11/13/04 13:24:01 (20 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1375
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/lemon/full_graph.h
r984 r985 297 297 298 298 class Node { 299 friend class FullGraphBase;299 friend class UndirFullGraphBase; 300 300 301 301 protected: … … 313 313 314 314 class Edge { 315 friend class FullGraphBase;315 friend class UndirFullGraphBase; 316 316 317 317 protected: … … 320 320 Edge(int _id) : id(_id) {} 321 321 322 Edge(const FullGraphBase& _graph, int tail, int head)322 Edge(const UndirFullGraphBase& _graph, int tail, int head) 323 323 : id(_graph.NodeNum * head+tail) {} 324 324 public: … … 351 351 352 352 /// \todo with specialized iterators we can make faster iterating 353 void nextOut(Edge& e dge) const {353 void nextOut(Edge& e) const { 354 354 int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; 355 355 int head = e.id - (tail) * (tail - 1) / 2; 356 356 ++head; 357 returnhead < tail ? tail * (tail - 1) / 2 + head : -1;357 e.id = head < tail ? tail * (tail - 1) / 2 + head : -1; 358 358 } 359 359 … … 362 362 } 363 363 364 void nextIn(Edge& e dge) const {364 void nextIn(Edge& e) const { 365 365 int tail = ((int)sqrt((double)(1 + 8 * e.id)) + 1) / 2;; 366 366 int head = e.id - (tail) * (tail - 1) / 2; ++head; 367 367 ++tail; 368 return tail < nodeNum ? tail * (tail - 1) / 2 + head : -1;368 e.id = tail < NodeNum ? tail * (tail - 1) / 2 + head : -1; 369 369 } 370 370
Note: See TracChangeset
for help on using the changeset viewer.