Boost logo

Boost Users :

From: Magnus Ekdahl (maguno_at_[hidden])
Date: 2006-07-19 04:28:07


I put in 0,1,2,3,4 into a Fibonacci heap, manipulate some and get 0,2,4,1,25
back. With the relaxed heap I get 0,2,4,1,3 back, which is as expected with my
code. AFAIK this is due to a bug in the Fibonacci heap?

Anyway here is code adopted from the cvs (fibonacci_heap.cpp) that reproduces
the result on two different machines (intel/amd), where the programs are
compiled using g++ 4.0.4. Any help in clearing out this confusing result is
appreciated :)

#include <iostream>
#include <cstdlib>
#include <vector>
#include <boost/pending/Fibonacci_heap.hpp>
#include <boost/pending/relaxed_heap.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/pending/indirect_cmp.hpp>

using namespace std;
using namespace boost;

int main(int argc, char *argv[])
   typedef indirect_cmp<unsigned*,std::less<unsigned> > ICmp;
   unsigned current;
   const unsigned N=5;
   vector<unsigned> w(N);

   ICmp cmp(&w[0], std::less<unsigned>());
   Fibonacci_heap<unsigned, ICmp> Q(N, cmp);
   //relaxed_heap<unsigned, ICmp> Q(N, cmp);

   cout << current << " ";
   current =;
   cout << current << " ";
   current =;
   cout << current << " ";
   current =;
   cout << current << " ";
   current =;
   cout << current << " ";

   return EXIT_SUCCESS;

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at