Time-dependent graphs

Hi,
I am currently using an adjacency_list for calculating shortest paths
using BGL. Now I would like to make the edge weights time-dependent
by calling some own function during the algorithm. Unfortunately,
I did not really get things working as described in the book "The Boost
Graph Library" with respect to self-defined property maps. (Or should I
use a visitor for that purpose?)
Maybe you could helb me with some code example on using own code for
the edge weights to be used during the Dijkstra algorithm?
Many thanks and best regards,
Thomas Hanne
My current code for calculating shortst paths is like
...
typedef adjacency_list

On Jun 22, 2006, at 10:55 AM, Thomas Hanne wrote:
Hi,
I am currently using an adjacency_list for calculating shortest paths using BGL. Now I would like to make the edge weights time-dependent by calling some own function during the algorithm. Unfortunately, I did not really get things working as described in the book "The Boost Graph Library" with respect to self-defined property maps. (Or should I use a visitor for that purpose?)
You can create a new property map that calculates weights however you want, e.g., struct my_weight_map { typedef /*the edge_descriptor type*/ key_type; typedef double value_type; typedef value_type reference; typedef boost::readable_property_map_tag category; // data used by my_weight_map }; double get(const my_weight_map& m, /* the edge_descriptor type*/ edge) { return /* compute weight */; } Then, instead of passing "gewichte" to dijkstra_shortest_path, pass my_weight_map(); Doug
participants (2)
-
Doug Gregor
-
Thomas Hanne