Changeset 2263:9273fe7d850c in lemon-0.x for lemon/fib_heap.h
- Timestamp:
- 10/26/06 16:20:17 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@3021
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/fib_heap.h
r2050 r2263 44 44 ///\e binary \e heap. 45 45 /// 46 ///\param Item Type of the items to be stored.47 46 ///\param Prio Type of the priority of the items. 48 47 ///\param ItemIntMap A read and writable Item int map, used internally … … 56 55 57 56 #ifdef DOXYGEN 58 template <typename Item, 59 typename Prio, 57 template <typename Prio, 60 58 typename ItemIntMap, 61 59 typename Compare> 62 60 #else 63 template <typename Item, 64 typename Prio, 61 template <typename Prio, 65 62 typename ItemIntMap, 66 63 typename Compare = std::less<Prio> > 67 64 #endif 68 65 class FibHeap { 69 public: 66 public: 67 typedef typename ItemIntMap::Key Item; 70 68 typedef Prio PrioType; 71 69 … … 272 270 // ********************************************************************** 273 271 274 template <typename Item, typenamePrio, typename ItemIntMap,275 typename Compare> 276 void FibHeap< Item,Prio, ItemIntMap, Compare>::set272 template <typename Prio, typename ItemIntMap, 273 typename Compare> 274 void FibHeap<Prio, ItemIntMap, Compare>::set 277 275 (Item const item, PrioType const value) 278 276 { … … 284 282 } 285 283 286 template <typename Item, typenamePrio, typename ItemIntMap,287 typename Compare> 288 void FibHeap< Item,Prio, ItemIntMap, Compare>::push284 template <typename Prio, typename ItemIntMap, 285 typename Compare> 286 void FibHeap<Prio, ItemIntMap, Compare>::push 289 287 (Item const item, PrioType const value) { 290 288 int i=iimap[item]; … … 317 315 } 318 316 319 template <typename Item, typenamePrio, typename ItemIntMap,320 typename Compare> 321 void FibHeap< Item,Prio, ItemIntMap, Compare>::pop() {317 template <typename Prio, typename ItemIntMap, 318 typename Compare> 319 void FibHeap<Prio, ItemIntMap, Compare>::pop() { 322 320 /*The first case is that there are only one root.*/ 323 321 if ( container[minimum].left_neighbor==minimum ) { … … 351 349 352 350 353 template <typename Item, typenamePrio, typename ItemIntMap,354 typename Compare> 355 void FibHeap< Item,Prio, ItemIntMap, Compare>::erase351 template <typename Prio, typename ItemIntMap, 352 typename Compare> 353 void FibHeap<Prio, ItemIntMap, Compare>::erase 356 354 (const Item& item) { 357 355 int i=iimap[item]; … … 368 366 } 369 367 370 template <typename Item, typenamePrio, typename ItemIntMap,371 typename Compare> 372 void FibHeap< Item,Prio, ItemIntMap, Compare>::decrease368 template <typename Prio, typename ItemIntMap, 369 typename Compare> 370 void FibHeap<Prio, ItemIntMap, Compare>::decrease 373 371 (Item item, PrioType const value) { 374 372 int i=iimap[item]; … … 384 382 385 383 386 template <typename Item, typenamePrio, typename ItemIntMap,387 typename Compare> 388 void FibHeap< Item,Prio, ItemIntMap, Compare>::balance() {384 template <typename Prio, typename ItemIntMap, 385 typename Compare> 386 void FibHeap<Prio, ItemIntMap, Compare>::balance() { 389 387 390 388 int maxdeg=int( std::floor( 2.08*log(double(container.size()))))+1; … … 429 427 } 430 428 431 template <typename Item, typenamePrio, typename ItemIntMap,432 typename Compare> 433 void FibHeap< Item,Prio, ItemIntMap, Compare>::makeroot429 template <typename Prio, typename ItemIntMap, 430 typename Compare> 431 void FibHeap<Prio, ItemIntMap, Compare>::makeroot 434 432 (int c) { 435 433 int s=c; … … 441 439 442 440 443 template <typename Item, typenamePrio, typename ItemIntMap,444 typename Compare> 445 void FibHeap< Item,Prio, ItemIntMap, Compare>::cut441 template <typename Prio, typename ItemIntMap, 442 typename Compare> 443 void FibHeap<Prio, ItemIntMap, Compare>::cut 446 444 (int a, int b) { 447 445 /* … … 470 468 471 469 472 template <typename Item, typenamePrio, typename ItemIntMap,473 typename Compare> 474 void FibHeap< Item,Prio, ItemIntMap, Compare>::cascade470 template <typename Prio, typename ItemIntMap, 471 typename Compare> 472 void FibHeap<Prio, ItemIntMap, Compare>::cascade 475 473 (int a) 476 474 { … … 487 485 488 486 489 template <typename Item, typenamePrio, typename ItemIntMap,490 typename Compare> 491 void FibHeap< Item,Prio, ItemIntMap, Compare>::fuse487 template <typename Prio, typename ItemIntMap, 488 typename Compare> 489 void FibHeap<Prio, ItemIntMap, Compare>::fuse 492 490 (int a, int b) { 493 491 unlace(b); … … 518 516 *It is invoked only if a has siblings. 519 517 */ 520 template <typename Item, typenamePrio, typename ItemIntMap,521 typename Compare> 522 void FibHeap< Item,Prio, ItemIntMap, Compare>::unlace518 template <typename Prio, typename ItemIntMap, 519 typename Compare> 520 void FibHeap<Prio, ItemIntMap, Compare>::unlace 523 521 (int a) { 524 522 int leftn=container[a].left_neighbor;
Note: See TracChangeset
for help on using the changeset viewer.