Boost logo

Boost Users :

Subject: Re: [Boost-users] Need example of substitution of priority queue
From: Eric Fowler (eric.fowler_at_[hidden])
Date: 2010-05-21 01:22:04


I don't see how this substitutes a hand-rolled queue.

And I don't see why this:

                boost::bfs_visitor<null_visitor> nv;
                std::stack<T> q;

                breadth_first_search(graph, vertex, q, nv);

Is getting me this:

In file included from MyDialog.h:8,
                 from MyDialog.cpp:2:
../DelaunayGraph/DelaunayGraph.h: In member function ‘Vertex
DelaunayGraph<T>::seek_vertex_nearest_point(const POS<T>&) const [with
T = short int]’:
MyDialog.cpp:44: instantiated from here
../DelaunayGraph/DelaunayGraph.h:214: error: no matching function for
call to ‘breadth_first_search(const DelaunayGraph<short int>&, const
Vertex&, std::stack<short int, std::deque<short int,
std::allocator<short int> > >&,
boost::bfs_visitor<boost::null_visitor>&)’
make: *** [MyDialog.o] Error 1

Eric

On Thu, May 20, 2010 at 11:13 AM, Jeremiah Willcock <jewillco_at_[hidden]> wrote:
> 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 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