Changeset 1206:9c398137c2cb in lemon-0.x for src/test/heap_test.h
- Timestamp:
- 03/09/05 15:10:21 (19 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@1625
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/test/heap_test.h
r1187 r1206 1 1 // -+- c++ -+- 2 2 3 #include <vector> 3 4 #include <algorithm> 4 5 #include <lemon/bin_heap.h>6 #include <lemon/fib_heap.h>7 #include <lemon/radix_heap.h>8 5 9 6 #include <lemon/dijkstra.h> … … 43 40 } 44 41 42 template <typename _Heap> 43 void heapIncreaseTest(int n) { 44 typedef _Heap Heap; 45 IntIntMap map(n, -1); 46 47 Heap heap(map); 48 49 std::vector<int> v(n); 50 51 for (int i = 0; i < n; ++i) { 52 v[i] = rand() % 1000; 53 heap.push(i, v[i]); 54 } 55 for (int i = 0; i < n; ++i) { 56 v[i] += rand() % 1000; 57 heap.increase(i, v[i]); 58 } 59 std::sort(v.begin(), v.end()); 60 for (int i = 0; i < n; ++i) { 61 check(v[i] == heap.prio() ,"Wrong order in heap increase test."); 62 heap.pop(); 63 } 64 } 65 66 67 45 68 template <typename _Traits, typename _Heap> 46 69 struct DefHeapTraits : public _Traits { … … 77 100 78 101 for(NodeIt v(graph); v!=INVALID; ++v) { 79 if ( dijkstra.reached(v) ) {102 if ( dijkstra.reached(v) && dijkstra.pred(v) != INVALID ) { 80 103 Edge e=dijkstra.pred(v); 81 104 Node u=graph.source(e);
Note: See TracChangeset
for help on using the changeset viewer.