Boost logo

Boost Users :

From: Thomas Hanne (hanne_at_[hidden])
Date: 2006-06-22 10:55:55


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<listS, vecS, directedS, no_property,
                        property<edge_weight_t, double> > tGraph;

...

int anzKnoten = num_vertices(m_Wegezeiten);
vector<vertex_descriptor> vorg(anzKnoten);
vector<double> wege(anzKnoten);
property_map<tGraph, edge_weight_t>::type gewichte =
newget(edge_weight, m_Wegezeiten);
property_map<tGraph, vertex_index_t>::type indizes = get(vertex_index,
        m_Wegezeiten);
vertex_descriptor start = vertex(nrVon, m_Wegezeiten);

dijkstra_shortest_paths(m_Wegezeiten, start, &vorg.at(0), &wege.at(0),
        gewichte, indizes, less<double>(), closed_plus<double>(),
        numeric_limits<int>::max(), 0, default_dijkstra_visitor() );
                


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