Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL]Why the output of algorithms are vertex sequence(PredecessorMap)? How about parallel edges??
From: Andrew Sutton (andrew.n.sutton_at_[hidden])
Date: 2009-05-13 07:47:25


>
> template<typename EdgePredecessorMap, typename VertexPredecessorMap,
> typename EdgeIndexMap, typename VertexDescriptor>
> std::vector<int> translate_to_edges_index(const EdgePredecessorMap& em,
> const VertexPredecessorMap& vm, const EdgeIndexMap& im, VertexDescriptor
> dest)
> {
> std::vector<int> res;
> while(vm[dest] != dest)
> {
> res.push_back(im[em[dest]]);
> dest = vm[dest];
> }
> return res;
> }
>

I would recommend using the get() and put() functions for property maps
instead of operator[]. It allows a broader class of property maps to be used
with the algorithm.

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