[Lemon-commits] [lemon_svn] klao: r386 - in hugo/trunk: doc src/include src/work src/work/alpar/dijkstra

Lemon SVN svn at lemon.cs.elte.hu
Mon Nov 6 20:39:09 CET 2006


Author: klao
Date: Thu Apr  1 23:06:53 2004
New Revision: 386

Removed:
   hugo/trunk/src/work/alpar/dijkstra/bin_heap.h
Modified:
   hugo/trunk/doc/Doxyfile
   hugo/trunk/src/include/bin_heap.h
   hugo/trunk/src/work/bin_heap_demo.cc

Log:
bin_heap merge-olva

Modified: hugo/trunk/doc/Doxyfile
==============================================================================
--- hugo/trunk/doc/Doxyfile	(original)
+++ hugo/trunk/doc/Doxyfile	Thu Apr  1 23:06:53 2004
@@ -396,7 +396,7 @@
                          ../src/include/smart_graph.h \
                          ../src/include/skeletons/maps.h \
                          ../src/include/dijkstra.h \
-                         ../src/demo/alpar/dijkstra/bin_heap.h \
+                         ../src/include/bin_heap.h \
                          ../src/include/fib_heap.h \
                          ../src/demo/athos/xy/xy.h \
                          maps.dox

Modified: hugo/trunk/src/include/bin_heap.h
==============================================================================
--- hugo/trunk/src/include/bin_heap.h	(original)
+++ hugo/trunk/src/include/bin_heap.h	Thu Apr  1 23:06:53 2004
@@ -1,3 +1,5 @@
+// -*- C++ -*- //
+
 /* FIXME: Copyright ... 
  *
  * This implementation is heavily based on STL's heap functions and
@@ -59,12 +61,16 @@
 #ifndef BIN_HEAP_HH
 #define BIN_HEAP_HH
 
+///\file
+///\brief Binary Heap implementation.
+
 #include <vector>
 #include <utility>
 #include <functional>
 
 namespace hugo {
 
+  /// A Binary Heap implementation.
   template <typename Item, typename Prio, typename ItemIntMap,
 	    typename Compare = std::less<Prio> >
   class BinHeap {
@@ -85,6 +91,8 @@
      * The ItemIntMap _should_ be initialized in such way, that it maps
      * PRE_HEAP (-1) to any element to be put in the heap...
      */
+    ///\todo it is used nowhere
+    ///
     enum state_enum {
       IN_HEAP = 0,
       PRE_HEAP = -1,
@@ -140,11 +148,10 @@
     void push(const Item &i, const Prio &p) { push(PairType(i,p)); }
 
     Item top() const {
-      // FIXME: test size>0 ?
       return data[0].first;
     }
-    Prio topPrio() const {
-      // FIXME: test size>0 ?
+    /// Returns the prio of the top element of the heap.
+    Prio prio() const {
       return data[0].second;
     }
 
@@ -156,13 +163,11 @@
       rmidx(iim[i]);
     }
 
-    Prio get(const Item &i) const {
+    Prio operator[](const Item &i) const {
       int idx = iim[i];
       return data[idx].second;
     }
-    Prio operator[](const Item &i) const {
-      return get(i);
-    }
+
     void set(const Item &i, const Prio &p) {
       int idx = iim[i];
       if( idx < 0 ) {

Modified: hugo/trunk/src/work/bin_heap_demo.cc
==============================================================================
--- hugo/trunk/src/work/bin_heap_demo.cc	(original)
+++ hugo/trunk/src/work/bin_heap_demo.cc	Thu Apr  1 23:06:53 2004
@@ -53,33 +53,30 @@
   cout << "heap.set(\"korte\", 3.4);\n";
   heap.set("korte", 3.4);
 
-  cout << "heap.get(\"alma\") = " 
-       << heap.get("alma")
-       << endl;
   cout << "heap[\"alma\"] = " 
        << heap["alma"]
        << endl;
 
   cout << "heap.top() = "
        << heap.top() << endl;
-  cout << "heap.topPrio() = "
-       << heap.topPrio() << endl;
+  cout << "heap.prio() = "
+       << heap.prio() << endl;
 
   cout << "heap.decrease(\"alma\", 1.2);\n";
   heap.set("alma", 1.2);
 
   cout << "heap.top() = "
        << heap.top() << endl;
-  cout << "heap.topPrio() = "
-       << heap.topPrio() << endl;
+  cout << "heap.prio() = "
+       << heap.prio() << endl;
 
   cout << "heap.set(\"alma\", 22);\n";
   heap.set("alma", 22);
 
   cout << "heap.top() = "
        << heap.top() << endl;
-  cout << "heap.topPrio() = "
-       << heap.topPrio() << endl;
+  cout << "heap.prio() = "
+       << heap.prio() << endl;
 
   cout << "heap.size() = "
        << heap.size() << endl;
@@ -88,8 +85,8 @@
 
   cout << "heap.top() = "
        << heap.top() << endl;
-  cout << "heap.topPrio() = "
-       << heap.topPrio() << endl;
+  cout << "heap.prio() = "
+       << heap.prio() << endl;
 
   cout << "heap.state(\"szilva\") = "
        << heap.state("szilva") << endl;



More information about the Lemon-commits mailing list