Boost logo

Boost Users :

From: Line Blander Reinhardt (lbr_at_[hidden])
Date: 2008-07-11 12:17:52


Thanks Moritz
for the information and the examples. It is expecially merging heaps I am interested in and it seems that relaxed_heap has a combine method to merge heaps.
Thanks alot for the help.
Line
 

________________________________

Fra: boost-users-bounces_at_[hidden] på vegne af moritz Hilger
Sendt: fr 11-07-2008 09:55
Til: boost-users_at_[hidden]
Emne: Re: [Boost-users] Relaxed heaps

Hi Line,
afaik there is no real documentation for the relaxed heap. It resides
in boost/pending/relaxed_heap.hpp. There's also a binary heap in
mutable_queue.hpp. Find below some basic code on how to initialize the
heaps

typedef graph_traits<graph_t>::vertex_descriptor vertex_t;
typedef property_map<graph_t, vertex_index_t>::const_type vertex_index_map_t;

// set up distance map
typedef iterator_property_map<std::vector<cost_t>::iterator,
vertex_index_map_t> distance_map_t;
std::vector<cost_t>
distance_vector(num_vertices(graph),std::numeric_limits<cost_t>::max());
distance_map_t distances(distance_vector.begin(), vertex_indices);
typedef indirect_cmp<distance_map_t, compare_t> indirect_cmp_t;
indirect_cmp_t icmp(distances, compare_t());

#ifdef MUTABLE
      typedef mutable_queue<vertex_t, std::vector<vertex_t>,
indirect_cmp_t, vertex_index_map_t> Queue;
#endif

#ifdef RELAXED
      typedef relaxed_heap<vertex_t, indirect_cmp_t, vertex_index_map_t> Queue;
#endif
Queue Q(num_vertices(g), icmp, vertex_indices);

afterwards you can insert elements into the heap via Q.push( ... ),
get a reference to the first element via Q.top(), remove the first
with Q.pop(), update an element's position with Q.update( ... ), ask
if Q.empty() etc.

Regards, Moritz

On Fri, Jul 11, 2008 at 1:55 AM, Line Blander Reinhardt <lbr_at_[hidden]> wrote:
> Hi all
> I would like to know where I can get some information about how to use the relaxed heaps in Boost?
> I would also like to know which file/files it is located in?
> Are there any bugs on relaxed heaps that has been fixed since 1.33.1 ?
>
> Thanks alot for your help.
> Line
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net