Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

Click here to view the latest version of this page.
C++ Boost

tsp_tour_len_visitor<Graph, WeightMap, OutputIterator, Length>

This type is a TSP tour visitor. It supplies the OutputIterator with the vertices of the tour and records the total length of the tour.

Example

double d(0.0);
std::vector<Vertex> c;
boost::metric_tsp_approx
  (g, get(edge_weight, g),
  make_tsp_tour_len_visitor(g, std::back_inserter(c), d, get(edge_weight, g)));

Model of

TSP Tour Visitor

Template Parameters

ParameterDescriptionDefault
Graph The graph type None
WeightMap The weight of each edge in the graph. The type WeightMap must be a model of Readable Property Map. The edge descriptor type of the graph needs to be usable as the key type for the weight map. None
OutputIterator An OutputIterator None
Length A suitable container for the length of the tour. It must implement additive operators. None

Where Defined

boost/graph/metric_tsp_approx.hpp

Member Functions

This class implements all of the member functions required by TSPTourVisitor.

Non-Member Functions

FunctionDescription
template <typename Graph, typename WeightMap, typename OutputIterator, typename Length>
tsp_tour_len_visitor<OutputIterator>
make_tsp_tour_len_visitor(Graph const& g, OutIter iter, Length& l, WeightMap map)
Returns a tour_len_visitor that records the TSP tour in the OutputIterator parameter and the tour's length in the Length parameter.

See Also

None

Copyright © 2008 Matyas Egyhazy