Boost logo

Boost Users :

Subject: Re: [Boost-users] Modifying Dijkstra's Shortest Paths algorithm in Boost::Graph to not relax certain edges
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-04-21 20:21:58


> Thanks for your reply. I am still learning the library so I don't know the
> source very well. How would one provide new functions to DSP? Is there some
> sort of internal mechanism to allow for this?
>

Sorry... I was in a hurry when I wrote last. The DSP algorithm takes
function objects as parameters that can be used to change the default
behavior of distance comparison and combination. It's mentioned here, but I
doubt that there are any good examples.

http://www.boost.org/doc/libs/1_38_0/libs/graph/doc/dijkstra_shortest_paths.html

For example, you might call it as:

dijkstra_shortest_paths(g, v,
    weight_map(weights).
    distance_map(results).
    distance_compare(my_compare));

Where my_compare is a BinaryPredicate (like std::less), taking the
value_type of the weights. You might also look at ways using or modifying
the color_map, which is also an optional parameter.

Hope that's more clear.

Andrew Sutton
andrew.n.sutton_at_[hidden]



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