Boost logo

Boost :

Subject: [boost] Is the bellman_ford_shortest_paths function missing an overload with the root vertex?
From: Geoff Hilton (geoff.hilton_at_[hidden])
Date: 2008-11-28 11:39:39


Quick question, was the fact that there is no
bellman_ford_shortest_paths overload in the BGL that allows for the
specification of the root vertex intentional? I'm using MSVC9 and tried
using the named parameters overload but it won't compile. Ditto for
dijkstra_shortest_paths and dag_shortest_paths actually.

Here's what I have that won't compile with (twice) the error message:
error C2248: 'Weight<long long>::Weight': cannot access private member
declared in class 'Weight<long long>' c:\program
files\boost\boost_1_37_0\boost\graph\bellman_ford_shortest_paths.hpp 155

class ShortestPathBellmanFordForward: public ShortestPathFunction
{
     public:
         virtual ~ShortestPathBellmanFordForward(){}
         virtual AlgoResult operator()(
                 const vertex_descriptor startingVertex,
                 const WeightComparer<long long>& comparer,
                 Graph& graph) const {
     const size_t numVertices = boost::num_vertices(graph);
     AlgoResult retval;
     retval.first = PredecessorMap(numVertices);
     retval.second = DistanceMap(numVertices);
     vertex_index_prop_t vindex = get(boost::vertex_index, graph);
     boost::bellman_ford_shortest_paths(graph, numVertices,
         weight_map(boost::get(&EdgeProp::weights, graph)).
         predecessor_map(boost::make_iterator_property_map(
             retval.first.begin(), vindex)).
         distance_map(boost::make_iterator_property_map(
             retval.second.begin(), vindex)).
         root_vertex(startingVertex).
         distance_combine(WeightCombiner<long long>()).
         distance_compare(comparer));
     return retval;
     }
};

Thanks,
Geoff


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk