Boost logo

Boost Users :

Subject: Re: [Boost-users] Need example of substitution of priority queue
From: Jeremiah Willcock (jewillco_at_[hidden])
Date: 2010-05-20 14:13:25


On Thu, 20 May 2010, Eric Fowler wrote:

> I wish to run a breadth_first_search() on a graph where I am defining
> the priority queue (I have a hand-rolled sort order).
> Is there any reason I cannot use std::priority_queue<> to do this?
> Does anyone have an example, or know of one in the docs?

One easy place to find that code is in this function in
boost/graph/dijkstra_shortest_paths.hpp:

   // Call breadth first search
   template <class Graph, class DijkstraVisitor,
             class PredecessorMap, class DistanceMap,
             class WeightMap, class IndexMap, class Compare, class Combine,
             class DistZero, class ColorMap>
   inline void
   dijkstra_shortest_paths_no_init
     (const Graph& g,
      typename graph_traits<Graph>::vertex_descriptor s,
      PredecessorMap predecessor, DistanceMap distance, WeightMap weight,
      IndexMap index_map,
      Compare compare, Combine combine, DistZero zero,
      DijkstraVisitor vis, ColorMap color);

(note that there are other overloads that do not call breadth_first_search
directly). That code creates a priority queue and uses it in BFS. I do
not see any code in BGL that uses std::priority_queue in BFS.

-- Jeremiah Willcock


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