Changeset 967:6563019430ba in lemon0.x for src/lemon/bin_heap.h
 Timestamp:
 11/08/04 16:22:39 (17 years ago)
 Branch:
 default
 Phase:
 public
 Convert:
 svn:c9d7d8f590d60310b91f818b3a526b0e/lemon/trunk@1354
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

src/lemon/bin_heap.h
r921 r967 33 33 34 34 /// A Binary Heap implementation. 35 36 ///\todo Please document... 37 /// 38 ///\sa FibHeap 39 ///\sa Dijkstra 35 40 template <typename Item, typename Prio, typename ItemIntMap, 36 41 typename Compare = std::less<Prio> > … … 68 73 69 74 public: 75 ///\e 70 76 BinHeap(ItemIntMap &_iim) : iim(_iim) {} 77 ///\e 71 78 BinHeap(ItemIntMap &_iim, const Compare &_comp) : comp(_comp), iim(_iim) {} 72 79 73 80 81 ///\e 74 82 int size() const { return data.size(); } 83 ///\e 75 84 bool empty() const { return data.empty(); } 76 85 … … 102 111 103 112 public: 113 ///\e 104 114 void push(const PairType &p) { 105 115 int n = data.size(); … … 107 117 bubble_up(n, p); 108 118 } 119 ///\e 109 120 void push(const Item &i, const Prio &p) { push(PairType(i,p)); } 110 121 122 ///\e 111 123 Item top() const { 112 124 return data[0].first; … … 117 129 } 118 130 131 ///\e 119 132 void pop() { 120 133 rmidx(0); 121 134 } 122 135 136 ///\e 123 137 void erase(const Item &i) { 124 138 rmidx(iim[i]); 125 139 } 126 140 141 ///\e 127 142 Prio operator[](const Item &i) const { 128 143 int idx = iim[i]; … … 130 145 } 131 146 147 ///\e 132 148 void set(const Item &i, const Prio &p) { 133 149 int idx = iim[i]; … … 143 159 } 144 160 161 ///\e 145 162 void decrease(const Item &i, const Prio &p) { 146 163 int idx = iim[i]; 147 164 bubble_up(idx, PairType(i,p)); 148 165 } 166 ///\e 149 167 void increase(const Item &i, const Prio &p) { 150 168 int idx = iim[i]; … … 152 170 } 153 171 172 ///\e 154 173 state_enum state(const Item &i) const { 155 174 int s = iim[i];
Note: See TracChangeset
for help on using the changeset viewer.