Boost logo

Boost Users :

From: Andreas Fabri (Andreas.Fabri_at_[hidden])
Date: 2005-12-08 09:25:43


Hello,

I have my own graph model and want to run dikstra_shortest_path
on it.

I want a dijkstra_visitor to initialize the id's of my vertices,

struct initialize_index : public boost::base_visitor<initialize_index> {
   int i;
   typedef boost::on_initialize_vertex event_filter;

   initialize_index(int i_)
     : i(i_)
   {}

   template <class Vertex, class Graph>
   void operator()(Vertex v, Graph& G) {
     std::cout << "i = " << i << std::endl;
    v->id() = i++;
   }
};

.
.
.
.
boost::dijkstra_shortest_paths(ft, source ,
                  distance_map(distance_pmap)
                  .predecessor_map(predecessor_pmap)
                  .visitor(make_dijkstra_visitor(initialize_index(0))));

but the operator is never called.

Is that a bug ? Shouldbn't it be called by the bfs performed
in dijkstra_shortest_paths_no_init ?

Also when looking in the header file dijkstra_shortest_paths.hpp
I see that the color map gets initialized before the vertices
get initialized. I would expect that the vertices get initialized
before the color map gets initialized, because if the vertex_index_map
is not set up correctly ...

andreas


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