COIN-OR::LEMON - Graph Library

Changeset 274:28728f3945c5 in lemon-0.x


Ignore:
Timestamp:
04/01/04 23:06:53 (20 years ago)
Author:
Mihaly Barasz
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@386
Message:

bin_heap merge-olva

Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • doc/Doxyfile

    r264 r274  
    397397                         ../src/include/skeletons/maps.h \
    398398                         ../src/include/dijkstra.h \
    399                          ../src/demo/alpar/dijkstra/bin_heap.h \
     399                         ../src/include/bin_heap.h \
    400400                         ../src/include/fib_heap.h \
    401401                         ../src/demo/athos/xy/xy.h \
  • src/include/bin_heap.h

    r258 r274  
     1// -*- C++ -*- //
     2
    13/* FIXME: Copyright ...
    24 *
     
    6062#define BIN_HEAP_HH
    6163
     64///\file
     65///\brief Binary Heap implementation.
     66
    6267#include <vector>
    6368#include <utility>
     
    6671namespace hugo {
    6772
     73  /// A Binary Heap implementation.
    6874  template <typename Item, typename Prio, typename ItemIntMap,
    6975            typename Compare = std::less<Prio> >
     
    8692     * PRE_HEAP (-1) to any element to be put in the heap...
    8793     */
     94    ///\todo it is used nowhere
     95    ///
    8896    enum state_enum {
    8997      IN_HEAP = 0,
     
    141149
    142150    Item top() const {
    143       // FIXME: test size>0 ?
    144151      return data[0].first;
    145152    }
    146     Prio topPrio() const {
    147       // FIXME: test size>0 ?
     153    /// Returns the prio of the top element of the heap.
     154    Prio prio() const {
    148155      return data[0].second;
    149156    }
     
    157164    }
    158165
    159     Prio get(const Item &i) const {
     166    Prio operator[](const Item &i) const {
    160167      int idx = iim[i];
    161168      return data[idx].second;
    162169    }
    163     Prio operator[](const Item &i) const {
    164       return get(i);
    165     }
     170
    166171    void set(const Item &i, const Prio &p) {
    167172      int idx = iim[i];
  • src/work/bin_heap_demo.cc

    r258 r274  
    5454  heap.set("korte", 3.4);
    5555
    56   cout << "heap.get(\"alma\") = "
    57        << heap.get("alma")
    58        << endl;
    5956  cout << "heap[\"alma\"] = "
    6057       << heap["alma"]
     
    6360  cout << "heap.top() = "
    6461       << heap.top() << endl;
    65   cout << "heap.topPrio() = "
    66        << heap.topPrio() << endl;
     62  cout << "heap.prio() = "
     63       << heap.prio() << endl;
    6764
    6865  cout << "heap.decrease(\"alma\", 1.2);\n";
     
    7168  cout << "heap.top() = "
    7269       << heap.top() << endl;
    73   cout << "heap.topPrio() = "
    74        << heap.topPrio() << endl;
     70  cout << "heap.prio() = "
     71       << heap.prio() << endl;
    7572
    7673  cout << "heap.set(\"alma\", 22);\n";
     
    7976  cout << "heap.top() = "
    8077       << heap.top() << endl;
    81   cout << "heap.topPrio() = "
    82        << heap.topPrio() << endl;
     78  cout << "heap.prio() = "
     79       << heap.prio() << endl;
    8380
    8481  cout << "heap.size() = "
     
    8986  cout << "heap.top() = "
    9087       << heap.top() << endl;
    91   cout << "heap.topPrio() = "
    92        << heap.topPrio() << endl;
     88  cout << "heap.prio() = "
     89       << heap.prio() << endl;
    9390
    9491  cout << "heap.state(\"szilva\") = "
Note: See TracChangeset for help on using the changeset viewer.