[Lemon-commits] [lemon_svn] deba: r2677 - in hugo/trunk: demo lemon test

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


Author: deba
Date: Tue Apr  4 19:45:35 2006
New Revision: 2677

Added:
   hugo/trunk/lemon/bucket_heap.h
      - copied, changed from r2675, /hugo/trunk/lemon/linear_heap.h
Removed:
   hugo/trunk/lemon/linear_heap.h
Modified:
   hugo/trunk/demo/coloring.cc
   hugo/trunk/lemon/Makefile.am
   hugo/trunk/lemon/min_cut.h
   hugo/trunk/lemon/topology.h
   hugo/trunk/test/heap_test.cc

Log:
LinearHeap is renamed to BucketHeap which is more conform
and widely used name for this data structure




Modified: hugo/trunk/demo/coloring.cc
==============================================================================
--- hugo/trunk/demo/coloring.cc	(original)
+++ hugo/trunk/demo/coloring.cc	Tue Apr  4 19:45:35 2006
@@ -30,7 +30,7 @@
 #include <iostream>
 
 #include <lemon/smart_graph.h>
-#include <lemon/linear_heap.h>
+#include <lemon/bucket_heap.h>
 #include <lemon/graph_reader.h>
 #include <lemon/graph_to_eps.h>
 
@@ -63,7 +63,7 @@
   Graph::NodeMap<int> color(graph, -2);
   
   Graph::NodeMap<int> heapMap(graph, -1);
-  LinearHeap<Node, Graph::NodeMap<int> > heap(heapMap);
+  BucketHeap<Node, Graph::NodeMap<int> > heap(heapMap);
   
   for (NodeIt it(graph); it != INVALID; ++it) {
     heap.push(it, countOutEdges(graph, it));

Modified: hugo/trunk/lemon/Makefile.am
==============================================================================
--- hugo/trunk/lemon/Makefile.am	(original)
+++ hugo/trunk/lemon/Makefile.am	Tue Apr  4 19:45:35 2006
@@ -53,7 +53,7 @@
 	iterable_maps.h \
 	johnson.h \
 	kruskal.h \
-	linear_heap.h \
+	bucket_heap.h \
 	list_graph.h \
 	lp.h \
 	lp_base.h \

Copied: hugo/trunk/lemon/bucket_heap.h (from r2675, /hugo/trunk/lemon/linear_heap.h)
==============================================================================
--- /hugo/trunk/lemon/linear_heap.h	(original)
+++ hugo/trunk/lemon/bucket_heap.h	Tue Apr  4 19:45:35 2006
@@ -16,12 +16,12 @@
  *
  */
 
-#ifndef LEMON_LINEAR_HEAP_H
-#define LEMON_LINEAR_HEAP_H
+#ifndef LEMON_BUCKET_HEAP_H
+#define LEMON_BUCKET_HEAP_H
 
 ///\ingroup auxdat
 ///\file
-///\brief Binary Heap implementation.
+///\brief Bucket Heap implementation.
 
 #include <vector>
 #include <utility>
@@ -31,12 +31,12 @@
 
   /// \ingroup auxdat
 
-  /// \brief A Linear Heap implementation.
+  /// \brief A Bucket Heap implementation.
   ///
-  /// This class implements the \e linear \e heap data structure. A \e heap
+  /// This class implements the \e bucket \e heap data structure. A \e heap
   /// is a data structure for storing items with specified values called \e
   /// priorities in such a way that finding the item with minimum priority is
-  /// efficient. The linear heap is very simple implementation, it can store
+  /// efficient. The bucket heap is very simple implementation, it can store
   /// only integer priorities and it stores for each priority in the [0..C]
   /// range a list of items. So it should be used only when the priorities
   /// are small. It is not intended to use as dijkstra heap.
@@ -47,7 +47,7 @@
   /// \param minimize If the given parameter is true then the heap gives back
   /// the lowest priority. 
   template <typename _Item, typename _ItemIntMap, bool minimize = true >
-  class LinearHeap {
+  class BucketHeap {
 
   public:
     typedef _Item Item;
@@ -76,7 +76,7 @@
     /// \param _index should be given to the constructor, since it is used
     /// internally to handle the cross references. The value of the map
     /// should be PRE_HEAP (-1) for each element.
-    explicit LinearHeap(ItemIntMap &_index) : index(_index), minimal(0) {}
+    explicit BucketHeap(ItemIntMap &_index) : index(_index), minimal(0) {}
     
     /// The number of items stored in the heap.
     ///
@@ -156,7 +156,7 @@
     void push(const Item &i, const Prio &p) { 
       int idx = data.size();
       index[i] = idx;
-      data.push_back(LinearItem(i, p));
+      data.push_back(BucketItem(i, p));
       lace(idx);
       if (p < minimal) {
 	minimal = p;
@@ -308,8 +308,8 @@
 
   private:
 
-    struct LinearItem {
-      LinearItem(const Item& _item, int _value) 
+    struct BucketItem {
+      BucketItem(const Item& _item, int _value) 
 	: item(_item), value(_value) {}
 
       Item item;
@@ -320,14 +320,14 @@
 
     ItemIntMap& index;
     std::vector<int> first;
-    std::vector<LinearItem> data;
+    std::vector<BucketItem> data;
     mutable int minimal;
 
-  }; // class LinearHeap
+  }; // class BucketHeap
 
 
   template <typename _Item, typename _ItemIntMap>
-  class LinearHeap<_Item, _ItemIntMap, false> {
+  class BucketHeap<_Item, _ItemIntMap, false> {
 
   public:
     typedef _Item Item;
@@ -343,7 +343,7 @@
 
   public:
 
-    explicit LinearHeap(ItemIntMap &_index) : index(_index), maximal(-1) {}
+    explicit BucketHeap(ItemIntMap &_index) : index(_index), maximal(-1) {}
 
     int size() const { return data.size(); }
     bool empty() const { return data.empty(); }
@@ -405,7 +405,7 @@
     void push(const Item &i, const Prio &p) { 
       int idx = data.size();
       index[i] = idx;
-      data.push_back(LinearItem(i, p));
+      data.push_back(BucketItem(i, p));
       lace(idx);
       if (data[idx].value > maximal) {
 	maximal = data[idx].value;
@@ -498,8 +498,8 @@
 
   private:
 
-    struct LinearItem {
-      LinearItem(const Item& _item, int _value) 
+    struct BucketItem {
+      BucketItem(const Item& _item, int _value) 
 	: item(_item), value(_value) {}
 
       Item item;
@@ -510,10 +510,10 @@
 
     ItemIntMap& index;
     std::vector<int> first;
-    std::vector<LinearItem> data;
+    std::vector<BucketItem> data;
     mutable int maximal;
 
-  }; // class LinearHeap
+  }; // class BucketHeap
 
 }
   

Modified: hugo/trunk/lemon/min_cut.h
==============================================================================
--- hugo/trunk/lemon/min_cut.h	(original)
+++ hugo/trunk/lemon/min_cut.h	Tue Apr  4 19:45:35 2006
@@ -24,7 +24,7 @@
 
 #include <lemon/list_graph.h>
 #include <lemon/bin_heap.h>
-#include <lemon/linear_heap.h>
+#include <lemon/bucket_heap.h>
 
 #include <lemon/bits/invalid.h>
 #include <lemon/error.h>
@@ -48,7 +48,7 @@
     struct HeapSelector<ConstMap<CapacityKey, Const<int, 1> > > {
       template <typename Key, typename Value, typename Ref>
       struct Selector {
-        typedef LinearHeap<Key, Ref, false > Heap;
+        typedef BucketHeap<Key, Ref, false > Heap;
       };
     };
 
@@ -94,7 +94,7 @@
     /// maximalize the priorities. The default heap type is
     /// the \ref BinHeap, but it is specialized when the
     /// CapacityMap is ConstMap<Graph::Node, Const<int, 1> >
-    /// to LinearHeap.
+    /// to BucketHeap.
     ///
     /// \sa MaxCardinalitySearch
     typedef typename _min_cut_bits
@@ -841,7 +841,7 @@
   ///
   /// The complexity of the algorithm is O(n*e*log(n)) but with Fibonacci 
   /// heap it can be decreased to O(n*e+n^2*log(n)). When the neutral capacity 
-  /// map is used then it uses LinearHeap which results O(n*e) time complexity.
+  /// map is used then it uses BucketHeap which results O(n*e) time complexity.
 #ifdef DOXYGEN
   template <typename _Graph, typename _CapacityMap, typename _Traits>
 #else

Modified: hugo/trunk/lemon/topology.h
==============================================================================
--- hugo/trunk/lemon/topology.h	(original)
+++ hugo/trunk/lemon/topology.h	Tue Apr  4 19:45:35 2006
@@ -30,7 +30,7 @@
 #include <lemon/concept_check.h>
 
 #include <lemon/bin_heap.h>
-#include <lemon/linear_heap.h>
+#include <lemon/bucket_heap.h>
 
 #include <stack>
 #include <functional>

Modified: hugo/trunk/test/heap_test.cc
==============================================================================
--- hugo/trunk/test/heap_test.cc	(original)
+++ hugo/trunk/test/heap_test.cc	Tue Apr  4 19:45:35 2006
@@ -31,7 +31,7 @@
 #include <lemon/bin_heap.h>
 #include <lemon/fib_heap.h>
 #include <lemon/radix_heap.h>
-#include <lemon/linear_heap.h>
+#include <lemon/bucket_heap.h>
 
 #include "test_tools.h"
 
@@ -120,14 +120,14 @@
   }
 
   {
-    std::cerr << "Checking Linear Heap" << std::endl;
+    std::cerr << "Checking Bucket Heap" << std::endl;
 
-    typedef LinearHeap<Item, ItemIntMap> IntHeap;
+    typedef BucketHeap<Item, ItemIntMap> IntHeap;
     checkConcept<Heap<Item, Prio, ItemIntMap>, IntHeap>();
     heapSortTest<IntHeap>(100);
     heapIncreaseTest<IntHeap>(100);
 
-    typedef LinearHeap<Node, Graph::NodeMap<int> > NodeHeap;
+    typedef BucketHeap<Node, Graph::NodeMap<int> > NodeHeap;
     checkConcept<Heap<Node, Prio, Graph::NodeMap<int> >, NodeHeap>();
     Timer timer;
     dijkstraHeapTest<Graph, LengthMap, NodeHeap>(graph, length, start);



More information about the Lemon-commits mailing list